@sanity/ui 3.0.0-static.18 → 3.0.0-static.19
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/_visual-editing.cjs +137 -136
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/buildCommand.cjs +21 -22
- package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +138 -137
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +12 -22
- package/dist/_visual-editing.d.ts +12 -22
- package/dist/cli.cjs +1 -1
- package/dist/css.cjs +1589 -2017
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +9423 -874
- package/dist/css.d.ts +9423 -874
- package/dist/css.js +1591 -2019
- package/dist/css.js.map +1 -1
- package/dist/index.cjs +28 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +30 -42
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2749 -2756
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +242 -161
- package/dist/theme.d.ts +242 -161
- package/dist/theme.js +2750 -2757
- package/dist/theme.js.map +1 -1
- package/dist/ui-system.css +15719 -16097
- package/dist/ui-system.min.css +1 -1
- package/dist/ui-theme.css +850 -4568
- package/dist/ui-theme.min.css +1 -1
- package/dist/ui.css +16569 -20772
- package/dist/ui.min.css +1 -1
- package/package.json +10 -15
- package/src/cli/buildCommand.ts +13 -30
- package/src/core/StyleTags.tsx +4 -12
- package/src/core/_compat/styles/_responsive.ts +1 -1
- package/src/core/_compat/theme/theme.test.tsx +4 -5
- package/src/core/_compat/theme/themeColorProvider.tsx +2 -2
- package/src/core/_compat/theme/themeContext.ts +2 -2
- package/src/core/_compat/theme/themeProvider.tsx +2 -2
- package/src/core/_compat/theme/types.ts +1 -1
- package/src/core/_compat/theme/useRootTheme.ts +1 -1
- package/src/core/_compat/theme/useTheme.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/async.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +11 -11
- package/src/core/components/autocomplete/__workshop__/example.tsx +6 -7
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/autocomplete/autocompleteReducer.ts +1 -1
- package/src/core/components/autocomplete/constants.ts +1 -1
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -7
- package/src/core/components/dialog/__workshop__/activate.tsx +4 -4
- package/src/core/components/dialog/__workshop__/position.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +1 -1
- package/src/core/components/dialog/__workshop__/wrapped.tsx +2 -2
- package/src/core/components/dialog/dialog.tsx +15 -8
- package/src/core/components/dialog/dialogCard.tsx +18 -3
- package/src/core/components/dialog/dialogContext.ts +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +3 -3
- package/src/core/components/dialog/useDialog.ts +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -4
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +5 -4
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +2 -2
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +3 -3
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +2 -2
- package/src/core/components/menu/__workshop__/menuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +1 -1
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +13 -4
- package/src/core/components/menu/__workshop__/selectedItem.tsx +2 -2
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +6 -7
- package/src/core/components/menu/menu.tsx +2 -2
- package/src/core/components/menu/menuButton.tsx +9 -9
- package/src/core/components/menu/menuContext.ts +1 -1
- package/src/core/components/menu/menuDivider.tsx +3 -3
- package/src/core/components/menu/menuGroup.tsx +9 -9
- package/src/core/components/menu/menuItem.tsx +9 -6
- package/src/core/components/menu/useMenu.ts +1 -1
- package/src/core/components/menu/useMenuController.ts +4 -4
- package/src/core/components/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/components/skeleton/codeSkeleton.tsx +5 -5
- package/src/core/components/skeleton/headingSkeleton.tsx +5 -5
- package/src/core/components/skeleton/labelSkeleton.tsx +5 -5
- package/src/core/components/skeleton/skeleton.tsx +4 -4
- package/src/core/components/skeleton/textSkeleton.tsx +5 -5
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/tab.tsx +7 -7
- package/src/core/components/tab/tabList.tsx +14 -7
- package/src/core/components/tab/tabPanel.tsx +10 -7
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +5 -5
- package/src/core/components/toast/toast.tsx +6 -7
- package/src/core/components/toast/toastContext.ts +1 -1
- package/src/core/components/toast/toastLayer.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/toast/types.ts +1 -1
- package/src/core/components/toast/useToast.ts +1 -1
- package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
- package/src/core/components/tree/__workshop__/basic.tsx +1 -1
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/helpers.ts +1 -1
- package/src/core/components/tree/tree.tsx +6 -6
- package/src/core/components/tree/treeContext.ts +1 -1
- package/src/core/components/tree/treeGroup.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +15 -15
- package/src/core/components/tree/types.ts +2 -2
- package/src/core/components/tree/useTree.ts +1 -1
- package/src/core/hooks/useClickOutside.test.tsx +15 -16
- package/src/core/hooks/useClickOutsideEvent.test.tsx +4 -5
- package/src/core/hooks/useDelayed.test.ts +6 -7
- package/src/core/hooks/useDelayedState.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -1
- package/src/core/hooks/useElementSize.ts +1 -1
- package/src/core/hooks/useForwardedRef.ts +1 -1
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +2 -2
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersDark.test.tsx +1 -0
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +1 -0
- package/src/core/middleware/origin.ts +1 -1
- package/src/core/primitives/_selectable/selectable.tsx +3 -3
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +6 -6
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +7 -7
- package/src/core/primitives/avatar/types.ts +1 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +3 -3
- package/src/core/primitives/box/__workshop__/responsive.tsx +2 -1
- package/src/core/primitives/box/box.tsx +4 -2
- package/src/core/primitives/button/__workshop__/custom.tsx +2 -2
- package/src/core/primitives/button/__workshop__/customIcons.tsx +3 -3
- package/src/core/primitives/button/__workshop__/disabled.tsx +9 -9
- package/src/core/primitives/button/__workshop__/props.tsx +3 -4
- package/src/core/primitives/button/__workshop__/stacked.tsx +4 -5
- package/src/core/primitives/button/button.test.tsx +2 -3
- package/src/core/primitives/button/button.tsx +11 -6
- package/src/core/primitives/card/__workshop__/asButton.tsx +16 -7
- package/src/core/primitives/card/__workshop__/checkered.tsx +1 -1
- package/src/core/primitives/card/__workshop__/index.ts +1 -1
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +3 -3
- package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
- package/src/core/primitives/card/__workshop__/{allTones.tsx → tones.tsx} +3 -3
- package/src/core/primitives/card/card.tsx +4 -4
- package/src/core/primitives/card/cardContext.ts +2 -2
- package/src/core/primitives/card/cardProvider.tsx +3 -3
- package/src/core/primitives/card/types.ts +2 -2
- package/src/core/primitives/card/useCard.ts +2 -1
- package/src/core/primitives/checkbox/__workshop__/props.tsx +2 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +11 -20
- package/src/core/primitives/checkbox/checkbox.tsx +5 -7
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/code.tsx +3 -3
- package/src/core/primitives/container/container.tsx +4 -4
- package/src/core/primitives/flex/flex.tsx +2 -2
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +2 -2
- package/src/core/primitives/inline/types.ts +1 -0
- package/src/core/primitives/kbd/kbd.tsx +5 -5
- package/src/core/primitives/label/label.tsx +5 -5
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -4
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -4
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -3
- package/src/core/primitives/popover/constants.ts +1 -1
- package/src/core/primitives/popover/floating-ui/size.ts +2 -2
- package/src/core/primitives/popover/helpers.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverLayer.tsx +4 -4
- package/src/core/primitives/popover/types.ts +3 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +5 -5
- package/src/core/primitives/select/__workshop__/plain.tsx +15 -3
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +4 -10
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -2
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +3 -3
- package/src/core/primitives/spinner/spinner.tsx +3 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -5
- package/src/core/primitives/switch/switch.tsx +3 -3
- package/src/core/primitives/text/__workshop__/colored.tsx +5 -5
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +6 -6
- package/src/core/primitives/textArea/__workshop__/plain.tsx +35 -23
- package/src/core/primitives/textArea/textArea.tsx +14 -5
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +9 -15
- package/src/core/primitives/textInput/__workshop__/states.tsx +4 -4
- package/src/core/primitives/textInput/__workshop__/tones.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +13 -11
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -2
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +5 -4
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +61 -60
- package/src/core/primitives/tooltip/tooltip.tsx +11 -6
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +3 -3
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +4 -4
- package/src/core/primitives/types.ts +15 -24
- package/src/core/types/badge.ts +1 -1
- package/src/core/types/button.ts +1 -1
- package/src/core/types/card.ts +1 -1
- package/src/core/types/selectable.ts +1 -1
- package/src/core/utils/arrow/arrow.tsx +5 -14
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +5 -5
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +1 -1
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +15 -8
- package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/core/utils/errorBoundary.tsx +4 -4
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +5 -5
- package/src/core/utils/layer/__workshop__/nested.tsx +3 -3
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +9 -5
- package/src/core/utils/layer/getLayerContext.test.ts +3 -1
- package/src/core/utils/layer/getLayerContext.ts +1 -1
- package/src/core/utils/layer/layer.test.tsx +5 -5
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/layer/layerCard.tsx +3 -3
- package/src/core/utils/layer/layerContext.ts +1 -1
- package/src/core/utils/layer/layerProvider.tsx +10 -2
- package/src/core/utils/layer/useLayer.ts +1 -1
- package/src/core/utils/portal/__workshop__/named.tsx +3 -3
- package/src/core/utils/portal/portal.test.tsx +5 -5
- package/src/core/utils/portal/portal.tsx +3 -2
- package/src/core/utils/portal/portalContext.ts +1 -1
- package/src/core/utils/portal/portalProvider.tsx +2 -2
- package/src/core/utils/portal/usePortal.ts +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +3 -3
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +3 -3
- package/src/css/_assign.ts +3 -0
- package/src/css/_compileStyle.ts +12 -4
- package/src/css/_compileTheme.ts +10 -13
- package/src/css/_composeClassNames.ts +12 -0
- package/src/css/_fromEntries.ts +3 -0
- package/src/css/_getClassNames.ts +9 -0
- package/src/css/_hash.ts +9 -0
- package/src/css/_mergeStyles.ts +1 -1
- package/src/css/_resp.ts +6 -12
- package/src/css/_scopeClassName.ts +9 -0
- package/src/css/_scopeClassNames.ts +12 -0
- package/src/css/_system.style.ts +2 -0
- package/src/css/aspects/border/border.style.ts +2 -2
- package/src/css/aspects/border/border.ts +3 -3
- package/src/css/aspects/border/types.ts +1 -1
- package/src/css/aspects/boxSizing/boxSizing.style.ts +10 -0
- package/src/css/aspects/boxSizing/boxSizing.ts +8 -0
- package/src/css/aspects/boxSizing/index.ts +2 -0
- package/src/css/aspects/boxSizing/types.ts +9 -0
- package/src/css/aspects/display/display.style.ts +8 -8
- package/src/css/aspects/display/display.ts +3 -3
- package/src/css/aspects/display/types.ts +1 -1
- package/src/css/aspects/flex/flex.ts +3 -3
- package/src/css/aspects/flex/types.ts +1 -1
- package/src/css/aspects/flexItem/flex.style.ts +1 -1
- package/src/css/aspects/flexItem/flexItem.ts +3 -3
- package/src/css/aspects/flexItem/types.ts +1 -1
- package/src/css/aspects/font/font.style.ts +33 -22
- package/src/css/aspects/font/font.ts +3 -3
- package/src/css/aspects/font/types.ts +1 -1
- package/src/css/aspects/gap/gap.style.ts +2 -2
- package/src/css/aspects/gap/gap.ts +3 -3
- package/src/css/aspects/gap/types.ts +2 -2
- package/src/css/aspects/grid/grid.ts +3 -3
- package/src/css/aspects/grid/types.ts +1 -1
- package/src/css/aspects/gridItem/gridItem.ts +3 -3
- package/src/css/aspects/gridItem/types.ts +1 -1
- package/src/css/aspects/height/height.ts +3 -3
- package/src/css/aspects/index.ts +1 -0
- package/src/css/aspects/inset/inset.ts +3 -3
- package/src/css/aspects/inset/types.ts +1 -1
- package/src/css/aspects/margin/margin.style.ts +10 -10
- package/src/css/aspects/margin/margin.ts +3 -3
- package/src/css/aspects/margin/types.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.style.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.ts +4 -3
- package/src/css/aspects/maxWidth/types.ts +2 -2
- package/src/css/aspects/minWidth/minWidth.ts +4 -3
- package/src/css/aspects/minWidth/types.ts +1 -1
- package/src/css/aspects/overflow/overflow.ts +3 -3
- package/src/css/aspects/overflow/types.ts +1 -1
- package/src/css/aspects/padding/padding.style.ts +2 -5
- package/src/css/aspects/padding/padding.ts +3 -3
- package/src/css/aspects/padding/types.ts +2 -2
- package/src/css/aspects/pointerEvents/pointerEvents.ts +3 -3
- package/src/css/aspects/position/position.ts +3 -3
- package/src/css/aspects/position/types.ts +1 -1
- package/src/css/aspects/radius/radius.style.ts +1 -1
- package/src/css/aspects/radius/radius.ts +3 -3
- package/src/css/aspects/radius/types.ts +2 -2
- package/src/css/aspects/shadow/shadow.style.ts +7 -7
- package/src/css/aspects/shadow/shadow.ts +3 -3
- package/src/css/aspects/shadow/types.ts +2 -2
- package/src/css/aspects/textAlign/textAlign.style.ts +1 -1
- package/src/css/aspects/textAlign/textAlign.ts +3 -3
- package/src/css/aspects/textOverflow/textOverflow.ts +3 -3
- package/src/css/aspects/width/types.ts +2 -2
- package/src/css/aspects/width/width.style.ts +1 -1
- package/src/css/aspects/width/width.ts +4 -3
- package/src/css/components/breadcrumbs/breadcrumbs.style.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.ts +2 -2
- package/src/css/components/dialog/dialog.style.ts +14 -16
- package/src/css/components/dialog/dialog.ts +9 -8
- package/src/css/components/menu/menu.style.ts +2 -2
- package/src/css/components/menu/menu.ts +3 -3
- package/src/css/components/skeleton/skeleton.style.ts +24 -17
- package/src/css/components/skeleton/skeleton.ts +8 -7
- package/src/css/components/skeleton/types.ts +4 -6
- package/src/css/components/toast/toast.style.ts +1 -1
- package/src/css/components/toast/toast.ts +6 -6
- package/src/css/components/tree/tree.style.ts +7 -23
- package/src/css/components/tree/tree.ts +2 -2
- package/src/css/constants.ts +0 -3
- package/src/css/index.ts +3 -5
- package/src/css/prefix/constants.ts +6 -0
- package/src/css/prefix/types.ts +1 -0
- package/src/css/primitives/_arrow/_arrow.style.ts +11 -13
- package/src/css/primitives/_arrow/_arrow.ts +5 -5
- package/src/css/primitives/_input/_input.style.ts +171 -75
- package/src/css/primitives/_input/input.ts +13 -10
- package/src/css/primitives/_input/types.ts +3 -3
- package/src/css/primitives/_selectable/_selectable.style.ts +5 -6
- package/src/css/primitives/_selectable/selectable.ts +4 -3
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.style.ts +38 -39
- package/src/css/primitives/avatar/avatar.ts +8 -8
- package/src/css/primitives/avatar/types.ts +3 -3
- package/src/css/primitives/badge/badge.style.ts +2 -3
- package/src/css/primitives/badge/badge.ts +7 -3
- package/src/css/primitives/badge/types.ts +2 -2
- package/src/css/primitives/box/box.style.ts +5 -15
- package/src/css/primitives/box/box.ts +7 -9
- package/src/css/primitives/box/types.ts +3 -6
- package/src/css/primitives/button/button.style.ts +189 -162
- package/src/css/primitives/button/button.ts +11 -4
- package/src/css/primitives/button/types.ts +1 -1
- package/src/css/primitives/card/card.style.ts +102 -68
- package/src/css/primitives/card/card.ts +5 -7
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.style.ts +125 -101
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.style.ts +24 -26
- package/src/css/primitives/code/code.ts +7 -3
- package/src/css/primitives/code/types.ts +2 -2
- package/src/css/primitives/container/container.style.ts +1 -1
- package/src/css/primitives/container/container.ts +4 -3
- package/src/css/primitives/container/types.ts +2 -2
- package/src/css/primitives/heading/heading.style.ts +31 -23
- package/src/css/primitives/heading/heading.ts +10 -8
- package/src/css/primitives/heading/types.ts +3 -2
- package/src/css/primitives/kbd/kbd.style.ts +7 -7
- package/src/css/primitives/kbd/kbd.ts +4 -3
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.style.ts +27 -24
- package/src/css/primitives/label/label.ts +5 -8
- package/src/css/primitives/label/types.ts +4 -3
- package/src/css/primitives/popover/popover.style.ts +6 -2
- package/src/css/primitives/popover/popover.ts +3 -3
- package/src/css/primitives/radio/radio.style.ts +37 -76
- package/src/css/primitives/radio/radio.ts +2 -2
- package/src/css/primitives/select/select.style.ts +3 -3
- package/src/css/primitives/select/select.ts +5 -5
- package/src/css/primitives/select/types.ts +1 -1
- package/src/css/primitives/spinner/spinner.style.ts +1 -1
- package/src/css/primitives/spinner/spinner.ts +3 -3
- package/src/css/primitives/stack/stack.style.ts +6 -2
- package/src/css/primitives/stack/stack.ts +2 -2
- package/src/css/primitives/switch/switch.style.ts +47 -39
- package/src/css/primitives/switch/switch.ts +6 -6
- package/src/css/primitives/text/text.style.ts +28 -23
- package/src/css/primitives/text/text.ts +5 -8
- package/src/css/primitives/text/types.ts +2 -2
- package/src/css/primitives/textArea/textArea.style.ts +6 -2
- package/src/css/primitives/textArea/textArea.ts +4 -4
- package/src/css/primitives/textArea/types.ts +1 -1
- package/src/css/primitives/textInput/textInput.style.ts +23 -17
- package/src/css/primitives/textInput/textInput.ts +4 -4
- package/src/css/primitives/textInput/types.ts +2 -8
- package/src/css/primitives/token/token.style.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.style.ts +5 -4
- package/src/css/primitives/tooltip/tooltip.ts +3 -3
- package/src/css/renderColor.ts +31 -0
- package/src/css/theme/index.ts +14 -0
- package/src/css/theme/lib/contract/buildVarContract.ts +76 -0
- package/src/css/theme/lib/contract/index.ts +2 -0
- package/src/css/theme/lib/contract/types.ts +15 -0
- package/src/css/theme/resolveTheme.ts +852 -0
- package/src/css/types.ts +25 -914
- package/src/css/utils/srOnly/srOnly.style.ts +1 -1
- package/src/css/utils/srOnly/srOnly.ts +3 -3
- package/src/theme/getScopedTheme.ts +4 -4
- package/src/theme/index.ts +0 -5
- package/src/theme/types.ts +4 -4
- package/src/theme/v0/color/_generic.ts +1 -1
- package/src/theme/v0/color/button.ts +1 -1
- package/src/theme/v0/color/card.ts +1 -1
- package/src/theme/v0/color/color.ts +11 -11
- package/src/theme/v0/color/input.ts +1 -1
- package/src/theme/v0/color/muted.ts +1 -1
- package/src/theme/v0/color/selectable.ts +1 -1
- package/src/theme/v0/color/solid.ts +1 -1
- package/src/theme/v0/color/spot.ts +1 -1
- package/src/theme/v0/styles.ts +1 -1
- package/src/theme/v0/theme.ts +7 -7
- package/src/theme/v2/avatar.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/_selectable/createSelectableTones.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/_solid/createSolidTones.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonTones.ts +4 -4
- package/src/theme/{build → v2/build}/_deprecated/color/card/createCardStates.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/color.test.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/defaults.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/factory.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/input/createInputModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/spot/createSpot.ts +2 -2
- package/src/theme/{build → v2/build}/buildColorTheme.test.ts +3 -1
- package/src/theme/{build → v2/build}/buildColorTheme.ts +24 -24
- package/src/theme/{build → v2/build}/buildTheme.test.ts +10 -8
- package/src/theme/{build → v2/build}/buildTheme.ts +4 -4
- package/src/theme/{build → v2/build}/colorToken/colorToken.ts +2 -2
- package/src/theme/{build → v2/build}/colorToken/compileColorToken.ts +1 -1
- package/src/theme/{build → v2/build}/colorToken/types.ts +2 -2
- package/src/theme/{build → v2/build}/lib/color-fns/blend/mix.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/multiply.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/screen.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/color-fns.test.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/contrastRatio.ts +5 -2
- package/src/theme/{build → v2/build}/lib/color-fns/convert.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/parse.ts +1 -1
- package/src/theme/{build → v2/build}/mixThemeColor.test.ts +2 -0
- package/src/theme/{build → v2/build}/mixThemeColor.ts +1 -1
- package/src/theme/{build → v2/build}/renderColorTheme.ts +27 -27
- package/src/theme/{build → v2/build}/renderColorValue.ts +3 -3
- package/src/theme/{build → v2/build}/resolveColorTokens.ts +13 -13
- package/src/theme/v2/color/_helpers.ts +2 -2
- package/src/theme/v2/color/_system.ts +1 -1
- package/src/theme/v2/color/avatar.ts +1 -1
- package/src/theme/v2/color/badge.ts +1 -1
- package/src/theme/v2/color/button.ts +2 -2
- package/src/theme/v2/color/color.ts +7 -7
- package/src/theme/v2/color/input.ts +5 -1
- package/src/theme/v2/color/selectable.ts +2 -2
- package/src/theme/v2/color/state.ts +4 -4
- package/src/theme/{config → v2/config}/helpers.ts +6 -13
- package/src/theme/{config → v2/config}/system.ts +11 -12
- package/src/theme/{config → v2/config}/tokens/color/types.ts +14 -10
- package/src/theme/{config → v2/config}/tokens/index.ts +0 -1
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.ts +2 -2
- package/src/theme/{config → v2/config}/tokens/types.ts +3 -3
- package/src/theme/{config → v2/config}/types.ts +8 -6
- package/src/theme/{defaults → v2/defaults}/colorPalette.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/colorTokens.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/config.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/fonts.ts +1 -1
- package/src/theme/v2/index.ts +2 -0
- package/src/theme/v2/input.ts +1 -1
- package/src/theme/v2/theme.ts +8 -8
- package/src/theme/{_constants.ts → v3/_constants.ts} +6 -3
- package/src/theme/v3/_parseColorToken.ts +185 -0
- package/src/theme/v3/buildTheme_v3.ts +11 -7
- package/src/theme/v3/color/_constants.ts +15 -0
- package/src/theme/v3/color/avatar.ts +14 -0
- package/src/theme/v3/color/card.ts +53 -53
- package/src/theme/v3/color/color.ts +66 -68
- package/src/theme/v3/color/element.ts +8 -8
- package/src/theme/v3/color/index.ts +2 -2
- package/src/theme/v3/color/token.ts +18 -4
- package/src/theme/v3/color/tokens.ts +2 -2
- package/src/theme/v3/defaultTokens.ts +73 -85
- package/src/theme/v3/index.ts +3 -0
- package/src/theme/v3/palette/index.ts +2 -0
- package/src/theme/v3/resolveTokens.ts +65 -65
- package/src/theme/v3/tokens.ts +2 -2
- package/src/theme/v3/types.ts +61 -7
- package/src/theme/versioning/getTheme_v2.ts +3 -3
- package/src/theme/versioning/is_v0.ts +2 -2
- package/src/theme/versioning/is_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -1
- package/src/theme/versioning/themeColor_v3_v2.ts +229 -52
- package/src/theme/versioning/v0_v2.ts +3 -3
- package/src/theme/versioning/v2_v0.ts +4 -4
- package/src/theme/versioning/v3_v2.ts +38 -38
- package/dist/ui-palette.css +0 -105
- package/dist/ui-palette.min.css +0 -1
- package/src/css/_comp.test.ts +0 -7
- package/src/css/_comp.ts +0 -11
- package/src/css/_compilePalette.ts +0 -32
- package/src/css/_compileTheme_v3.ts +0 -440
- package/src/css/aspects/flex/flex.style.ts +0 -30
- package/src/css/composeClassNames.ts +0 -19
- package/src/css/primitives/_selectable/__style.ts +0 -117
- package/src/css/primitives/checkbox/__styles.ts +0 -129
- package/src/css/scopeClassName.ts +0 -7
- package/src/css/varNames.ts +0 -607
- package/src/css/vars.ts +0 -520
- package/src/theme/_types.ts +0 -41
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/v3/buildTheme_v3.test.ts +0 -40
- package/src/theme/v3/color/buildColor_v3.ts +0 -226
- package/src/theme/v3/color/parseColor.test.ts +0 -79
- package/src/theme/v3/color/parseColor.ts +0 -167
- package/src/theme/v3/color/renderColor.test.ts +0 -20
- package/src/theme/v3/color/renderColor.ts +0 -43
- /package/src/{theme/palette → css/prefix}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/_deprecated/color/index.ts +0 -0
- /package/src/theme/{build → v2/build}/colorToken/index.ts +0 -0
- /package/src/theme/{build → v2/build}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/blend/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/rgba.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/types.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/isRecord.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/utils.ts +0 -0
- /package/src/theme/{build → v2/build}/merge.ts +0 -0
- /package/src/theme/{config → v2/config}/index.ts +0 -0
- /package/src/theme/{config → v2/config}/tokens/color/index.ts +0 -0
- /package/src/theme/{palette → v3/palette}/constants.ts +0 -0
- /package/src/theme/{palette → v3/palette}/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.19",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"require": "./dist/theme.cjs",
|
|
49
49
|
"default": "./dist/theme.js"
|
|
50
50
|
},
|
|
51
|
-
"./ui-palette.css": "./dist/ui-palette.css",
|
|
52
51
|
"./ui-theme.css": "./dist/ui-theme.css",
|
|
53
52
|
"./ui-system.css": "./dist/ui-system.css",
|
|
54
53
|
"./ui.css": "./dist/ui.css"
|
|
@@ -128,7 +127,6 @@
|
|
|
128
127
|
"@commitlint/cli": "^19.8.0",
|
|
129
128
|
"@commitlint/config-conventional": "^19.8.0",
|
|
130
129
|
"@eslint/js": "^9.26.0",
|
|
131
|
-
"@rollup/plugin-replace": "^6.0.2",
|
|
132
130
|
"@sanity/pkg-utils": "^7.2.2",
|
|
133
131
|
"@sanity/prettier-config": "^1.0.3",
|
|
134
132
|
"@sanity/ui-workshop": "^2.1.2",
|
|
@@ -150,14 +148,13 @@
|
|
|
150
148
|
"@testing-library/jest-dom": "^6.6.3",
|
|
151
149
|
"@testing-library/react": "^16.3.0",
|
|
152
150
|
"@testing-library/user-event": "^14.6.1",
|
|
153
|
-
"@types/jest": "^29.5.14",
|
|
154
|
-
"@types/jest-axe": "^3.5.9",
|
|
155
151
|
"@types/node": "^20.12.7",
|
|
156
152
|
"@types/react": "^19.1.3",
|
|
157
153
|
"@types/react-dom": "^19.1.3",
|
|
158
154
|
"@types/react-is": "^19.0.0",
|
|
159
155
|
"@types/refractor": "^3.4.1",
|
|
160
156
|
"@vitejs/plugin-react": "^4.4.1",
|
|
157
|
+
"@vitest/browser": "^3.1.4",
|
|
161
158
|
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
162
159
|
"cac": "^6.7.14",
|
|
163
160
|
"commitizen": "^4.3.1",
|
|
@@ -180,12 +177,7 @@
|
|
|
180
177
|
"globals": "^16.0.0",
|
|
181
178
|
"http-server": "^14.1.1",
|
|
182
179
|
"husky": "^8.0.3",
|
|
183
|
-
"jest": "^29.7.0",
|
|
184
|
-
"jest-axe": "^10.0.0",
|
|
185
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
186
180
|
"lint-staged": "^14.0.1",
|
|
187
|
-
"magic-string": "^0.30.17",
|
|
188
|
-
"module-alias": "^2.2.3",
|
|
189
181
|
"npm-run-all2": "^5.0.2",
|
|
190
182
|
"react": "^19.1.0",
|
|
191
183
|
"react-dom": "^19.1.0",
|
|
@@ -200,7 +192,9 @@
|
|
|
200
192
|
"typescript": "5.8.3",
|
|
201
193
|
"typescript-eslint": "^8.32.0",
|
|
202
194
|
"vite": "^5.4.19",
|
|
203
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
195
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
196
|
+
"vitest": "^3.1.4",
|
|
197
|
+
"vitest-axe": "1.0.0-pre.5"
|
|
204
198
|
},
|
|
205
199
|
"peerDependencies": {
|
|
206
200
|
"react": "^18 || >=19.0.0-0",
|
|
@@ -219,13 +213,13 @@
|
|
|
219
213
|
},
|
|
220
214
|
"scripts": {
|
|
221
215
|
"build": "run-s clean css:build pkg:build pkg:check figma:pkg:build",
|
|
222
|
-
"clean": "rimraf
|
|
216
|
+
"clean": "rimraf dist",
|
|
223
217
|
"css:build": "node -r esbuild-register scripts/build",
|
|
224
218
|
"commit": "cz",
|
|
225
219
|
"cypress:dev": "run-p dev cypress:open",
|
|
226
220
|
"cypress:open": "cypress open",
|
|
227
221
|
"cypress:run": "cypress run",
|
|
228
|
-
"dev": "run-p workshop:dev",
|
|
222
|
+
"dev": "run-p workshop:clean workshop:dev",
|
|
229
223
|
"figma:pkg:build": "cd figma && pnpm build",
|
|
230
224
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
231
225
|
"lint": "eslint .",
|
|
@@ -234,12 +228,13 @@
|
|
|
234
228
|
"release": "semantic-release",
|
|
235
229
|
"storybook:build": "storybook build",
|
|
236
230
|
"storybook:dev": "storybook dev -p 6006",
|
|
237
|
-
"test": "
|
|
231
|
+
"test": "vitest run",
|
|
238
232
|
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
239
233
|
"ts:check": "tsc",
|
|
240
234
|
"watch": "pkg watch --strict",
|
|
241
235
|
"workshop:build": "workshop build",
|
|
242
|
-
"workshop:
|
|
236
|
+
"workshop:clean": "rimraf .workshop",
|
|
237
|
+
"workshop:dev": "node -r esbuild-register ../ui-workshop/scripts/dev",
|
|
243
238
|
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
244
239
|
}
|
|
245
240
|
}
|
package/src/cli/buildCommand.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {buildTheme_v3, RootTheme} from '@sanity/ui/theme'
|
|
3
|
+
import {_compileSystem, _compileTheme} from '@sanity/ui/css'
|
|
5
4
|
import cssnano from 'cssnano'
|
|
6
5
|
import fs from 'fs/promises'
|
|
7
6
|
import {gzipSizeSync} from 'gzip-size'
|
|
@@ -14,12 +13,9 @@ export async function buildCommand(options: {cwd?: string; outDir?: string}): Pr
|
|
|
14
13
|
const cwd = options.cwd ?? process.cwd()
|
|
15
14
|
const outDir = options.outDir ?? path.resolve(cwd, 'dist')
|
|
16
15
|
|
|
17
|
-
await
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
buildSystem(outDir),
|
|
21
|
-
buildAll(outDir),
|
|
22
|
-
])
|
|
16
|
+
await buildTheme({outDir})
|
|
17
|
+
await buildSystem({outDir})
|
|
18
|
+
await buildAll({outDir})
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
//
|
|
@@ -42,23 +38,10 @@ function prettySize(str: string) {
|
|
|
42
38
|
return `${prettyBytes(str.length)} / ${prettyBytes(gzipSizeSync(str))}`
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
// @sanity/ui/ui-palette.css
|
|
46
|
-
async function buildPalette(outDir: string) {
|
|
47
|
-
const css = _compilePalette()
|
|
48
|
-
const minified = await minify(css)
|
|
49
|
-
const prettified = await prettify(css)
|
|
50
|
-
|
|
51
|
-
await fs.mkdir(outDir, {recursive: true})
|
|
52
|
-
await fs.writeFile(path.resolve(outDir, 'ui-palette.css'), prettified, 'utf-8')
|
|
53
|
-
await fs.writeFile(path.resolve(outDir, 'ui-palette.min.css'), minified.css, 'utf-8')
|
|
54
|
-
|
|
55
|
-
console.log(`- built ui-palette.css (${prettySize(prettified)})`)
|
|
56
|
-
console.log(`- built ui-palette.min.css (${prettySize(minified.css)})`)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
41
|
// @sanity/ui/ui-theme.css
|
|
60
|
-
async function buildTheme(outDir: string) {
|
|
61
|
-
const
|
|
42
|
+
async function buildTheme(options: {outDir: string}) {
|
|
43
|
+
const {outDir} = options
|
|
44
|
+
const css = await prettify(_compileTheme())
|
|
62
45
|
const minified = await minify(css)
|
|
63
46
|
const prettified = await prettify(css)
|
|
64
47
|
|
|
@@ -71,7 +54,8 @@ async function buildTheme(outDir: string) {
|
|
|
71
54
|
}
|
|
72
55
|
|
|
73
56
|
// @sanity/ui/ui-system.css
|
|
74
|
-
async function buildSystem(outDir: string) {
|
|
57
|
+
async function buildSystem(options: {outDir: string}) {
|
|
58
|
+
const {outDir} = options
|
|
75
59
|
const css = await prettify(_compileSystem())
|
|
76
60
|
const minified = await minify(css)
|
|
77
61
|
const prettified = await prettify(css)
|
|
@@ -85,13 +69,12 @@ async function buildSystem(outDir: string) {
|
|
|
85
69
|
}
|
|
86
70
|
|
|
87
71
|
// @sanity/ui/ui.css
|
|
88
|
-
async function buildAll(outDir: string) {
|
|
72
|
+
async function buildAll(options: {outDir: string}) {
|
|
73
|
+
const {outDir} = options
|
|
89
74
|
const css = await prettify(
|
|
90
75
|
[
|
|
91
|
-
`/* @sanity/ui/ui-
|
|
92
|
-
|
|
93
|
-
`\n\n/* @sanity/ui/ui-theme.css */\n`,
|
|
94
|
-
_compileTheme({v3: buildTheme_v3()} as RootTheme),
|
|
76
|
+
`/* @sanity/ui/ui-theme.css */\n`,
|
|
77
|
+
_compileTheme(),
|
|
95
78
|
`\n\n/* @sanity/ui/ui-system.css */\n`,
|
|
96
79
|
_compileSystem(),
|
|
97
80
|
`\n`,
|
package/src/core/StyleTags.tsx
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {ReactNode} from 'react'
|
|
1
|
+
import {_compileSystem, _compileTheme} from '@sanity/ui/css'
|
|
2
|
+
import type {ReactNode} from 'react'
|
|
4
3
|
|
|
5
4
|
/** @beta */
|
|
6
|
-
export function StyleTags(
|
|
7
|
-
const {theme: themeProp} = props
|
|
8
|
-
|
|
9
|
-
const theme = themeProp ?? buildTheme_v3()
|
|
10
|
-
|
|
5
|
+
export function StyleTags(): ReactNode {
|
|
11
6
|
return (
|
|
12
7
|
<>
|
|
13
|
-
<style href="sanity-palette" precedence="palette">
|
|
14
|
-
{_compilePalette()}
|
|
15
|
-
</style>
|
|
16
8
|
<style href="sanity-theme" precedence="theme">
|
|
17
|
-
{_compileTheme(
|
|
9
|
+
{_compileTheme()}
|
|
18
10
|
</style>
|
|
19
11
|
<style href="sanity-system" precedence="system">
|
|
20
12
|
{_compileSystem()}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
/** @jest-environment jsdom */
|
|
2
|
-
|
|
3
1
|
import {buildTheme} from '@sanity/ui/theme'
|
|
2
|
+
import {describe, expect, it, vi} from 'vitest'
|
|
4
3
|
|
|
5
4
|
import {render} from '../../../../test'
|
|
6
5
|
import {ThemeContext} from './themeContext'
|
|
7
|
-
import {ThemeContextValue} from './types'
|
|
6
|
+
import type {ThemeContextValue} from './types'
|
|
8
7
|
import {useRootTheme} from './useRootTheme'
|
|
9
8
|
|
|
10
9
|
describe('theme', () => {
|
|
11
10
|
describe('useRootTheme', () => {
|
|
12
11
|
it('should get context value', async () => {
|
|
13
|
-
const log =
|
|
12
|
+
const log = vi.fn()
|
|
14
13
|
|
|
15
14
|
function Debug() {
|
|
16
15
|
const rootTheme = useRootTheme()
|
|
@@ -43,7 +42,7 @@ describe('theme', () => {
|
|
|
43
42
|
})
|
|
44
43
|
|
|
45
44
|
it('should fail when no context value is provided', async () => {
|
|
46
|
-
const log =
|
|
45
|
+
const log = vi.fn()
|
|
47
46
|
|
|
48
47
|
function Debug() {
|
|
49
48
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
-
import {ReactElement, ReactNode} from 'react'
|
|
1
|
+
import type {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
+
import type {ReactElement, ReactNode} from 'react'
|
|
3
3
|
|
|
4
4
|
import {ThemeProvider} from './themeProvider'
|
|
5
5
|
import {useRootTheme} from './useRootTheme'
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
type ThemeColorCardToneKey,
|
|
6
6
|
type ThemeColorSchemeKey,
|
|
7
7
|
} from '@sanity/ui/theme'
|
|
8
|
-
import {ReactElement, ReactNode, useContext, useMemo} from 'react'
|
|
8
|
+
import {type ReactElement, type ReactNode, useContext, useMemo} from 'react'
|
|
9
9
|
import {ThemeProvider as StyledThemeProvider} from 'styled-components'
|
|
10
10
|
|
|
11
11
|
import {CardProvider} from '../../primitives/card/cardProvider'
|
|
12
12
|
import {ThemeColorProvider} from './themeColorProvider'
|
|
13
13
|
import {ThemeContext} from './themeContext'
|
|
14
|
-
import {ThemeContextValue} from './types'
|
|
14
|
+
import type {ThemeContextValue} from './types'
|
|
15
15
|
|
|
16
16
|
/** @public */
|
|
17
17
|
export interface ThemeProviderProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {EarthAmericasIcon, SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {
|
|
3
3
|
Autocomplete,
|
|
4
|
-
BaseAutocompleteOption,
|
|
4
|
+
type BaseAutocompleteOption,
|
|
5
5
|
Box,
|
|
6
6
|
Card,
|
|
7
7
|
Code,
|
|
@@ -81,7 +81,7 @@ export default function AsyncStory() {
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<Box paddingX={[4, 5, 6]} paddingY={[5, 6, 7]}>
|
|
84
|
-
<Stack
|
|
84
|
+
<Stack gap={[3, 3, 4]}>
|
|
85
85
|
<Text as="label" htmlFor="async" size={[1, 1, 2]} weight="medium">
|
|
86
86
|
Country
|
|
87
87
|
</Text>
|
|
@@ -12,8 +12,8 @@ import {useCallback, useState} from 'react'
|
|
|
12
12
|
|
|
13
13
|
import {Popover} from '../../../primitives'
|
|
14
14
|
import countries from '../__mocks__/countries'
|
|
15
|
-
import {AutocompleteProps} from '../autocomplete'
|
|
16
|
-
import {ExampleOption} from './types'
|
|
15
|
+
import type {AutocompleteProps} from '../autocomplete'
|
|
16
|
+
import type {ExampleOption} from './types'
|
|
17
17
|
|
|
18
18
|
export default function ConstrainedHeightStory() {
|
|
19
19
|
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Autocomplete, Box, Button, Card, Code, Container,
|
|
2
|
-
import {
|
|
1
|
+
import {Autocomplete, Box, Button, Card, Code, Container, Stack, Text} from '@sanity/ui'
|
|
2
|
+
import type {Radius} from '@sanity/ui/theme'
|
|
3
3
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
4
|
import {useCallback, useState} from 'react'
|
|
5
5
|
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
10
10
|
} from '../../../../../workshop/constants'
|
|
11
11
|
import countries from '../__mocks__/countries'
|
|
12
|
-
import {ExampleOption} from './types'
|
|
12
|
+
import type {ExampleOption} from './types'
|
|
13
13
|
|
|
14
14
|
export default function CustomStory() {
|
|
15
15
|
const data: ExampleOption[] = countries.map((d) => ({value: d.code, title: d.name}))
|
|
16
16
|
const border = useBoolean('Border', true, 'Props')
|
|
17
17
|
const disabled = useBoolean('Disabled', false, 'Props')
|
|
18
|
-
const fontSize =
|
|
18
|
+
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, undefined, 'Props') ?? 2
|
|
19
19
|
const openButton = useBoolean('Open button', true, 'Props')
|
|
20
|
-
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS,
|
|
21
|
-
const radius =
|
|
20
|
+
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, undefined, 'Props')
|
|
21
|
+
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, undefined, 'Props') ?? 2
|
|
22
22
|
const readOnly = useBoolean('Read only', false, 'Props')
|
|
23
23
|
const [value, setValue] = useState('')
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ export default function CustomStory() {
|
|
|
31
31
|
key={option.value}
|
|
32
32
|
onClick={(event) => event.preventDefault()}
|
|
33
33
|
padding={padding}
|
|
34
|
-
radius={(radius - 1) as Radius}
|
|
34
|
+
radius={Math.max(radius - 1, 0) as Radius}
|
|
35
35
|
>
|
|
36
36
|
<Text size={fontSize}>{option.title}</Text>
|
|
37
37
|
</Card>
|
|
@@ -52,8 +52,8 @@ export default function CustomStory() {
|
|
|
52
52
|
return (
|
|
53
53
|
<Box paddingX={[4, 5, 6]} paddingY={[5, 6, 7]}>
|
|
54
54
|
<Container width={0}>
|
|
55
|
-
<Stack
|
|
56
|
-
<Stack
|
|
55
|
+
<Stack gap={5}>
|
|
56
|
+
<Stack gap={3}>
|
|
57
57
|
<Text as="label" htmlFor="custom" id="custom-label" size={1} weight="medium">
|
|
58
58
|
Country
|
|
59
59
|
</Text>
|
|
@@ -62,14 +62,14 @@ export default function CustomStory() {
|
|
|
62
62
|
border={border}
|
|
63
63
|
disabled={disabled}
|
|
64
64
|
filterOption={filterOption}
|
|
65
|
-
fontSize={fontSize
|
|
65
|
+
fontSize={fontSize}
|
|
66
66
|
id="custom"
|
|
67
67
|
onChange={setValue}
|
|
68
68
|
openButton={openButton}
|
|
69
69
|
options={options}
|
|
70
70
|
padding={padding}
|
|
71
71
|
placeholder="Search"
|
|
72
|
-
radius={radius
|
|
72
|
+
radius={radius}
|
|
73
73
|
readOnly={readOnly}
|
|
74
74
|
renderOption={renderOption}
|
|
75
75
|
renderValue={renderValue}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import {FontTextSize, Radius} from '@sanity/ui/theme'
|
|
3
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
|
-
import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
3
|
+
import {type PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
5
4
|
import {fireEvent} from '@testing-library/dom'
|
|
6
5
|
import {useCallback, useMemo, useState} from 'react'
|
|
7
6
|
|
|
@@ -37,10 +36,10 @@ export default function ExampleStory() {
|
|
|
37
36
|
const border = useBoolean('Border', true, 'Props')
|
|
38
37
|
const customValidity = useText('Custom validity', '', 'Props') || undefined
|
|
39
38
|
const disabled = useBoolean('Disabled', false, 'Props')
|
|
40
|
-
const fontSize =
|
|
39
|
+
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
|
|
41
40
|
const openButton = useBoolean('Open button', false, 'Props')
|
|
42
41
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
43
|
-
const radius =
|
|
42
|
+
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2, 'Props')
|
|
44
43
|
const readOnly = useBoolean('Read only', false, 'Props')
|
|
45
44
|
const [value, setValue] = useState('')
|
|
46
45
|
|
|
@@ -50,7 +49,7 @@ export default function ExampleStory() {
|
|
|
50
49
|
<Card height="fill" tone={layoutTone}>
|
|
51
50
|
<Container width={1}>
|
|
52
51
|
<Box paddingX={[4, 5, 6]} paddingY={[5, 6, 7]}>
|
|
53
|
-
<Stack
|
|
52
|
+
<Stack gap={3}>
|
|
54
53
|
<Text as="label" htmlFor="default" size={1} weight="medium">
|
|
55
54
|
Country code
|
|
56
55
|
</Text>
|
|
@@ -59,14 +58,14 @@ export default function ExampleStory() {
|
|
|
59
58
|
border={border}
|
|
60
59
|
customValidity={customValidity}
|
|
61
60
|
disabled={disabled}
|
|
62
|
-
fontSize={fontSize
|
|
61
|
+
fontSize={fontSize}
|
|
63
62
|
onChange={handleChange}
|
|
64
63
|
id="default"
|
|
65
64
|
openButton={openButton}
|
|
66
65
|
options={options}
|
|
67
66
|
padding={padding}
|
|
68
67
|
placeholder="Search"
|
|
69
|
-
radius={radius
|
|
68
|
+
radius={radius}
|
|
70
69
|
readOnly={readOnly}
|
|
71
70
|
ref={ref}
|
|
72
71
|
value={value}
|
|
@@ -10,7 +10,7 @@ export default function FocusAndBlurStory() {
|
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<Box padding={[4, 5, 6]}>
|
|
13
|
-
<Stack
|
|
13
|
+
<Stack gap={3}>
|
|
14
14
|
<Autocomplete
|
|
15
15
|
id="focus-and-blur"
|
|
16
16
|
onBlur={handleBlur}
|
|
@@ -21,7 +21,7 @@ export default function FocusAndBlurStory() {
|
|
|
21
21
|
placeholder="Search"
|
|
22
22
|
value={value}
|
|
23
23
|
/>
|
|
24
|
-
<Stack
|
|
24
|
+
<Stack gap={3}>
|
|
25
25
|
<Box muted overflow="auto" padding={3} radius={2}>
|
|
26
26
|
<Code id="focus-and-blur-log" language="json" size={1}>
|
|
27
27
|
{JSON.stringify(log)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {ResponsiveProp} from '@sanity/ui/css'
|
|
3
|
-
import {Space} from '@sanity/ui/theme'
|
|
2
|
+
import type {ResponsiveProp} from '@sanity/ui/css'
|
|
3
|
+
import type {Space} from '@sanity/ui/theme'
|
|
4
4
|
import {
|
|
5
5
|
type ChangeEvent,
|
|
6
6
|
cloneElement,
|
|
@@ -23,7 +23,7 @@ import {_hasFocus, _raf, focusFirstDescendant} from '../../helpers'
|
|
|
23
23
|
import {useArrayProp} from '../../hooks'
|
|
24
24
|
import {
|
|
25
25
|
Box,
|
|
26
|
-
BoxProps,
|
|
26
|
+
type BoxProps,
|
|
27
27
|
Button,
|
|
28
28
|
Card,
|
|
29
29
|
Popover,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
Stack,
|
|
32
32
|
Text,
|
|
33
33
|
TextInput,
|
|
34
|
-
TextInputOwnProps,
|
|
34
|
+
type TextInputOwnProps,
|
|
35
35
|
} from '../../primitives'
|
|
36
36
|
import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
|
|
37
37
|
import type {ComponentType, Props, Radius} from '../../types'
|
|
@@ -587,10 +587,10 @@ export function Autocomplete<
|
|
|
587
587
|
as="ul"
|
|
588
588
|
aria-multiselectable={false}
|
|
589
589
|
data-ui="AutoComplete__resultsList"
|
|
590
|
+
gap={1}
|
|
590
591
|
id={listBoxId}
|
|
591
592
|
ref={listBoxElementRef}
|
|
592
593
|
role="listbox"
|
|
593
|
-
space={1}
|
|
594
594
|
>
|
|
595
595
|
{filteredOptions.map((option) => {
|
|
596
596
|
const active =
|
|
@@ -19,13 +19,13 @@ export default function Example() {
|
|
|
19
19
|
return (
|
|
20
20
|
<Flex align="center" height="fill" justify="center">
|
|
21
21
|
<Breadcrumbs
|
|
22
|
+
gap={2}
|
|
22
23
|
maxLength={maxLength}
|
|
23
24
|
separator={
|
|
24
25
|
<Text muted size={1}>
|
|
25
26
|
/
|
|
26
27
|
</Text>
|
|
27
28
|
}
|
|
28
|
-
space={2}
|
|
29
29
|
>
|
|
30
30
|
<Text size={1}>
|
|
31
31
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {Space} from '@sanity/ui/theme'
|
|
1
|
+
import {_composeClassNames, breadcrumbs, type GapStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
import {
|
|
4
4
|
Children,
|
|
5
5
|
Fragment,
|
|
6
6
|
isValidElement,
|
|
7
|
-
ReactNode,
|
|
7
|
+
type ReactNode,
|
|
8
8
|
useCallback,
|
|
9
9
|
useMemo,
|
|
10
10
|
useRef,
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
} from 'react'
|
|
13
13
|
|
|
14
14
|
import {useClickOutsideEvent} from '../../hooks'
|
|
15
|
-
import {Box, Button, ButtonProps, Flex, Popover, Stack, Text} from '../../primitives'
|
|
16
|
-
import {ComponentType, Props} from '../../types'
|
|
15
|
+
import {Box, Button, type ButtonProps, Flex, Popover, Stack, Text} from '../../primitives'
|
|
16
|
+
import type {ComponentType, Props} from '../../types'
|
|
17
17
|
|
|
18
18
|
/** @beta */
|
|
19
19
|
export const DEFAULT_BREADCRUMBS_ELEMENT = 'nav'
|
|
@@ -79,7 +79,7 @@ export function Breadcrumbs<E extends BreadcrumbsElementType = typeof DEFAULT_BR
|
|
|
79
79
|
<Popover
|
|
80
80
|
constrainSize
|
|
81
81
|
content={
|
|
82
|
-
<Stack as="ol" overflow="auto"
|
|
82
|
+
<Stack as="ol" gap={gapY} overflow="auto">
|
|
83
83
|
{rawItems.slice(beforeLength - 1, len - afterLength)}
|
|
84
84
|
</Stack>
|
|
85
85
|
}
|
|
@@ -112,7 +112,7 @@ export function Breadcrumbs<E extends BreadcrumbsElementType = typeof DEFAULT_BR
|
|
|
112
112
|
as={as}
|
|
113
113
|
data-ui="Breadcrumbs"
|
|
114
114
|
{...rest}
|
|
115
|
-
className={
|
|
115
|
+
className={_composeClassNames(className, breadcrumbs())}
|
|
116
116
|
gapX={gapX}
|
|
117
117
|
gapY={gapY}
|
|
118
118
|
>
|
|
@@ -28,7 +28,7 @@ export default function LayeringFocusStory() {
|
|
|
28
28
|
onActivate={({activeElement}) => activeElement?.focus()}
|
|
29
29
|
onClose={() => setFirstDialogOpen(false)}
|
|
30
30
|
>
|
|
31
|
-
<Stack
|
|
31
|
+
<Stack gap={2} padding={3}>
|
|
32
32
|
<Button
|
|
33
33
|
mode="ghost"
|
|
34
34
|
text="Open dialog 2"
|
|
@@ -56,7 +56,7 @@ export default function LayeringFocusStory() {
|
|
|
56
56
|
onActivate={({activeElement}) => activeElement?.focus()}
|
|
57
57
|
onClose={() => setSecondDialogOpen(false)}
|
|
58
58
|
>
|
|
59
|
-
<Stack
|
|
59
|
+
<Stack gap={2} padding={3}>
|
|
60
60
|
<Button
|
|
61
61
|
mode="ghost"
|
|
62
62
|
text="Open dialog 3"
|
|
@@ -84,7 +84,7 @@ export default function LayeringFocusStory() {
|
|
|
84
84
|
onActivate={({activeElement}) => activeElement?.focus()}
|
|
85
85
|
onClose={() => setThirdDialogOpen(false)}
|
|
86
86
|
>
|
|
87
|
-
<Stack
|
|
87
|
+
<Stack gap={2} padding={3}>
|
|
88
88
|
<MenuButton
|
|
89
89
|
id="menu"
|
|
90
90
|
button={
|
|
@@ -116,7 +116,7 @@ export default function LayeringFocusStory() {
|
|
|
116
116
|
onActivate={({activeElement}) => activeElement?.focus()}
|
|
117
117
|
onClose={() => setFourthDialogOpen(false)}
|
|
118
118
|
>
|
|
119
|
-
<Stack
|
|
119
|
+
<Stack gap={2} padding={3}>
|
|
120
120
|
<Text>👋</Text>
|
|
121
121
|
</Stack>
|
|
122
122
|
</Dialog>
|