@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,134 +0,0 @@
|
|
|
1
|
-
import {ErrorOutlineIcon} from '@sanity/icons'
|
|
2
|
-
import {
|
|
3
|
-
BoundaryElementProvider,
|
|
4
|
-
Box,
|
|
5
|
-
Button,
|
|
6
|
-
Card,
|
|
7
|
-
Flex,
|
|
8
|
-
Menu,
|
|
9
|
-
MenuButton,
|
|
10
|
-
MenuItem,
|
|
11
|
-
SelectableTone,
|
|
12
|
-
Text,
|
|
13
|
-
} from '@sanity/ui'
|
|
14
|
-
import {useState} from 'react'
|
|
15
|
-
|
|
16
|
-
import {MenuButtonProps} from '../menuButton'
|
|
17
|
-
|
|
18
|
-
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
19
|
-
constrainSize: true,
|
|
20
|
-
placement: 'bottom',
|
|
21
|
-
portal: true,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const items: {tone: SelectableTone; message: string}[] = [
|
|
25
|
-
{
|
|
26
|
-
tone: 'critical',
|
|
27
|
-
message: 'Critical message',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
tone: 'critical',
|
|
31
|
-
message: 'Critical message',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
tone: 'critical',
|
|
35
|
-
message: 'Critical message',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
tone: 'critical',
|
|
39
|
-
message: 'Critical message',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
tone: 'critical',
|
|
43
|
-
message: 'Critical message',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
tone: 'critical',
|
|
47
|
-
message: 'Critical message',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
tone: 'critical',
|
|
51
|
-
message: 'Critical message',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
tone: 'critical',
|
|
55
|
-
message: 'Critical message',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
tone: 'critical',
|
|
59
|
-
message: 'Critical message',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
tone: 'critical',
|
|
63
|
-
message: 'Critical message',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
tone: 'critical',
|
|
67
|
-
message: 'Critical message',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
tone: 'critical',
|
|
71
|
-
message: 'Critical message',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
tone: 'critical',
|
|
75
|
-
message: 'Critical message',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
tone: 'critical',
|
|
79
|
-
message: 'Critical message',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
tone: 'critical',
|
|
83
|
-
message: 'Critical message',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
tone: 'critical',
|
|
87
|
-
message: 'Critical message',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
tone: 'critical',
|
|
91
|
-
message: 'Critical message',
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
export default function ConstrainedInBoundaryStory() {
|
|
96
|
-
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<Box height="fill" padding={[4, 5, 6]} sizing="border">
|
|
100
|
-
<Card height="fill" shadow={1}>
|
|
101
|
-
<Flex height="fill">
|
|
102
|
-
<Card flex={1} padding={4}>
|
|
103
|
-
<Text>Pane</Text>
|
|
104
|
-
</Card>
|
|
105
|
-
<Card borderLeft flex={1} padding={2} ref={setBoundaryElement}>
|
|
106
|
-
<Flex>
|
|
107
|
-
<Box flex={1} padding={3}>
|
|
108
|
-
<Text>Pane</Text>
|
|
109
|
-
</Box>
|
|
110
|
-
<Box>
|
|
111
|
-
<BoundaryElementProvider element={boundaryElement}>
|
|
112
|
-
<MenuButton
|
|
113
|
-
button={<Button icon={ErrorOutlineIcon} mode="bleed" tone="critical" />}
|
|
114
|
-
id="validation-menu"
|
|
115
|
-
menu={
|
|
116
|
-
<Menu>
|
|
117
|
-
{items.map((item, itemIndex) => (
|
|
118
|
-
<MenuItem key={itemIndex} padding={5} tone={item.tone}>
|
|
119
|
-
<Text>{item.message}</Text>
|
|
120
|
-
</MenuItem>
|
|
121
|
-
))}
|
|
122
|
-
</Menu>
|
|
123
|
-
}
|
|
124
|
-
popover={POPOVER_PROPS}
|
|
125
|
-
/>
|
|
126
|
-
</BoundaryElementProvider>
|
|
127
|
-
</Box>
|
|
128
|
-
</Flex>
|
|
129
|
-
</Card>
|
|
130
|
-
</Flex>
|
|
131
|
-
</Card>
|
|
132
|
-
</Box>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {Box, Card, LayerProvider, Menu, MenuDivider, MenuItem, Stack, Text} from '@sanity/ui'
|
|
2
|
-
|
|
3
|
-
export default function CustomMenuItemStory() {
|
|
4
|
-
return (
|
|
5
|
-
<Box padding={[4, 5, 6]}>
|
|
6
|
-
<Card radius={3} shadow={2}>
|
|
7
|
-
<LayerProvider>
|
|
8
|
-
<Menu>
|
|
9
|
-
<MenuItem padding={3}>
|
|
10
|
-
<Stack space={3}>
|
|
11
|
-
<Text weight="medium" size={1}>
|
|
12
|
-
First option
|
|
13
|
-
</Text>
|
|
14
|
-
<Text muted size={1}>
|
|
15
|
-
Description
|
|
16
|
-
</Text>
|
|
17
|
-
</Stack>
|
|
18
|
-
</MenuItem>
|
|
19
|
-
<MenuItem padding={3}>
|
|
20
|
-
<Stack space={3}>
|
|
21
|
-
<Text weight="medium" size={1}>
|
|
22
|
-
Second option
|
|
23
|
-
</Text>
|
|
24
|
-
<Text muted size={1}>
|
|
25
|
-
Description
|
|
26
|
-
</Text>
|
|
27
|
-
</Stack>
|
|
28
|
-
</MenuItem>
|
|
29
|
-
<MenuDivider />
|
|
30
|
-
<MenuItem padding={3} tone="critical">
|
|
31
|
-
<Stack space={3}>
|
|
32
|
-
<Text weight="medium" size={1}>
|
|
33
|
-
Dangerous option
|
|
34
|
-
</Text>
|
|
35
|
-
<Text muted size={1}>
|
|
36
|
-
Description
|
|
37
|
-
</Text>
|
|
38
|
-
</Stack>
|
|
39
|
-
</MenuItem>
|
|
40
|
-
</Menu>
|
|
41
|
-
</LayerProvider>
|
|
42
|
-
</Card>
|
|
43
|
-
</Box>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
|
|
4
|
-
import {Box, Button} from '../../../primitives'
|
|
5
|
-
import {Menu} from '../menu'
|
|
6
|
-
import {MenuButton} from '../menuButton'
|
|
7
|
-
import {MenuItem} from '../menuItem'
|
|
8
|
-
|
|
9
|
-
const selectedOptions = {
|
|
10
|
-
undefined: 'undefined',
|
|
11
|
-
true: true,
|
|
12
|
-
false: false,
|
|
13
|
-
} as const
|
|
14
|
-
|
|
15
|
-
export default function CustomSelectedStateStory() {
|
|
16
|
-
const selected = useSelect('Selected', selectedOptions, false)
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Box padding={4}>
|
|
20
|
-
<MenuButton
|
|
21
|
-
button={
|
|
22
|
-
<Button
|
|
23
|
-
icon={ChevronDownIcon}
|
|
24
|
-
mode="bleed"
|
|
25
|
-
selected={selected === 'undefined' ? undefined : selected}
|
|
26
|
-
text="Menu"
|
|
27
|
-
/>
|
|
28
|
-
}
|
|
29
|
-
id="test-menu"
|
|
30
|
-
menu={
|
|
31
|
-
<Menu>
|
|
32
|
-
<MenuItem text="Item 1" />
|
|
33
|
-
<MenuItem text="Item 2" />
|
|
34
|
-
</Menu>
|
|
35
|
-
}
|
|
36
|
-
/>
|
|
37
|
-
</Box>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex, Menu, MenuButton, MenuButtonProps, MenuItem} from '@sanity/ui'
|
|
3
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
4
|
-
|
|
5
|
-
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
6
|
-
constrainSize: true,
|
|
7
|
-
matchReferenceWidth: true,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function DisableFocusOnCloseStory() {
|
|
11
|
-
const disableRestoreFocusOnClose = useBoolean('Disable restore focus on close', false)
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
15
|
-
<MenuButton
|
|
16
|
-
__unstable_disableRestoreFocusOnClose={disableRestoreFocusOnClose}
|
|
17
|
-
button={
|
|
18
|
-
<Button
|
|
19
|
-
iconRight={ChevronDownIcon}
|
|
20
|
-
mode="ghost"
|
|
21
|
-
text={
|
|
22
|
-
disableRestoreFocusOnClose
|
|
23
|
-
? 'Should not focus after close'
|
|
24
|
-
: 'Should focus after close'
|
|
25
|
-
}
|
|
26
|
-
/>
|
|
27
|
-
}
|
|
28
|
-
id="example"
|
|
29
|
-
menu={
|
|
30
|
-
<Menu>
|
|
31
|
-
<MenuItem text="Test 1" />
|
|
32
|
-
<MenuItem text="Test 2" />
|
|
33
|
-
<MenuItem text="Test 3" />
|
|
34
|
-
</Menu>
|
|
35
|
-
}
|
|
36
|
-
popover={POPOVER_PROPS}
|
|
37
|
-
/>
|
|
38
|
-
</Flex>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Button,
|
|
4
|
-
Card,
|
|
5
|
-
Inline,
|
|
6
|
-
LayerProvider,
|
|
7
|
-
Menu,
|
|
8
|
-
MenuButton,
|
|
9
|
-
MenuButtonProps,
|
|
10
|
-
MenuDivider,
|
|
11
|
-
MenuGroup,
|
|
12
|
-
MenuItem,
|
|
13
|
-
} from '@sanity/ui'
|
|
14
|
-
import {useAction} from '@sanity/ui-workshop'
|
|
15
|
-
|
|
16
|
-
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
17
|
-
placement: 'bottom',
|
|
18
|
-
portal: true,
|
|
19
|
-
preventOverflow: true,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const NESTED_POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
23
|
-
placement: 'right-start',
|
|
24
|
-
portal: true,
|
|
25
|
-
preventOverflow: true,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default function GroupsStory() {
|
|
29
|
-
return (
|
|
30
|
-
<Box padding={[4, 5, 6]}>
|
|
31
|
-
<Card padding={1} radius={3} shadow={1}>
|
|
32
|
-
<Inline space={1}>
|
|
33
|
-
<LayerProvider>
|
|
34
|
-
<MenuButton
|
|
35
|
-
button={<Button fontSize={1} mode="bleed" padding={2} text="File" />}
|
|
36
|
-
id="example"
|
|
37
|
-
menu={
|
|
38
|
-
<Menu>
|
|
39
|
-
<MenuItem
|
|
40
|
-
fontSize={1}
|
|
41
|
-
hotkeys={['⌘', 'T']}
|
|
42
|
-
onClick={useAction('New tab')}
|
|
43
|
-
padding={2}
|
|
44
|
-
text="New tab"
|
|
45
|
-
/>
|
|
46
|
-
<MenuItem
|
|
47
|
-
fontSize={1}
|
|
48
|
-
hotkeys={['⌘', 'N']}
|
|
49
|
-
onClick={useAction('New window')}
|
|
50
|
-
padding={2}
|
|
51
|
-
text="New window"
|
|
52
|
-
/>
|
|
53
|
-
<MenuItem
|
|
54
|
-
fontSize={1}
|
|
55
|
-
hotkeys={['⇧', '⌘', 'T']}
|
|
56
|
-
onClick={useAction('Reopen closed tab')}
|
|
57
|
-
padding={2}
|
|
58
|
-
text="Reopen closed tab"
|
|
59
|
-
/>
|
|
60
|
-
<MenuItem
|
|
61
|
-
fontSize={1}
|
|
62
|
-
hotkeys={['⌘', 'O']}
|
|
63
|
-
onClick={useAction('Open file…')}
|
|
64
|
-
padding={2}
|
|
65
|
-
text="Open file…"
|
|
66
|
-
/>
|
|
67
|
-
<MenuItem
|
|
68
|
-
fontSize={1}
|
|
69
|
-
hotkeys={['⌘', 'L']}
|
|
70
|
-
onClick={useAction('Open location…')}
|
|
71
|
-
padding={2}
|
|
72
|
-
text="Open location…"
|
|
73
|
-
/>
|
|
74
|
-
<MenuDivider />
|
|
75
|
-
<MenuGroup
|
|
76
|
-
fontSize={1}
|
|
77
|
-
onClick={useAction('Share')}
|
|
78
|
-
padding={2}
|
|
79
|
-
popover={NESTED_POPOVER_PROPS}
|
|
80
|
-
text="Share"
|
|
81
|
-
>
|
|
82
|
-
<MenuItem
|
|
83
|
-
fontSize={1}
|
|
84
|
-
onClick={useAction('Share / Email link')}
|
|
85
|
-
padding={2}
|
|
86
|
-
text="Email link"
|
|
87
|
-
/>
|
|
88
|
-
<MenuItem
|
|
89
|
-
fontSize={1}
|
|
90
|
-
onClick={useAction('Share / Messages')}
|
|
91
|
-
padding={2}
|
|
92
|
-
text="Messages"
|
|
93
|
-
/>
|
|
94
|
-
<MenuItem
|
|
95
|
-
fontSize={1}
|
|
96
|
-
onClick={useAction('Share / Airdrop')}
|
|
97
|
-
padding={2}
|
|
98
|
-
text="Airdrop"
|
|
99
|
-
/>
|
|
100
|
-
<MenuItem fontSize={1} onClick={useAction('Notes')} padding={2} text="Notes" />
|
|
101
|
-
<MenuGroup
|
|
102
|
-
fontSize={1}
|
|
103
|
-
onClick={useAction('Share / More')}
|
|
104
|
-
padding={2}
|
|
105
|
-
popover={NESTED_POPOVER_PROPS}
|
|
106
|
-
text="More"
|
|
107
|
-
>
|
|
108
|
-
<MenuItem
|
|
109
|
-
fontSize={1}
|
|
110
|
-
onClick={useAction('Share / More / Email link')}
|
|
111
|
-
padding={2}
|
|
112
|
-
text="Email link"
|
|
113
|
-
/>
|
|
114
|
-
<MenuItem
|
|
115
|
-
fontSize={1}
|
|
116
|
-
onClick={useAction('Share / More / Messages')}
|
|
117
|
-
padding={2}
|
|
118
|
-
text="Messages"
|
|
119
|
-
/>
|
|
120
|
-
<MenuItem
|
|
121
|
-
fontSize={1}
|
|
122
|
-
onClick={useAction('Share / More / Airdrop')}
|
|
123
|
-
padding={2}
|
|
124
|
-
text="Airdrop"
|
|
125
|
-
/>
|
|
126
|
-
<MenuItem
|
|
127
|
-
fontSize={1}
|
|
128
|
-
onClick={useAction('Share / More / Notes')}
|
|
129
|
-
padding={2}
|
|
130
|
-
text="Notes"
|
|
131
|
-
/>
|
|
132
|
-
</MenuGroup>
|
|
133
|
-
</MenuGroup>
|
|
134
|
-
<MenuDivider />
|
|
135
|
-
<MenuItem
|
|
136
|
-
fontSize={1}
|
|
137
|
-
hotkeys={['⌘', 'P']}
|
|
138
|
-
onClick={useAction('Print…')}
|
|
139
|
-
padding={2}
|
|
140
|
-
text="Print…"
|
|
141
|
-
/>
|
|
142
|
-
</Menu>
|
|
143
|
-
}
|
|
144
|
-
popover={POPOVER_PROPS}
|
|
145
|
-
/>
|
|
146
|
-
</LayerProvider>
|
|
147
|
-
|
|
148
|
-
<Button disabled fontSize={1} mode="bleed" padding={2} text="Edit" />
|
|
149
|
-
<Button disabled fontSize={1} mode="bleed" padding={2} text="View" />
|
|
150
|
-
<Button disabled fontSize={1} mode="bleed" padding={2} text="Window" />
|
|
151
|
-
<Button disabled fontSize={1} mode="bleed" padding={2} text="Help" />
|
|
152
|
-
</Inline>
|
|
153
|
-
</Card>
|
|
154
|
-
</Box>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'components/menu',
|
|
6
|
-
title: 'Menu',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'menu-button',
|
|
10
|
-
title: 'MenuButton',
|
|
11
|
-
component: lazy(() => import('./menuButton')),
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'nested-menu-items',
|
|
15
|
-
title: 'Nested MenuItems',
|
|
16
|
-
component: lazy(() => import('./nestedMenu')),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'custom-menu-item',
|
|
20
|
-
title: 'Custom MenuItem',
|
|
21
|
-
component: lazy(() => import('./customMenuItem')),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'groups',
|
|
25
|
-
title: 'Groups',
|
|
26
|
-
component: lazy(() => import('./groups')),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'menu-group-right',
|
|
30
|
-
title: 'Menu group (right)',
|
|
31
|
-
component: lazy(() => import('./menuGroupRight')),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'tones',
|
|
35
|
-
title: 'Tones',
|
|
36
|
-
component: lazy(() => import('./tones')),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'selected-item',
|
|
40
|
-
title: 'Selected item',
|
|
41
|
-
component: lazy(() => import('./selectedItem')),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'closable',
|
|
45
|
-
title: 'Closeable',
|
|
46
|
-
component: lazy(() => import('./closableMenuButton')),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'without-arrow',
|
|
50
|
-
title: 'Without arrow',
|
|
51
|
-
component: lazy(() => import('./withoutArrow')),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'constrained-in-boundary',
|
|
55
|
-
title: 'Constrained in boundary',
|
|
56
|
-
component: lazy(() => import('./constrainedInBoundary')),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'as-component',
|
|
60
|
-
title: 'As component',
|
|
61
|
-
component: lazy(() => import('./asComponent')),
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'disable-focus-on-close',
|
|
65
|
-
title: 'Disable focus on close',
|
|
66
|
-
component: lazy(() => import('./disableFocusOnClose')),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'menu-button-with-on-close',
|
|
70
|
-
title: 'MenuButton with on close',
|
|
71
|
-
component: lazy(() => import('./onCloseMenuButton')),
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'shouldFocus',
|
|
75
|
-
title: 'Menu with shouldFocus',
|
|
76
|
-
component: lazy(() => import('./shouldFocus')),
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'avatar',
|
|
80
|
-
title: 'Avatar menu',
|
|
81
|
-
component: lazy(() => import('./avatarMenu')),
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'custom-selected-state',
|
|
85
|
-
title: 'Custom selected state',
|
|
86
|
-
component: lazy(() => import('./customSelectedState')),
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
})
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {ClockIcon, CommentIcon, ExpandIcon, SearchIcon} from '@sanity/icons'
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
Button,
|
|
5
|
-
Card,
|
|
6
|
-
Grid,
|
|
7
|
-
LayerProvider,
|
|
8
|
-
Menu,
|
|
9
|
-
MenuButton,
|
|
10
|
-
MenuButtonProps,
|
|
11
|
-
MenuDivider,
|
|
12
|
-
MenuItem,
|
|
13
|
-
} from '@sanity/ui'
|
|
14
|
-
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
15
|
-
import {useMemo} from 'react'
|
|
16
|
-
|
|
17
|
-
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
18
|
-
|
|
19
|
-
export default function MenuButtonStory() {
|
|
20
|
-
const layoutTone = useSelect('Layout tone', WORKSHOP_CARD_TONE_OPTIONS, 'default', 'Props')
|
|
21
|
-
const portal = useBoolean('Portal', false, 'Props')
|
|
22
|
-
|
|
23
|
-
const popover: MenuButtonProps['popover'] = useMemo(
|
|
24
|
-
() => ({
|
|
25
|
-
constrainSize: true,
|
|
26
|
-
portal,
|
|
27
|
-
}),
|
|
28
|
-
[portal],
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Card height="fill" tone={layoutTone}>
|
|
33
|
-
<Box padding={[4, 5, 6]}>
|
|
34
|
-
<Grid columns={3} gap={2}>
|
|
35
|
-
<Button id="prev-button" mode="ghost" text="Prev" />
|
|
36
|
-
<LayerProvider>
|
|
37
|
-
<MenuButton
|
|
38
|
-
button={<Button text="Open" />}
|
|
39
|
-
id="menu-button"
|
|
40
|
-
menu={
|
|
41
|
-
<Menu>
|
|
42
|
-
<MenuItem
|
|
43
|
-
icon={SearchIcon}
|
|
44
|
-
id="menu-item-1"
|
|
45
|
-
onClick={useAction('Search')}
|
|
46
|
-
text="Search"
|
|
47
|
-
/>
|
|
48
|
-
<MenuItem
|
|
49
|
-
icon={ClockIcon}
|
|
50
|
-
id="menu-item-2"
|
|
51
|
-
onClick={useAction('Clock')}
|
|
52
|
-
text="Clock"
|
|
53
|
-
/>
|
|
54
|
-
<MenuItem
|
|
55
|
-
disabled
|
|
56
|
-
icon={CommentIcon}
|
|
57
|
-
id="menu-item-3"
|
|
58
|
-
onClick={useAction('Comment')}
|
|
59
|
-
text="Comment"
|
|
60
|
-
/>
|
|
61
|
-
<MenuDivider />
|
|
62
|
-
<MenuItem
|
|
63
|
-
icon={ExpandIcon}
|
|
64
|
-
id="menu-item-4"
|
|
65
|
-
onClick={useAction('Expand')}
|
|
66
|
-
text="Expand"
|
|
67
|
-
/>
|
|
68
|
-
</Menu>
|
|
69
|
-
}
|
|
70
|
-
onClose={useAction('onClose')}
|
|
71
|
-
onOpen={useAction('onOpen')}
|
|
72
|
-
popover={popover}
|
|
73
|
-
/>
|
|
74
|
-
</LayerProvider>
|
|
75
|
-
<Button mode="ghost" id="next-button" text="Next" />
|
|
76
|
-
</Grid>
|
|
77
|
-
</Box>
|
|
78
|
-
</Card>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddIcon,
|
|
3
|
-
BookIcon,
|
|
4
|
-
CopyIcon,
|
|
5
|
-
EllipsisVerticalIcon,
|
|
6
|
-
ImageIcon,
|
|
7
|
-
TrashIcon,
|
|
8
|
-
} from '@sanity/icons'
|
|
9
|
-
import {
|
|
10
|
-
Box,
|
|
11
|
-
Button,
|
|
12
|
-
Card,
|
|
13
|
-
Container,
|
|
14
|
-
Flex,
|
|
15
|
-
Menu,
|
|
16
|
-
MenuButton,
|
|
17
|
-
MenuButtonProps,
|
|
18
|
-
MenuDivider,
|
|
19
|
-
MenuGroup,
|
|
20
|
-
MenuItem,
|
|
21
|
-
} from '@sanity/ui'
|
|
22
|
-
|
|
23
|
-
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
24
|
-
placement: 'right',
|
|
25
|
-
portal: true,
|
|
26
|
-
preventOverflow: true,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default function MenuGroupRightStory() {
|
|
30
|
-
return (
|
|
31
|
-
<Card height="fill" tone="transparent">
|
|
32
|
-
<Flex align="center" height="fill" padding={4} sizing="border">
|
|
33
|
-
<Container width={1}>
|
|
34
|
-
<Card padding={2} radius={2} shadow={2}>
|
|
35
|
-
<Flex>
|
|
36
|
-
<Box flex={1} />
|
|
37
|
-
<Box>
|
|
38
|
-
<MenuButton
|
|
39
|
-
button={<Button icon={EllipsisVerticalIcon} mode="bleed" />}
|
|
40
|
-
id="right-menu"
|
|
41
|
-
menu={
|
|
42
|
-
<Menu>
|
|
43
|
-
<MenuGroup icon={AddIcon} popover={{placement: 'left'}} text="Add above">
|
|
44
|
-
<MenuItem icon={ImageIcon} text="Image" />
|
|
45
|
-
<MenuItem icon={BookIcon} text="Book" />
|
|
46
|
-
</MenuGroup>
|
|
47
|
-
<MenuGroup icon={AddIcon} popover={{placement: 'left'}} text="Add below">
|
|
48
|
-
<MenuItem icon={ImageIcon} text="Image" />
|
|
49
|
-
<MenuItem icon={BookIcon} text="Book" />
|
|
50
|
-
</MenuGroup>
|
|
51
|
-
<MenuDivider />
|
|
52
|
-
<MenuItem icon={CopyIcon} text="Duplicate" />
|
|
53
|
-
<MenuItem icon={TrashIcon} text="Remove" tone="critical" />
|
|
54
|
-
</Menu>
|
|
55
|
-
}
|
|
56
|
-
popover={POPOVER_PROPS}
|
|
57
|
-
/>
|
|
58
|
-
</Box>
|
|
59
|
-
</Flex>
|
|
60
|
-
</Card>
|
|
61
|
-
</Container>
|
|
62
|
-
</Flex>
|
|
63
|
-
</Card>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem, Stack} from '@sanity/ui'
|
|
2
|
-
|
|
3
|
-
export default function NestedMenuItems() {
|
|
4
|
-
return (
|
|
5
|
-
<Box padding={[4, 5, 6]}>
|
|
6
|
-
<MenuButton
|
|
7
|
-
button={<Button text="Open" />}
|
|
8
|
-
id="nested-example"
|
|
9
|
-
menu={
|
|
10
|
-
<Menu>
|
|
11
|
-
<Stack space={1}>
|
|
12
|
-
<MenuItem text="Item 1" />
|
|
13
|
-
<MenuItem text="Item 2" />
|
|
14
|
-
</Stack>
|
|
15
|
-
<MenuDivider />
|
|
16
|
-
<MenuItem text="Item 3" />
|
|
17
|
-
</Menu>
|
|
18
|
-
}
|
|
19
|
-
/>
|
|
20
|
-
</Box>
|
|
21
|
-
)
|
|
22
|
-
}
|