@sanity/ui 3.0.0-static.32 → 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 +269 -378
- 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 +270 -381
- 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 -894
- package/dist/_visual-editing.d.ts +2 -894
- package/dist/_visual-editing.js +2 -4
- package/dist/css/index.cjs +13 -13
- 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 +13 -13
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +242 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +990 -3085
- package/dist/index.d.ts +990 -3085
- package/dist/index.js +244 -361
- 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 +8 -9
- package/src/core/Root.tsx +6 -4
- 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 +34 -17
- 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 +2 -2
- package/src/css/primitives/root/root.ts +2 -2
- 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/dist/css/layers.css +0 -4
- package/dist/css/primitives/popover/popover.css +0 -4
- 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
package/src/css/types.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AvatarColor,
|
|
3
3
|
AvatarSize,
|
|
4
|
+
CardTone,
|
|
5
|
+
ColorScheme,
|
|
6
|
+
ColorVariant,
|
|
4
7
|
ContainerScale,
|
|
8
|
+
ElementTone,
|
|
5
9
|
FontCodeSize,
|
|
6
10
|
FontHeadingSize,
|
|
7
11
|
FontLabelSize,
|
|
@@ -10,12 +14,9 @@ import type {
|
|
|
10
14
|
Radius,
|
|
11
15
|
Shadow,
|
|
12
16
|
Space,
|
|
13
|
-
ThemeColorCardToneKey,
|
|
14
|
-
ThemeColorSchemeKey,
|
|
15
|
-
ThemeColorStateToneKey,
|
|
16
|
-
ThemeColorVariantKey,
|
|
17
17
|
Tint,
|
|
18
18
|
} from '@sanity/ui/theme'
|
|
19
|
+
import type {createThemeContract} from '@vanilla-extract/css'
|
|
19
20
|
|
|
20
21
|
import type {BREAKPOINTS} from './constants'
|
|
21
22
|
|
|
@@ -32,13 +33,29 @@ export type ResponsiveRules = Record<Breakpoint, string>
|
|
|
32
33
|
export type ResponsiveRuleOptions<K extends string | number> = Record<K, ResponsiveRules>
|
|
33
34
|
|
|
34
35
|
/** @public */
|
|
35
|
-
export type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
export type CSSVarFunction = `var(--${string})`
|
|
37
|
+
|
|
38
|
+
/** @public */
|
|
39
|
+
export type ElementColorTokens = {
|
|
40
|
+
bg: {
|
|
41
|
+
0: string
|
|
42
|
+
4: string
|
|
43
|
+
}
|
|
44
|
+
border: {
|
|
45
|
+
0: string
|
|
46
|
+
4: string
|
|
47
|
+
}
|
|
48
|
+
fg: {
|
|
49
|
+
0: string
|
|
50
|
+
4: string
|
|
51
|
+
}
|
|
52
|
+
}
|
|
39
53
|
|
|
40
54
|
/** @public */
|
|
41
|
-
export type
|
|
55
|
+
export type VariantColorTokens = Record<ElementTone, ElementColorTokens>
|
|
56
|
+
|
|
57
|
+
/** @public */
|
|
58
|
+
export type CSSCardColorTokens = {
|
|
42
59
|
avatar: Record<AvatarColor, {bg: string; fg: string}>
|
|
43
60
|
backdrop: string
|
|
44
61
|
code: {
|
|
@@ -97,37 +114,22 @@ export type CSSThemeColorCard = {
|
|
|
97
114
|
from: string
|
|
98
115
|
to: string
|
|
99
116
|
}
|
|
100
|
-
} & Record<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
bg: {
|
|
106
|
-
0: string
|
|
107
|
-
4: string
|
|
108
|
-
}
|
|
109
|
-
border: {
|
|
110
|
-
0: string
|
|
111
|
-
4: string
|
|
112
|
-
}
|
|
113
|
-
fg: {
|
|
114
|
-
0: string
|
|
115
|
-
4: string
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
>
|
|
119
|
-
>
|
|
117
|
+
} & Record<ColorVariant, VariantColorTokens>
|
|
118
|
+
|
|
119
|
+
/** @public */
|
|
120
|
+
export type SchemeColorTokens = Record<CardTone, CSSCardColorTokens>
|
|
120
121
|
|
|
121
122
|
/** @public */
|
|
122
|
-
export type
|
|
123
|
+
export type ColorPaletteTokens = {
|
|
124
|
+
black: string
|
|
125
|
+
white: string
|
|
126
|
+
} & Record<Hue, Record<Tint, string>>
|
|
123
127
|
|
|
124
128
|
/** @public */
|
|
125
|
-
export type
|
|
126
|
-
palette: CSSThemeColorPalette
|
|
127
|
-
} & Record<ThemeColorSchemeKey, CSSThemeColorScheme>
|
|
129
|
+
export type ColorTokens = Record<ColorScheme, SchemeColorTokens>
|
|
128
130
|
|
|
129
131
|
/** @public */
|
|
130
|
-
export type
|
|
132
|
+
export type FontTokens<FontScaleIndex extends number> = {
|
|
131
133
|
family: string
|
|
132
134
|
featureSettings: string
|
|
133
135
|
weight: {
|
|
@@ -151,9 +153,8 @@ export type CSSThemeFont<FontScaleIndex extends number> = {
|
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
/** @public */
|
|
154
|
-
export type
|
|
155
|
-
|
|
156
|
-
'avatar': {
|
|
156
|
+
export type ThemeTokens = {
|
|
157
|
+
avatar: {
|
|
157
158
|
focusRing: {
|
|
158
159
|
offset: string
|
|
159
160
|
width: string
|
|
@@ -166,7 +167,7 @@ export type CSSTheme = {
|
|
|
166
167
|
}
|
|
167
168
|
>
|
|
168
169
|
}
|
|
169
|
-
|
|
170
|
+
button: {
|
|
170
171
|
border: {
|
|
171
172
|
width: string
|
|
172
173
|
}
|
|
@@ -175,20 +176,20 @@ export type CSSTheme = {
|
|
|
175
176
|
width: string
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
+
card: {
|
|
179
180
|
shadow: {
|
|
180
181
|
outline: string
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
code:
|
|
187
|
-
heading:
|
|
188
|
-
label:
|
|
189
|
-
text:
|
|
184
|
+
color: ColorTokens
|
|
185
|
+
container: Record<ContainerScale, string>
|
|
186
|
+
font: {
|
|
187
|
+
code: FontTokens<FontCodeSize>
|
|
188
|
+
heading: FontTokens<FontHeadingSize>
|
|
189
|
+
label: FontTokens<FontLabelSize>
|
|
190
|
+
text: FontTokens<FontTextSize>
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
+
input: {
|
|
192
193
|
border: {
|
|
193
194
|
width: string
|
|
194
195
|
}
|
|
@@ -231,8 +232,8 @@ export type CSSTheme = {
|
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
radius: Record<Radius, string>
|
|
236
|
+
shadow: Record<
|
|
236
237
|
Shadow,
|
|
237
238
|
{
|
|
238
239
|
umbra: string
|
|
@@ -240,10 +241,181 @@ export type CSSTheme = {
|
|
|
240
241
|
ambient: string
|
|
241
242
|
}
|
|
242
243
|
>
|
|
243
|
-
|
|
244
|
+
space: Record<Space, string>
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** @public */
|
|
248
|
+
export type RootThemeTokens = ThemeTokens & {
|
|
249
|
+
color: {palette: ColorPaletteTokens}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** @public */
|
|
253
|
+
export type ScopedTokens = {
|
|
254
|
+
arrow: {
|
|
255
|
+
size: string
|
|
256
|
+
}
|
|
257
|
+
avatar: {
|
|
258
|
+
distance: string
|
|
259
|
+
size: string
|
|
260
|
+
}
|
|
261
|
+
button: {
|
|
262
|
+
boxShadow: string
|
|
263
|
+
}
|
|
264
|
+
card: {
|
|
265
|
+
test: string
|
|
266
|
+
}
|
|
267
|
+
color: {
|
|
268
|
+
avatar: {
|
|
269
|
+
bg: string
|
|
270
|
+
fg: string
|
|
271
|
+
}
|
|
272
|
+
bg: string
|
|
273
|
+
border: string
|
|
274
|
+
fg: string
|
|
275
|
+
muted: {
|
|
276
|
+
bg: string
|
|
277
|
+
border: string
|
|
278
|
+
fg: string
|
|
279
|
+
}
|
|
280
|
+
input: {
|
|
281
|
+
checkbox: {
|
|
282
|
+
bg: string
|
|
283
|
+
border: string
|
|
284
|
+
fg: string
|
|
285
|
+
}
|
|
286
|
+
text: {
|
|
287
|
+
bg: string
|
|
288
|
+
border: string
|
|
289
|
+
fg: string
|
|
290
|
+
placeholder: string
|
|
291
|
+
}
|
|
292
|
+
radio: {
|
|
293
|
+
bg: string
|
|
294
|
+
border: string
|
|
295
|
+
fg: string
|
|
296
|
+
}
|
|
297
|
+
switch: {
|
|
298
|
+
bg: string
|
|
299
|
+
fg: string
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
} & CSSCardColorTokens &
|
|
303
|
+
Record<
|
|
304
|
+
ColorVariant,
|
|
305
|
+
Record<
|
|
306
|
+
ElementTone,
|
|
307
|
+
{
|
|
308
|
+
bg: {
|
|
309
|
+
0: string
|
|
310
|
+
1: string
|
|
311
|
+
2: string
|
|
312
|
+
3: string
|
|
313
|
+
4: string
|
|
314
|
+
}
|
|
315
|
+
border: {
|
|
316
|
+
0: string
|
|
317
|
+
1: string
|
|
318
|
+
2: string
|
|
319
|
+
3: string
|
|
320
|
+
4: string
|
|
321
|
+
}
|
|
322
|
+
fg: {
|
|
323
|
+
0: string
|
|
324
|
+
1: string
|
|
325
|
+
2: string
|
|
326
|
+
3: string
|
|
327
|
+
4: string
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
>
|
|
331
|
+
> &
|
|
332
|
+
Record<
|
|
333
|
+
CardTone,
|
|
334
|
+
CSSCardColorTokens &
|
|
335
|
+
Record<
|
|
336
|
+
ColorVariant,
|
|
337
|
+
Record<
|
|
338
|
+
ElementTone,
|
|
339
|
+
{
|
|
340
|
+
bg: {
|
|
341
|
+
0: string
|
|
342
|
+
4: string
|
|
343
|
+
}
|
|
344
|
+
border: {
|
|
345
|
+
0: string
|
|
346
|
+
4: string
|
|
347
|
+
}
|
|
348
|
+
fg: {
|
|
349
|
+
0: string
|
|
350
|
+
4: string
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
>
|
|
354
|
+
>
|
|
355
|
+
>
|
|
356
|
+
|
|
357
|
+
font: {
|
|
358
|
+
family: string
|
|
359
|
+
featureSettings: string
|
|
360
|
+
fontSize: string
|
|
361
|
+
lineHeight: string
|
|
362
|
+
letterSpacing: string
|
|
363
|
+
fontWeight: string
|
|
364
|
+
|
|
365
|
+
ascenderHeight: string
|
|
366
|
+
descenderHeight: string
|
|
367
|
+
iconSize: string
|
|
368
|
+
customIconSize: string
|
|
369
|
+
capHeight: string
|
|
370
|
+
iconOffset: string
|
|
371
|
+
customIconOffset: string
|
|
372
|
+
|
|
373
|
+
skeleton: {
|
|
374
|
+
ascenderHeight: string
|
|
375
|
+
descenderHeight: string
|
|
376
|
+
lineHeight: string
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
weight: {
|
|
380
|
+
regular: string
|
|
381
|
+
medium: string
|
|
382
|
+
semibold: string
|
|
383
|
+
bold: string
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
input: {
|
|
388
|
+
switch: {
|
|
389
|
+
thumb: {
|
|
390
|
+
offset: string
|
|
391
|
+
size: string
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
text: {
|
|
395
|
+
fontSize: string
|
|
396
|
+
lineHeight: string
|
|
397
|
+
letterSpacing: string
|
|
398
|
+
ascenderHeight: string
|
|
399
|
+
descenderHeight: string
|
|
400
|
+
padding: string
|
|
401
|
+
gap: string
|
|
402
|
+
}
|
|
403
|
+
}
|
|
244
404
|
}
|
|
245
405
|
|
|
246
|
-
/** @
|
|
247
|
-
export type
|
|
248
|
-
|
|
406
|
+
/** @public */
|
|
407
|
+
export type NullableTokens = {
|
|
408
|
+
[key: string]: string | NullableTokens
|
|
249
409
|
}
|
|
410
|
+
|
|
411
|
+
/** @public */
|
|
412
|
+
export type ThemeContract<T extends NullableTokens> = ReturnType<typeof createThemeContract<T>>
|
|
413
|
+
|
|
414
|
+
/** @public */
|
|
415
|
+
export type ColorPaletteVars = ThemeContract<ColorPaletteTokens>
|
|
416
|
+
|
|
417
|
+
/** @public */
|
|
418
|
+
export type ScopedVars = ThemeContract<ScopedTokens>
|
|
419
|
+
|
|
420
|
+
/** @public */
|
|
421
|
+
export type ThemeVars = ThemeContract<RootThemeTokens & ScopedTokens> // _CSSThemeWithoutPaletteTokens & ScopedVars
|
package/src/css/util.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {BoxShadow} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
3
|
/** @internal */
|
|
4
4
|
export function rem(value: number): string {
|
|
@@ -15,7 +15,7 @@ export function px(value: number): string {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** @internal */
|
|
18
|
-
export function toBoxShadow(value:
|
|
18
|
+
export function toBoxShadow(value: BoxShadow | undefined): string {
|
|
19
19
|
if (!value) return 'none'
|
|
20
20
|
|
|
21
21
|
return value.map((n) => px(n)).join(' ')
|
package/src/css/vars.css.ts
CHANGED
|
@@ -2,8 +2,11 @@ import {COLOR_HUES, COLOR_TINTS} from '@sanity/color'
|
|
|
2
2
|
import {
|
|
3
3
|
AVATAR_COLORS,
|
|
4
4
|
AVATAR_SIZE,
|
|
5
|
+
CARD_TONES,
|
|
6
|
+
COLOR_SCHEMES,
|
|
5
7
|
COLOR_VARIANTS,
|
|
6
8
|
CONTAINER_SCALE,
|
|
9
|
+
ELEMENT_TONES,
|
|
7
10
|
FONT_CODE_SIZE,
|
|
8
11
|
FONT_HEADING_SIZE,
|
|
9
12
|
FONT_LABEL_SIZE,
|
|
@@ -11,21 +14,22 @@ import {
|
|
|
11
14
|
RADIUS,
|
|
12
15
|
SHADOW,
|
|
13
16
|
SPACE,
|
|
14
|
-
THEME_COLOR_CARD_TONES,
|
|
15
|
-
THEME_COLOR_SCHEMES,
|
|
16
|
-
THEME_COLOR_STATE_TONES,
|
|
17
17
|
} from '@sanity/ui/theme'
|
|
18
18
|
import {createThemeContract, createVar} from '@vanilla-extract/css'
|
|
19
19
|
|
|
20
20
|
import {_fromEntries} from './_fromEntries'
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
ColorPaletteTokens,
|
|
23
|
+
ColorPaletteVars,
|
|
24
|
+
RootThemeTokens,
|
|
25
|
+
ThemeContract,
|
|
26
|
+
ThemeTokens,
|
|
27
|
+
ThemeVars,
|
|
28
|
+
} from './types'
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
export const paletteVars = createThemeContract({
|
|
30
|
+
const paletteTokens: ColorPaletteTokens = {
|
|
25
31
|
black: '',
|
|
26
32
|
white: '',
|
|
27
|
-
|
|
28
|
-
// hues
|
|
29
33
|
..._fromEntries(
|
|
30
34
|
COLOR_HUES.map((h) => [
|
|
31
35
|
h,
|
|
@@ -34,9 +38,12 @@ export const paletteVars = createThemeContract({
|
|
|
34
38
|
},
|
|
35
39
|
]),
|
|
36
40
|
),
|
|
37
|
-
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @public */
|
|
44
|
+
export const paletteVars: ColorPaletteVars = createThemeContract(paletteTokens)
|
|
38
45
|
|
|
39
|
-
const
|
|
46
|
+
const themeTokens: ThemeTokens = {
|
|
40
47
|
avatar: {
|
|
41
48
|
focusRing: {
|
|
42
49
|
offset: '',
|
|
@@ -71,29 +78,20 @@ const _themeVars = createThemeContract({
|
|
|
71
78
|
color: {
|
|
72
79
|
// schemes
|
|
73
80
|
..._fromEntries(
|
|
74
|
-
|
|
81
|
+
COLOR_SCHEMES.map((s) => [
|
|
75
82
|
s,
|
|
76
83
|
{
|
|
77
84
|
..._fromEntries(
|
|
78
|
-
|
|
85
|
+
CARD_TONES.map((t) => [
|
|
79
86
|
t,
|
|
80
87
|
{
|
|
81
88
|
avatar: {
|
|
82
89
|
..._fromEntries(AVATAR_COLORS.map((c) => [c, {bg: '', fg: ''}])),
|
|
83
90
|
},
|
|
84
91
|
backdrop: '',
|
|
85
|
-
// bg: {
|
|
86
|
-
// '0': '',
|
|
87
|
-
// '4': '',
|
|
88
|
-
// },
|
|
89
|
-
// border: {
|
|
90
|
-
// '0': '',
|
|
91
|
-
// '4': '',
|
|
92
|
-
// },
|
|
93
92
|
code: {
|
|
94
93
|
bg: '',
|
|
95
94
|
fg: '',
|
|
96
|
-
|
|
97
95
|
token: {
|
|
98
96
|
atrule: '',
|
|
99
97
|
attrName: '',
|
|
@@ -133,34 +131,26 @@ const _themeVars = createThemeContract({
|
|
|
133
131
|
variable: '',
|
|
134
132
|
},
|
|
135
133
|
},
|
|
136
|
-
// fg: {
|
|
137
|
-
// '0': '',
|
|
138
|
-
// '4': '',
|
|
139
|
-
// },
|
|
140
|
-
|
|
141
134
|
focusRing: '',
|
|
142
135
|
link: {
|
|
143
136
|
fg: '',
|
|
144
137
|
},
|
|
145
|
-
|
|
146
138
|
shadow: {
|
|
147
139
|
outline: '',
|
|
148
140
|
umbra: '',
|
|
149
141
|
penumbra: '',
|
|
150
142
|
ambient: '',
|
|
151
143
|
},
|
|
152
|
-
|
|
153
144
|
skeleton: {
|
|
154
145
|
from: '',
|
|
155
146
|
to: '',
|
|
156
147
|
},
|
|
157
|
-
|
|
158
148
|
..._fromEntries(
|
|
159
149
|
COLOR_VARIANTS.map((v) => [
|
|
160
150
|
v,
|
|
161
151
|
{
|
|
162
152
|
..._fromEntries(
|
|
163
|
-
|
|
153
|
+
ELEMENT_TONES.map((t) => [
|
|
164
154
|
t,
|
|
165
155
|
{
|
|
166
156
|
bg: {
|
|
@@ -358,13 +348,15 @@ const _themeVars = createThemeContract({
|
|
|
358
348
|
space: {
|
|
359
349
|
..._fromEntries(SPACE.map((s) => [s, ''])),
|
|
360
350
|
},
|
|
361
|
-
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const _themeVars: ThemeContract<ThemeTokens> = createThemeContract(themeTokens)
|
|
362
354
|
|
|
363
355
|
/**
|
|
364
356
|
* Variables to be defined in a theme.
|
|
365
357
|
*
|
|
366
358
|
* @public */
|
|
367
|
-
export const themeVars = {
|
|
359
|
+
export const themeVars: ThemeContract<RootThemeTokens> = {
|
|
368
360
|
..._themeVars,
|
|
369
361
|
color: {
|
|
370
362
|
..._themeVars.color,
|
|
@@ -377,7 +369,7 @@ export const themeVars = {
|
|
|
377
369
|
*
|
|
378
370
|
* @public
|
|
379
371
|
*/
|
|
380
|
-
export const vars = {
|
|
372
|
+
export const vars: ThemeVars = {
|
|
381
373
|
...themeVars,
|
|
382
374
|
avatar: {
|
|
383
375
|
...themeVars.avatar,
|
|
@@ -391,6 +383,10 @@ export const vars = {
|
|
|
391
383
|
...themeVars.button,
|
|
392
384
|
boxShadow: createVar(),
|
|
393
385
|
},
|
|
386
|
+
card: {
|
|
387
|
+
...themeVars.card,
|
|
388
|
+
test: createVar(),
|
|
389
|
+
},
|
|
394
390
|
color: {
|
|
395
391
|
...themeVars.color,
|
|
396
392
|
avatar: {
|
|
@@ -486,13 +482,14 @@ export const vars = {
|
|
|
486
482
|
from: createVar(),
|
|
487
483
|
to: createVar(),
|
|
488
484
|
},
|
|
485
|
+
|
|
489
486
|
// variants
|
|
490
487
|
..._fromEntries(
|
|
491
488
|
COLOR_VARIANTS.map((v) => [
|
|
492
489
|
v,
|
|
493
490
|
{
|
|
494
491
|
..._fromEntries(
|
|
495
|
-
|
|
492
|
+
ELEMENT_TONES.map((t) => [
|
|
496
493
|
t,
|
|
497
494
|
{
|
|
498
495
|
bg: {
|
|
@@ -525,7 +522,7 @@ export const vars = {
|
|
|
525
522
|
|
|
526
523
|
// tones
|
|
527
524
|
..._fromEntries(
|
|
528
|
-
|
|
525
|
+
CARD_TONES.map((t) => [
|
|
529
526
|
t,
|
|
530
527
|
{
|
|
531
528
|
avatar: {
|
|
@@ -601,7 +598,7 @@ export const vars = {
|
|
|
601
598
|
v,
|
|
602
599
|
{
|
|
603
600
|
..._fromEntries(
|
|
604
|
-
|
|
601
|
+
ELEMENT_TONES.map((t) => [
|
|
605
602
|
t,
|
|
606
603
|
{
|
|
607
604
|
bg: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import {HUES, TINTS} from './constants'
|
|
2
|
+
import type {ColorToken, Hue, Tint} from './types'
|
|
3
3
|
|
|
4
4
|
const RE_PERCENTAGE = /^([0-9]+)%/
|
|
5
5
|
const RE_OPACITY = /^(1|0\.[0-9]+)?/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {black, hues, white} from '@sanity/color'
|
|
2
|
+
|
|
3
|
+
import {defaultColor} from './defaults/color'
|
|
4
|
+
import {defaultTheme} from './defaults/common'
|
|
5
|
+
import {defaultFonts} from './defaults/fonts'
|
|
6
|
+
import {resolveTokens} from './resolveTokens'
|
|
7
|
+
import type {Options, Theme} from './types'
|
|
8
|
+
|
|
9
|
+
/** @public */
|
|
10
|
+
export function buildTheme(options?: Options): Theme {
|
|
11
|
+
const tokens = resolveTokens({
|
|
12
|
+
...options?.tokens,
|
|
13
|
+
color: options?.tokens?.color ?? defaultColor,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
_version: 3,
|
|
18
|
+
_tokens: tokens,
|
|
19
|
+
avatar: defaultTheme.avatar,
|
|
20
|
+
button: defaultTheme.button,
|
|
21
|
+
card: defaultTheme.card,
|
|
22
|
+
color: tokens.color,
|
|
23
|
+
container: defaultTheme.container,
|
|
24
|
+
font: defaultFonts,
|
|
25
|
+
input: defaultTheme.input,
|
|
26
|
+
layer: defaultTheme.layer,
|
|
27
|
+
media: defaultTheme.media,
|
|
28
|
+
palette: {black, white, hues},
|
|
29
|
+
radius: defaultTheme.radius,
|
|
30
|
+
shadow: defaultTheme.shadow,
|
|
31
|
+
space: defaultTheme.space,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export const HUES = [
|
|
3
|
+
'gray',
|
|
4
|
+
'blue',
|
|
5
|
+
'purple',
|
|
6
|
+
'magenta',
|
|
7
|
+
'red',
|
|
8
|
+
'orange',
|
|
9
|
+
'yellow',
|
|
10
|
+
'green',
|
|
11
|
+
'cyan',
|
|
12
|
+
] as const
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export const TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export const AVATAR_SIZE = [0, 1, 2, 3] as const
|
|
19
|
+
|
|
20
|
+
/** @public */
|
|
21
|
+
export const CONTAINER_SCALE = [0, 1, 2, 3, 4, 5] as const
|
|
22
|
+
|
|
23
|
+
/** @public */
|
|
24
|
+
export const CONTAINER: [...typeof CONTAINER_SCALE, 'auto'] = [...CONTAINER_SCALE, 'auto']
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
export const RADIUS = [0, 1, 2, 3, 4, 5, 6] as const
|
|
28
|
+
|
|
29
|
+
/** @public */
|
|
30
|
+
export const SPACE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as const
|
|
31
|
+
|
|
32
|
+
/** @public */
|
|
33
|
+
export const FONT_CODE_SIZE = [0, 1, 2, 3, 4] as const
|
|
34
|
+
|
|
35
|
+
/** @public */
|
|
36
|
+
export const FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5] as const
|
|
37
|
+
|
|
38
|
+
/** @public */
|
|
39
|
+
export const FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5] as const
|
|
40
|
+
|
|
41
|
+
/** @public */
|
|
42
|
+
export const FONT_TEXT_SIZE = [0, 1, 2, 3, 4] as const
|
|
43
|
+
|
|
44
|
+
/** @public */
|
|
45
|
+
export const SHADOW = [0, 1, 2, 3, 4, 5] as const
|
|
46
|
+
|
|
47
|
+
/** @public */
|
|
48
|
+
export const COLOR_SCHEMES = ['light', 'dark'] as const
|
|
49
|
+
|
|
50
|
+
/** @public */
|
|
51
|
+
export const COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
52
|
+
|
|
53
|
+
/** @public */
|
|
54
|
+
export const AVATAR_COLORS = [
|
|
55
|
+
'gray',
|
|
56
|
+
'blue',
|
|
57
|
+
'purple',
|
|
58
|
+
'magenta',
|
|
59
|
+
'red',
|
|
60
|
+
'orange',
|
|
61
|
+
'yellow',
|
|
62
|
+
'green',
|
|
63
|
+
'cyan',
|
|
64
|
+
] as const
|
|
65
|
+
|
|
66
|
+
/** @public */
|
|
67
|
+
export const CARD_TONES = [
|
|
68
|
+
'transparent',
|
|
69
|
+
'default',
|
|
70
|
+
'neutral',
|
|
71
|
+
'primary', // selections
|
|
72
|
+
'suggest',
|
|
73
|
+
'positive',
|
|
74
|
+
'caution',
|
|
75
|
+
'critical',
|
|
76
|
+
] as const
|
|
77
|
+
|
|
78
|
+
/** @public */
|
|
79
|
+
export const ELEMENT_TONES = [
|
|
80
|
+
'default',
|
|
81
|
+
'neutral',
|
|
82
|
+
'primary', // selections
|
|
83
|
+
'suggest',
|
|
84
|
+
'positive',
|
|
85
|
+
'caution',
|
|
86
|
+
'critical',
|
|
87
|
+
] as const
|
|
88
|
+
|
|
89
|
+
/** @public */
|
|
90
|
+
export const BUTTON_MODES = ['default', 'ghost', 'bleed'] as const
|