-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #369
- Loading branch information
Showing
7 changed files
with
4,326 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "@samgreening/sanity-plugin-datetime", | ||
"version": "0.1.0", | ||
"description": "", | ||
"keywords": [], | ||
"license": "ISC", | ||
"author": "", | ||
"exports": { | ||
".": { | ||
"import": "./src/index.ts" | ||
}, | ||
"./src/*": { | ||
"import": "./src/*" | ||
}, | ||
"./src/*.css": { | ||
"require": "./src/*.css", | ||
"import": "./src/*.css" | ||
} | ||
}, | ||
"main": "src/index.ts", | ||
"files": [ | ||
"src", | ||
"!src/**/*.test.*", | ||
"!src/**/*.spec.*" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@adobe/react-spectrum": "^3.26.0", | ||
"@internationalized/date": "^3.2.0", | ||
"@sanity/ui": "1.3.3", | ||
"@types/react": "^18.2.6", | ||
"@types/styled-components": "^5.1.26", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"@typescript-eslint/parser": "^5.59.6", | ||
"react": "^18.2.0", | ||
"react-aria-components": "1.0.0-alpha.3", | ||
"react-dom": "^18.2.0", | ||
"react-is": "^18.2.0", | ||
"sanity": "^3.9.1", | ||
"styled-components": "^5", | ||
"typescript": "^5.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@adobe/react-spectrum": "^3", | ||
"@internationalized/date": "^3", | ||
"@sanity/ui": "^1", | ||
"react": "^18", | ||
"react-aria-components": "1.0.0-alpha.3", | ||
"sanity": "^3", | ||
"styled-components": "^5", | ||
"typescript": "^5" | ||
} | ||
} |
287 changes: 287 additions & 0 deletions
287
packages/sanity-plugin-datetime-2/src/dateTimePicker.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
.react-aria-DatePicker { | ||
--text-color-invalid: var(--card-accent-fg-color); | ||
|
||
.react-aria-Group { | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
.react-aria-Button { | ||
background: none; | ||
color: white; | ||
border: none; | ||
appearance: none; | ||
/* width: 2.3rem; */ | ||
/* height: 100%; */ | ||
aspect-ratio: 1/1; | ||
margin: 0.2rem; | ||
vertical-align: middle; | ||
font-size: 1rem; | ||
outline: none; | ||
|
||
&:hover { | ||
background: slateblue; | ||
} | ||
|
||
&[data-focus-visible] { | ||
box-shadow: 0 0 0 2px slateblue; | ||
} | ||
} | ||
|
||
[slot=description] { | ||
font-size: 12px; | ||
} | ||
|
||
[slot=errorMessage] { | ||
font-size: 12px; | ||
color: var(--text-color-invalid); | ||
} | ||
} | ||
|
||
.react-aria-DateInput { | ||
--field-border: var(--card-border-color); | ||
--field-background: var(--card-bg-color); | ||
--text-color: var(--input-fg-color); | ||
--text-color-placeholder: var(--card-border-color); | ||
--text-color-invalid: var(--card-accent-fg-color); | ||
--highlight-background: slateblue; | ||
--highlight-foreground: white; | ||
--highlight-background-invalid: var(--card-accent-fg-color); | ||
|
||
flex: 1; | ||
display: flex; | ||
padding: 0.4375rem 2.5rem 0.4375rem 8px; | ||
border: 1px solid var(--field-border); | ||
border-radius: 6px 0px 0px 6px; | ||
background: var(--field-background); | ||
min-width: 150px; | ||
white-space: nowrap; | ||
box-sizing: border-box; | ||
|
||
&:focus-within { | ||
border-color: var(--highlight-background); | ||
box-shadow: 0 0 0 1px var(--highlight-background); | ||
} | ||
} | ||
|
||
.react-aria-DateSegment { | ||
padding: 0 2px; | ||
font-variant-numeric: tabular-nums; | ||
text-align: end; | ||
color: var(--text-color); | ||
|
||
&[data-type=literal] { | ||
padding: 0; | ||
} | ||
|
||
&[data-placeholder] { | ||
color: var(--text-color-placeholder); | ||
font-style: italic; | ||
} | ||
|
||
&:focus { | ||
color: var(--highlight-foreground); | ||
background: var(--highlight-background); | ||
outline: none; | ||
border-radius: 4px; | ||
caret-color: transparent; | ||
} | ||
|
||
&[aria-invalid] { | ||
color: var(--text-color-invalid); | ||
|
||
&:focus { | ||
background: var(--highlight-background-invalid); | ||
color: var(--highlight-foreground); | ||
} | ||
} | ||
} | ||
|
||
.react-aria-Calendar { | ||
--highlight-background: slateblue; | ||
--highlight-foreground: white; | ||
--button-background: var(--card-bg-color); | ||
--button-background-pressed: var(--card-fg-color); | ||
--button-border: var(--card-border-color); | ||
--text-color: var(--input-fg-color); | ||
--text-color-disabled: var(--input-placeholder-color); | ||
--text-color-invalid: var(--card-accent-fg-color); | ||
--pressed-color: var(--card-muted-fg-color); | ||
--unavailable-color: var(--card-accent-fg-color); | ||
--invalid-color: var(--card-accent-fg-color); | ||
|
||
width: fit-content; | ||
color: var(--text-color); | ||
|
||
& header { | ||
display: flex; | ||
align-items: center; | ||
margin: 0 4px .5rem 4px; | ||
|
||
.react-aria-Heading { | ||
flex: 1; | ||
margin: 0; | ||
text-align: center; | ||
font-size: 1.375rem; | ||
} | ||
|
||
.react-aria-Button { | ||
background: var(--button-background); | ||
border: 1px solid var(--button-border); | ||
color: var(--text-color); | ||
box-shadow: 0 1px 2px rgba(0 0 0 / 0.1); | ||
border-radius: 4px; | ||
appearance: none; | ||
vertical-align: middle; | ||
font-size: 1rem; | ||
width: 2rem; | ||
height: 2rem; | ||
padding: 0; | ||
text-align: center; | ||
margin: 0; | ||
outline: none; | ||
|
||
&[data-focus-visible] { | ||
border-color: var(--highlight-background); | ||
box-shadow: 0 0 0 1px var(--highlight-background); | ||
} | ||
|
||
&[data-pressed] { | ||
background: var(--button-background-pressed); | ||
} | ||
} | ||
} | ||
|
||
.react-aria-CalendarCell { | ||
width: 2rem; | ||
line-height: 2rem; | ||
text-align: center; | ||
border-radius: 6px; | ||
cursor: default; | ||
outline: none; | ||
border: 2px solid var(--page-background); | ||
margin: -1px; | ||
|
||
&[data-outside-month] { | ||
display: none; | ||
} | ||
|
||
&[data-pressed] { | ||
background: var(--pressed-color); | ||
} | ||
|
||
&[data-focus-visible] { | ||
box-shadow: 0 0 0 2px var(--highlight-background); | ||
} | ||
|
||
&[data-selected] { | ||
background: var(--highlight-background); | ||
color: var(--highlight-foreground); | ||
} | ||
|
||
&[data-disabled] { | ||
color: var(--text-color-disabled); | ||
} | ||
|
||
&[data-unavailable] { | ||
text-decoration: line-through; | ||
color: var(--unavailable-color); | ||
} | ||
|
||
&[aria-invalid] { | ||
background: var(--invalid-color); | ||
color: var(--highlight-foreground); | ||
} | ||
} | ||
|
||
[slot=errorMessage] { | ||
font-size: 12px; | ||
color: var(--text-color-invalid); | ||
} | ||
} | ||
|
||
.react-aria-Popover { | ||
overflow: auto; | ||
border: 1px solid var(--card-border-color); | ||
box-shadow: 0 8px 20px rgba(0 0 0 / 0.1); | ||
border-radius: 6px; | ||
background: var(--page-background); | ||
padding: 1.25rem; | ||
|
||
&[data-placement=top] { | ||
--origin: translateY(8px); | ||
} | ||
|
||
&[data-placement=bottom] { | ||
--origin: translateY(-8px); | ||
} | ||
|
||
&[data-entering] { | ||
animation: slide 200ms; | ||
} | ||
|
||
&[data-exiting] { | ||
animation: slide 200ms reverse ease-in; | ||
} | ||
} | ||
|
||
@keyframes slide { | ||
from { | ||
transform: var(--origin); | ||
opacity: 0; | ||
} | ||
|
||
to { | ||
transform: translateY(0); | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@media (forced-colors: active) { | ||
.react-aria-DatePicker { | ||
--text-color-invalid: LinkText; | ||
|
||
.react-aria-Button { | ||
forced-color-adjust: none; | ||
|
||
--focus-ring-color: Highlight; | ||
background: ButtonFace; | ||
color: ButtonText; | ||
border: 1px solid ButtonBorder; | ||
|
||
&[data-focus-visible] { | ||
border-color: Highlight; | ||
box-shadow: 0 0 0 1px Highlight; | ||
} | ||
} | ||
} | ||
|
||
.react-aria-DateInput { | ||
forced-color-adjust: none; | ||
|
||
--field-border: ButtonBorder; | ||
--field-background: Field; | ||
--text-color: FieldText; | ||
--text-color-placeholder: FieldText; | ||
--text-color-invalid: LinkText; | ||
--highlight-background: Highlight; | ||
--highlight-foreground: HighlightText; | ||
--highlight-background-invalid: LinkText; | ||
} | ||
|
||
.react-aria-Calendar { | ||
forced-color-adjust: none; | ||
|
||
--highlight-background: Highlight; | ||
--highlight-foreground: HighlightText; | ||
--button-border: ButtonBorder; | ||
--button-background: ButtonFace; | ||
--button-backgound-pressed: ButtonFace; | ||
--text-color: ButtonText; | ||
--text-color-disabled: GrayText; | ||
--text-color-invalid: LinkText; | ||
--unavailable-color: GrayText; | ||
--invalid-color: LinkText; | ||
--pressed-color: Canvas; | ||
} | ||
} |
Oops, something went wrong.