@sanity/ui 3.0.0-static.0 → 3.0.0-static.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/buildCommand.js +1387 -681
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/css.d.mts +131 -12
- package/dist/css.d.ts +131 -12
- package/dist/css.esm.js +1450 -791
- package/dist/css.esm.js.map +1 -1
- package/dist/css.js +1449 -790
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +1450 -791
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +84 -76
- package/dist/index.d.ts +84 -76
- package/dist/index.esm.js +2734 -3146
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2733 -3145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2734 -3146
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1590 -1158
- package/dist/theme.esm.js +1565 -452
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1599 -484
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1565 -452
- package/dist/theme.mjs.map +1 -1
- package/package.json +22 -22
- package/src/core/__workshop__/constants.ts +14 -5
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/_compat/index.ts +2 -0
- package/src/core/{styles → _compat/styles}/box/boxStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/helpers.ts +1 -1
- package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
- package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/dialog/dialog.tsx +1 -5
- package/src/core/components/hotkeys/hotkeys.tsx +1 -1
- package/src/core/components/menu/menu.tsx +8 -10
- package/src/core/components/menu/menuDivider.tsx +16 -0
- package/src/core/components/menu/menuGroup.tsx +2 -8
- package/src/core/components/menu/menuItem.tsx +1 -1
- package/src/core/components/skeleton/skeleton.tsx +14 -20
- package/src/core/components/skeleton/textSkeleton.tsx +72 -48
- package/src/core/components/tab/tab.tsx +0 -1
- package/src/core/components/tab/tabList.tsx +4 -21
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/toast.tsx +27 -14
- package/src/core/components/toast/toastProvider.tsx +4 -13
- package/src/core/components/tree/tree.tsx +1 -2
- package/src/core/components/tree/treeGroup.tsx +4 -1
- package/src/core/components/tree/treeItem.tsx +11 -15
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/index.ts +0 -1
- package/src/core/lib/styled/members.ts +2 -2
- package/src/core/primitives/avatar/avatar.tsx +0 -21
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/avatar/styles.ts +2 -2
- package/src/core/primitives/box/box.tsx +4 -1
- package/src/core/primitives/button/__workshop__/props.tsx +2 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/styles.ts +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +2 -2
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +7 -10
- package/src/core/primitives/code/code.tsx +2 -4
- package/src/core/primitives/container/styles.ts +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -13
- package/src/core/primitives/grid/grid.tsx +5 -19
- package/src/core/primitives/heading/heading.tsx +8 -25
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +3 -12
- package/src/core/primitives/inline/styles.ts +1 -1
- package/src/core/primitives/label/label.tsx +4 -9
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverCard.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +2 -2
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +3 -3
- package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/stack/styles.ts +1 -1
- package/src/core/primitives/switch/styles.ts +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -1
- package/src/core/primitives/text/text.tsx +1 -4
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +3 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +3 -2
- package/src/core/primitives/textInput/textInput.tsx +16 -83
- package/src/core/primitives/tooltip/tooltipCard.tsx +5 -5
- package/src/core/primitives/types.ts +1 -0
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +2 -4
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/types/box.ts +22 -16
- package/src/core/types/grid.ts +17 -12
- package/src/core/types/text.ts +7 -4
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/compile/{comileRules.ts → compileRules.ts} +2 -5
- package/src/css/compile/compileSystem.ts +1 -1
- package/src/css/compile/compileTheme.ts +4 -1
- package/src/css/components/breadcrumbs/rules.ts +18 -0
- package/src/css/components/menu/index.ts +1 -0
- package/src/css/components/menu/menu.ts +5 -0
- package/src/css/components/menu/rules.ts +10 -0
- package/src/css/components/skeleton/index.ts +2 -0
- package/src/css/components/skeleton/rules.ts +106 -0
- package/src/css/components/skeleton/skeleton.ts +31 -0
- package/src/css/components/skeleton/types.ts +24 -0
- package/src/css/components/toast/rules.ts +68 -0
- package/src/css/components/tree/rules.ts +115 -0
- package/src/css/index.ts +4 -0
- package/src/css/primitives/box/box.ts +5 -1
- package/src/css/primitives/box/types.ts +7 -8
- package/src/css/primitives/card/rules.ts +161 -13
- package/src/css/primitives/checkbox/__styles.ts +115 -113
- package/src/css/primitives/selectable/__style.ts +117 -115
- package/src/css/primitives/spinner/rules.ts +5 -7
- package/src/css/primitives/spinner/spinner.ts +4 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +159 -64
- package/src/css/primitives/textInput/textInput.ts +11 -3
- package/src/css/primitives/textInput/types.ts +8 -0
- package/src/css/rules.ts +16 -38
- package/src/css/styles/font/font.ts +7 -2
- package/src/css/styles/font/rules.ts +23 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/rules.ts +6 -6
- package/src/css/styles/grid/grid.ts +13 -0
- package/src/css/styles/grid/index.ts +2 -0
- package/src/css/styles/grid/rules.ts +112 -1
- package/src/css/styles/grid/types.ts +29 -0
- package/src/css/styles/margin/rules.ts +58 -54
- package/src/css/styles/outline/rules.ts +7 -0
- package/src/css/styles/overflow/index.ts +2 -0
- package/src/css/styles/overflow/overflow.ts +11 -0
- package/src/css/styles/overflow/types.ts +11 -0
- package/src/css/styles/padding/rules.ts +50 -48
- package/src/css/types.ts +36 -1
- package/src/css/varNames.ts +1 -1
- package/src/css/vars.ts +86 -0
- package/dist/_chunks-cjs/getTheme_v2.js +0 -316
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -317
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -317
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
- package/src/core/components/menu/menuDivider.ts +0 -13
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/toast/styles.ts +0 -61
- package/src/core/components/tree/style.ts +0 -104
- package/src/core/primitives/card/styles.ts +0 -146
- /package/src/core/{styles → _compat/styles}/border/borderStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/types.ts +0 -0
- /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"csstype": "^3.1.3",
|
|
103
103
|
"dotenv-flow": "^4.1.0",
|
|
104
104
|
"framer-motion": "11.0.8",
|
|
105
|
+
"react-compiler-runtime": "19.0.0-beta-6fc168f-20241025",
|
|
105
106
|
"react-refractor": "^2.2.0",
|
|
106
107
|
"use-effect-event": "^1.0.2"
|
|
107
108
|
},
|
|
@@ -113,24 +114,24 @@
|
|
|
113
114
|
"@commitlint/cli": "^19.4.0",
|
|
114
115
|
"@commitlint/config-conventional": "^19.2.2",
|
|
115
116
|
"@juggle/resize-observer": "^3.4.0",
|
|
116
|
-
"@sanity/pkg-utils": "^6.11.
|
|
117
|
+
"@sanity/pkg-utils": "^6.11.8",
|
|
117
118
|
"@sanity/prettier-config": "^1.0.3",
|
|
118
119
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
119
120
|
"@sanity/ui-workshop": "^2.0.16",
|
|
120
|
-
"@storybook/addon-a11y": "^8.
|
|
121
|
-
"@storybook/addon-docs": "^8.
|
|
122
|
-
"@storybook/addon-essentials": "^8.
|
|
123
|
-
"@storybook/addon-interactions": "^8.
|
|
124
|
-
"@storybook/addon-links": "^8.
|
|
125
|
-
"@storybook/addon-mdx-gfm": "^8.
|
|
126
|
-
"@storybook/addon-storysource": "^8.
|
|
127
|
-
"@storybook/addon-themes": "^8.
|
|
128
|
-
"@storybook/blocks": "^8.
|
|
129
|
-
"@storybook/manager-api": "^8.
|
|
130
|
-
"@storybook/react": "^8.
|
|
131
|
-
"@storybook/react-vite": "^8.
|
|
132
|
-
"@storybook/test": "^8.
|
|
133
|
-
"@storybook/theming": "^8.
|
|
121
|
+
"@storybook/addon-a11y": "^8.4.0",
|
|
122
|
+
"@storybook/addon-docs": "^8.4.0",
|
|
123
|
+
"@storybook/addon-essentials": "^8.4.0",
|
|
124
|
+
"@storybook/addon-interactions": "^8.4.0",
|
|
125
|
+
"@storybook/addon-links": "^8.4.0",
|
|
126
|
+
"@storybook/addon-mdx-gfm": "^8.4.0",
|
|
127
|
+
"@storybook/addon-storysource": "^8.4.0",
|
|
128
|
+
"@storybook/addon-themes": "^8.4.0",
|
|
129
|
+
"@storybook/blocks": "^8.4.0",
|
|
130
|
+
"@storybook/manager-api": "^8.4.0",
|
|
131
|
+
"@storybook/react": "^8.4.0",
|
|
132
|
+
"@storybook/react-vite": "^8.4.0",
|
|
133
|
+
"@storybook/test": "^8.4.0",
|
|
134
|
+
"@storybook/theming": "^8.4.0",
|
|
134
135
|
"@testing-library/dom": "^10.4.0",
|
|
135
136
|
"@testing-library/jest-dom": "^6.6.2",
|
|
136
137
|
"@testing-library/react": "^16.0.1",
|
|
@@ -172,24 +173,23 @@
|
|
|
172
173
|
"npm-run-all2": "^5.0.2",
|
|
173
174
|
"prettier": "^3.3.3",
|
|
174
175
|
"react": "^18.3.1",
|
|
175
|
-
"react-compiler-runtime": "beta",
|
|
176
176
|
"react-dom": "^18.3.1",
|
|
177
177
|
"react-is": "^18.3.1",
|
|
178
178
|
"refractor": "^4.8.1",
|
|
179
179
|
"rimraf": "^5.0.5",
|
|
180
180
|
"semantic-release": "^24.0.0",
|
|
181
181
|
"start-server-and-test": "^2.0.5",
|
|
182
|
-
"storybook": "^8.
|
|
182
|
+
"storybook": "^8.4.0",
|
|
183
183
|
"styled-components": "^6.1.13",
|
|
184
184
|
"tsconfig-paths": "^4.2.0",
|
|
185
|
-
"typescript": "
|
|
185
|
+
"typescript": "5.6.3",
|
|
186
186
|
"vite": "^5.4.2",
|
|
187
187
|
"vite-tsconfig-paths": "^5.0.1"
|
|
188
188
|
},
|
|
189
189
|
"peerDependencies": {
|
|
190
|
-
"react": "^18",
|
|
191
|
-
"react-dom": "^18",
|
|
192
|
-
"react-is": "^18",
|
|
190
|
+
"react": "^18 || >=19.0.0-0",
|
|
191
|
+
"react-dom": "^18 || >=19.0.0-0",
|
|
192
|
+
"react-is": "^18 || >=19.0.0-0",
|
|
193
193
|
"styled-components": "^5.2 || ^6"
|
|
194
194
|
},
|
|
195
195
|
"engines": {
|
|
@@ -9,12 +9,20 @@ import {
|
|
|
9
9
|
CardTone,
|
|
10
10
|
DialogPosition,
|
|
11
11
|
FlexAlign,
|
|
12
|
+
FlexDirection,
|
|
12
13
|
FlexJustify,
|
|
13
14
|
Placement,
|
|
14
15
|
TextAlign,
|
|
15
16
|
TextInputType,
|
|
16
17
|
} from '@sanity/ui'
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ContainerWidth,
|
|
20
|
+
FontHeadingSize,
|
|
21
|
+
Space,
|
|
22
|
+
ThemeColorSpotKey,
|
|
23
|
+
ThemeColorToneKey,
|
|
24
|
+
ThemeFontWeightKey,
|
|
25
|
+
} from '@sanity/ui/theme'
|
|
18
26
|
|
|
19
27
|
export const WORKSHOP_AVATAR_SIZE_OPTIONS: {[key: string]: AvatarSize} = {
|
|
20
28
|
'0': 0,
|
|
@@ -85,7 +93,7 @@ export const WORKSHOP_CODE_LANGUAGE_OPTIONS = {
|
|
|
85
93
|
TypeScript: 'typescript',
|
|
86
94
|
}
|
|
87
95
|
|
|
88
|
-
export const WORKSHOP_CONTAINER_WIDTH_OPTIONS: {[key: string]:
|
|
96
|
+
export const WORKSHOP_CONTAINER_WIDTH_OPTIONS: {[key: string]: ContainerWidth} = {
|
|
89
97
|
'0': 0,
|
|
90
98
|
'1': 1,
|
|
91
99
|
'2': 2,
|
|
@@ -100,7 +108,7 @@ export const WORKSHOP_DIALOG_POSITION_OPTIONS: {[key: string]: DialogPosition} =
|
|
|
100
108
|
Absolute: 'absolute',
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
export const WORKSHOP_FLEX_DIRECTION_OPTIONS: {[key: string]:
|
|
111
|
+
export const WORKSHOP_FLEX_DIRECTION_OPTIONS: {[key: string]: FlexDirection} = {
|
|
104
112
|
Row: 'row',
|
|
105
113
|
Column: 'column',
|
|
106
114
|
}
|
|
@@ -129,12 +137,13 @@ export const WORKSHOP_FONT_WEIGHT_OPTIONS: {[key: string]: ThemeFontWeightKey} =
|
|
|
129
137
|
Bold: 'bold',
|
|
130
138
|
}
|
|
131
139
|
|
|
132
|
-
export const WORKSHOP_HEADING_FONT_SIZE_OPTIONS = {
|
|
140
|
+
export const WORKSHOP_HEADING_FONT_SIZE_OPTIONS: Record<string, FontHeadingSize> = {
|
|
133
141
|
'0': 0,
|
|
134
142
|
'1': 1,
|
|
135
143
|
'2 (default)': 2,
|
|
136
144
|
'3': 3,
|
|
137
145
|
'4': 4,
|
|
146
|
+
'5': 5,
|
|
138
147
|
}
|
|
139
148
|
|
|
140
149
|
export const WORKSHOP_ICON_SYMBOL_OPTIONS: {[key: string]: IconSymbol | ''} = Object.keys(
|
|
@@ -285,7 +294,7 @@ export const WORKSHOP_TOAST_STATUS_OPTIONS: {
|
|
|
285
294
|
Error: 'error',
|
|
286
295
|
}
|
|
287
296
|
|
|
288
|
-
export const WORKSHOP_WIDTH_OPTIONS: {[key: string]:
|
|
297
|
+
export const WORKSHOP_WIDTH_OPTIONS: {[key: string]: ContainerWidth} = {
|
|
289
298
|
'Auto': 'auto',
|
|
290
299
|
'0': 0,
|
|
291
300
|
'1': 1,
|
|
@@ -88,8 +88,8 @@ export function _cardColorStyle(
|
|
|
88
88
|
'--card-muted-bg-color': color.muted.bg,
|
|
89
89
|
'--card-muted-fg-color': color.muted.fg,
|
|
90
90
|
|
|
91
|
-
'--card-skeleton-color
|
|
92
|
-
'--card-skeleton-color
|
|
91
|
+
'--card-skeleton-from-color': color.skeleton.from,
|
|
92
|
+
'--card-skeleton-to-color': color.skeleton.to,
|
|
93
93
|
|
|
94
94
|
// deprecated variables (kept for legacy)
|
|
95
95
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
|
|
2
|
-
import {EMPTY_ARRAY} from '
|
|
2
|
+
import {EMPTY_ARRAY} from '../../../constants'
|
|
3
3
|
import {_responsive} from '../helpers'
|
|
4
4
|
import {ThemeProps} from '../types'
|
|
5
5
|
import {ResponsiveFlexItemStyleProps} from './types'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ThemeColorSchemeKey, ThemeFontWeightKey, getTheme_v2} from '@sanity/ui/theme'
|
|
2
2
|
import {CSSObject} from '@sanity/ui/theme'
|
|
3
|
-
import {css} from '
|
|
4
|
-
import {CardTone} from '
|
|
3
|
+
import {css} from '../../../lib/styled'
|
|
4
|
+
import {CardTone} from '../../../types'
|
|
5
5
|
import {focusRingBorderStyle, focusRingStyle} from '../focusRing'
|
|
6
6
|
import {rem, _responsive} from '../helpers'
|
|
7
7
|
import {ThemeProps} from '../types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ThemeBoxShadow, ThemeShadow, getTheme_v2} from '@sanity/ui/theme'
|
|
2
2
|
import {CSSObject} from '@sanity/ui/theme'
|
|
3
|
-
import {EMPTY_RECORD} from '
|
|
3
|
+
import {EMPTY_RECORD} from '../../../constants'
|
|
4
4
|
import {rem, _responsive} from '../helpers'
|
|
5
5
|
import {ThemeProps} from '../types'
|
|
6
6
|
import {ResponsiveShadowStyleProps} from './types'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {Autocomplete, Box, Button, Card, Code, Container, Stack, Text} from '@sanity/ui'
|
|
1
|
+
import {Autocomplete, Box, Button, Card, Code, Container, Radius, Stack, Text} from '@sanity/ui'
|
|
2
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
2
3
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
4
|
import {useCallback, useState} from 'react'
|
|
4
5
|
import {
|
|
@@ -29,7 +30,7 @@ export default function CustomStory() {
|
|
|
29
30
|
key={option.value}
|
|
30
31
|
onClick={(event) => event.preventDefault()}
|
|
31
32
|
padding={padding}
|
|
32
|
-
radius={radius - 1}
|
|
33
|
+
radius={(radius - 1) as Radius}
|
|
33
34
|
>
|
|
34
35
|
<Text size={fontSize}>{option.title}</Text>
|
|
35
36
|
</Card>
|
|
@@ -60,14 +61,14 @@ export default function CustomStory() {
|
|
|
60
61
|
border={border}
|
|
61
62
|
disabled={disabled}
|
|
62
63
|
filterOption={filterOption}
|
|
63
|
-
fontSize={fontSize}
|
|
64
|
+
fontSize={fontSize as FontTextSize}
|
|
64
65
|
id="custom"
|
|
65
66
|
onChange={setValue}
|
|
66
67
|
openButton={openButton}
|
|
67
68
|
options={options}
|
|
68
69
|
padding={padding}
|
|
69
70
|
placeholder="Search"
|
|
70
|
-
radius={radius}
|
|
71
|
+
radius={radius as Radius}
|
|
71
72
|
readOnly={readOnly}
|
|
72
73
|
renderOption={renderOption}
|
|
73
74
|
renderValue={renderValue}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
|
|
2
|
+
import {FontTextSize, Radius} from '@sanity/ui/theme'
|
|
2
3
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
4
|
import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
4
5
|
import {fireEvent} from '@testing-library/dom'
|
|
@@ -57,14 +58,14 @@ export default function ExampleStory() {
|
|
|
57
58
|
border={border}
|
|
58
59
|
customValidity={customValidity}
|
|
59
60
|
disabled={disabled}
|
|
60
|
-
fontSize={fontSize}
|
|
61
|
+
fontSize={fontSize as FontTextSize}
|
|
61
62
|
onChange={handleChange}
|
|
62
63
|
id="default"
|
|
63
64
|
openButton={openButton}
|
|
64
65
|
options={options}
|
|
65
66
|
padding={padding}
|
|
66
67
|
placeholder="Search"
|
|
67
|
-
radius={radius}
|
|
68
|
+
radius={radius as Radius}
|
|
68
69
|
readOnly={readOnly}
|
|
69
70
|
ref={ref}
|
|
70
71
|
value={value}
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
Text,
|
|
35
35
|
TextInput,
|
|
36
36
|
} from '../../primitives'
|
|
37
|
+
import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
|
|
37
38
|
import {Radius} from '../../types'
|
|
38
|
-
import {AnimatedSpinnerIcon, ListBox, Root} from './autocomplete.styles'
|
|
39
39
|
import {AutocompleteOption} from './autocompleteOption'
|
|
40
40
|
import {autocompleteReducer} from './autocompleteReducer'
|
|
41
41
|
import {
|
|
@@ -584,7 +584,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
584
584
|
if (filteredOptions.length === 0) return null
|
|
585
585
|
|
|
586
586
|
return (
|
|
587
|
-
<
|
|
587
|
+
<Box
|
|
588
588
|
data-ui="AutoComplete__results"
|
|
589
589
|
onKeyDown={handleListBoxKeyDown}
|
|
590
590
|
padding={1}
|
|
@@ -621,7 +621,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
621
621
|
)
|
|
622
622
|
})}
|
|
623
623
|
</Stack>
|
|
624
|
-
</
|
|
624
|
+
</Box>
|
|
625
625
|
)
|
|
626
626
|
}, [
|
|
627
627
|
activeValue,
|
|
@@ -686,7 +686,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
686
686
|
])
|
|
687
687
|
|
|
688
688
|
return (
|
|
689
|
-
<
|
|
689
|
+
<div
|
|
690
690
|
data-ui="Autocomplete"
|
|
691
691
|
onBlur={handleRootBlur}
|
|
692
692
|
onFocus={handleRootFocus}
|
|
@@ -695,7 +695,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
695
695
|
>
|
|
696
696
|
{input}
|
|
697
697
|
{results}
|
|
698
|
-
</
|
|
698
|
+
</div>
|
|
699
699
|
)
|
|
700
700
|
})
|
|
701
701
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useCallback, useState} from 'react'
|
|
2
|
-
import {styled} from '
|
|
2
|
+
import {styled} from 'styled-components'
|
|
3
3
|
import {Box, Button, Card, Flex} from '../../../primitives'
|
|
4
4
|
import {BoundaryElementProvider, PortalProvider} from '../../../utils'
|
|
5
5
|
import {Menu, MenuButton, MenuItem} from '../../menu'
|
|
@@ -4,6 +4,7 @@ import {useCallback, useRef, useState} from 'react'
|
|
|
4
4
|
import {WORKSHOP_WIDTH_OPTIONS} from '../../../__workshop__/constants'
|
|
5
5
|
|
|
6
6
|
export default function PropsStory() {
|
|
7
|
+
const animate = useBoolean('Animate', false, 'Props')
|
|
7
8
|
const header = useText('Header', 'Props example', 'Props')
|
|
8
9
|
const onClickOutside = useBoolean('Close when click outside', false, 'Props') || false
|
|
9
10
|
const hideCloseButton = useBoolean('Hide close button', false, 'Props') || false
|
|
@@ -29,6 +30,7 @@ export default function PropsStory() {
|
|
|
29
30
|
{open && (
|
|
30
31
|
<Dialog
|
|
31
32
|
__unstable_hideCloseButton={hideCloseButton}
|
|
33
|
+
animate={animate}
|
|
32
34
|
header={header}
|
|
33
35
|
id="dialog"
|
|
34
36
|
onClickOutside={onClickOutside ? handleClose : undefined}
|
|
@@ -262,7 +262,7 @@ DialogCard.displayName = 'ForwardRef(DialogCard)'
|
|
|
262
262
|
*/
|
|
263
263
|
export const Dialog = forwardRef(function Dialog(
|
|
264
264
|
props: DialogProps &
|
|
265
|
-
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'id' | 'width' | 'wrap'>,
|
|
265
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'id' | 'rows' | 'width' | 'wrap'>,
|
|
266
266
|
ref: React.Ref<HTMLDivElement>,
|
|
267
267
|
) {
|
|
268
268
|
const context = useDialog()
|
|
@@ -366,12 +366,8 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
366
366
|
<Portal __unstable_name={portalProp}>
|
|
367
367
|
<Layer
|
|
368
368
|
{...restProps}
|
|
369
|
-
// $animate={animate}
|
|
370
|
-
// $padding={padding}
|
|
371
|
-
// $position={position}
|
|
372
369
|
aria-labelledby={labelId}
|
|
373
370
|
aria-modal
|
|
374
|
-
// className="root"
|
|
375
371
|
className={composeClassNames(className, dialog())}
|
|
376
372
|
data-animate={animate ? '' : undefined}
|
|
377
373
|
data-ui="Dialog"
|
|
@@ -23,7 +23,7 @@ export const Hotkeys = forwardRef(function Hotkeys(
|
|
|
23
23
|
props: HotkeysProps &
|
|
24
24
|
Omit<
|
|
25
25
|
React.HTMLProps<HTMLDivElement>,
|
|
26
|
-
'as' | 'display' | 'height' | 'ref' | 'size' | 'width' | 'wrap'
|
|
26
|
+
'as' | 'display' | 'height' | 'ref' | 'rows' | 'size' | 'width' | 'wrap'
|
|
27
27
|
>,
|
|
28
28
|
ref: React.Ref<HTMLDivElement>,
|
|
29
29
|
) {
|
|
@@ -2,7 +2,6 @@ import {PaddingStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
|
2
2
|
import {Space} from '@sanity/ui/theme'
|
|
3
3
|
import {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'
|
|
4
4
|
import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
|
|
5
|
-
import {styled} from '../../lib/styled'
|
|
6
5
|
import {Box, Stack} from '../../primitives'
|
|
7
6
|
import {useLayer} from '../../utils'
|
|
8
7
|
import {MenuContext, MenuContextValue} from './menuContext'
|
|
@@ -27,15 +26,9 @@ export interface MenuProps extends PaddingStyleProps {
|
|
|
27
26
|
originElement?: HTMLElement | null
|
|
28
27
|
registerElement?: (el: HTMLElement) => () => void
|
|
29
28
|
shouldFocus?: 'first' | 'last' | null
|
|
30
|
-
// space?: number | number[]
|
|
31
29
|
space?: ResponsiveProp<Space>
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
const Root = styled(Box)`
|
|
35
|
-
outline: none;
|
|
36
|
-
overflow: auto;
|
|
37
|
-
`
|
|
38
|
-
|
|
39
32
|
/**
|
|
40
33
|
* The `Menu` component is a building block for application menus.
|
|
41
34
|
*
|
|
@@ -43,7 +36,10 @@ const Root = styled(Box)`
|
|
|
43
36
|
*/
|
|
44
37
|
export const Menu = forwardRef(function Menu(
|
|
45
38
|
props: MenuProps &
|
|
46
|
-
Omit<
|
|
39
|
+
Omit<
|
|
40
|
+
React.HTMLProps<HTMLDivElement>,
|
|
41
|
+
'as' | 'height' | 'role' | 'rows' | 'tabIndex' | 'width' | 'wrap'
|
|
42
|
+
>,
|
|
47
43
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
48
44
|
) {
|
|
49
45
|
const {
|
|
@@ -158,17 +154,19 @@ export const Menu = forwardRef(function Menu(
|
|
|
158
154
|
|
|
159
155
|
return (
|
|
160
156
|
<MenuContext.Provider value={value}>
|
|
161
|
-
<
|
|
157
|
+
<Box
|
|
162
158
|
data-ui="Menu"
|
|
163
159
|
{...restProps}
|
|
164
160
|
onKeyDown={handleKeyDown}
|
|
161
|
+
overflow="auto"
|
|
162
|
+
outline="none"
|
|
165
163
|
padding={padding}
|
|
166
164
|
ref={handleRefChange}
|
|
167
165
|
role="menu"
|
|
168
166
|
tabIndex={-1}
|
|
169
167
|
>
|
|
170
168
|
<Stack space={space}>{children}</Stack>
|
|
171
|
-
</
|
|
169
|
+
</Box>
|
|
172
170
|
</MenuContext.Provider>
|
|
173
171
|
)
|
|
174
172
|
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {composeClassNames, menuDivider} from '@sanity/ui/css'
|
|
2
|
+
import {forwardRef, HTMLProps} from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const MenuDivider = forwardRef(function MenuDivider(
|
|
8
|
+
props: HTMLProps<HTMLHRElement>,
|
|
9
|
+
ref: React.ForwardedRef<HTMLHRElement>,
|
|
10
|
+
) {
|
|
11
|
+
const {className, ...restProps} = props
|
|
12
|
+
|
|
13
|
+
return <hr {...restProps} className={composeClassNames(className, menuDivider())} ref={ref} />
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
MenuDivider.displayName = 'MenuDivider'
|
|
@@ -3,10 +3,8 @@ import {ResponsiveProp} from '@sanity/ui/css'
|
|
|
3
3
|
import {Space} from '@sanity/ui/theme'
|
|
4
4
|
import {isValidElement, useCallback, useEffect, useState} from 'react'
|
|
5
5
|
import {isValidElementType} from 'react-is'
|
|
6
|
-
// import {useArrayProp} from '../../hooks'
|
|
7
6
|
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
8
7
|
import {Selectable} from '../../primitives/_selectable'
|
|
9
|
-
// import {useRootTheme} from '../../theme'
|
|
10
8
|
import {Radius, SelectableTone} from '../../types'
|
|
11
9
|
import {Menu} from './menu'
|
|
12
10
|
import {useMenu} from './useMenu'
|
|
@@ -22,7 +20,6 @@ export interface MenuGroupProps {
|
|
|
22
20
|
popover?: Omit<PopoverProps, 'content' | 'open'>
|
|
23
21
|
radius?: Radius | Radius[]
|
|
24
22
|
space?: ResponsiveProp<Space>
|
|
25
|
-
// space?: number | number[]
|
|
26
23
|
text: React.ReactNode
|
|
27
24
|
tone?: SelectableTone
|
|
28
25
|
}
|
|
@@ -33,7 +30,7 @@ export interface MenuGroupProps {
|
|
|
33
30
|
export function MenuGroup(
|
|
34
31
|
props: Omit<
|
|
35
32
|
React.HTMLProps<HTMLDivElement>,
|
|
36
|
-
'as' | 'height' | 'popover' | 'ref' | 'tabIndex' | 'width' | 'wrap'
|
|
33
|
+
'as' | 'height' | 'popover' | 'ref' | 'rows' | 'tabIndex' | 'width' | 'wrap'
|
|
37
34
|
> &
|
|
38
35
|
MenuGroupProps,
|
|
39
36
|
): React.ReactElement {
|
|
@@ -52,7 +49,7 @@ export function MenuGroup(
|
|
|
52
49
|
...restProps
|
|
53
50
|
} = props
|
|
54
51
|
const menu = useMenu()
|
|
55
|
-
|
|
52
|
+
|
|
56
53
|
const {
|
|
57
54
|
activeElement,
|
|
58
55
|
mount,
|
|
@@ -172,9 +169,6 @@ export function MenuGroup(
|
|
|
172
169
|
aria-pressed={as === 'button' ? withinMenu : undefined}
|
|
173
170
|
data-pressed={as !== 'button' ? withinMenu : undefined}
|
|
174
171
|
data-selected={!withinMenu && active ? '' : undefined}
|
|
175
|
-
// $radius={useArrayProp(radius)}
|
|
176
|
-
// $tone={tone}
|
|
177
|
-
// $scheme={scheme}
|
|
178
172
|
onClick={handleClick}
|
|
179
173
|
onKeyDown={handleKeyDown}
|
|
180
174
|
onMouseEnter={handleMouseEnter}
|
|
@@ -43,7 +43,7 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
43
43
|
props: MenuItemProps &
|
|
44
44
|
Omit<
|
|
45
45
|
React.HTMLProps<HTMLDivElement>,
|
|
46
|
-
'as' | 'height' | 'ref' | 'selected' | 'tabIndex' | 'width' | 'wrap'
|
|
46
|
+
'as' | 'height' | 'ref' | 'rows' | 'selected' | 'tabIndex' | 'width' | 'wrap'
|
|
47
47
|
>,
|
|
48
48
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
49
49
|
) {
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {Box} from '../../primitives'
|
|
5
|
-
import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
|
|
6
|
-
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
7
|
-
import {skeletonStyle} from './styles'
|
|
8
|
-
|
|
9
|
-
const Root = styled(Box)<{$animated: boolean; $visible: boolean} & ResponsiveRadiusStyleProps>(
|
|
10
|
-
responsiveRadiusStyle,
|
|
11
|
-
skeletonStyle,
|
|
12
|
-
)
|
|
1
|
+
import {composeClassNames, skeleton, SkeletonStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import {ForwardedRef, forwardRef, HTMLProps, useEffect, useState} from 'react'
|
|
3
|
+
import {Box, BoxProps} from '../../primitives'
|
|
13
4
|
|
|
14
5
|
/**
|
|
15
6
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
16
7
|
* @beta
|
|
17
8
|
*/
|
|
18
|
-
export interface SkeletonProps extends
|
|
9
|
+
export interface SkeletonProps extends SkeletonStyleProps, Omit<BoxProps, 'children'> {
|
|
19
10
|
animated?: boolean
|
|
20
11
|
delay?: number
|
|
21
12
|
}
|
|
@@ -25,10 +16,11 @@ export interface SkeletonProps extends ResponsiveRadiusProps, Omit<BoxProps, 'ch
|
|
|
25
16
|
* @beta
|
|
26
17
|
*/
|
|
27
18
|
export const Skeleton = forwardRef(function Skeleton(
|
|
28
|
-
props: SkeletonProps &
|
|
29
|
-
|
|
19
|
+
props: SkeletonProps &
|
|
20
|
+
Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'width' | 'wrap'>,
|
|
21
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
30
22
|
) {
|
|
31
|
-
const {animated = false, delay, radius, ...restProps} = props
|
|
23
|
+
const {animated = false, className, delay, radius, ...restProps} = props
|
|
32
24
|
const [visible, setVisible] = useState<boolean>(delay ? false : true)
|
|
33
25
|
|
|
34
26
|
useEffect(() => {
|
|
@@ -46,13 +38,15 @@ export const Skeleton = forwardRef(function Skeleton(
|
|
|
46
38
|
}, [delay])
|
|
47
39
|
|
|
48
40
|
return (
|
|
49
|
-
<
|
|
41
|
+
<Box
|
|
42
|
+
data-ui="Skeleton"
|
|
50
43
|
{...restProps}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
className={composeClassNames(className, skeleton({radius}))}
|
|
45
|
+
data-animated={animated ? '' : undefined}
|
|
46
|
+
data-visible={visible ? '' : undefined}
|
|
54
47
|
ref={ref}
|
|
55
48
|
/>
|
|
56
49
|
)
|
|
57
50
|
})
|
|
51
|
+
|
|
58
52
|
Skeleton.displayName = 'ForwardRef(Skeleton)'
|