@sanity/ui 2.10.0-corel.0 → 2.10.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/getTheme_v2.js +110 -54
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +110 -54
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +110 -54
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.d.mts +43 -54
- package/dist/index.d.ts +43 -54
- package/dist/index.esm.js +3323 -3046
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3322 -3046
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3323 -3046
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +9 -9
- package/dist/theme.d.ts +9 -9
- package/dist/theme.esm.js +1144 -592
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1144 -592
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1144 -592
- package/dist/theme.mjs.map +1 -1
- package/package.json +78 -64
- package/src/core/__workshop__/constants.ts +15 -19
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +4 -3
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +13 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +31 -39
- package/src/core/components/dialog/dialog.tsx +5 -3
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +5 -6
- package/src/core/components/menu/menu.test.tsx +0 -2
- package/src/core/components/menu/menu.tsx +15 -11
- package/src/core/components/menu/menuButton.tsx +16 -38
- package/src/core/components/menu/menuGroup.tsx +4 -3
- package/src/core/components/menu/menuItem.tsx +5 -2
- package/src/core/components/tab/tabList.tsx +4 -12
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +0 -1
- package/src/core/components/toast/toast.tsx +3 -3
- package/src/core/components/toast/toastProvider.tsx +8 -8
- package/src/core/components/toast/toastState.ts +6 -0
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +1 -1
- package/src/core/constants.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useDelayedState.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +2 -2
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -1
- package/src/core/lib/globalScope.ts +0 -1
- package/src/core/primitives/avatar/avatar.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +2 -5
- package/src/core/primitives/badge/__workshop__/tones.tsx +6 -13
- package/src/core/primitives/badge/badge.tsx +1 -1
- package/src/core/primitives/box/box.tsx +1 -1
- package/src/core/primitives/button/__workshop__/custom.tsx +4 -3
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/button.tsx +7 -12
- package/src/core/primitives/button/styles.ts +1 -1
- package/src/core/primitives/card/__workshop__/allTones.tsx +6 -8
- package/src/core/primitives/card/__workshop__/asButton.tsx +42 -24
- package/src/core/primitives/card/__workshop__/asComponent.tsx +2 -2
- package/src/core/primitives/card/__workshop__/checkered.tsx +17 -7
- package/src/core/primitives/card/__workshop__/interactive.tsx +10 -3
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +5 -3
- package/src/core/primitives/card/__workshop__/props.tsx +7 -5
- package/src/core/primitives/card/__workshop__/selected.tsx +4 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +6 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/code/code.tsx +1 -2
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +3 -3
- package/src/core/primitives/flex/flex.tsx +1 -5
- package/src/core/primitives/grid/__workshop__/responsive.tsx +12 -12
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +13 -25
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/inline/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/inline/inline.tsx +0 -1
- package/src/core/primitives/kbd/kbd.tsx +1 -1
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +6 -6
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +10 -10
- package/src/core/primitives/radio/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +6 -6
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +11 -21
- package/src/core/primitives/text/styles.ts +0 -1
- package/src/core/primitives/text/text.tsx +3 -5
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -2
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +6 -2
- package/src/core/primitives/textInput/__workshop__/tones.tsx +38 -0
- package/src/core/primitives/tooltip/tooltip.tsx +1 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
- package/src/core/styles/card/_cardColorStyle.ts +8 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +0 -2
- package/src/core/theme/__workshop__/build/story.tsx +1 -3
- package/src/core/theme/__workshop__/debug/story.tsx +18 -13
- package/src/core/theme/theme.test.tsx +0 -1
- package/src/core/theme/themeColorProvider.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +5 -7
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -1
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +3 -1
- package/src/core/utils/elementQuery/elementQuery.tsx +16 -17
- package/src/core/utils/layer/layer.test.tsx +0 -1
- package/src/core/utils/layer/layer.tsx +9 -1
- package/src/core/utils/layer/layerProvider.tsx +2 -2
- package/src/core/utils/portal/portal.test.tsx +0 -1
- package/src/core/utils/portal/portalProvider.tsx +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +10 -3
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +12 -8
- package/src/theme/build/merge.ts +0 -2
- package/src/theme/build/renderColorTheme.ts +54 -232
- package/src/theme/defaults/colorTokens.ts +13 -18
- package/src/theme/system/color/_constants.ts +6 -10
- package/src/theme/system/css.ts +1 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -26
- package/src/theme/versioning/v0_v2.ts +4 -4
- package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
- package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
- package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
- package/src/core/components/menu/__workshop__/.eslintrc +0 -5
- package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
- package/src/core/components/tab/__workshop__/.eslintrc +0 -5
- package/src/core/components/toast/__workshop__/.eslintrc +0 -5
- package/src/core/components/tree/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
- package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
- package/src/core/theme/__workshop__/.eslintrc +0 -5
- package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
- package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
- package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
- package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
- package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -51,6 +51,32 @@
|
|
|
51
51
|
"src",
|
|
52
52
|
"theme.js"
|
|
53
53
|
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
56
|
+
"clean": "rimraf .workshop dist",
|
|
57
|
+
"commit": "cz",
|
|
58
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
59
|
+
"cypress:open": "cypress open",
|
|
60
|
+
"cypress:run": "cypress run",
|
|
61
|
+
"dev": "run-p storybook:dev workshop:dev",
|
|
62
|
+
"figma:pkg:build": "cd figma && pnpm build",
|
|
63
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
64
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
65
|
+
"pkg:build": "pkg build --strict",
|
|
66
|
+
"pkg:check": "pkg --strict",
|
|
67
|
+
"prepare": "husky install",
|
|
68
|
+
"prepack": "pnpm build",
|
|
69
|
+
"release": "semantic-release",
|
|
70
|
+
"storybook:build": "storybook build",
|
|
71
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
72
|
+
"test": "jest",
|
|
73
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
74
|
+
"ts:check": "tsc",
|
|
75
|
+
"watch": "pkg watch --strict",
|
|
76
|
+
"workshop:build": "workshop build",
|
|
77
|
+
"workshop:dev": "workshop dev",
|
|
78
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
79
|
+
},
|
|
54
80
|
"commitlint": {
|
|
55
81
|
"extends": [
|
|
56
82
|
"@commitlint/config-conventional"
|
|
@@ -81,9 +107,10 @@
|
|
|
81
107
|
"dependencies": {
|
|
82
108
|
"@floating-ui/react-dom": "^2.1.2",
|
|
83
109
|
"@sanity/color": "^3.0.6",
|
|
84
|
-
"@sanity/icons": "^3.
|
|
110
|
+
"@sanity/icons": "^3.5.0",
|
|
85
111
|
"csstype": "^3.1.3",
|
|
86
|
-
"framer-motion": "11.
|
|
112
|
+
"framer-motion": "^11.13.1",
|
|
113
|
+
"react-compiler-runtime": "19.0.0-beta-df7b47d-20241124",
|
|
87
114
|
"react-refractor": "^2.2.0",
|
|
88
115
|
"use-effect-event": "^1.0.2"
|
|
89
116
|
},
|
|
@@ -95,53 +122,53 @@
|
|
|
95
122
|
"@commitlint/cli": "^19.4.0",
|
|
96
123
|
"@commitlint/config-conventional": "^19.2.2",
|
|
97
124
|
"@juggle/resize-observer": "^3.4.0",
|
|
98
|
-
"@sanity/pkg-utils": "^6.11.
|
|
99
|
-
"@sanity/prettier-config": "^1.0.
|
|
125
|
+
"@sanity/pkg-utils": "^6.11.14",
|
|
126
|
+
"@sanity/prettier-config": "^1.0.3",
|
|
100
127
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
101
128
|
"@sanity/ui-workshop": "^2.0.16",
|
|
102
|
-
"@storybook/addon-a11y": "^8.
|
|
103
|
-
"@storybook/addon-docs": "^8.
|
|
104
|
-
"@storybook/addon-essentials": "^8.
|
|
105
|
-
"@storybook/addon-interactions": "^8.
|
|
106
|
-
"@storybook/addon-links": "^8.
|
|
107
|
-
"@storybook/addon-mdx-gfm": "^8.
|
|
108
|
-
"@storybook/addon-storysource": "^8.
|
|
109
|
-
"@storybook/addon-themes": "^8.
|
|
110
|
-
"@storybook/blocks": "^8.
|
|
111
|
-
"@storybook/manager-api": "^8.
|
|
112
|
-
"@storybook/react": "^8.
|
|
113
|
-
"@storybook/react-vite": "^8.
|
|
114
|
-
"@storybook/test": "^8.
|
|
115
|
-
"@storybook/theming": "^8.
|
|
129
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
130
|
+
"@storybook/addon-docs": "^8.4.7",
|
|
131
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
132
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
133
|
+
"@storybook/addon-links": "^8.4.7",
|
|
134
|
+
"@storybook/addon-mdx-gfm": "^8.4.7",
|
|
135
|
+
"@storybook/addon-storysource": "^8.4.7",
|
|
136
|
+
"@storybook/addon-themes": "^8.4.7",
|
|
137
|
+
"@storybook/blocks": "^8.4.7",
|
|
138
|
+
"@storybook/manager-api": "^8.4.7",
|
|
139
|
+
"@storybook/react": "^8.4.7",
|
|
140
|
+
"@storybook/react-vite": "^8.4.7",
|
|
141
|
+
"@storybook/test": "^8.4.7",
|
|
142
|
+
"@storybook/theming": "^8.4.7",
|
|
116
143
|
"@testing-library/dom": "^10.4.0",
|
|
117
|
-
"@testing-library/jest-dom": "^6.6.
|
|
118
|
-
"@testing-library/react": "^16.0
|
|
144
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
145
|
+
"@testing-library/react": "^16.1.0",
|
|
119
146
|
"@testing-library/user-event": "^14.5.2",
|
|
120
147
|
"@types/jest": "^29.5.12",
|
|
121
148
|
"@types/jest-axe": "^3.5.9",
|
|
122
149
|
"@types/node": "^20.12.7",
|
|
123
|
-
"@types/react": "^
|
|
124
|
-
"@types/react-dom": "^
|
|
125
|
-
"@types/react-is": "^
|
|
150
|
+
"@types/react": "^19.0.1",
|
|
151
|
+
"@types/react-dom": "^19.0.1",
|
|
152
|
+
"@types/react-is": "^19.0.0",
|
|
126
153
|
"@types/refractor": "^3.4.1",
|
|
127
154
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
128
155
|
"@typescript-eslint/parser": "^7.18.0",
|
|
129
156
|
"@vitejs/plugin-react": "^4.3.3",
|
|
130
|
-
"babel-plugin-react-compiler": "beta",
|
|
157
|
+
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
|
131
158
|
"commitizen": "^4.3.0",
|
|
132
159
|
"cypress": "^13.13.2",
|
|
133
160
|
"cypress-real-events": "^1.13.0",
|
|
134
161
|
"cz-conventional-changelog": "^3.3.0",
|
|
135
162
|
"eslint": "^8.57.1",
|
|
136
163
|
"eslint-config-prettier": "^9.1.0",
|
|
137
|
-
"eslint-plugin-boundaries": "^
|
|
164
|
+
"eslint-plugin-boundaries": "^5.0.1",
|
|
138
165
|
"eslint-plugin-import": "^2.31.0",
|
|
139
166
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
140
167
|
"eslint-plugin-prettier": "^5.2.1",
|
|
141
168
|
"eslint-plugin-react": "^7.37.2",
|
|
142
|
-
"eslint-plugin-react-compiler": "beta",
|
|
169
|
+
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
|
143
170
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
144
|
-
"eslint-plugin-storybook": "^0.
|
|
171
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
145
172
|
"http-server": "^14.1.1",
|
|
146
173
|
"husky": "^8.0.3",
|
|
147
174
|
"jest": "^29.7.0",
|
|
@@ -151,58 +178,45 @@
|
|
|
151
178
|
"module-alias": "^2.2.3",
|
|
152
179
|
"npm-run-all2": "^5.0.2",
|
|
153
180
|
"prettier": "^3.3.3",
|
|
154
|
-
"react": "^
|
|
155
|
-
"react-
|
|
156
|
-
"react-
|
|
157
|
-
"react-is": "^18.3.1",
|
|
181
|
+
"react": "^19.0.0",
|
|
182
|
+
"react-dom": "^19.0.0",
|
|
183
|
+
"react-is": "^19.0.0",
|
|
158
184
|
"refractor": "^4.8.1",
|
|
159
185
|
"rimraf": "^5.0.5",
|
|
160
186
|
"semantic-release": "^24.0.0",
|
|
161
187
|
"start-server-and-test": "^2.0.5",
|
|
162
|
-
"storybook": "^8.
|
|
188
|
+
"storybook": "^8.4.7",
|
|
163
189
|
"styled-components": "^6.1.13",
|
|
164
190
|
"tsconfig-paths": "^4.2.0",
|
|
165
|
-
"typescript": "5.
|
|
166
|
-
"vite": "^5.4.
|
|
167
|
-
"vite-tsconfig-paths": "^5.
|
|
191
|
+
"typescript": "5.6.3",
|
|
192
|
+
"vite": "^5.4.11",
|
|
193
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
168
194
|
},
|
|
169
195
|
"peerDependencies": {
|
|
170
|
-
"react": "^18",
|
|
171
|
-
"react-dom": "^18",
|
|
172
|
-
"react-is": "^18",
|
|
196
|
+
"react": "^18 || >=19.0.0-0",
|
|
197
|
+
"react-dom": "^18 || >=19.0.0-0",
|
|
198
|
+
"react-is": "^18 || >=19.0.0-0",
|
|
173
199
|
"styled-components": "^5.2 || ^6"
|
|
174
200
|
},
|
|
201
|
+
"packageManager": "pnpm@9.15.0",
|
|
175
202
|
"engines": {
|
|
176
203
|
"node": ">=14.0.0"
|
|
177
204
|
},
|
|
178
205
|
"publishConfig": {
|
|
179
206
|
"access": "public"
|
|
180
207
|
},
|
|
208
|
+
"pnpm": {
|
|
209
|
+
"overrides": {
|
|
210
|
+
"@types/react": "$@types/react",
|
|
211
|
+
"@types/react-dom": "$@types/react-dom",
|
|
212
|
+
"@types/react-is": "$@types/react-is",
|
|
213
|
+
"conventional-changelog-conventionalcommits": ">= 8.0.0",
|
|
214
|
+
"react": "$react",
|
|
215
|
+
"react-dom": "$react-dom",
|
|
216
|
+
"react-is": "$react-is"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
181
219
|
"esm.sh": {
|
|
182
220
|
"bundle": false
|
|
183
|
-
},
|
|
184
|
-
"scripts": {
|
|
185
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
186
|
-
"clean": "rimraf .workshop dist",
|
|
187
|
-
"commit": "cz",
|
|
188
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
189
|
-
"cypress:open": "cypress open",
|
|
190
|
-
"cypress:run": "cypress run",
|
|
191
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
192
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
193
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
194
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
195
|
-
"pkg:build": "pkg build --strict",
|
|
196
|
-
"pkg:check": "pkg --strict",
|
|
197
|
-
"release": "semantic-release",
|
|
198
|
-
"storybook:build": "storybook build",
|
|
199
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
200
|
-
"test": "jest",
|
|
201
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
202
|
-
"ts:check": "tsc",
|
|
203
|
-
"watch": "pkg watch --strict",
|
|
204
|
-
"workshop:build": "workshop build",
|
|
205
|
-
"workshop:dev": "workshop dev",
|
|
206
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
207
221
|
}
|
|
208
|
-
}
|
|
222
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
TextAlign,
|
|
15
15
|
TextInputType,
|
|
16
16
|
} from '@sanity/ui'
|
|
17
|
-
import {
|
|
17
|
+
import {ThemeColorAvatarColorKey, ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
18
18
|
|
|
19
19
|
export const WORKSHOP_AVATAR_SIZE_OPTIONS: {[key: string]: AvatarSize} = {
|
|
20
20
|
'0': 0,
|
|
@@ -31,6 +31,7 @@ export const WORKSHOP_BADGE_MODE_OPTIONS: {[key: string]: BadgeMode} = {
|
|
|
31
31
|
export const WORKSHOP_BADGE_TONE_OPTIONS: {[key: string]: BadgeTone} = {
|
|
32
32
|
Default: 'default',
|
|
33
33
|
Primary: 'primary',
|
|
34
|
+
Suggest: 'suggest',
|
|
34
35
|
Positive: 'positive',
|
|
35
36
|
Caution: 'caution',
|
|
36
37
|
Critical: 'critical',
|
|
@@ -51,7 +52,9 @@ export const WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS: {[key: string]: ButtonTextAlign
|
|
|
51
52
|
|
|
52
53
|
export const WORKSHOP_BUTTON_TONE_OPTIONS: {[key: string]: ButtonTone} = {
|
|
53
54
|
Default: 'default',
|
|
55
|
+
Neutral: 'neutral',
|
|
54
56
|
Primary: 'primary',
|
|
57
|
+
Suggest: 'suggest',
|
|
55
58
|
Positive: 'positive',
|
|
56
59
|
Caution: 'caution',
|
|
57
60
|
Critical: 'critical',
|
|
@@ -69,13 +72,15 @@ export const WORKSHOP_CARD_AS_OPTIONS: {
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export const WORKSHOP_CARD_TONE_OPTIONS: {[key: string]: CardTone} = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
'Inherit': 'inherit',
|
|
76
|
+
'Transparent': 'transparent',
|
|
77
|
+
'Default': 'default',
|
|
78
|
+
'Neutral': 'neutral',
|
|
79
|
+
'Primary (deprecated)': 'primary',
|
|
80
|
+
'Suggest': 'suggest',
|
|
81
|
+
'Positive': 'positive',
|
|
82
|
+
'Caution': 'caution',
|
|
83
|
+
'Critical': 'critical',
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
export const WORKSHOP_CODE_LANGUAGE_OPTIONS = {
|
|
@@ -203,7 +208,7 @@ export const WORKSHOP_SPACE_OPTIONS = {
|
|
|
203
208
|
'9': 9,
|
|
204
209
|
}
|
|
205
210
|
|
|
206
|
-
export const WORKSHOP_SPOT_COLOR_OPTIONS: {[key: string]:
|
|
211
|
+
export const WORKSHOP_SPOT_COLOR_OPTIONS: {[key: string]: ThemeColorAvatarColorKey} = {
|
|
207
212
|
Gray: 'gray',
|
|
208
213
|
Blue: 'blue',
|
|
209
214
|
Purple: 'purple',
|
|
@@ -260,21 +265,12 @@ export const WORKSHOP_TEXT_SIZE_OPTIONS = {
|
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
export const WORKSHOP_TEXT_WEIGHT_OPTIONS: {[key: string]: ThemeFontWeightKey | ''} = {
|
|
263
|
-
Regular: '
|
|
268
|
+
Regular: '',
|
|
264
269
|
Medium: 'medium',
|
|
265
270
|
Semibold: 'semibold',
|
|
266
271
|
Bold: 'bold',
|
|
267
272
|
}
|
|
268
273
|
|
|
269
|
-
export const WORKSHOP_THEME_COLOR_TONE_OPTIONS: {[key: string]: ThemeColorToneKey} = {
|
|
270
|
-
Default: 'default',
|
|
271
|
-
Transparent: 'transparent',
|
|
272
|
-
Primary: 'primary',
|
|
273
|
-
Positive: 'positive',
|
|
274
|
-
Caution: 'caution',
|
|
275
|
-
Critical: 'critical',
|
|
276
|
-
}
|
|
277
|
-
|
|
278
274
|
export const WORKSHOP_TOAST_STATUS_OPTIONS: {
|
|
279
275
|
[key: string]: 'error' | 'success' | 'warning' | 'info' | ''
|
|
280
276
|
} = {
|
|
@@ -81,7 +81,7 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
81
81
|
const renderPopover: AutocompleteProps['renderPopover'] = useCallback(
|
|
82
82
|
(
|
|
83
83
|
popoverProps: {
|
|
84
|
-
content: React.ReactElement | null
|
|
84
|
+
content: React.ReactElement<any> | null
|
|
85
85
|
hidden: boolean
|
|
86
86
|
inputElement: HTMLInputElement | null
|
|
87
87
|
onMouseEnter: () => void
|
|
@@ -73,11 +73,11 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
73
73
|
/** @beta */
|
|
74
74
|
relatedElements?: HTMLElement[]
|
|
75
75
|
/** The callback function for rendering each option. */
|
|
76
|
-
renderOption?: (option: Option) => ReactElement
|
|
76
|
+
renderOption?: (option: Option) => ReactElement<any>
|
|
77
77
|
/** @beta */
|
|
78
78
|
renderPopover?: (
|
|
79
79
|
props: {
|
|
80
|
-
content: ReactElement | null
|
|
80
|
+
content: ReactElement<any> | null
|
|
81
81
|
hidden: boolean
|
|
82
82
|
inputElement: HTMLInputElement | null
|
|
83
83
|
onMouseEnter: () => void
|
|
@@ -663,6 +663,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
663
663
|
radius={radius}
|
|
664
664
|
ref={resultsPopoverElementRef}
|
|
665
665
|
referenceElement={inputElementRef.current}
|
|
666
|
+
// @ts-expect-error fix later
|
|
666
667
|
{...popover}
|
|
667
668
|
/>
|
|
668
669
|
)
|
|
@@ -724,4 +725,4 @@ export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocomplet
|
|
|
724
725
|
> & {
|
|
725
726
|
ref?: Ref<HTMLInputElement>
|
|
726
727
|
},
|
|
727
|
-
) => ReactElement
|
|
728
|
+
) => ReactElement<any>
|
|
@@ -9,7 +9,7 @@ export interface AutocompleteOptionProps {
|
|
|
9
9
|
value: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function AutocompleteOption(props: AutocompleteOptionProps): React.ReactElement {
|
|
12
|
+
export function AutocompleteOption(props: AutocompleteOptionProps): React.ReactElement<any> {
|
|
13
13
|
const {children, id, onSelect, selected, value} = props
|
|
14
14
|
|
|
15
15
|
const handleClick = useCallback(() => {
|
|
@@ -19,15 +19,13 @@ export default function Example() {
|
|
|
19
19
|
return (
|
|
20
20
|
<Flex align="center" height="fill" justify="center">
|
|
21
21
|
<Breadcrumbs
|
|
22
|
-
gapX={1}
|
|
23
|
-
gapY={3}
|
|
24
22
|
maxLength={maxLength}
|
|
25
23
|
separator={
|
|
26
24
|
<Text muted size={1}>
|
|
27
25
|
/
|
|
28
26
|
</Text>
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
space={2}
|
|
31
29
|
>
|
|
32
30
|
<Text size={1}>
|
|
33
31
|
<a href="#">Root</a>
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import {styled} from 'styled-components'
|
|
2
|
+
import {Button} from '../../primitives'
|
|
2
3
|
|
|
3
|
-
export const Root = styled.
|
|
4
|
+
export const Root = styled.ol`
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
list-style: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
white-space: nowrap;
|
|
4
11
|
line-height: 0;
|
|
5
12
|
`
|
|
13
|
+
|
|
14
|
+
export const ExpandButton = styled(Button)`
|
|
15
|
+
appearance: none;
|
|
16
|
+
margin: -4px;
|
|
17
|
+
`
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
forwardRef,
|
|
4
|
+
Fragment,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useCallback,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import {useArrayProp, useClickOutsideEvent} from '../../hooks'
|
|
12
|
+
import {Box, Popover, Stack, Text} from '../../primitives'
|
|
13
|
+
import {ExpandButton, Root} from './breadcrumbs.styles'
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* @beta
|
|
8
17
|
*/
|
|
9
18
|
export interface BreadcrumbsProps {
|
|
10
|
-
expandButton?: Omit<ButtonProps, 'onClick' | 'selected'>
|
|
11
|
-
gap?: number | number[]
|
|
12
|
-
gapX?: number | number[]
|
|
13
|
-
gapY?: number | number[]
|
|
14
19
|
maxLength?: number
|
|
15
20
|
separator?: React.ReactNode
|
|
16
|
-
/** @deprecated - Use `gap`, `gapX`, `gapY` instead */
|
|
17
21
|
space?: number | number[]
|
|
18
22
|
}
|
|
19
23
|
|
|
@@ -24,19 +28,8 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
24
28
|
props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'ref' | 'type'>,
|
|
25
29
|
ref: React.ForwardedRef<HTMLOListElement>,
|
|
26
30
|
) {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
expandButton: expandButtonProps,
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
-
gap: _gapProp,
|
|
32
|
-
gapX = props.gap ?? props.space ?? 2,
|
|
33
|
-
gapY = props.gap ?? props.space ?? 2,
|
|
34
|
-
maxLength,
|
|
35
|
-
separator,
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
-
space: _spaceProp,
|
|
38
|
-
...restProps
|
|
39
|
-
} = props
|
|
31
|
+
const {children, maxLength, separator, space: spaceRaw = 2, ...restProps} = props
|
|
32
|
+
const space = useArrayProp(spaceRaw)
|
|
40
33
|
const [open, setOpen] = useState(false)
|
|
41
34
|
const expandElementRef = useRef<HTMLButtonElement | null>(null)
|
|
42
35
|
const popoverElementRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -60,25 +53,24 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
60
53
|
<Popover
|
|
61
54
|
constrainSize
|
|
62
55
|
content={
|
|
63
|
-
<Stack as="ol" overflow="auto" space={
|
|
56
|
+
<Stack as="ol" overflow="auto" padding={space} space={space}>
|
|
64
57
|
{rawItems.slice(beforeLength - 1, len - afterLength)}
|
|
65
58
|
</Stack>
|
|
66
59
|
}
|
|
67
60
|
key="button"
|
|
68
61
|
open={open}
|
|
69
|
-
padding={2}
|
|
70
62
|
placement="top"
|
|
71
63
|
portal
|
|
72
64
|
ref={popoverElementRef}
|
|
73
65
|
>
|
|
74
|
-
<
|
|
66
|
+
<ExpandButton
|
|
67
|
+
fontSize={1}
|
|
75
68
|
mode="bleed"
|
|
76
|
-
padding={0}
|
|
77
|
-
text="…"
|
|
78
|
-
{...expandButtonProps}
|
|
79
69
|
onClick={open ? collapse : expand}
|
|
70
|
+
padding={1}
|
|
80
71
|
ref={expandElementRef}
|
|
81
72
|
selected={open}
|
|
73
|
+
text="…"
|
|
82
74
|
/>
|
|
83
75
|
</Popover>,
|
|
84
76
|
...rawItems.slice(len - afterLength),
|
|
@@ -86,20 +78,20 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
86
78
|
}
|
|
87
79
|
|
|
88
80
|
return rawItems
|
|
89
|
-
}, [collapse, expand,
|
|
90
|
-
|
|
91
|
-
const len = items.length
|
|
81
|
+
}, [collapse, expand, maxLength, open, rawItems, space])
|
|
92
82
|
|
|
93
83
|
return (
|
|
94
84
|
<Root data-ui="Breadcrumbs" {...restProps} ref={ref}>
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
<Box
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
{items.map((item, itemIndex) => (
|
|
86
|
+
<Fragment key={itemIndex}>
|
|
87
|
+
{itemIndex > 0 && (
|
|
88
|
+
<Box aria-hidden as="li" paddingX={space}>
|
|
89
|
+
{separator || <Text muted>/</Text>}
|
|
90
|
+
</Box>
|
|
91
|
+
)}
|
|
92
|
+
<Box as="li">{item}</Box>
|
|
93
|
+
</Fragment>
|
|
94
|
+
))}
|
|
103
95
|
</Root>
|
|
104
96
|
)
|
|
105
97
|
})
|
|
@@ -305,13 +305,15 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
305
305
|
onFocus,
|
|
306
306
|
padding: paddingProp = 3,
|
|
307
307
|
portal: portalProp,
|
|
308
|
-
position:
|
|
308
|
+
position: _positionProp,
|
|
309
309
|
scheme,
|
|
310
310
|
width: widthProp = 0,
|
|
311
|
-
zOffset:
|
|
311
|
+
zOffset: _zOffsetProp,
|
|
312
312
|
animate: _animate = false,
|
|
313
313
|
...restProps
|
|
314
314
|
} = props
|
|
315
|
+
const positionProp = _positionProp ?? (dialog.position || 'fixed')
|
|
316
|
+
const zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset)
|
|
315
317
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
316
318
|
const animate = prefersReducedMotion ? false : _animate
|
|
317
319
|
const portal = usePortal()
|
|
@@ -355,7 +357,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
355
357
|
|
|
356
358
|
const labelId = `${id}_label`
|
|
357
359
|
|
|
358
|
-
const rootClickTimeoutRef = useRef<NodeJS.Timeout>()
|
|
360
|
+
const rootClickTimeoutRef = useRef<NodeJS.Timeout>(undefined)
|
|
359
361
|
|
|
360
362
|
// If the resulting active element (a.k.a. focused element) is not withing scope when clicking
|
|
361
363
|
// within the dialog, then we want to focus the previously interactive element in the dialog instead.
|
|
@@ -16,7 +16,7 @@ export interface DialogProviderProps {
|
|
|
16
16
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
17
17
|
* @beta
|
|
18
18
|
*/
|
|
19
|
-
export function DialogProvider(props: DialogProviderProps): React.ReactElement {
|
|
19
|
+
export function DialogProvider(props: DialogProviderProps): React.ReactElement<any> {
|
|
20
20
|
const {children, position, zOffset} = props
|
|
21
21
|
|
|
22
22
|
const contextValue: DialogContextValue = useMemo(
|
|
@@ -4,7 +4,7 @@ import {forwardRef} from 'react'
|
|
|
4
4
|
const CustomLink = forwardRef(function CustomLink(
|
|
5
5
|
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
6
6
|
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
7
|
-
): React.ReactElement {
|
|
7
|
+
): React.ReactElement<any> {
|
|
8
8
|
const {children, req, ...restProps} = props
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {CubeIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, LayerProvider, Menu, MenuItem} from '@sanity/ui'
|
|
3
|
+
import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
3
4
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
5
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
5
6
|
|
|
@@ -12,11 +13,9 @@ export default function TonesStory() {
|
|
|
12
13
|
<Box padding={[4, 5, 6]}>
|
|
13
14
|
<Card radius={3} shadow={3} tone={parentTone}>
|
|
14
15
|
<Menu>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<MenuItem disabled={disabled} icon={SearchIcon} text="Caution" tone="caution" />
|
|
19
|
-
<MenuItem disabled={disabled} icon={SearchIcon} text="Critical" tone="critical" />
|
|
16
|
+
{THEME_COLOR_STATE_TONES.map((tone) => (
|
|
17
|
+
<MenuItem disabled={disabled} icon={CubeIcon} key={tone} text={tone} tone={tone} />
|
|
18
|
+
))}
|
|
20
19
|
</Menu>
|
|
21
20
|
</Card>
|
|
22
21
|
</Box>
|
|
@@ -79,7 +79,6 @@ describe('components/menu', () => {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function Root() {
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
82
|
const value: any = undefined
|
|
84
83
|
|
|
85
84
|
return (
|
|
@@ -109,7 +108,6 @@ describe('components/menu', () => {
|
|
|
109
108
|
|
|
110
109
|
function Root() {
|
|
111
110
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
111
|
const value: any = () => {
|
|
114
112
|
return {version: 1}
|
|
115
113
|
}
|
|
@@ -14,19 +14,21 @@ export interface MenuProps extends ResponsivePaddingProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated Use `shouldFocus="first"` instead.
|
|
16
16
|
*/
|
|
17
|
-
focusFirst?: boolean
|
|
17
|
+
'focusFirst'?: boolean
|
|
18
18
|
/**
|
|
19
19
|
* @deprecated Use `shouldFocus="last"` instead.
|
|
20
20
|
*/
|
|
21
|
-
focusLast?: boolean
|
|
22
|
-
onClickOutside?: (event: MouseEvent) => void
|
|
23
|
-
onEscape?: () => void
|
|
24
|
-
onItemClick?: () => void
|
|
25
|
-
onItemSelect?: (index: number) => void
|
|
26
|
-
originElement?: HTMLElement | null
|
|
27
|
-
registerElement?: (el: HTMLElement) => () => void
|
|
28
|
-
shouldFocus?: 'first' | 'last' | null
|
|
29
|
-
space?: number | number[]
|
|
21
|
+
'focusLast'?: boolean
|
|
22
|
+
'onClickOutside'?: (event: MouseEvent) => void
|
|
23
|
+
'onEscape'?: () => void
|
|
24
|
+
'onItemClick'?: () => void
|
|
25
|
+
'onItemSelect'?: (index: number) => void
|
|
26
|
+
'originElement'?: HTMLElement | null
|
|
27
|
+
'registerElement'?: (el: HTMLElement) => () => void
|
|
28
|
+
'shouldFocus'?: 'first' | 'last' | null
|
|
29
|
+
'space'?: number | number[]
|
|
30
|
+
'aria-labelledby'?: string
|
|
31
|
+
'onBlurCapture'?: (event: FocusEvent) => void
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
const Root = styled(Box)`
|
|
@@ -57,10 +59,12 @@ export const Menu = forwardRef(function Menu(
|
|
|
57
59
|
originElement,
|
|
58
60
|
padding = 1,
|
|
59
61
|
registerElement,
|
|
60
|
-
shouldFocus
|
|
62
|
+
shouldFocus: _shouldFocus,
|
|
61
63
|
space = 1,
|
|
62
64
|
...restProps
|
|
63
65
|
} = props
|
|
66
|
+
const shouldFocus =
|
|
67
|
+
_shouldFocus ?? ((props.focusFirst && 'first') || (props.focusLast && 'last') || null)
|
|
64
68
|
|
|
65
69
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
66
70
|
|