@sanity/ui 2.16.22 → 2.16.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/_visual-editing.js +115 -1040
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +115 -1040
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +411 -351
- package/dist/_visual-editing.d.ts +411 -351
- package/dist/index.d.mts +1107 -930
- package/dist/index.d.ts +1107 -930
- package/dist/index.js +64 -155
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -155
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +769 -681
- package/dist/theme.d.ts +769 -681
- package/dist/theme.js +47 -0
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +47 -0
- package/dist/theme.mjs.map +1 -1
- package/exports/_visual-editing.ts +1 -0
- package/package.json +49 -162
- package/src/core/_compat.ts +30 -0
- package/src/core/components/autocomplete/autocomplete.tsx +11 -4
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
- package/src/core/components/dialog/dialog.tsx +3 -0
- package/src/core/components/hotkeys/hotkeys.tsx +1 -0
- package/src/core/components/menu/menu.test.tsx +6 -4
- package/src/core/components/menu/menu.tsx +3 -2
- package/src/core/components/menu/menuButton.tsx +8 -0
- package/src/core/components/menu/menuGroup.tsx +5 -2
- package/src/core/components/menu/menuItem.tsx +4 -0
- package/src/core/components/menu/useMenuController.ts +6 -4
- package/src/core/components/skeleton/skeleton.tsx +2 -1
- package/src/core/components/tab/tab.tsx +1 -0
- package/src/core/components/tab/tabList.tsx +1 -0
- package/src/core/components/toast/toast.test.tsx +9 -4
- package/src/core/components/tree/tree.tsx +1 -0
- package/src/core/components/tree/treeGroup.tsx +1 -0
- package/src/core/components/tree/treeItem.tsx +2 -2
- package/src/core/hooks/useClickOutside.test.tsx +43 -15
- package/src/core/hooks/useClickOutside.ts +1 -1
- package/src/core/hooks/useClickOutsideEvent.test.tsx +8 -4
- package/src/core/hooks/useDelayed.test.ts +7 -6
- package/src/core/hooks/useElementRect/useElementRect.ts +1 -0
- package/src/core/hooks/useForwardedRef.ts +1 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +2 -1
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersDark.test.tsx +3 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +3 -1
- package/src/core/lib/createGlobalScopedContext.ts +1 -0
- package/src/core/lib/globalScope.ts +1 -0
- package/src/core/observers/elementSizeObserver.ts +1 -0
- package/src/core/primitives/avatar/avatar.tsx +1 -2
- package/src/core/primitives/avatar/avatarStack.tsx +1 -0
- package/src/core/primitives/badge/badge.test.tsx +3 -2
- package/src/core/primitives/badge/badge.tsx +2 -1
- package/src/core/primitives/box/box.tsx +2 -1
- package/src/core/primitives/button/button.test.tsx +3 -2
- package/src/core/primitives/button/button.tsx +2 -0
- package/src/core/primitives/button/styles.ts +1 -0
- package/src/core/primitives/card/card.tsx +1 -5
- package/src/core/primitives/card/types.ts +1 -0
- package/src/core/primitives/code/refractor.tsx +2 -0
- package/src/core/primitives/flex/flex.tsx +1 -3
- package/src/core/primitives/inline/inline.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +12 -3
- package/src/core/primitives/popover/popoverCard.tsx +1 -0
- package/src/core/primitives/popover/types.ts +0 -1
- package/src/core/primitives/stack/styles.ts +1 -0
- package/src/core/primitives/textInput/textInput.tsx +2 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +82 -49
- package/src/core/primitives/tooltip/tooltip.tsx +5 -0
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +2 -0
- package/src/core/styles/flex/types.ts +0 -1
- package/src/core/styles/font/responsiveFont.ts +0 -3
- package/src/core/styles/font/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +1 -0
- package/src/core/styles/margin/marginStyle.ts +1 -0
- package/src/core/styles/margin/marginsStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.ts +1 -0
- package/src/core/theme/theme.test.tsx +7 -3
- package/src/core/theme/useRootTheme.ts +1 -0
- package/src/core/theme/useTheme.ts +2 -0
- package/src/core/utils/arrow/arrow.tsx +1 -0
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +9 -4
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +1 -0
- package/src/core/utils/getElementRef.ts +5 -0
- package/src/core/utils/layer/getLayerContext.test.ts +2 -0
- package/src/core/utils/layer/layer.test.tsx +9 -4
- package/src/core/utils/layer/layer.tsx +1 -0
- package/src/core/utils/layer/useLayer.ts +2 -0
- package/src/core/utils/portal/portal.test.tsx +9 -4
- package/src/core/utils/portal/portalProvider.tsx +4 -3
- package/src/core/utils/virtualList/virtualList.tsx +2 -1
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +10 -0
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +4 -0
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +5 -0
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +5 -0
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +6 -0
- package/src/theme/build/_deprecated/color/color.test.ts +5 -1
- package/src/theme/build/_deprecated/color/defaults.ts +1 -0
- package/src/theme/build/_deprecated/color/factory.ts +36 -0
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +5 -0
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +4 -0
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +3 -0
- package/src/theme/build/buildColorTheme.test.ts +2 -0
- package/src/theme/build/buildColorTheme.ts +7 -0
- package/src/theme/build/buildTheme.test.ts +2 -0
- package/src/theme/build/lib/color-fns/color-fns.test.ts +3 -1
- package/src/theme/build/merge.ts +5 -0
- package/src/theme/build/mixThemeColor.test.ts +2 -0
- package/src/theme/build/renderColorTheme.ts +6 -0
- package/src/theme/build/renderColorValue.ts +0 -2
- package/src/theme/build/resolveColorTokens.ts +6 -0
- package/src/theme/build/theme.test.ts +2 -0
- package/src/theme/config/helpers.ts +5 -0
- package/src/theme/config/system.ts +2 -0
- package/src/theme/config/tokens/color/types.ts +6 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.ts +1 -0
- package/src/theme/getScopedTheme.ts +5 -0
- package/src/theme/system/color/_helpers.ts +4 -0
- package/src/theme/system/theme.ts +4 -0
- package/src/theme/system/v0/color/_system.ts +1 -0
- package/src/theme/system/v0/color/button.ts +14 -0
- package/src/theme/system/v0/color/card.ts +6 -0
- package/src/theme/system/v0/color/color.ts +11 -0
- package/src/theme/system/v0/color/input.ts +6 -0
- package/src/theme/system/v0/color/muted.ts +11 -0
- package/src/theme/system/v0/color/selectable.ts +11 -0
- package/src/theme/system/v0/color/solid.ts +11 -0
- package/src/theme/system/v0/color/spot.ts +1 -0
- package/src/theme/versioning/getTheme_v2.ts +15 -0
- package/src/theme/versioning/themeColor_v0_v2.ts +7 -0
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -0
- package/src/theme/versioning/v0_v2.ts +13 -1
- package/src/theme/versioning/v2_v0.ts +15 -0
- package/src/core/__workshop__/constants.ts +0 -293
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
- package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/core/components/dialog/__workshop__/index.ts +0 -19
- package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/core/components/dialog/__workshop__/position.tsx +0 -30
- package/src/core/components/dialog/__workshop__/props.tsx +0 -75
- package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/core/components/menu/__workshop__/groups.tsx +0 -156
- package/src/core/components/menu/__workshop__/index.ts +0 -89
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -65
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/core/components/skeleton/__workshop__/index.ts +0 -11
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/core/components/tab/__workshop__/example.tsx +0 -79
- package/src/core/components/tab/__workshop__/index.ts +0 -14
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/index.ts +0 -19
- package/src/core/components/toast/__workshop__/toast.tsx +0 -26
- package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/core/components/tree/__workshop__/basic.tsx +0 -105
- package/src/core/components/tree/__workshop__/index.ts +0 -21
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
- package/src/core/primitives/badge/__workshop__/index.ts +0 -19
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/core/primitives/box/__workshop__/index.ts +0 -19
- package/src/core/primitives/box/__workshop__/props.tsx +0 -20
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
- package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/core/primitives/button/__workshop__/index.ts +0 -59
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/core/primitives/button/__workshop__/props.tsx +0 -55
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/core/primitives/card/__workshop__/index.ts +0 -18
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/core/primitives/card/__workshop__/props.tsx +0 -53
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/core/primitives/code/__workshop__/index.ts +0 -19
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/code/__workshop__/props.tsx +0 -21
- package/src/core/primitives/container/__workshop__/example.tsx +0 -20
- package/src/core/primitives/container/__workshop__/index.ts +0 -8
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/__workshop__/index.ts +0 -11
- package/src/core/primitives/grid/__workshop__/index.ts +0 -10
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/index.ts +0 -19
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/inline/__workshop__/index.ts +0 -8
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/core/primitives/label/__workshop__/index.ts +0 -19
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
- package/src/core/primitives/popover/__workshop__/index.ts +0 -49
- package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/core/primitives/radio/__workshop__/index.ts +0 -11
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/select/__workshop__/index.ts +0 -11
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
- package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/core/primitives/switch/__workshop__/index.ts +0 -11
- package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
- package/src/core/primitives/text/__workshop__/example.tsx +0 -39
- package/src/core/primitives/text/__workshop__/index.ts +0 -24
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -465
- package/src/core/theme/__workshop__/canvas.tsx +0 -352
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -408
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/core/utils/layer/__workshop__/index.ts +0 -24
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/core/utils/portal/__workshop__/index.ts +0 -14
- package/src/core/utils/portal/__workshop__/named.tsx +0 -63
- package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
2
|
-
import {useRef, useState} from 'react'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
WORKSHOP_CONTAINER_WIDTH_OPTIONS,
|
|
6
|
-
WORKSHOP_PLACEMENT_OPTIONS,
|
|
7
|
-
WORKSHOP_RADIUS_OPTIONS,
|
|
8
|
-
} from '../../../__workshop__/constants'
|
|
9
|
-
import {BoundaryElementProvider, PortalProvider} from '../../../utils'
|
|
10
|
-
import {Button} from '../../button'
|
|
11
|
-
import {Card} from '../../card'
|
|
12
|
-
import {Text} from '../../text'
|
|
13
|
-
import {Popover} from '../popover'
|
|
14
|
-
import {PopoverUpdateCallback} from '../types'
|
|
15
|
-
|
|
16
|
-
export default function TestStory(): React.JSX.Element {
|
|
17
|
-
const [portalElement, setPortalElement] = useState<HTMLDivElement | null>(null)
|
|
18
|
-
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
19
|
-
|
|
20
|
-
const mount = useBoolean('Mount', true)
|
|
21
|
-
const arrow = useBoolean('Arrow', true)
|
|
22
|
-
const constrainSize = useBoolean('Constrain size', true)
|
|
23
|
-
const matchReferenceWidth = useBoolean('Match reference width', false)
|
|
24
|
-
const open = useBoolean('Open', true)
|
|
25
|
-
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
|
|
26
|
-
const portal = useBoolean('Render in portal', true)
|
|
27
|
-
const preventOverflow = useBoolean('Prevent overflow', true)
|
|
28
|
-
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
29
|
-
const referenceWide = useBoolean('Reference wide?', false)
|
|
30
|
-
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 'auto')
|
|
31
|
-
|
|
32
|
-
const text = useText('Text', 'Test')
|
|
33
|
-
|
|
34
|
-
const updateRef = useRef<PopoverUpdateCallback>(undefined)
|
|
35
|
-
|
|
36
|
-
const button = (
|
|
37
|
-
<Button text="reference" selected style={{width: referenceWide ? 300 : undefined}} />
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Card
|
|
42
|
-
ref={setBoundaryElement}
|
|
43
|
-
shadow={2}
|
|
44
|
-
style={{
|
|
45
|
-
position: 'absolute',
|
|
46
|
-
top: 50,
|
|
47
|
-
right: 50,
|
|
48
|
-
bottom: 50,
|
|
49
|
-
left: 50,
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
data-portal=""
|
|
54
|
-
ref={setPortalElement}
|
|
55
|
-
style={{
|
|
56
|
-
position: 'absolute',
|
|
57
|
-
top: 0,
|
|
58
|
-
right: 0,
|
|
59
|
-
bottom: 0,
|
|
60
|
-
left: 0,
|
|
61
|
-
overflow: 'hidden',
|
|
62
|
-
pointerEvents: 'none',
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
|
|
66
|
-
<div style={{width: '100%', height: '100%', overflow: 'auto'}}>
|
|
67
|
-
<div style={{padding: '150vh'}}>
|
|
68
|
-
<PortalProvider element={portalElement}>
|
|
69
|
-
<BoundaryElementProvider element={boundaryElement}>
|
|
70
|
-
{!mount && button}
|
|
71
|
-
{mount && (
|
|
72
|
-
<Popover
|
|
73
|
-
arrow={arrow}
|
|
74
|
-
content={<Text size={1}>{text}</Text>}
|
|
75
|
-
constrainSize={constrainSize}
|
|
76
|
-
fallbackPlacements={['left', 'bottom', 'right', 'top']}
|
|
77
|
-
matchReferenceWidth={matchReferenceWidth}
|
|
78
|
-
open={open}
|
|
79
|
-
overflow="hidden"
|
|
80
|
-
padding={3}
|
|
81
|
-
placement={placement}
|
|
82
|
-
portal={portal}
|
|
83
|
-
preventOverflow={preventOverflow}
|
|
84
|
-
radius={radius}
|
|
85
|
-
updateRef={updateRef}
|
|
86
|
-
width={width}
|
|
87
|
-
>
|
|
88
|
-
{button}
|
|
89
|
-
</Popover>
|
|
90
|
-
)}
|
|
91
|
-
</BoundaryElementProvider>
|
|
92
|
-
</PortalProvider>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</Card>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/popover',
|
|
6
|
-
title: 'Popover',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'test',
|
|
10
|
-
title: 'Test',
|
|
11
|
-
component: lazy(() => import('./TestStory')),
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'plain',
|
|
15
|
-
title: 'Plain',
|
|
16
|
-
component: lazy(() => import('./PlainStory')),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'recursive',
|
|
20
|
-
title: 'Recursive',
|
|
21
|
-
component: lazy(() => import('./RecursiveStory')),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'match-ref-width',
|
|
25
|
-
title: 'Match reference width',
|
|
26
|
-
component: lazy(() => import('./MatchReferenceWidthStory')),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'margins',
|
|
30
|
-
title: 'Margins',
|
|
31
|
-
component: lazy(() => import('./MarginsStory')),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'aligned',
|
|
35
|
-
title: 'Aligned',
|
|
36
|
-
component: lazy(() => import('./AlignedStory')),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'openOnMountStory',
|
|
40
|
-
title: 'Open on mount',
|
|
41
|
-
component: lazy(() => import('./OpenOnMountStory')),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'side-panel',
|
|
45
|
-
title: 'Side panel',
|
|
46
|
-
component: lazy(() => import('./SidePanelStory')),
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
})
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {Box, Container, Flex, Radio, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
|
-
import {useCallback, useState} from 'react'
|
|
4
|
-
|
|
5
|
-
export default function ExampleStory() {
|
|
6
|
-
const [value, setValue] = useState('first-option')
|
|
7
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
8
|
-
const readOnly = useBoolean('Read only', false, 'Props')
|
|
9
|
-
|
|
10
|
-
const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
11
|
-
setValue(event.target.value)
|
|
12
|
-
}, [])
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Flex align="center" height="fill" justify="center" padding={[3, 4, 5]} sizing="border">
|
|
16
|
-
<Container width={0}>
|
|
17
|
-
<Stack space={3}>
|
|
18
|
-
<Flex align="center" as="label">
|
|
19
|
-
<Radio
|
|
20
|
-
checked={value === 'first-option'}
|
|
21
|
-
disabled={disabled}
|
|
22
|
-
name="name"
|
|
23
|
-
onChange={handleChange}
|
|
24
|
-
readOnly={readOnly}
|
|
25
|
-
value="first-option"
|
|
26
|
-
/>
|
|
27
|
-
<Box marginLeft={2}>
|
|
28
|
-
<Text>First option</Text>
|
|
29
|
-
</Box>
|
|
30
|
-
</Flex>
|
|
31
|
-
|
|
32
|
-
<Flex align="center" as="label">
|
|
33
|
-
<Radio
|
|
34
|
-
checked={value === 'second-option'}
|
|
35
|
-
disabled={disabled}
|
|
36
|
-
name="name"
|
|
37
|
-
onChange={handleChange}
|
|
38
|
-
readOnly={readOnly}
|
|
39
|
-
value="second-option"
|
|
40
|
-
/>
|
|
41
|
-
<Box marginLeft={2}>
|
|
42
|
-
<Text>Second option</Text>
|
|
43
|
-
</Box>
|
|
44
|
-
</Flex>
|
|
45
|
-
|
|
46
|
-
<Flex align="center" as="label">
|
|
47
|
-
<Radio
|
|
48
|
-
checked={value === 'third-option'}
|
|
49
|
-
disabled={disabled}
|
|
50
|
-
name="name"
|
|
51
|
-
onChange={handleChange}
|
|
52
|
-
readOnly={readOnly}
|
|
53
|
-
value="third-option"
|
|
54
|
-
/>
|
|
55
|
-
<Box marginLeft={2}>
|
|
56
|
-
<Text>Third option</Text>
|
|
57
|
-
</Box>
|
|
58
|
-
</Flex>
|
|
59
|
-
</Stack>
|
|
60
|
-
</Container>
|
|
61
|
-
</Flex>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/radio',
|
|
6
|
-
title: 'Radio',
|
|
7
|
-
stories: [
|
|
8
|
-
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
|
-
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
|
-
],
|
|
11
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {Flex, Radio} from '@sanity/ui'
|
|
2
|
-
import {useAction, useBoolean} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
export default function PlainStory() {
|
|
5
|
-
const checked = useBoolean('Checked', false, 'Props')
|
|
6
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
7
|
-
const id = 'radioStory'
|
|
8
|
-
const name = 'radioStory'
|
|
9
|
-
const onBlur = useAction('onBlur')
|
|
10
|
-
const onChange = useAction('onChange')
|
|
11
|
-
const onFocus = useAction('onFocus')
|
|
12
|
-
const readOnly = useBoolean('Read only', false, 'Props')
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Flex align="center" height="fill" justify="center" padding={[3, 4, 5]} sizing="border">
|
|
16
|
-
<Radio
|
|
17
|
-
checked={checked}
|
|
18
|
-
disabled={disabled}
|
|
19
|
-
id={id}
|
|
20
|
-
name={name}
|
|
21
|
-
onBlur={onBlur}
|
|
22
|
-
onChange={onChange}
|
|
23
|
-
onFocus={onFocus}
|
|
24
|
-
readOnly={readOnly}
|
|
25
|
-
/>
|
|
26
|
-
</Flex>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/select',
|
|
6
|
-
title: 'Select',
|
|
7
|
-
stories: [
|
|
8
|
-
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
|
-
{name: 'read-only', title: 'Read-only', component: lazy(() => import('./readOnly'))},
|
|
10
|
-
],
|
|
11
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {Card, Container, Label, Select, Stack} from '@sanity/ui'
|
|
2
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
export default function PlainStory() {
|
|
5
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
6
|
-
const readOnly = useBoolean('Read only', false, 'Props')
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<Container width={0}>
|
|
10
|
-
<Card padding={4}>
|
|
11
|
-
<Stack space={3}>
|
|
12
|
-
<Label as="label" htmlFor="select">
|
|
13
|
-
Select
|
|
14
|
-
</Label>
|
|
15
|
-
|
|
16
|
-
<Select disabled={disabled} id="select-example" readOnly={readOnly}>
|
|
17
|
-
<option value="a">Option A</option>
|
|
18
|
-
<option value="b">Option B</option>
|
|
19
|
-
<option value="c">Option C</option>
|
|
20
|
-
<option value="d">Option D</option>
|
|
21
|
-
<option value="e">Option E</option>
|
|
22
|
-
</Select>
|
|
23
|
-
</Stack>
|
|
24
|
-
</Card>
|
|
25
|
-
</Container>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {Card, Container, Label, Select, Stack} from '@sanity/ui'
|
|
2
|
-
|
|
3
|
-
export default function ReadOnlyStory() {
|
|
4
|
-
return (
|
|
5
|
-
<Container width={0}>
|
|
6
|
-
<Card padding={4}>
|
|
7
|
-
<Stack space={3}>
|
|
8
|
-
<Label as="label" htmlFor="select">
|
|
9
|
-
Select
|
|
10
|
-
</Label>
|
|
11
|
-
|
|
12
|
-
<Select id="select-example" readOnly>
|
|
13
|
-
<option value="a">Option A</option>
|
|
14
|
-
<option value="b">Option B</option>
|
|
15
|
-
<option value="c">Option C</option>
|
|
16
|
-
<option value="d">Option D</option>
|
|
17
|
-
<option value="e">Option E</option>
|
|
18
|
-
</Select>
|
|
19
|
-
</Stack>
|
|
20
|
-
</Card>
|
|
21
|
-
</Container>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {Flex, Spinner} from '@sanity/ui'
|
|
2
|
-
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
import {WORKSHOP_TEXT_SIZE_OPTIONS} from '../../../__workshop__/constants'
|
|
5
|
-
|
|
6
|
-
export default function Props() {
|
|
7
|
-
const muted = useBoolean('Muted', false, 'Props')
|
|
8
|
-
const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Flex align="center" height="fill" justify="center">
|
|
12
|
-
<Spinner muted={muted} size={size} />
|
|
13
|
-
</Flex>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/spinner',
|
|
6
|
-
title: 'Spinner',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'props',
|
|
10
|
-
title: 'Props',
|
|
11
|
-
component: lazy(() => import('./Props')),
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/stack',
|
|
6
|
-
title: 'Stack',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'plain',
|
|
10
|
-
title: 'Plain',
|
|
11
|
-
component: lazy(() => import('./plain')),
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import {useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
import {WORKSHOP_SPACE_OPTIONS} from '../../../__workshop__/constants'
|
|
5
|
-
|
|
6
|
-
export default function PlainStory() {
|
|
7
|
-
return (
|
|
8
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
|
-
<Container width={0}>
|
|
10
|
-
<Stack space={useSelect('Space', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}>
|
|
11
|
-
<Card padding={[2, 3, 4]} shadow={1}>
|
|
12
|
-
<Text align="center" muted>
|
|
13
|
-
Stack item
|
|
14
|
-
</Text>
|
|
15
|
-
</Card>
|
|
16
|
-
|
|
17
|
-
<Card padding={[2, 3, 4]} shadow={1}>
|
|
18
|
-
<Text align="center" muted>
|
|
19
|
-
Stack item
|
|
20
|
-
</Text>
|
|
21
|
-
</Card>
|
|
22
|
-
|
|
23
|
-
<Card padding={[2, 3, 4]} shadow={1}>
|
|
24
|
-
<Text align="center" muted>
|
|
25
|
-
Stack item
|
|
26
|
-
</Text>
|
|
27
|
-
</Card>
|
|
28
|
-
</Stack>
|
|
29
|
-
</Container>
|
|
30
|
-
</Flex>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {Box, Flex, Switch, Text} from '@sanity/ui'
|
|
2
|
-
import {useCallback, useState} from 'react'
|
|
3
|
-
|
|
4
|
-
export default function ExampleStory() {
|
|
5
|
-
const [checked, setChecked] = useState<boolean | undefined>(undefined)
|
|
6
|
-
const indeterminate = checked === undefined
|
|
7
|
-
const handleChange = useCallback((event: React.FormEvent<HTMLInputElement>) => {
|
|
8
|
-
setChecked(event.currentTarget.checked)
|
|
9
|
-
}, [])
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
13
|
-
<Flex align="center" as="label">
|
|
14
|
-
<Switch checked={checked || false} indeterminate={indeterminate} onChange={handleChange} />
|
|
15
|
-
<Box marginLeft={3}>
|
|
16
|
-
<Text size={1} weight="medium">
|
|
17
|
-
Label
|
|
18
|
-
</Text>
|
|
19
|
-
</Box>
|
|
20
|
-
</Flex>
|
|
21
|
-
</Flex>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/switch',
|
|
6
|
-
title: 'Switch',
|
|
7
|
-
stories: [
|
|
8
|
-
{name: 'props', title: 'Props', component: lazy(() => import('./props'))},
|
|
9
|
-
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
|
-
],
|
|
11
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {Flex, Switch} from '@sanity/ui'
|
|
2
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
|
-
import {useCallback} from 'react'
|
|
4
|
-
|
|
5
|
-
export default function PropsStory() {
|
|
6
|
-
const checked = useBoolean('Checked', false)
|
|
7
|
-
const indeterminate = useBoolean('Indeterminate', false)
|
|
8
|
-
const readOnly = useBoolean('Read only', false)
|
|
9
|
-
const handleChange = useCallback(() => undefined, [])
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
13
|
-
<Switch
|
|
14
|
-
checked={checked}
|
|
15
|
-
indeterminate={indeterminate}
|
|
16
|
-
onChange={handleChange}
|
|
17
|
-
readOnly={readOnly}
|
|
18
|
-
/>
|
|
19
|
-
</Flex>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {Flex, Text, ThemeProps} from '@sanity/ui'
|
|
2
|
-
import {getTheme_v2, ThemeColorAvatarColorKey, ThemeColorSpotKey} from '@sanity/ui/theme'
|
|
3
|
-
import {useSelect} from '@sanity/ui-workshop'
|
|
4
|
-
import {css, styled} from 'styled-components'
|
|
5
|
-
|
|
6
|
-
import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../__workshop__/constants'
|
|
7
|
-
|
|
8
|
-
const ColoredText = styled(Text)<{$color?: ThemeColorSpotKey}>((
|
|
9
|
-
props: {
|
|
10
|
-
$color?: ThemeColorAvatarColorKey
|
|
11
|
-
} & ThemeProps,
|
|
12
|
-
) => {
|
|
13
|
-
const {color} = getTheme_v2(props.theme)
|
|
14
|
-
|
|
15
|
-
return css`
|
|
16
|
-
color: ${color.avatar[props.$color || 'gray'].bg};
|
|
17
|
-
`
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
export default function ColoredTextStory() {
|
|
21
|
-
const color = useSelect('Color', WORKSHOP_SPOT_COLOR_OPTIONS, 'gray')
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
25
|
-
<ColoredText align="center" $color={color} size={4} weight="bold">
|
|
26
|
-
{color}
|
|
27
|
-
</ColoredText>
|
|
28
|
-
</Flex>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {Container, Flex, Text} from '@sanity/ui'
|
|
2
|
-
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
WORKSHOP_TEXT_ALIGN_OPTIONS,
|
|
6
|
-
WORKSHOP_TEXT_OVERFLOW_OPTIONS,
|
|
7
|
-
WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
8
|
-
WORKSHOP_TEXT_WEIGHT_OPTIONS,
|
|
9
|
-
} from '../../../__workshop__/constants'
|
|
10
|
-
|
|
11
|
-
export default function TextStory() {
|
|
12
|
-
const accent = useBoolean('Accent', false, 'Props')
|
|
13
|
-
const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS, '', 'Props') || undefined
|
|
14
|
-
const muted = useBoolean('Muted', false, 'Props')
|
|
15
|
-
const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS, 1, 'Props')
|
|
16
|
-
const text = useText('Text', 'Hello, world', 'Props')
|
|
17
|
-
|
|
18
|
-
const textOverflow =
|
|
19
|
-
useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS, undefined, 'Props') || undefined
|
|
20
|
-
|
|
21
|
-
const weight = useSelect('Weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
25
|
-
<Container width={0}>
|
|
26
|
-
<Text
|
|
27
|
-
accent={accent}
|
|
28
|
-
align={align}
|
|
29
|
-
muted={muted}
|
|
30
|
-
size={size}
|
|
31
|
-
textOverflow={textOverflow}
|
|
32
|
-
weight={weight}
|
|
33
|
-
>
|
|
34
|
-
{text}
|
|
35
|
-
</Text>
|
|
36
|
-
</Container>
|
|
37
|
-
</Flex>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/text',
|
|
6
|
-
title: 'Text',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'default',
|
|
10
|
-
title: 'Text',
|
|
11
|
-
component: lazy(() => import('./example')),
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'colored',
|
|
15
|
-
title: 'Colored text',
|
|
16
|
-
component: lazy(() => import('./colored')),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'optical-alignment',
|
|
20
|
-
title: 'Optical alignment',
|
|
21
|
-
component: lazy(() => import('./opticalAlignment')),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
})
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {AddCircleIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Card, Flex, Stack, Text} from '@sanity/ui'
|
|
3
|
-
|
|
4
|
-
export default function OpticalAlignment() {
|
|
5
|
-
return (
|
|
6
|
-
<Box padding={[4, 5, 6]}>
|
|
7
|
-
<Stack space={1}>
|
|
8
|
-
<Flex>
|
|
9
|
-
<Card padding={0} tone="neutral">
|
|
10
|
-
<Text size={4}>Hamburgefonstiv M</Text>
|
|
11
|
-
</Card>
|
|
12
|
-
</Flex>
|
|
13
|
-
|
|
14
|
-
<Flex>
|
|
15
|
-
<Card padding={0} tone="neutral">
|
|
16
|
-
<Text size={3}>Hamburgefonstiv M</Text>
|
|
17
|
-
</Card>
|
|
18
|
-
</Flex>
|
|
19
|
-
|
|
20
|
-
<Flex>
|
|
21
|
-
<Card padding={0} tone="neutral">
|
|
22
|
-
<Text size={2}>Hamburgefonstiv M</Text>
|
|
23
|
-
</Card>
|
|
24
|
-
</Flex>
|
|
25
|
-
|
|
26
|
-
<Flex>
|
|
27
|
-
<Card padding={0} tone="neutral">
|
|
28
|
-
<Text size={1}>Hamburgefonstiv M</Text>
|
|
29
|
-
</Card>
|
|
30
|
-
</Flex>
|
|
31
|
-
|
|
32
|
-
<Flex>
|
|
33
|
-
<Card padding={0} tone="neutral">
|
|
34
|
-
<Text size={0}>Hamburgefonstiv M</Text>
|
|
35
|
-
</Card>
|
|
36
|
-
</Flex>
|
|
37
|
-
|
|
38
|
-
<Flex>
|
|
39
|
-
<Card padding={2} tone="neutral">
|
|
40
|
-
<Text>
|
|
41
|
-
<AddCircleIcon />
|
|
42
|
-
</Text>
|
|
43
|
-
</Card>
|
|
44
|
-
</Flex>
|
|
45
|
-
</Stack>
|
|
46
|
-
</Box>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/text-area',
|
|
6
|
-
title: 'TextArea',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'plain',
|
|
10
|
-
title: 'Plain',
|
|
11
|
-
component: lazy(() => import('./plain')),
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
})
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {Card, Container, Flex, Stack, Text, TextArea} from '@sanity/ui'
|
|
2
|
-
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
WORKSHOP_CARD_TONE_OPTIONS,
|
|
6
|
-
WORKSHOP_FONT_WEIGHT_OPTIONS,
|
|
7
|
-
WORKSHOP_RADIUS_OPTIONS,
|
|
8
|
-
WORKSHOP_SPACE_OPTIONS,
|
|
9
|
-
WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
10
|
-
} from '../../../__workshop__/constants'
|
|
11
|
-
|
|
12
|
-
export default function PlainStory() {
|
|
13
|
-
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
14
|
-
|
|
15
|
-
const border = useBoolean('Border', true, 'Props')
|
|
16
|
-
const customValidity = useText('Custom validity', '', 'Props') || undefined
|
|
17
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
18
|
-
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2, 'Props')
|
|
19
|
-
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
20
|
-
const placeholder = useText('Placeholder', '', 'Props') || undefined
|
|
21
|
-
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2, 'Props')
|
|
22
|
-
const readOnly = useBoolean('Read only', false, 'Props')
|
|
23
|
-
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS, undefined, 'Props')
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
27
|
-
<Container width={0}>
|
|
28
|
-
<Card padding={3} tone={tone}>
|
|
29
|
-
<Stack space={3}>
|
|
30
|
-
<Text as="label" htmlFor="text-area-example" size={1} weight="medium">
|
|
31
|
-
TextArea
|
|
32
|
-
</Text>
|
|
33
|
-
<TextArea
|
|
34
|
-
border={border}
|
|
35
|
-
customValidity={customValidity}
|
|
36
|
-
disabled={disabled}
|
|
37
|
-
fontSize={fontSize}
|
|
38
|
-
id="text-area-example"
|
|
39
|
-
padding={padding}
|
|
40
|
-
placeholder={placeholder}
|
|
41
|
-
radius={radius}
|
|
42
|
-
readOnly={readOnly}
|
|
43
|
-
weight={weight}
|
|
44
|
-
/>
|
|
45
|
-
</Stack>
|
|
46
|
-
</Card>
|
|
47
|
-
</Container>
|
|
48
|
-
</Flex>
|
|
49
|
-
)
|
|
50
|
-
}
|