@sanity/ui 3.0.0-static.17 → 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 +138 -137
- 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 +139 -138
- 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 -2016
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +9427 -874
- package/dist/css.d.ts +9427 -874
- package/dist/css.js +1591 -2018
- 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 +26 -23
- package/dist/index.d.ts +26 -23
- 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 +3 -18
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +10 -10
- 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 +1 -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 +26 -910
- 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
|
@@ -7,12 +7,17 @@ import type {
|
|
|
7
7
|
ResponsiveProp,
|
|
8
8
|
Width,
|
|
9
9
|
} from '@sanity/ui/css'
|
|
10
|
-
import {button, buttonLoadingBox
|
|
11
|
-
import type {
|
|
10
|
+
import {_composeClassNames, button, buttonLoadingBox} from '@sanity/ui/css'
|
|
11
|
+
import type {
|
|
12
|
+
FontTextSize,
|
|
13
|
+
Space,
|
|
14
|
+
ThemeColorButtonModeKey,
|
|
15
|
+
ThemeColorStateToneKey,
|
|
16
|
+
} from '@sanity/ui/theme'
|
|
12
17
|
import {type ElementType as ReactElementType, isValidElement, type ReactNode} from 'react'
|
|
13
18
|
import {isValidElementType} from 'react-is'
|
|
14
19
|
|
|
15
|
-
import type {
|
|
20
|
+
import type {ButtonTextAlign, ComponentType, Props} from '../../types'
|
|
16
21
|
import {Box} from '../box'
|
|
17
22
|
import {Spinner} from '../spinner'
|
|
18
23
|
import type {TextOwnProps} from '../text'
|
|
@@ -30,7 +35,7 @@ export type ButtonOwnProps = ButtonStyleProps &
|
|
|
30
35
|
'data-ui'?: string
|
|
31
36
|
'disabled'?: boolean
|
|
32
37
|
'fontSize'?: ResponsiveProp<FontTextSize>
|
|
33
|
-
'mode'?:
|
|
38
|
+
'mode'?: ThemeColorButtonModeKey
|
|
34
39
|
'icon'?: ReactElementType | ReactNode
|
|
35
40
|
'iconRight'?: ReactElementType | ReactNode
|
|
36
41
|
'justify'?: FlexStyleProps['justify']
|
|
@@ -45,7 +50,7 @@ export type ButtonOwnProps = ButtonStyleProps &
|
|
|
45
50
|
'text'?: ReactNode
|
|
46
51
|
'textOverflow'?: TextOwnProps['textOverflow']
|
|
47
52
|
'textWeight'?: TextOwnProps['weight']
|
|
48
|
-
'tone'?:
|
|
53
|
+
'tone'?: ThemeColorStateToneKey
|
|
49
54
|
'width'?: ResponsiveProp<Width>
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -108,7 +113,7 @@ export function Button<E extends ButtonElementType = typeof DEFAULT_BUTTON_ELEME
|
|
|
108
113
|
<Element
|
|
109
114
|
data-ui="Button"
|
|
110
115
|
{...rest}
|
|
111
|
-
className={
|
|
116
|
+
className={_composeClassNames(className, button({display, flex, radius, width}))}
|
|
112
117
|
data-disabled={loading || disabled ? '' : undefined}
|
|
113
118
|
data-mode={mode}
|
|
114
119
|
data-tone={tone}
|
|
@@ -8,12 +8,12 @@ export default function AsButtonStory() {
|
|
|
8
8
|
return (
|
|
9
9
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
10
10
|
<Container>
|
|
11
|
-
<Grid columns={3} gap={
|
|
11
|
+
<Grid columns={3} gap={1}>
|
|
12
12
|
<Box>
|
|
13
13
|
<Text align="center" size={1} weight="medium">
|
|
14
14
|
Enabled
|
|
15
15
|
</Text>
|
|
16
|
-
<Stack marginTop={3}
|
|
16
|
+
<Stack marginTop={3} gap={1}>
|
|
17
17
|
{tones.map(([title, tone]) => (
|
|
18
18
|
<Card
|
|
19
19
|
__unstable_focusRing
|
|
@@ -23,13 +23,16 @@ export default function AsButtonStory() {
|
|
|
23
23
|
style={{textAlign: 'center'}}
|
|
24
24
|
tone={tone}
|
|
25
25
|
>
|
|
26
|
-
<Stack
|
|
26
|
+
<Stack gap={3}>
|
|
27
27
|
<Text size={1} weight="medium">
|
|
28
28
|
{title}
|
|
29
29
|
</Text>
|
|
30
30
|
<Text muted size={1}>
|
|
31
31
|
Muted
|
|
32
32
|
</Text>
|
|
33
|
+
<Text size={1}>
|
|
34
|
+
<code>Code</code>
|
|
35
|
+
</Text>
|
|
33
36
|
</Stack>
|
|
34
37
|
</Card>
|
|
35
38
|
))}
|
|
@@ -40,7 +43,7 @@ export default function AsButtonStory() {
|
|
|
40
43
|
<Text align="center" size={1} weight="medium">
|
|
41
44
|
Disabled
|
|
42
45
|
</Text>
|
|
43
|
-
<Stack marginTop={3}
|
|
46
|
+
<Stack marginTop={3} gap={1}>
|
|
44
47
|
{tones.map(([title, tone]) => (
|
|
45
48
|
<Card
|
|
46
49
|
__unstable_focusRing
|
|
@@ -51,13 +54,16 @@ export default function AsButtonStory() {
|
|
|
51
54
|
style={{textAlign: 'center'}}
|
|
52
55
|
tone={tone}
|
|
53
56
|
>
|
|
54
|
-
<Stack
|
|
57
|
+
<Stack gap={3}>
|
|
55
58
|
<Text size={1} weight="medium">
|
|
56
59
|
{title}
|
|
57
60
|
</Text>
|
|
58
61
|
<Text size={1} muted>
|
|
59
62
|
Muted
|
|
60
63
|
</Text>
|
|
64
|
+
<Text size={1}>
|
|
65
|
+
<code>Code</code>
|
|
66
|
+
</Text>
|
|
61
67
|
</Stack>
|
|
62
68
|
</Card>
|
|
63
69
|
))}
|
|
@@ -68,7 +74,7 @@ export default function AsButtonStory() {
|
|
|
68
74
|
<Text align="center" size={1} weight="medium">
|
|
69
75
|
Selected
|
|
70
76
|
</Text>
|
|
71
|
-
<Stack marginTop={3}
|
|
77
|
+
<Stack marginTop={3} gap={1}>
|
|
72
78
|
{tones.map(([title, tone]) => (
|
|
73
79
|
<Card
|
|
74
80
|
__unstable_focusRing
|
|
@@ -79,13 +85,16 @@ export default function AsButtonStory() {
|
|
|
79
85
|
style={{textAlign: 'center'}}
|
|
80
86
|
tone={tone}
|
|
81
87
|
>
|
|
82
|
-
<Stack
|
|
88
|
+
<Stack gap={3}>
|
|
83
89
|
<Text size={1} weight="medium">
|
|
84
90
|
{title}
|
|
85
91
|
</Text>
|
|
86
92
|
<Text size={1} muted>
|
|
87
93
|
Muted
|
|
88
94
|
</Text>
|
|
95
|
+
<Text size={1}>
|
|
96
|
+
<code>Code</code>
|
|
97
|
+
</Text>
|
|
89
98
|
</Stack>
|
|
90
99
|
</Card>
|
|
91
100
|
))}
|
|
@@ -4,7 +4,7 @@ import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
|
4
4
|
export default function CheckeredStory() {
|
|
5
5
|
return (
|
|
6
6
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
7
|
-
<Stack
|
|
7
|
+
<Stack gap={1}>
|
|
8
8
|
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
9
9
|
<Card
|
|
10
10
|
__unstable_checkered
|
|
@@ -8,7 +8,7 @@ export default defineScope({
|
|
|
8
8
|
{name: 'props', title: 'Props', component: lazy(() => import('./props'))},
|
|
9
9
|
{name: 'styled', title: 'Styled', component: lazy(() => import('./styled'))},
|
|
10
10
|
{name: 'interactive', title: 'Interactive', component: lazy(() => import('./interactive'))},
|
|
11
|
-
{name: 'tones', title: 'Tones', component: lazy(() => import('./
|
|
11
|
+
{name: 'tones', title: 'Tones', component: lazy(() => import('./tones'))},
|
|
12
12
|
{name: 'as-button', title: 'As button', component: lazy(() => import('./asButton'))},
|
|
13
13
|
{name: 'list-nav', title: 'List navigation', component: lazy(() => import('./listNavigation'))},
|
|
14
14
|
{name: 'checkered', title: 'Checkered', component: lazy(() => import('./checkered'))},
|
|
@@ -21,7 +21,7 @@ export default function ListNavigationStory() {
|
|
|
21
21
|
|
|
22
22
|
function List1() {
|
|
23
23
|
return (
|
|
24
|
-
<Stack
|
|
24
|
+
<Stack gap={1}>
|
|
25
25
|
<Card __unstable_focusRing as="a" href="#" padding={2} radius={2}>
|
|
26
26
|
<Preview />
|
|
27
27
|
</Card>
|
|
@@ -43,7 +43,7 @@ function List1() {
|
|
|
43
43
|
|
|
44
44
|
function List2() {
|
|
45
45
|
return (
|
|
46
|
-
<Stack
|
|
46
|
+
<Stack gap={1}>
|
|
47
47
|
<Card __unstable_focusRing as="a" href="#" padding={2} radius={2}>
|
|
48
48
|
<Preview />
|
|
49
49
|
</Card>
|
|
@@ -67,7 +67,7 @@ function Preview() {
|
|
|
67
67
|
return (
|
|
68
68
|
<Flex align="center" gap={2}>
|
|
69
69
|
<Skeleton radius="full" style={{width: 33, height: 33}} />
|
|
70
|
-
<Stack flex={1}
|
|
70
|
+
<Stack flex={1} gap={2}>
|
|
71
71
|
<Text size={1} weight="medium">
|
|
72
72
|
Preview
|
|
73
73
|
</Text>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Card, Flex,
|
|
1
|
+
import {Card, Flex, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -31,12 +31,12 @@ export default function PropsStory() {
|
|
|
31
31
|
onClick={useAction('onClick')}
|
|
32
32
|
padding={padding}
|
|
33
33
|
pressed={pressed}
|
|
34
|
-
radius={radius
|
|
34
|
+
radius={radius}
|
|
35
35
|
selected={selected}
|
|
36
36
|
shadow={shadow}
|
|
37
37
|
tone={tone}
|
|
38
38
|
>
|
|
39
|
-
<Stack
|
|
39
|
+
<Stack gap={3}>
|
|
40
40
|
<Text size={1}>
|
|
41
41
|
Card with <code>padding={padding}</code>, <code>tone={tone}</code>, and{' '}
|
|
42
42
|
<code>shadow={shadow}</code>.
|
|
@@ -9,7 +9,7 @@ export default function SelectedStory() {
|
|
|
9
9
|
return (
|
|
10
10
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
11
11
|
<Container width={0}>
|
|
12
|
-
<Stack
|
|
12
|
+
<Stack gap={1}>
|
|
13
13
|
<Card
|
|
14
14
|
__unstable_focusRing
|
|
15
15
|
as="button"
|
|
@@ -44,7 +44,7 @@ function Preview({selected}: {selected: boolean}) {
|
|
|
44
44
|
<Box flex={1}>
|
|
45
45
|
<Text size={1}>Title</Text>
|
|
46
46
|
</Box>
|
|
47
|
-
<Inline
|
|
47
|
+
<Inline gap={3}>
|
|
48
48
|
<Text data-selected={selected ? '' : undefined} muted size={1} weight="medium">
|
|
49
49
|
<EditIcon />
|
|
50
50
|
</Text>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
export default function
|
|
4
|
+
export default function TonesStory() {
|
|
5
5
|
return (
|
|
6
6
|
<Card height="fill" tone="transparent">
|
|
7
7
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
8
8
|
<Container width={0}>
|
|
9
|
-
<Stack
|
|
10
|
-
{THEME_COLOR_CARD_TONES.
|
|
9
|
+
<Stack gap={3}>
|
|
10
|
+
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
11
11
|
<Card
|
|
12
12
|
key={tone}
|
|
13
13
|
padding={3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {card, CardStyleProps
|
|
1
|
+
import {_composeClassNames, card, type CardStyleProps} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import {Props} from '../../types'
|
|
4
|
-
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
3
|
+
import type {Props} from '../../types'
|
|
4
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
5
5
|
import {CardProvider} from './cardProvider'
|
|
6
6
|
import {useCard} from './useCard'
|
|
7
7
|
|
|
@@ -64,7 +64,7 @@ export function Card<E extends CardElementType = typeof DEFAULT_CARD_ELEMENT>(pr
|
|
|
64
64
|
data-ui="Card"
|
|
65
65
|
{...rest}
|
|
66
66
|
as={as}
|
|
67
|
-
className={
|
|
67
|
+
className={_composeClassNames(
|
|
68
68
|
className,
|
|
69
69
|
card({
|
|
70
70
|
scheme: scheme === parent?.scheme ? undefined : scheme,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
-
import {ReactNode, useMemo} from 'react'
|
|
1
|
+
import type {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
+
import {type ReactNode, useMemo} from 'react'
|
|
3
3
|
|
|
4
4
|
import {CardContext} from './cardContext'
|
|
5
|
-
import {_CardCompatProviderComponent} from './types'
|
|
5
|
+
import type {_CardCompatProviderComponent} from './types'
|
|
6
6
|
|
|
7
7
|
export function CardProvider(props: {
|
|
8
8
|
children?: ReactNode
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
-
import {ComponentType, ReactNode} from 'react'
|
|
1
|
+
import type {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
+
import type {ComponentType, ReactNode} from 'react'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -5,6 +5,7 @@ export default function PropsStory() {
|
|
|
5
5
|
const checked = useBoolean('Checked', false, 'Props')
|
|
6
6
|
const disabled = useBoolean('Disabled', false, 'Props')
|
|
7
7
|
const indeterminate = useBoolean('Indeterminate', false, 'Props')
|
|
8
|
+
const invalid = useBoolean('Invalid', false, 'Props')
|
|
8
9
|
const onChange = useAction('onChange')
|
|
9
10
|
const onFocus = useAction('onFocus')
|
|
10
11
|
const onBlur = useAction('onBlur')
|
|
@@ -15,6 +16,7 @@ export default function PropsStory() {
|
|
|
15
16
|
<Flex align="center" as="label">
|
|
16
17
|
<Checkbox
|
|
17
18
|
checked={checked}
|
|
19
|
+
customValidity={invalid ? 'Invalid' : undefined}
|
|
18
20
|
disabled={disabled}
|
|
19
21
|
indeterminate={indeterminate}
|
|
20
22
|
onChange={onChange}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import {Card, Checkbox, Flex, Stack} from '@sanity/ui'
|
|
1
|
+
import {Card, Checkbox, Flex, Stack, Text} from '@sanity/ui'
|
|
2
|
+
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
2
3
|
|
|
3
4
|
export default function MultipleTonesStory() {
|
|
4
5
|
return (
|
|
5
6
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
6
|
-
<Stack>
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</Card>
|
|
16
|
-
<Card padding={3} tone="positive">
|
|
17
|
-
<Checkbox />
|
|
18
|
-
</Card>
|
|
19
|
-
<Card padding={3} tone="caution">
|
|
20
|
-
<Checkbox />
|
|
21
|
-
</Card>
|
|
22
|
-
<Card padding={3} tone="critical">
|
|
23
|
-
<Checkbox />
|
|
24
|
-
</Card>
|
|
7
|
+
<Stack gap={1}>
|
|
8
|
+
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
9
|
+
<Card align="center" as="label" display="flex" gap={2} padding={3} radius={3} tone={tone}>
|
|
10
|
+
<Checkbox />
|
|
11
|
+
<Text muted size={1}>
|
|
12
|
+
{tone}
|
|
13
|
+
</Text>
|
|
14
|
+
</Card>
|
|
15
|
+
))}
|
|
25
16
|
</Stack>
|
|
26
17
|
</Flex>
|
|
27
18
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
|
|
2
|
-
import {checkbox, checkboxInput
|
|
2
|
+
import {_composeClassNames, checkbox, checkboxInput} from '@sanity/ui/css'
|
|
3
3
|
import {useEffect, useImperativeHandle, useRef} from 'react'
|
|
4
4
|
|
|
5
5
|
import {useCustomValidity} from '../../hooks'
|
|
6
|
-
import {ComponentType, Props} from '../../types'
|
|
6
|
+
import type {ComponentType, Props} from '../../types'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export const DEFAULT_CHECKBOX_ELEMENT = 'input'
|
|
@@ -61,14 +61,12 @@ export function Checkbox<E extends CheckboxElementType = typeof DEFAULT_CHECKBOX
|
|
|
61
61
|
useCustomValidity(ref, customValidity)
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<span className={
|
|
64
|
+
<span className={_composeClassNames(className, checkbox())} data-ui="Checkbox" style={style}>
|
|
65
65
|
<Element
|
|
66
66
|
{...rest}
|
|
67
67
|
checked={checked}
|
|
68
|
-
className={
|
|
69
|
-
data-
|
|
70
|
-
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
71
|
-
data-error={customValidity ? '' : undefined}
|
|
68
|
+
className={_composeClassNames(className, checkboxInput())}
|
|
69
|
+
data-invalid={customValidity ? '' : undefined}
|
|
72
70
|
disabled={disabled || readOnly}
|
|
73
71
|
type="checkbox"
|
|
74
72
|
readOnly={readOnly}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_composeClassNames, code, type FontStyleProps} from '@sanity/ui/css'
|
|
2
2
|
import {lazy, Suspense} from 'react'
|
|
3
3
|
|
|
4
|
-
import {ComponentType, Props} from '../../types'
|
|
4
|
+
import type {ComponentType, Props} from '../../types'
|
|
5
5
|
|
|
6
6
|
const LazyRefractor = lazy(() => import('./refractor'))
|
|
7
7
|
|
|
@@ -39,7 +39,7 @@ export function Code<E extends CodeElementType = typeof DEFAULT_CODE_ELEMENT>(pr
|
|
|
39
39
|
<Element
|
|
40
40
|
data-ui="Code"
|
|
41
41
|
{...rest}
|
|
42
|
-
className={
|
|
42
|
+
className={_composeClassNames(className, code({size, weight}))}
|
|
43
43
|
>
|
|
44
44
|
<Suspense fallback={<code>{children}</code>}>
|
|
45
45
|
<LazyRefractor language={language} value={children} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_composeClassNames, container, type ContainerStyleProps} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import {Props} from '../../types'
|
|
4
|
-
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
3
|
+
import type {Props} from '../../types'
|
|
4
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export const DEFAULT_CONTAINER_ELEMENT = 'div'
|
|
@@ -38,7 +38,7 @@ export function Container<E extends ContainerElementType = typeof DEFAULT_CONTAI
|
|
|
38
38
|
data-ui="Container"
|
|
39
39
|
{...rest}
|
|
40
40
|
as={as}
|
|
41
|
-
className={
|
|
41
|
+
className={_composeClassNames(className, container({width}))}
|
|
42
42
|
/>
|
|
43
43
|
)
|
|
44
44
|
}
|
|
@@ -4,7 +4,7 @@ import {Box, Card, Flex, Heading, Stack} from '@sanity/ui'
|
|
|
4
4
|
export default function OpticalAlignment() {
|
|
5
5
|
return (
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
|
-
<Stack
|
|
7
|
+
<Stack gap={1}>
|
|
8
8
|
<Flex>
|
|
9
9
|
<Card padding={0} tone="neutral">
|
|
10
10
|
<Heading size={5}>Hamburgefonstiv M</Heading>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
_composeClassNames,
|
|
3
3
|
heading,
|
|
4
4
|
type HeadingStyleProps,
|
|
5
5
|
textOverflow,
|
|
@@ -59,7 +59,7 @@ export function Heading<E extends HeadingElementType = typeof DEFAULT_HEADING_EL
|
|
|
59
59
|
<Element
|
|
60
60
|
data-ui="Heading"
|
|
61
61
|
{...rest}
|
|
62
|
-
className={
|
|
62
|
+
className={_composeClassNames(
|
|
63
63
|
className,
|
|
64
64
|
heading({
|
|
65
65
|
accent,
|
|
@@ -7,8 +7,8 @@ export default function PlainStory() {
|
|
|
7
7
|
return (
|
|
8
8
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
9
|
<Inline
|
|
10
|
+
gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}
|
|
10
11
|
onClick={useAction('onClick')}
|
|
11
|
-
space={useSelect('Space', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}
|
|
12
12
|
>
|
|
13
13
|
<Card padding={1} shadow={1}>
|
|
14
14
|
<Text size={1}>Inline item</Text>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {FlexStyleProps, GridStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
-
import {Space} from '@sanity/ui/theme'
|
|
1
|
+
import type {FlexStyleProps, GridStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {Props} from '../../types'
|
|
5
5
|
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {FontTextSize} from '@sanity/ui/theme'
|
|
1
|
+
import {_composeClassNames, kbd, type RadiusStyleProps, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {ComponentType, Props} from '../../types'
|
|
5
|
-
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
4
|
+
import type {ComponentType, Props} from '../../types'
|
|
5
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
6
6
|
import {Text} from '../text'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
@@ -42,7 +42,7 @@ export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props
|
|
|
42
42
|
data-ui="KBD"
|
|
43
43
|
{...rest}
|
|
44
44
|
as={as as BoxElementType}
|
|
45
|
-
className={
|
|
45
|
+
className={_composeClassNames(className, kbd({radius}))}
|
|
46
46
|
display={display}
|
|
47
47
|
muted
|
|
48
48
|
padding={padding}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
_composeClassNames,
|
|
3
3
|
label,
|
|
4
|
-
LabelStyleProps,
|
|
4
|
+
type LabelStyleProps,
|
|
5
5
|
textOverflow,
|
|
6
|
-
TextOverflowStyleProps,
|
|
6
|
+
type TextOverflowStyleProps,
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
8
|
|
|
9
|
-
import {ComponentType, Props} from '../../types'
|
|
9
|
+
import type {ComponentType, Props} from '../../types'
|
|
10
10
|
|
|
11
11
|
/** @public */
|
|
12
12
|
export const DEFAULT_LABEL_ELEMENT = 'div'
|
|
@@ -57,7 +57,7 @@ export function Label<E extends LabelElementType = typeof DEFAULT_LABEL_ELEMENT>
|
|
|
57
57
|
<Element
|
|
58
58
|
data-ui="Label"
|
|
59
59
|
{...rest}
|
|
60
|
-
className={
|
|
60
|
+
className={_composeClassNames(
|
|
61
61
|
className,
|
|
62
62
|
label({
|
|
63
63
|
accent,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Button, Card, Popover, PortalProvider,
|
|
1
|
+
import {Button, Card, Popover, PortalProvider, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
import {useState} from 'react'
|
|
4
4
|
|
|
@@ -57,7 +57,7 @@ export default function PlainStory() {
|
|
|
57
57
|
placement={placement}
|
|
58
58
|
portal={portal}
|
|
59
59
|
preventOverflow={preventOverflow}
|
|
60
|
-
radius={radius
|
|
60
|
+
radius={radius}
|
|
61
61
|
width={width}
|
|
62
62
|
>
|
|
63
63
|
<Button text="This button is the popover reference" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Button, Flex, LayerProvider, Placement, Popover, useLayer} from '@sanity/ui'
|
|
2
|
-
import {
|
|
1
|
+
import {Button, Flex, LayerProvider, type Placement, Popover, useLayer} from '@sanity/ui'
|
|
2
|
+
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
3
3
|
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function RecursiveStory() {
|
|
@@ -13,7 +13,6 @@ export default function RecursiveStory() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const placements: Placement[] = ['top', 'right', 'bottom', 'left']
|
|
16
|
-
const tones: ThemeColorToneKey[] = ['primary', 'positive', 'caution', 'critical']
|
|
17
16
|
|
|
18
17
|
function RecursiveExample({onClose}: {onClose?: () => void}) {
|
|
19
18
|
const [open, setOpen] = useState(false)
|
|
@@ -56,7 +55,7 @@ function RecursiveExample({onClose}: {onClose?: () => void}) {
|
|
|
56
55
|
padding={1}
|
|
57
56
|
placement={fallbackPlacements[3]}
|
|
58
57
|
portal
|
|
59
|
-
tone={
|
|
58
|
+
tone={THEME_COLOR_CARD_TONES[seed]}
|
|
60
59
|
>
|
|
61
60
|
<Button
|
|
62
61
|
mode="bleed"
|
|
@@ -2,15 +2,15 @@ import {useSelect} from '@sanity/ui-workshop'
|
|
|
2
2
|
import {useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
4
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../../../workshop/constants'
|
|
5
|
-
import {CardTone} from '../../../types'
|
|
5
|
+
import type {CardTone} from '../../../types'
|
|
6
6
|
import {BoundaryElementProvider} from '../../../utils'
|
|
7
7
|
import {Box} from '../../box'
|
|
8
8
|
import {Card} from '../../card'
|
|
9
9
|
import {Flex} from '../../flex'
|
|
10
10
|
import {Stack} from '../../stack'
|
|
11
11
|
import {Text} from '../../text'
|
|
12
|
-
import {Popover, PopoverProps} from '../popover'
|
|
13
|
-
import {PopoverUpdateCallback} from '../types'
|
|
12
|
+
import {Popover, type PopoverProps} from '../popover'
|
|
13
|
+
import type {PopoverUpdateCallback} from '../types'
|
|
14
14
|
|
|
15
15
|
const SIDE_PANEL_WIDTH = {
|
|
16
16
|
sm: 300,
|
|
@@ -38,7 +38,7 @@ export default function SidePanelStory() {
|
|
|
38
38
|
</Card>
|
|
39
39
|
<BoundaryElementProvider element={sidePanel}>
|
|
40
40
|
<Card borderLeft flex="none" ref={setSidePanel} style={{width: sidePanelWidth}} width={0}>
|
|
41
|
-
<Stack
|
|
41
|
+
<Stack gap={5} padding={4}>
|
|
42
42
|
<Text muted size={1}>
|
|
43
43
|
Click the <code>reference</code> text below to toggle the popover.
|
|
44
44
|
</Text>
|