@sanity/ui 3.0.0-static.33 → 3.0.0-static.34
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/README.md +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +263 -375
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +263 -377
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -1
- package/dist/_visual-editing.cjs +0 -2
- package/dist/_visual-editing.cjs.map +1 -1
- package/dist/_visual-editing.d.cts +2 -904
- package/dist/_visual-editing.d.ts +2 -904
- package/dist/_visual-editing.js +2 -4
- package/dist/css/index.cjs +12 -12
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +805 -14697
- package/dist/css/index.d.ts +805 -14697
- package/dist/css/index.js +12 -12
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +241 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +990 -3095
- package/dist/index.d.ts +990 -3095
- package/dist/index.js +243 -360
- package/dist/index.js.map +1 -1
- package/dist/portalProvider-DgNIVviV.d.ts +575 -0
- package/dist/theme.cjs +367 -4288
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +272 -1806
- package/dist/theme.d.ts +272 -1806
- package/dist/theme.js +371 -4292
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +0 -2
- package/package.json +3 -4
- package/src/core/Root.tsx +4 -2
- package/src/core/RootProvider.tsx +4 -4
- package/src/core/__workshop__/boundary.tsx +1 -1
- package/src/core/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/example.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/mock/apiStore.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/mock/countries.ts +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +2 -2
- package/src/core/components/autocomplete/autocompleteOption.tsx +2 -2
- package/src/core/components/autocomplete/constants.ts +2 -2
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/__workshop__/index.ts +5 -3
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -11
- package/src/core/components/dialog/__workshop__/activate.tsx +1 -1
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +1 -1
- package/src/core/components/dialog/__workshop__/index.ts +5 -3
- package/src/core/components/dialog/__workshop__/layering.tsx +1 -1
- package/src/core/components/dialog/__workshop__/nested.tsx +2 -3
- package/src/core/components/dialog/__workshop__/onScroll.tsx +1 -1
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- 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__/provider.tsx +1 -1
- package/src/core/components/dialog/__workshop__/wrapped.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +5 -6
- package/src/core/components/dialog/dialogCard.tsx +2 -2
- package/src/core/components/dialog/dialogContext.ts +3 -4
- package/src/core/components/dialog/dialogProvider.tsx +2 -2
- package/src/core/components/hotkeys/__workshop__/index.ts +5 -3
- package/src/core/components/hotkeys/__workshop__/plain.tsx +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -15
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +3 -3
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -1
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +1 -1
- package/src/core/components/menu/__workshop__/index.ts +5 -3
- package/src/core/components/menu/__workshop__/menuButton.tsx +2 -2
- 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 +1 -1
- package/src/core/components/menu/__workshop__/selectedItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +3 -3
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +2 -1
- package/src/core/components/menu/menu.tsx +7 -22
- package/src/core/components/menu/menuButton.tsx +4 -50
- package/src/core/components/menu/menuContext.ts +3 -15
- package/src/core/components/menu/menuDivider.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +10 -15
- package/src/core/components/menu/menuItem.tsx +7 -18
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/__workshop__/index.ts +5 -3
- package/src/core/components/tab/tab.tsx +6 -4
- package/src/core/components/tab/tabList.tsx +3 -8
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/__workshop__/index.ts +5 -3
- package/src/core/components/toast/__workshop__/toast.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +2 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/toast/toastContext.ts +4 -4
- package/src/core/components/toast/toastLayer.tsx +3 -3
- 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__/index.ts +5 -3
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/tree.tsx +8 -9
- package/src/core/components/tree/treeContext.ts +4 -4
- package/src/core/components/tree/treeGroup.tsx +6 -8
- package/src/core/components/tree/treeItem.tsx +4 -4
- package/src/core/components/tree/types.ts +1 -1
- package/src/core/components/virtualList/__workshop__/changingProps.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/elementScroll.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/index.ts +5 -3
- package/src/core/components/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/windowScrolll.tsx +1 -1
- package/src/core/components/virtualList/virtualList.tsx +2 -2
- package/src/core/constants.ts +0 -18
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +5 -3
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +6 -1
- package/src/core/index.ts +1 -24
- package/src/core/lib/createGlobalScopedContext.ts +1 -1
- package/src/core/lib/globalScope.ts +1 -1
- package/src/core/observers/elementSize.ts +1 -1
- package/src/core/primitives/arrow/arrow.tsx +2 -2
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/index.ts +5 -3
- package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +3 -10
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -4
- package/src/core/primitives/avatar/types.ts +0 -32
- package/src/core/primitives/badge/__workshop__/index.ts +5 -3
- package/src/core/primitives/badge/__workshop__/props.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -1
- package/src/core/primitives/badge/badge.tsx +12 -11
- package/src/core/primitives/box/__workshop__/index.ts +5 -3
- package/src/core/primitives/box/__workshop__/props.tsx +1 -1
- package/src/core/primitives/box/__workshop__/responsive.tsx +1 -1
- package/src/core/primitives/box/box.tsx +28 -32
- package/src/core/primitives/button/__workshop__/custom.tsx +5 -5
- package/src/core/primitives/button/__workshop__/customIcons.tsx +1 -1
- package/src/core/primitives/button/__workshop__/disabled.tsx +3 -3
- package/src/core/primitives/button/__workshop__/index.ts +5 -3
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +1 -1
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +1 -1
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/core/primitives/button/button.test.tsx +2 -1
- package/src/core/primitives/button/button.tsx +4 -7
- package/src/core/primitives/button/types.ts +0 -20
- package/src/core/primitives/card/__workshop__/asButton.tsx +2 -2
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +3 -3
- package/src/core/primitives/card/__workshop__/index.ts +5 -3
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -1
- package/src/core/primitives/card/__workshop__/props.tsx +1 -1
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/card/card.tsx +4 -2
- package/src/core/primitives/card/cardContext.ts +1 -1
- package/src/core/primitives/card/cardProvider.tsx +4 -4
- package/src/core/primitives/card/types.ts +5 -19
- package/src/core/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/index.ts +5 -3
- package/src/core/primitives/checkbox/__workshop__/props.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/checkbox/checkbox.tsx +2 -2
- package/src/core/primitives/code/__workshop__/index.ts +5 -3
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/code/code.tsx +4 -2
- package/src/core/primitives/code/refractor.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/container/__workshop__/index.ts +5 -3
- package/src/core/primitives/container/container.tsx +2 -2
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/gap.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/index.ts +5 -3
- package/src/core/primitives/flex/flex.tsx +4 -2
- package/src/core/primitives/grid/__workshop__/index.ts +5 -3
- package/src/core/primitives/grid/__workshop__/responsive.tsx +3 -3
- package/src/core/primitives/grid/grid.tsx +4 -2
- package/src/core/primitives/heading/__workshop__/index.ts +5 -3
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -4
- package/src/core/primitives/inline/__workshop__/index.ts +5 -3
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +4 -11
- package/src/core/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/core/primitives/kbd/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +4 -2
- package/src/core/primitives/label/__workshop__/index.ts +5 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/label/label.tsx +2 -4
- package/src/core/primitives/layer/__workshop__/_debug.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/index.ts +5 -3
- package/src/core/primitives/layer/__workshop__/multipleRoots.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/nested.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/responsiveZOffset.tsx +1 -1
- package/src/core/primitives/layer/layer.test.tsx +2 -1
- package/src/core/primitives/layer/layer.tsx +2 -2
- package/src/core/primitives/layer/layerCard.tsx +2 -2
- package/src/core/primitives/layer/layerContext.ts +4 -4
- package/src/core/primitives/layer/layerProvider.tsx +2 -10
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/index.ts +5 -3
- package/src/core/primitives/popover/popover.tsx +4 -9
- package/src/core/primitives/popover/popoverLayer.tsx +2 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/__workshop__/index.ts +5 -3
- package/src/core/primitives/radio/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/select/__workshop__/index.ts +5 -3
- package/src/core/primitives/select/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +5 -15
- package/src/core/primitives/selectable/selectable.tsx +4 -4
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/primitives/skeleton/__workshop__/index.ts +5 -3
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/codeSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/headingSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/labelSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/textSkeleton.tsx +2 -2
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -1
- package/src/core/primitives/spinner/__workshop__/index.ts +5 -3
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +2 -2
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/srOnly/srOnly.tsx +2 -2
- package/src/core/primitives/stack/__workshop__/index.ts +5 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -10
- package/src/core/primitives/switch/__workshop__/example.tsx +1 -1
- package/src/core/primitives/switch/__workshop__/index.ts +5 -3
- package/src/core/primitives/switch/__workshop__/props.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +1 -1
- package/src/core/primitives/text/__workshop__/index.ts +5 -3
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +4 -4
- package/src/core/primitives/textArea/__workshop__/index.ts +5 -3
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textArea/textArea.tsx +5 -15
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +5 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/states.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/tones.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +6 -9
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/index.ts +5 -3
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +2 -4
- package/src/core/primitives/tooltip/tooltip.tsx +5 -9
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +4 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +5 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -2
- package/src/core/{types/props.ts → types.ts} +27 -0
- package/src/core/utils/boundaryElement/__workshop__/index.ts +5 -3
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +2 -1
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +7 -4
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/index.ts +5 -3
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/getElementRef.ts +1 -1
- package/src/core/utils/portal/__workshop__/index.ts +5 -3
- package/src/core/utils/portal/__workshop__/named.tsx +1 -1
- package/src/core/utils/portal/portal.test.tsx +2 -1
- package/src/core/utils/portal/portalContext.ts +5 -2
- package/src/core/utils/portal/portalProvider.tsx +5 -9
- package/src/css/_responsiveClassName.ts +2 -2
- package/src/css/_style.css.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.css.ts +1 -1
- package/src/css/components/dialog/dialog.css.ts +9 -17
- package/src/css/components/menu/menu.css.ts +2 -2
- package/src/css/components/menu/menu.ts +2 -2
- package/src/css/components/skeleton/skeleton.css.ts +2 -6
- package/src/css/components/toast/toast.css.ts +2 -2
- package/src/css/components/toast/toast.ts +2 -2
- package/src/css/components/tree/tree.css.ts +1 -1
- package/src/css/components/tree/tree.ts +1 -1
- package/src/css/defaultTheme.css.ts +59 -60
- package/src/css/layers.css.ts +4 -1
- package/src/css/primitives/_arrow/_arrow.css.ts +5 -5
- package/src/css/primitives/_input/_input.css.ts +4 -4
- package/src/css/primitives/_selectable/_selectable.css.ts +4 -4
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.css.ts +10 -10
- package/src/css/primitives/badge/badge.css.ts +4 -4
- package/src/css/primitives/badge/types.ts +8 -2
- package/src/css/primitives/box/box.css.ts +2 -2
- package/src/css/primitives/button/button.css.ts +6 -6
- package/src/css/primitives/button/button.ts +2 -2
- package/src/css/primitives/button/types.ts +3 -3
- package/src/css/primitives/card/__workshop__/color.tsx +9 -9
- package/src/css/primitives/card/__workshop__/index.ts +5 -3
- package/src/css/primitives/card/card.css.ts +12 -18
- package/src/css/primitives/card/types.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.css.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.css.ts +4 -3
- package/src/css/primitives/code/types.ts +3 -4
- package/src/css/primitives/container/container.css.ts +1 -1
- package/src/css/primitives/heading/heading.css.ts +5 -4
- package/src/css/primitives/heading/types.ts +3 -6
- package/src/css/primitives/kbd/kbd.css.ts +1 -1
- package/src/css/primitives/label/label.css.ts +5 -4
- package/src/css/primitives/label/types.ts +0 -8
- package/src/css/primitives/popover/popover.css.ts +2 -2
- package/src/css/primitives/popover/popover.ts +2 -2
- package/src/css/primitives/radio/radio.css.ts +3 -3
- package/src/css/primitives/radio/radio.ts +3 -3
- package/src/css/primitives/root/root.css.ts +1 -1
- package/src/css/primitives/root/root.ts +1 -1
- package/src/css/primitives/root/types.ts +3 -3
- package/src/css/primitives/select/select.css.ts +3 -3
- package/src/css/primitives/spinner/spinner.css.ts +2 -6
- package/src/css/primitives/spinner/spinner.ts +2 -2
- package/src/css/primitives/srOnly/srOnly.css.ts +1 -1
- package/src/css/primitives/srOnly/srOnly.ts +1 -1
- package/src/css/primitives/stack/stack.css.ts +1 -1
- package/src/css/primitives/stack/stack.ts +1 -1
- package/src/css/primitives/switch/switch.css.ts +5 -5
- package/src/css/primitives/text/text.css.ts +5 -4
- package/src/css/primitives/text/types.ts +3 -5
- package/src/css/primitives/textArea/textArea.css.ts +1 -1
- package/src/css/primitives/textInput/textInput.css.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.css.ts +1 -1
- package/src/css/props/alignItems/alignItems.ts +1 -1
- package/src/css/props/border/border.ts +1 -16
- package/src/css/props/boxSizing/boxSizing.css.ts +2 -1
- package/src/css/props/boxSizing/boxSizing.ts +0 -3
- package/src/css/props/display/display.ts +1 -10
- package/src/css/props/flex/flex.ts +1 -1
- package/src/css/props/flexDirection/flexDirection.ts +1 -1
- package/src/css/props/flexWrap/flexWrap.ts +1 -1
- package/src/css/props/font/font.css.ts +3 -2
- package/src/css/props/font/font.ts +1 -1
- package/src/css/props/gap/gap.ts +1 -1
- package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +2 -2
- package/src/css/props/gridAutoColumns/gridAutoColumns.ts +2 -2
- package/src/css/props/gridAutoColumns/types.ts +0 -10
- package/src/css/props/gridAutoFlow/gridAutoFlow.ts +2 -2
- package/src/css/props/gridAutoFlow/types.ts +0 -4
- package/src/css/props/gridAutoRows/gridAutoRows.ts +2 -2
- package/src/css/props/gridAutoRows/types.ts +0 -4
- package/src/css/props/gridColumn/gridColumn.ts +3 -3
- package/src/css/props/gridColumn/types.ts +0 -10
- package/src/css/props/gridColumnEnd/gridColumnEnd.ts +3 -3
- package/src/css/props/gridColumnEnd/types.ts +0 -10
- package/src/css/props/gridColumnStart/gridColumnStart.ts +3 -6
- package/src/css/props/gridColumnStart/types.ts +0 -10
- package/src/css/props/gridRow/gridRow.ts +3 -3
- package/src/css/props/gridRow/types.ts +0 -10
- package/src/css/props/gridRowEnd/gridRowEnd.ts +3 -3
- package/src/css/props/gridRowEnd/types.ts +0 -10
- package/src/css/props/gridRowStart/gridRowStart.ts +3 -3
- package/src/css/props/gridRowStart/types.ts +0 -10
- package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +2 -2
- package/src/css/props/gridTemplateColumns/types.ts +0 -10
- package/src/css/props/gridTemplateRows/gridTemplateRows.ts +2 -2
- package/src/css/props/gridTemplateRows/types.ts +0 -10
- package/src/css/props/height/height.ts +1 -1
- package/src/css/props/height/types.ts +0 -6
- package/src/css/props/inset/inset.ts +1 -1
- package/src/css/props/justifyContent/justifyContent.ts +1 -1
- package/src/css/props/margin/margin.ts +1 -1
- package/src/css/props/maxWidth/maxWidth.ts +1 -1
- package/src/css/props/minHeight/minHeight.ts +1 -1
- package/src/css/props/minWidth/minWidth.ts +1 -1
- package/src/css/props/outline/outline.ts +1 -1
- package/src/css/props/overflow/overflow.ts +1 -1
- package/src/css/props/overflow/types.ts +0 -6
- package/src/css/props/padding/padding.ts +1 -1
- package/src/css/props/pointerEvents/pointerEvents.ts +1 -1
- package/src/css/props/position/position.ts +1 -1
- package/src/css/props/radius/radius.ts +1 -1
- package/src/css/props/shadow/shadow.ts +1 -1
- package/src/css/props/textAlign/textAlign.ts +1 -1
- package/src/css/props/textOverflow/textOverflow.ts +1 -1
- package/src/css/props/width/width.ts +1 -1
- package/src/css/types.ts +225 -53
- package/src/css/util.ts +2 -2
- package/src/css/vars.css.ts +33 -36
- package/src/theme/{v3/_parseColorToken.ts → _parseColorToken.ts} +2 -2
- package/src/theme/buildTheme.ts +33 -0
- package/src/theme/constants.ts +90 -0
- package/src/theme/defaults/color.ts +197 -0
- package/src/theme/{v2/defaults/config.ts → defaults/common.ts} +3 -16
- package/src/theme/{v3/defaultFonts.ts → defaults/fonts.ts} +2 -2
- package/src/theme/index.ts +4 -5
- package/src/theme/{v3/resolveTokens.ts → resolveTokens.ts} +15 -15
- package/src/theme/types.ts +355 -15
- package/src/core/__DEV__.ts +0 -5
- package/src/core/_compat/helpers.ts +0 -72
- package/src/core/_compat/styles/_responsive.ts +0 -19
- package/src/core/_compat/theme/theme.test.tsx +0 -73
- package/src/core/_compat/theme/themeColorProvider.tsx +0 -24
- package/src/core/_compat/theme/themeContext.ts +0 -10
- package/src/core/_compat/theme/themeProvider.tsx +0 -68
- package/src/core/_compat/theme/types.ts +0 -10
- package/src/core/_compat/theme/useRootTheme.ts +0 -15
- package/src/core/_compat/theme/useTheme.ts +0 -12
- package/src/core/_compat/types.ts +0 -191
- package/src/core/hooks/useArrayProp.ts +0 -26
- package/src/core/hooks/useClickOutside.test.tsx +0 -481
- package/src/core/hooks/useClickOutside.ts +0 -113
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -30
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useIsomorphicEffect.ts +0 -7
- package/src/core/primitives/badge/types.ts +0 -18
- package/src/core/primitives/box/types.ts +0 -22
- package/src/core/primitives/flex/types.ts +0 -27
- package/src/core/primitives/grid/types.ts +0 -17
- package/src/core/primitives/selectable/types.ts +0 -7
- package/src/core/primitives/types.ts +0 -153
- package/src/core/types/gridItem.ts +0 -32
- package/src/core/types/placement.ts +0 -18
- package/src/core/types/radius.ts +0 -7
- package/src/core/types/textAlign.ts +0 -7
- package/src/core/utils/spanWithTextOverflow.tsx +0 -10
- package/src/theme/getScopedTheme.ts +0 -88
- package/src/theme/v0/avatar.ts +0 -10
- package/src/theme/v0/color/_generic.ts +0 -35
- package/src/theme/v0/color/_system.ts +0 -17
- package/src/theme/v0/color/base.ts +0 -21
- package/src/theme/v0/color/button.ts +0 -42
- package/src/theme/v0/color/card.ts +0 -19
- package/src/theme/v0/color/color.ts +0 -40
- package/src/theme/v0/color/index.ts +0 -11
- package/src/theme/v0/color/input.ts +0 -34
- package/src/theme/v0/color/muted.ts +0 -26
- package/src/theme/v0/color/selectable.ts +0 -31
- package/src/theme/v0/color/solid.ts +0 -26
- package/src/theme/v0/color/spot.ts +0 -13
- package/src/theme/v0/css.ts +0 -10
- package/src/theme/v0/focusRing.ts +0 -5
- package/src/theme/v0/font.ts +0 -40
- package/src/theme/v0/index.ts +0 -10
- package/src/theme/v0/input.ts +0 -23
- package/src/theme/v0/layer.ts +0 -6
- package/src/theme/v0/shadow.ts +0 -15
- package/src/theme/v0/styles.ts +0 -13
- package/src/theme/v0/theme.ts +0 -72
- package/src/theme/v2/avatar.ts +0 -12
- package/src/theme/v2/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/v2/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/button/createButtonModes.ts +0 -22
- package/src/theme/v2/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/v2/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/v2/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/v2/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/v2/build/_deprecated/color/factory.ts +0 -141
- package/src/theme/v2/build/_deprecated/color/index.ts +0 -1
- package/src/theme/v2/build/_deprecated/color/input/createInputModes.ts +0 -86
- package/src/theme/v2/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/v2/build/buildColorTheme.test.ts +0 -185
- package/src/theme/v2/build/buildColorTheme.ts +0 -494
- package/src/theme/v2/build/buildTheme.test.ts +0 -89
- package/src/theme/v2/build/buildTheme.ts +0 -37
- package/src/theme/v2/build/colorToken/colorToken.ts +0 -19
- package/src/theme/v2/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/v2/build/colorToken/index.ts +0 -2
- package/src/theme/v2/build/colorToken/types.ts +0 -6
- package/src/theme/v2/build/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/v2/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/v2/build/lib/color-fns/contrastRatio.ts +0 -34
- package/src/theme/v2/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/v2/build/lib/color-fns/index.ts +0 -6
- package/src/theme/v2/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/v2/build/lib/color-fns/rgba.ts +0 -14
- package/src/theme/v2/build/lib/color-fns/types.ts +0 -28
- package/src/theme/v2/build/lib/isRecord.ts +0 -3
- package/src/theme/v2/build/lib/utils.ts +0 -19
- package/src/theme/v2/build/merge.ts +0 -28
- package/src/theme/v2/build/mixThemeColor.test.ts +0 -23
- package/src/theme/v2/build/mixThemeColor.ts +0 -53
- package/src/theme/v2/build/renderColorTheme.ts +0 -532
- package/src/theme/v2/build/renderColorValue.ts +0 -85
- package/src/theme/v2/build/resolveColorTokens.ts +0 -268
- package/src/theme/v2/color/_constants.ts +0 -45
- package/src/theme/v2/color/_helpers.ts +0 -24
- package/src/theme/v2/color/_system.ts +0 -38
- package/src/theme/v2/color/avatar.ts +0 -11
- package/src/theme/v2/color/badge.ts +0 -12
- package/src/theme/v2/color/button.ts +0 -11
- package/src/theme/v2/color/color.ts +0 -28
- package/src/theme/v2/color/index.ts +0 -13
- package/src/theme/v2/color/input.ts +0 -23
- package/src/theme/v2/color/kbd.ts +0 -6
- package/src/theme/v2/color/selectable.ts +0 -8
- package/src/theme/v2/color/shadow.ts +0 -7
- package/src/theme/v2/color/state.ts +0 -41
- package/src/theme/v2/color/syntax.ts +0 -39
- package/src/theme/v2/config/helpers.ts +0 -48
- package/src/theme/v2/config/index.ts +0 -4
- package/src/theme/v2/config/system.ts +0 -114
- package/src/theme/v2/config/tokens/color/index.ts +0 -1
- package/src/theme/v2/config/tokens/color/types.ts +0 -137
- package/src/theme/v2/config/tokens/index.ts +0 -3
- package/src/theme/v2/config/tokens/parseTokenValue.test.ts +0 -44
- package/src/theme/v2/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/v2/config/tokens/types.ts +0 -53
- package/src/theme/v2/config/types.ts +0 -47
- package/src/theme/v2/defaults/colorPalette.ts +0 -5
- package/src/theme/v2/defaults/colorTokens.ts +0 -648
- package/src/theme/v2/defaults/fonts.ts +0 -227
- package/src/theme/v2/index.ts +0 -6
- package/src/theme/v2/input.ts +0 -31
- package/src/theme/v2/theme.ts +0 -45
- package/src/theme/v3/_constants.ts +0 -29
- package/src/theme/v3/buildTheme_v3.ts +0 -39
- package/src/theme/v3/color/_constants.ts +0 -15
- package/src/theme/v3/color/avatar.ts +0 -14
- package/src/theme/v3/color/card.ts +0 -79
- package/src/theme/v3/color/color.ts +0 -98
- package/src/theme/v3/color/element.ts +0 -19
- package/src/theme/v3/color/index.ts +0 -7
- package/src/theme/v3/color/token.ts +0 -32
- package/src/theme/v3/color/tokens.ts +0 -5
- package/src/theme/v3/defaultTokens.ts +0 -199
- package/src/theme/v3/index.ts +0 -9
- package/src/theme/v3/palette/constants.ts +0 -15
- package/src/theme/v3/palette/index.ts +0 -2
- package/src/theme/v3/palette/types.ts +0 -7
- package/src/theme/v3/tokens.ts +0 -16
- package/src/theme/v3/types.ts +0 -133
- package/src/theme/versioning/getTheme_v2.ts +0 -58
- package/src/theme/versioning/index.ts +0 -1
- package/src/theme/versioning/is_v0.ts +0 -7
- package/src/theme/versioning/is_v2.ts +0 -7
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -245
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/themeColor_v3_v2.ts +0 -383
- package/src/theme/versioning/v0_v2.ts +0 -95
- package/src/theme/versioning/v2_v0.ts +0 -127
- package/src/theme/versioning/v3_v2.ts +0 -130
- /package/src/theme/{v3/merge.ts → merge.ts} +0 -0
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import {COLOR_HUES, type ColorHueKey} from '@sanity/color'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
THEME_COLOR_BUTTON_MODES,
|
|
5
|
-
THEME_COLOR_CARD_TONES,
|
|
6
|
-
THEME_COLOR_INPUT_MODES,
|
|
7
|
-
THEME_COLOR_INPUT_STATES,
|
|
8
|
-
THEME_COLOR_STATE_TONES,
|
|
9
|
-
THEME_COLOR_STATES,
|
|
10
|
-
type ThemeColorButtonModeKey,
|
|
11
|
-
type ThemeColorCardToneKey,
|
|
12
|
-
type ThemeColorStateKey,
|
|
13
|
-
type ThemeColorStateToneKey,
|
|
14
|
-
} from '../color'
|
|
15
|
-
import type {
|
|
16
|
-
ColorConfigCardTone,
|
|
17
|
-
ColorConfigInputMode,
|
|
18
|
-
ColorConfigInputState,
|
|
19
|
-
ColorConfigStateTone,
|
|
20
|
-
ThemeColorAvatarTokens,
|
|
21
|
-
ThemeColorBadgeTokens,
|
|
22
|
-
ThemeColorBaseTokens,
|
|
23
|
-
ThemeColorButtonTokens,
|
|
24
|
-
ThemeColorInputStateTokens,
|
|
25
|
-
ThemeColorInputTokens,
|
|
26
|
-
ThemeColorStatesTokens,
|
|
27
|
-
ThemeColorStateTokens,
|
|
28
|
-
ThemeColorTokens,
|
|
29
|
-
} from '../config'
|
|
30
|
-
import {defaultColorTokens} from '../defaults/colorTokens'
|
|
31
|
-
import {merge} from './merge'
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Convert a tree of color tokens from a sparse format to a dense format.
|
|
35
|
-
*/
|
|
36
|
-
export function resolveColorTokens(inputTokens?: ThemeColorTokens): ThemeColorTokens {
|
|
37
|
-
const tokens = merge(defaultColorTokens, inputTokens)
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
base: resolveBaseColorTokens(tokens),
|
|
41
|
-
button: resolveButtonColorTokens(tokens),
|
|
42
|
-
input: resolveInputColorTokens(tokens),
|
|
43
|
-
selectable: resolveSelectableColorTokens(tokens),
|
|
44
|
-
syntax: tokens.syntax,
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function resolveBaseColorTokens(sparseTokens: ThemeColorTokens) {
|
|
49
|
-
const tokens: Partial<Record<ColorConfigCardTone, ThemeColorBaseTokens>> = {}
|
|
50
|
-
|
|
51
|
-
// base tones
|
|
52
|
-
for (const tone of THEME_COLOR_CARD_TONES) {
|
|
53
|
-
tokens[tone] = resolveBaseColorTones(sparseTokens, tone)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return tokens
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function resolveBaseColorTones(
|
|
60
|
-
inputTokens: ThemeColorTokens,
|
|
61
|
-
tone: ThemeColorCardToneKey,
|
|
62
|
-
): ThemeColorBaseTokens {
|
|
63
|
-
const spec = merge(inputTokens?.base?.['*'], inputTokens?.base?.[tone])
|
|
64
|
-
|
|
65
|
-
const hue = spec._hue || inputTokens?.base?.[tone]?._hue || 'gray'
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
...spec,
|
|
69
|
-
_hue: hue,
|
|
70
|
-
avatar: COLOR_HUES.reduce((acc, hue) => {
|
|
71
|
-
return {
|
|
72
|
-
...acc,
|
|
73
|
-
[hue]: merge({_hue: hue}, spec.avatar?.['*'], spec.avatar?.[hue]),
|
|
74
|
-
}
|
|
75
|
-
}, {} as ThemeColorAvatarTokens),
|
|
76
|
-
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
77
|
-
return {
|
|
78
|
-
...acc,
|
|
79
|
-
[tone]: {
|
|
80
|
-
_hue: inputTokens?.base?.[tone]?._hue || hue,
|
|
81
|
-
...spec.badge?.['*'],
|
|
82
|
-
...spec.badge?.[tone],
|
|
83
|
-
},
|
|
84
|
-
}
|
|
85
|
-
}, {} as ThemeColorBadgeTokens),
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function resolveButtonColorTokens(
|
|
90
|
-
inputTokens: ThemeColorTokens,
|
|
91
|
-
): Partial<Record<ThemeColorButtonModeKey, ThemeColorButtonTokens>> {
|
|
92
|
-
const tokens: Partial<Record<ThemeColorButtonModeKey, ThemeColorButtonTokens>> = {}
|
|
93
|
-
|
|
94
|
-
for (const mode of THEME_COLOR_BUTTON_MODES) {
|
|
95
|
-
tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return tokens
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function resolveButtonToneColorTokens(
|
|
102
|
-
inputTokens: ThemeColorTokens,
|
|
103
|
-
mode: ThemeColorButtonModeKey,
|
|
104
|
-
): ThemeColorButtonTokens {
|
|
105
|
-
const tokens: ThemeColorButtonTokens = {}
|
|
106
|
-
|
|
107
|
-
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
108
|
-
tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return tokens
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function resolveButtonModeColorTokens(
|
|
115
|
-
inputTokens: ThemeColorTokens,
|
|
116
|
-
mode: ThemeColorButtonModeKey,
|
|
117
|
-
tone: ThemeColorStateToneKey,
|
|
118
|
-
): ThemeColorStatesTokens {
|
|
119
|
-
const tokens: ThemeColorStatesTokens = {}
|
|
120
|
-
|
|
121
|
-
for (const state of THEME_COLOR_STATES) {
|
|
122
|
-
tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return tokens
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function resolveButtonStateColorTokens(
|
|
129
|
-
inputTokens: ThemeColorTokens,
|
|
130
|
-
tone: ThemeColorStateToneKey,
|
|
131
|
-
mode: ThemeColorButtonModeKey,
|
|
132
|
-
state: ThemeColorStateKey,
|
|
133
|
-
): ThemeColorStateTokens {
|
|
134
|
-
const spec = merge(
|
|
135
|
-
inputTokens?.button?.[mode]?.['*']?.['*'],
|
|
136
|
-
inputTokens?.button?.[mode]?.[tone]?.['*'],
|
|
137
|
-
inputTokens?.button?.[mode]?.['*']?.[state],
|
|
138
|
-
inputTokens?.button?.[mode]?.[tone]?.[state],
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
const hue = spec._hue || inputTokens?.base?.[tone]?._hue
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
...spec,
|
|
145
|
-
_hue: hue,
|
|
146
|
-
avatar: COLOR_HUES.reduce((acc, hue) => {
|
|
147
|
-
return {
|
|
148
|
-
...acc,
|
|
149
|
-
[hue]: merge({_hue: hue}, spec.avatar?.['*'], spec.avatar?.[hue]),
|
|
150
|
-
}
|
|
151
|
-
}, {} as ThemeColorAvatarTokens),
|
|
152
|
-
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
153
|
-
return {
|
|
154
|
-
...acc,
|
|
155
|
-
[tone]: {
|
|
156
|
-
_hue: inputTokens?.base?.[tone]?._hue || hue,
|
|
157
|
-
...spec.badge?.['*'],
|
|
158
|
-
...spec.badge?.[tone],
|
|
159
|
-
},
|
|
160
|
-
}
|
|
161
|
-
}, {} as ThemeColorBadgeTokens),
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function resolveInputColorTokens(
|
|
166
|
-
inputTokens: ThemeColorTokens,
|
|
167
|
-
): Partial<Record<ColorConfigInputMode, ThemeColorInputTokens>> {
|
|
168
|
-
const tokens: Partial<Record<ColorConfigInputMode, ThemeColorInputTokens>> = {}
|
|
169
|
-
|
|
170
|
-
for (const mode of THEME_COLOR_INPUT_MODES) {
|
|
171
|
-
tokens[mode] = resolveInputModeColorTokens(inputTokens, mode)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return tokens
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function resolveInputModeColorTokens(
|
|
178
|
-
inputTokens: ThemeColorTokens,
|
|
179
|
-
mode: ColorConfigInputMode,
|
|
180
|
-
): ThemeColorInputTokens {
|
|
181
|
-
const states: ThemeColorInputTokens = {}
|
|
182
|
-
|
|
183
|
-
for (const state of THEME_COLOR_INPUT_STATES) {
|
|
184
|
-
states[state] = resolveInputStateColorTokens(inputTokens, mode, state)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return states
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function resolveInputStateColorTokens(
|
|
191
|
-
inputTokens: ThemeColorTokens,
|
|
192
|
-
mode: ColorConfigInputMode,
|
|
193
|
-
state: ColorConfigInputState,
|
|
194
|
-
): ThemeColorInputStateTokens {
|
|
195
|
-
const spec = merge(
|
|
196
|
-
inputTokens?.input?.['*']?.['*'],
|
|
197
|
-
inputTokens?.input?.[mode]?.['*'],
|
|
198
|
-
inputTokens?.input?.['*']?.[state],
|
|
199
|
-
inputTokens?.input?.[mode]?.[state],
|
|
200
|
-
)
|
|
201
|
-
|
|
202
|
-
const hue = spec._hue || inputTokens?.input?.[mode]?._hue
|
|
203
|
-
|
|
204
|
-
return {...spec, _hue: hue}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function resolveSelectableColorTokens(
|
|
208
|
-
inputTokens: ThemeColorTokens,
|
|
209
|
-
): Partial<Record<ColorConfigStateTone, {_hue?: ColorHueKey} & ThemeColorStatesTokens>> {
|
|
210
|
-
const tokens: ThemeColorButtonTokens = {}
|
|
211
|
-
|
|
212
|
-
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
213
|
-
tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return tokens
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function resolveSelectableToneColorTokens(
|
|
220
|
-
inputTokens: ThemeColorTokens,
|
|
221
|
-
tone: ThemeColorStateToneKey,
|
|
222
|
-
): {_hue?: ColorHueKey} & ThemeColorStatesTokens {
|
|
223
|
-
const states: {_hue?: ColorHueKey} & ThemeColorStatesTokens = {
|
|
224
|
-
_hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue,
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
for (const state of THEME_COLOR_STATES) {
|
|
228
|
-
states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return states
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function resolveSelectableStateColorTokens(
|
|
235
|
-
inputTokens: ThemeColorTokens,
|
|
236
|
-
tone: ThemeColorStateToneKey,
|
|
237
|
-
state: ThemeColorStateKey,
|
|
238
|
-
) {
|
|
239
|
-
const spec = merge(
|
|
240
|
-
inputTokens?.selectable?.['*']?.['*'],
|
|
241
|
-
inputTokens?.selectable?.[tone]?.['*'],
|
|
242
|
-
inputTokens?.selectable?.['*']?.[state],
|
|
243
|
-
inputTokens?.selectable?.[tone]?.[state],
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
const hue = spec._hue || inputTokens?.base?.[tone]?._hue
|
|
247
|
-
|
|
248
|
-
return {
|
|
249
|
-
...spec,
|
|
250
|
-
_hue: hue,
|
|
251
|
-
avatar: COLOR_HUES.reduce((acc, hue) => {
|
|
252
|
-
return {
|
|
253
|
-
...acc,
|
|
254
|
-
[hue]: merge({_hue: hue}, spec.avatar?.['*'], spec.avatar?.[hue]),
|
|
255
|
-
}
|
|
256
|
-
}, {} as ThemeColorAvatarTokens),
|
|
257
|
-
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
258
|
-
return {
|
|
259
|
-
...acc,
|
|
260
|
-
[tone]: {
|
|
261
|
-
_hue: inputTokens?.base?.[tone]?._hue || hue,
|
|
262
|
-
...spec.badge?.['*'],
|
|
263
|
-
...spec.badge?.[tone],
|
|
264
|
-
},
|
|
265
|
-
}
|
|
266
|
-
}, {} as ThemeColorBadgeTokens),
|
|
267
|
-
}
|
|
268
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {COLOR_HUES} from '@sanity/color'
|
|
2
|
-
|
|
3
|
-
/** @public */
|
|
4
|
-
export const THEME_COLOR_SCHEMES = ['light', 'dark'] as const
|
|
5
|
-
|
|
6
|
-
/** @public */
|
|
7
|
-
export const THEME_COLOR_BLEND_MODES = ['multiply', 'screen'] as const
|
|
8
|
-
|
|
9
|
-
/** @public */
|
|
10
|
-
export const THEME_COLOR_CARD_TONES = [
|
|
11
|
-
'transparent',
|
|
12
|
-
'default',
|
|
13
|
-
'neutral',
|
|
14
|
-
'primary', // deprecated
|
|
15
|
-
'suggest',
|
|
16
|
-
'positive',
|
|
17
|
-
'caution',
|
|
18
|
-
'critical',
|
|
19
|
-
] as const
|
|
20
|
-
|
|
21
|
-
/** @public */
|
|
22
|
-
export const THEME_COLOR_STATE_TONES = [
|
|
23
|
-
'default',
|
|
24
|
-
'neutral',
|
|
25
|
-
'primary', // deprecated
|
|
26
|
-
'suggest',
|
|
27
|
-
'positive',
|
|
28
|
-
'caution',
|
|
29
|
-
'critical',
|
|
30
|
-
] as const
|
|
31
|
-
|
|
32
|
-
/** @public */
|
|
33
|
-
export const THEME_COLOR_STATES = ['enabled', 'hovered', 'pressed', 'selected', 'disabled'] as const
|
|
34
|
-
|
|
35
|
-
/** @public */
|
|
36
|
-
export const THEME_COLOR_BUTTON_MODES = ['default', 'ghost', 'bleed'] as const
|
|
37
|
-
|
|
38
|
-
/** @public */
|
|
39
|
-
export const THEME_COLOR_INPUT_MODES = ['default', 'invalid'] as const
|
|
40
|
-
|
|
41
|
-
/** @public */
|
|
42
|
-
export const THEME_COLOR_INPUT_STATES = ['enabled', 'hovered', 'readOnly', 'disabled'] as const
|
|
43
|
-
|
|
44
|
-
/** @public */
|
|
45
|
-
export const THEME_COLOR_AVATAR_COLORS = COLOR_HUES
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {COLOR_HUES, COLOR_TINTS, type ColorHueKey, type ColorTintKey} from '@sanity/color'
|
|
2
|
-
|
|
3
|
-
import {THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES} from './_constants'
|
|
4
|
-
import type {ThemeColorBlendModeKey, ThemeColorButtonModeKey} from './_system'
|
|
5
|
-
|
|
6
|
-
/** @internal */
|
|
7
|
-
export function isColorBlendModeValue(str: string): str is ThemeColorBlendModeKey {
|
|
8
|
-
return THEME_COLOR_BLEND_MODES.includes(str as ThemeColorBlendModeKey)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** @internal */
|
|
12
|
-
export function isColorHueKey(str: string): str is ColorHueKey {
|
|
13
|
-
return COLOR_HUES.includes(str as ColorHueKey)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
export function isColorTintKey(str: string): str is ColorTintKey {
|
|
18
|
-
return COLOR_TINTS.includes(str as ColorTintKey)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** @internal */
|
|
22
|
-
export function isColorButtonMode(str: string): str is ThemeColorButtonModeKey {
|
|
23
|
-
return THEME_COLOR_BUTTON_MODES.includes(str as ThemeColorButtonModeKey)
|
|
24
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
THEME_COLOR_AVATAR_COLORS,
|
|
3
|
-
THEME_COLOR_BLEND_MODES,
|
|
4
|
-
THEME_COLOR_BUTTON_MODES,
|
|
5
|
-
THEME_COLOR_CARD_TONES,
|
|
6
|
-
THEME_COLOR_INPUT_MODES,
|
|
7
|
-
THEME_COLOR_INPUT_STATES,
|
|
8
|
-
THEME_COLOR_SCHEMES,
|
|
9
|
-
THEME_COLOR_STATE_TONES,
|
|
10
|
-
THEME_COLOR_STATES,
|
|
11
|
-
} from './_constants'
|
|
12
|
-
|
|
13
|
-
/** @public */
|
|
14
|
-
export type ThemeColorSchemeKey = (typeof THEME_COLOR_SCHEMES)[number]
|
|
15
|
-
|
|
16
|
-
/** @public */
|
|
17
|
-
export type ThemeColorBlendModeKey = (typeof THEME_COLOR_BLEND_MODES)[number]
|
|
18
|
-
|
|
19
|
-
/** @public */
|
|
20
|
-
export type ThemeColorCardToneKey = (typeof THEME_COLOR_CARD_TONES)[number]
|
|
21
|
-
|
|
22
|
-
/** @public */
|
|
23
|
-
export type ThemeColorButtonModeKey = (typeof THEME_COLOR_BUTTON_MODES)[number]
|
|
24
|
-
|
|
25
|
-
/** @public */
|
|
26
|
-
export type ThemeColorStateKey = (typeof THEME_COLOR_STATES)[number]
|
|
27
|
-
|
|
28
|
-
/** @public */
|
|
29
|
-
export type ThemeColorStateToneKey = (typeof THEME_COLOR_STATE_TONES)[number]
|
|
30
|
-
|
|
31
|
-
/** @public */
|
|
32
|
-
export type ThemeColorInputModeKey = (typeof THEME_COLOR_INPUT_MODES)[number]
|
|
33
|
-
|
|
34
|
-
/** @public */
|
|
35
|
-
export type ThemeColorInputStateKey = (typeof THEME_COLOR_INPUT_STATES)[number]
|
|
36
|
-
|
|
37
|
-
/** @public */
|
|
38
|
-
export type ThemeColorAvatarColorKey = (typeof THEME_COLOR_AVATAR_COLORS)[number]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorAvatarColorKey, ThemeColorBlendModeKey} from './_system'
|
|
2
|
-
|
|
3
|
-
/** @public */
|
|
4
|
-
export interface ThemeColorAvatarHue_v2 {
|
|
5
|
-
_blend?: ThemeColorBlendModeKey
|
|
6
|
-
bg: string
|
|
7
|
-
fg: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** @public */
|
|
11
|
-
export type ThemeColorAvatar_v2 = Record<ThemeColorAvatarColorKey, ThemeColorAvatarHue_v2>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorStateToneKey} from './_system'
|
|
2
|
-
|
|
3
|
-
/** @public */
|
|
4
|
-
export interface ThemeColorBadgeTone_v2 {
|
|
5
|
-
bg: string
|
|
6
|
-
fg: string
|
|
7
|
-
dot: string
|
|
8
|
-
icon: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** @public */
|
|
12
|
-
export type ThemeColorBadge_v2 = Record<ThemeColorStateToneKey, ThemeColorBadgeTone_v2>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorButtonModeKey, ThemeColorStateKey, ThemeColorStateToneKey} from './_system'
|
|
2
|
-
import type {ThemeColorState_v2} from './state'
|
|
3
|
-
|
|
4
|
-
/** @public */
|
|
5
|
-
export type ThemeColorButtonTone_v2 = Record<ThemeColorStateKey, ThemeColorState_v2>
|
|
6
|
-
|
|
7
|
-
/** @public */
|
|
8
|
-
export type ThemeColorButtonMode_v2 = Record<ThemeColorStateToneKey, ThemeColorButtonTone_v2>
|
|
9
|
-
|
|
10
|
-
/** @public */
|
|
11
|
-
export type ThemeColorButton_v2 = Record<ThemeColorButtonModeKey, ThemeColorButtonMode_v2>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorBlendModeKey, ThemeColorCardToneKey, ThemeColorSchemeKey} from './_system'
|
|
2
|
-
import type {ThemeColorButton_v2} from './button'
|
|
3
|
-
import type {ThemeColorInput_v2} from './input'
|
|
4
|
-
import type {ThemeColorSelectable_v2} from './selectable'
|
|
5
|
-
import type {ThemeColorShadow} from './shadow'
|
|
6
|
-
import type {ThemeColorState_v2} from './state'
|
|
7
|
-
import type {ThemeColorSyntax} from './syntax'
|
|
8
|
-
|
|
9
|
-
/** @public */
|
|
10
|
-
export interface ThemeColorCard_v2 extends ThemeColorState_v2 {
|
|
11
|
-
/** @internal */
|
|
12
|
-
_blend: ThemeColorBlendModeKey
|
|
13
|
-
_dark: boolean
|
|
14
|
-
|
|
15
|
-
backdrop: string
|
|
16
|
-
button: ThemeColorButton_v2
|
|
17
|
-
focusRing: string
|
|
18
|
-
input: ThemeColorInput_v2
|
|
19
|
-
selectable: ThemeColorSelectable_v2
|
|
20
|
-
shadow: ThemeColorShadow
|
|
21
|
-
syntax: ThemeColorSyntax
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** @public */
|
|
25
|
-
export type ThemeColorScheme_v2 = Record<ThemeColorCardToneKey, ThemeColorCard_v2>
|
|
26
|
-
|
|
27
|
-
/** @public */
|
|
28
|
-
export type ThemeColorSchemes_v2 = Record<ThemeColorSchemeKey, ThemeColorScheme_v2>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './_constants'
|
|
2
|
-
export * from './_helpers'
|
|
3
|
-
export * from './_system'
|
|
4
|
-
export * from './avatar'
|
|
5
|
-
export * from './badge'
|
|
6
|
-
export * from './button'
|
|
7
|
-
export * from './color'
|
|
8
|
-
export * from './input'
|
|
9
|
-
export * from './kbd'
|
|
10
|
-
export * from './selectable'
|
|
11
|
-
export * from './shadow'
|
|
12
|
-
export * from './state'
|
|
13
|
-
export * from './syntax'
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ThemeColorBlendModeKey,
|
|
3
|
-
ThemeColorInputModeKey,
|
|
4
|
-
ThemeColorInputStateKey,
|
|
5
|
-
} from './_system'
|
|
6
|
-
|
|
7
|
-
/** @public */
|
|
8
|
-
export interface ThemeColorInputState_v2 {
|
|
9
|
-
_blend?: ThemeColorBlendModeKey
|
|
10
|
-
bg: string
|
|
11
|
-
border: string
|
|
12
|
-
fg: string
|
|
13
|
-
muted: {
|
|
14
|
-
bg: string
|
|
15
|
-
}
|
|
16
|
-
placeholder: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** @public */
|
|
20
|
-
export type ThemeColorInputMode_v2 = Record<ThemeColorInputStateKey, ThemeColorInputState_v2>
|
|
21
|
-
|
|
22
|
-
/** @public */
|
|
23
|
-
export type ThemeColorInput_v2 = Record<ThemeColorInputModeKey, ThemeColorInputMode_v2>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorStateKey, ThemeColorStateToneKey} from './_system'
|
|
2
|
-
import type {ThemeColorState_v2} from './state'
|
|
3
|
-
|
|
4
|
-
/** @public */
|
|
5
|
-
export type ThemeColorSelectableTone_v2 = Record<ThemeColorStateKey, ThemeColorState_v2>
|
|
6
|
-
|
|
7
|
-
/** @public */
|
|
8
|
-
export type ThemeColorSelectable_v2 = Record<ThemeColorStateToneKey, ThemeColorSelectableTone_v2>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type {ThemeColorBlendModeKey} from './_system'
|
|
2
|
-
import type {ThemeColorAvatar_v2} from './avatar'
|
|
3
|
-
import type {ThemeColorBadge_v2} from './badge'
|
|
4
|
-
import type {ThemeColorKBD} from './kbd'
|
|
5
|
-
|
|
6
|
-
/** @public */
|
|
7
|
-
export interface ThemeColorState_v2 {
|
|
8
|
-
/** @internal */
|
|
9
|
-
_blend?: ThemeColorBlendModeKey
|
|
10
|
-
accent: {
|
|
11
|
-
fg: string
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @internal This may be removed in a future release
|
|
15
|
-
* */
|
|
16
|
-
avatar: ThemeColorAvatar_v2
|
|
17
|
-
/**
|
|
18
|
-
* @internal This may be removed in a future release
|
|
19
|
-
* */
|
|
20
|
-
badge: ThemeColorBadge_v2
|
|
21
|
-
bg: string
|
|
22
|
-
border: string
|
|
23
|
-
code: {
|
|
24
|
-
bg: string
|
|
25
|
-
fg: string
|
|
26
|
-
}
|
|
27
|
-
fg: string
|
|
28
|
-
icon: string
|
|
29
|
-
kbd: ThemeColorKBD
|
|
30
|
-
link: {
|
|
31
|
-
fg: string
|
|
32
|
-
}
|
|
33
|
-
muted: {
|
|
34
|
-
bg: string
|
|
35
|
-
fg: string
|
|
36
|
-
}
|
|
37
|
-
skeleton: {
|
|
38
|
-
from: string
|
|
39
|
-
to: string
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @public */
|
|
2
|
-
export interface ThemeColorSyntax {
|
|
3
|
-
atrule: string
|
|
4
|
-
attrName: string
|
|
5
|
-
attrValue: string
|
|
6
|
-
attribute: string
|
|
7
|
-
boolean: string
|
|
8
|
-
builtin: string
|
|
9
|
-
cdata: string
|
|
10
|
-
char: string
|
|
11
|
-
class: string
|
|
12
|
-
className: string
|
|
13
|
-
comment: string
|
|
14
|
-
constant: string
|
|
15
|
-
deleted: string
|
|
16
|
-
doctype: string
|
|
17
|
-
entity: string
|
|
18
|
-
function: string
|
|
19
|
-
hexcode: string
|
|
20
|
-
id: string
|
|
21
|
-
important: string
|
|
22
|
-
inserted: string
|
|
23
|
-
keyword: string
|
|
24
|
-
number: string
|
|
25
|
-
operator: string
|
|
26
|
-
prolog: string
|
|
27
|
-
property: string
|
|
28
|
-
pseudoClass: string
|
|
29
|
-
pseudoElement: string
|
|
30
|
-
punctuation: string
|
|
31
|
-
regex: string
|
|
32
|
-
selector: string
|
|
33
|
-
string: string
|
|
34
|
-
symbol: string
|
|
35
|
-
tag: string
|
|
36
|
-
unit: string
|
|
37
|
-
url: string
|
|
38
|
-
variable: string
|
|
39
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COLOR_CONFIG_BLEND_KEYS,
|
|
3
|
-
COLOR_CONFIG_CARD_KEYS,
|
|
4
|
-
COLOR_CONFIG_CARD_TONES,
|
|
5
|
-
COLOR_CONFIG_STATE_KEYS,
|
|
6
|
-
COLOR_CONFIG_STATE_TONES,
|
|
7
|
-
type ColorConfigBlendKey,
|
|
8
|
-
type ColorConfigCardKey,
|
|
9
|
-
type ColorConfigCardTone,
|
|
10
|
-
type ColorConfigOpacityValue,
|
|
11
|
-
type ColorConfigStateKey,
|
|
12
|
-
type ColorConfigStateTone,
|
|
13
|
-
} from './system'
|
|
14
|
-
|
|
15
|
-
/** @internal */
|
|
16
|
-
export function isColorConfigBaseTone(str: string): str is ColorConfigCardTone {
|
|
17
|
-
return COLOR_CONFIG_CARD_TONES.includes(str as ColorConfigCardTone)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** @internal */
|
|
21
|
-
export function isColorConfigBaseKey(str: string): str is ColorConfigCardKey {
|
|
22
|
-
return COLOR_CONFIG_CARD_KEYS.includes(str as ColorConfigCardKey)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export function isColorConfigStateKey(str: string): str is ColorConfigStateKey {
|
|
27
|
-
return COLOR_CONFIG_STATE_KEYS.includes(str as ColorConfigStateKey)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** @internal */
|
|
31
|
-
export function isColorConfigStateTone(str: string): str is ColorConfigStateTone {
|
|
32
|
-
return COLOR_CONFIG_STATE_TONES.includes(str as ColorConfigStateTone)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
export function isColorConfigBlendKey(str: string): str is ColorConfigBlendKey {
|
|
37
|
-
return COLOR_CONFIG_BLEND_KEYS.includes(str as ColorConfigBlendKey)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** @internal */
|
|
41
|
-
export function isColorValue(str: string): str is 'black' | 'white' {
|
|
42
|
-
return str === 'black' || str === 'white'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** @internal */
|
|
46
|
-
export function isColorOpacityValue(str: string): str is ColorConfigOpacityValue {
|
|
47
|
-
return str === '0' || /^0\.[0-9]+$/.test(str) || str === '1'
|
|
48
|
-
}
|