@sanity/ui 2.9.0-corel.0 → 2.9.1
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/getTheme_v2.js +110 -54
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +110 -54
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +110 -54
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.d.mts +14 -21
- package/dist/index.d.ts +14 -21
- package/dist/index.esm.js +3327 -3068
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3328 -3070
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3327 -3068
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +8 -8
- package/dist/theme.d.ts +8 -8
- package/dist/theme.esm.js +1144 -592
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1144 -592
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1144 -592
- package/dist/theme.mjs.map +1 -1
- package/package.json +60 -52
- package/src/core/__workshop__/constants.ts +15 -19
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +13 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +31 -39
- package/src/core/components/dialog/dialog.tsx +4 -2
- package/src/core/components/menu/__workshop__/tones.tsx +5 -6
- package/src/core/components/menu/menu.tsx +15 -11
- package/src/core/components/menu/menuButton.tsx +14 -36
- package/src/core/components/menu/menuGroup.tsx +2 -1
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/tab/tabList.tsx +3 -11
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +5 -6
- package/src/core/components/toast/toastState.ts +6 -0
- package/src/core/constants.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -5
- package/src/core/primitives/badge/__workshop__/tones.tsx +6 -13
- package/src/core/primitives/button/__workshop__/custom.tsx +4 -3
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/button.tsx +6 -11
- package/src/core/primitives/button/styles.ts +1 -1
- package/src/core/primitives/card/__workshop__/allTones.tsx +6 -8
- package/src/core/primitives/card/__workshop__/asButton.tsx +42 -24
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +17 -7
- package/src/core/primitives/card/__workshop__/interactive.tsx +10 -3
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +5 -3
- package/src/core/primitives/card/__workshop__/props.tsx +7 -5
- package/src/core/primitives/card/__workshop__/selected.tsx +4 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +6 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +3 -3
- package/src/core/primitives/flex/flex.tsx +1 -5
- package/src/core/primitives/grid/__workshop__/responsive.tsx +12 -12
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +13 -25
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +6 -6
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +6 -5
- package/src/core/primitives/radio/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +6 -6
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +11 -21
- package/src/core/primitives/text/styles.ts +0 -1
- package/src/core/primitives/text/text.tsx +2 -4
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -2
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +6 -2
- package/src/core/primitives/textInput/__workshop__/tones.tsx +38 -0
- package/src/core/styles/card/_cardColorStyle.ts +8 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +0 -2
- package/src/core/theme/__workshop__/debug/story.tsx +18 -11
- package/src/core/theme/themeProvider.tsx +4 -6
- package/src/core/utils/elementQuery/elementQuery.tsx +16 -17
- package/src/core/utils/layer/layerProvider.tsx +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +12 -8
- package/src/theme/build/renderColorTheme.ts +54 -232
- package/src/theme/defaults/colorTokens.ts +13 -18
- package/src/theme/system/color/_constants.ts +6 -10
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -26
- package/src/theme/versioning/v0_v2.ts +4 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
|
@@ -9,7 +9,7 @@ export default function PlainStory() {
|
|
|
9
9
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
10
10
|
<Container onClick={useAction('onClick')} width={width}>
|
|
11
11
|
<Card padding={4} shadow={1}>
|
|
12
|
-
<Text>
|
|
12
|
+
<Text size={1}>
|
|
13
13
|
Container with <code>max-width={width}</code>
|
|
14
14
|
</Text>
|
|
15
15
|
</Card>
|
|
@@ -18,15 +18,15 @@ export default function ExampleStory() {
|
|
|
18
18
|
return (
|
|
19
19
|
<Flex direction={direction} height="fill" style={{width: '100%'}}>
|
|
20
20
|
<DebugCard flex={1}>
|
|
21
|
-
<Code>1</Code>
|
|
21
|
+
<Code size={1}>1</Code>
|
|
22
22
|
</DebugCard>
|
|
23
23
|
|
|
24
24
|
<DebugCard flex={[1, 2, 3]}>
|
|
25
|
-
<Code>[1,2,3]</Code>
|
|
25
|
+
<Code size={1}>[1,2,3]</Code>
|
|
26
26
|
</DebugCard>
|
|
27
27
|
|
|
28
28
|
<DebugCard flex={['none', 'none', 1]}>
|
|
29
|
-
<Code>['none', 'none', 1]</Code>
|
|
29
|
+
<Code size={1}>['none', 'none', 1]</Code>
|
|
30
30
|
</DebugCard>
|
|
31
31
|
</Flex>
|
|
32
32
|
)
|
|
@@ -18,8 +18,6 @@ export interface FlexProps
|
|
|
18
18
|
ResponsiveFlexProps,
|
|
19
19
|
ResponsiveFlexItemProps {
|
|
20
20
|
gap?: number | number[]
|
|
21
|
-
gapX?: number | number[]
|
|
22
|
-
gapY?: number | number[]
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
const Root = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
@@ -36,7 +34,7 @@ export const Flex = forwardRef(function Flex(
|
|
|
36
34
|
props: FlexProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'wrap'>,
|
|
37
35
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
38
36
|
) {
|
|
39
|
-
const {align, as, direction = 'row', gap,
|
|
37
|
+
const {align, as, direction = 'row', gap, justify, wrap, ...restProps} = props
|
|
40
38
|
|
|
41
39
|
return (
|
|
42
40
|
<Root
|
|
@@ -45,8 +43,6 @@ export const Flex = forwardRef(function Flex(
|
|
|
45
43
|
$align={useArrayProp(align)}
|
|
46
44
|
$direction={useArrayProp(direction)}
|
|
47
45
|
$gap={useArrayProp(gap)}
|
|
48
|
-
$gapX={useArrayProp(gapX)}
|
|
49
|
-
$gapY={useArrayProp(gapY)}
|
|
50
46
|
$justify={useArrayProp(justify)}
|
|
51
47
|
$wrap={useArrayProp(wrap)}
|
|
52
48
|
forwardedAs={as}
|
|
@@ -11,40 +11,40 @@ export default function ResponsiveStory() {
|
|
|
11
11
|
rows={[1, 2, 3, 4, 5, 6, 7]}
|
|
12
12
|
style={{textAlign: 'center'}}
|
|
13
13
|
>
|
|
14
|
-
<Card padding={[1, 2, 3]} tone="
|
|
14
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
15
15
|
<Code>1</Code>
|
|
16
16
|
</Card>
|
|
17
|
-
<Card padding={[1, 2, 3]} tone="
|
|
17
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
18
18
|
<Code>2</Code>
|
|
19
19
|
</Card>
|
|
20
|
-
<Card padding={[1, 2, 3]} tone="
|
|
20
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
21
21
|
<Code>3</Code>
|
|
22
22
|
</Card>
|
|
23
|
-
<Card padding={[1, 2, 3]} tone="
|
|
23
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
24
24
|
<Code>4</Code>
|
|
25
25
|
</Card>
|
|
26
|
-
<Card padding={[1, 2, 3]} tone="
|
|
26
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
27
27
|
<Code>5</Code>
|
|
28
28
|
</Card>
|
|
29
|
-
<Card padding={[1, 2, 3]} tone="
|
|
29
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
30
30
|
<Code>6</Code>
|
|
31
31
|
</Card>
|
|
32
|
-
<Card padding={[1, 2, 3]} tone="
|
|
32
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
33
33
|
<Code>7</Code>
|
|
34
34
|
</Card>
|
|
35
|
-
<Card padding={[1, 2, 3]} tone="
|
|
35
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
36
36
|
<Code>8</Code>
|
|
37
37
|
</Card>
|
|
38
|
-
<Card padding={[1, 2, 3]} tone="
|
|
38
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
39
39
|
<Code>9</Code>
|
|
40
40
|
</Card>
|
|
41
|
-
<Card padding={[1, 2, 3]} tone="
|
|
41
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
42
42
|
<Code>10</Code>
|
|
43
43
|
</Card>
|
|
44
|
-
<Card padding={[1, 2, 3]} tone="
|
|
44
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
45
45
|
<Code>11</Code>
|
|
46
46
|
</Card>
|
|
47
|
-
<Card padding={[1, 2, 3]} tone="
|
|
47
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
48
48
|
<Code>12</Code>
|
|
49
49
|
</Card>
|
|
50
50
|
</Grid>
|
|
@@ -6,55 +6,43 @@ export default function OpticalAlignment() {
|
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<Stack space={1}>
|
|
8
8
|
<Flex>
|
|
9
|
-
<Card padding={0}
|
|
10
|
-
<Heading
|
|
11
|
-
Hamburgefonstiv M
|
|
12
|
-
</Heading>
|
|
9
|
+
<Card padding={0} tone="neutral">
|
|
10
|
+
<Heading size={5}>Hamburgefonstiv M</Heading>
|
|
13
11
|
</Card>
|
|
14
12
|
</Flex>
|
|
15
13
|
|
|
16
14
|
<Flex>
|
|
17
|
-
<Card padding={0}
|
|
18
|
-
<Heading
|
|
19
|
-
Hamburgefonstiv M
|
|
20
|
-
</Heading>
|
|
15
|
+
<Card padding={0} tone="neutral">
|
|
16
|
+
<Heading size={4}>Hamburgefonstiv M</Heading>
|
|
21
17
|
</Card>
|
|
22
18
|
</Flex>
|
|
23
19
|
|
|
24
20
|
<Flex>
|
|
25
|
-
<Card padding={0}
|
|
26
|
-
<Heading
|
|
27
|
-
Hamburgefonstiv M
|
|
28
|
-
</Heading>
|
|
21
|
+
<Card padding={0} tone="neutral">
|
|
22
|
+
<Heading size={3}>Hamburgefonstiv M</Heading>
|
|
29
23
|
</Card>
|
|
30
24
|
</Flex>
|
|
31
25
|
|
|
32
26
|
<Flex>
|
|
33
|
-
<Card padding={0}
|
|
34
|
-
<Heading
|
|
35
|
-
Hamburgefonstiv M
|
|
36
|
-
</Heading>
|
|
27
|
+
<Card padding={0} tone="neutral">
|
|
28
|
+
<Heading size={2}>Hamburgefonstiv M</Heading>
|
|
37
29
|
</Card>
|
|
38
30
|
</Flex>
|
|
39
31
|
|
|
40
32
|
<Flex>
|
|
41
|
-
<Card padding={0}
|
|
42
|
-
<Heading
|
|
43
|
-
Hamburgefonstiv M
|
|
44
|
-
</Heading>
|
|
33
|
+
<Card padding={0} tone="neutral">
|
|
34
|
+
<Heading size={1}>Hamburgefonstiv M</Heading>
|
|
45
35
|
</Card>
|
|
46
36
|
</Flex>
|
|
47
37
|
|
|
48
38
|
<Flex>
|
|
49
|
-
<Card padding={0}
|
|
50
|
-
<Heading
|
|
51
|
-
Hamburgefonstiv M
|
|
52
|
-
</Heading>
|
|
39
|
+
<Card padding={0} tone="neutral">
|
|
40
|
+
<Heading size={0}>Hamburgefonstiv M</Heading>
|
|
53
41
|
</Card>
|
|
54
42
|
</Flex>
|
|
55
43
|
|
|
56
44
|
<Flex>
|
|
57
|
-
<Card padding={2}
|
|
45
|
+
<Card padding={2} tone="neutral">
|
|
58
46
|
<Heading accent>
|
|
59
47
|
<AddCircleIcon />
|
|
60
48
|
</Heading>
|
|
@@ -26,7 +26,7 @@ export interface HeadingProps {
|
|
|
26
26
|
* Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
|
|
27
27
|
* @beta
|
|
28
28
|
*/
|
|
29
|
-
textOverflow?: 'ellipsis'
|
|
29
|
+
textOverflow?: 'ellipsis'
|
|
30
30
|
weight?: ThemeFontWeightKey
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -10,15 +10,15 @@ export default function PlainStory() {
|
|
|
10
10
|
space={useSelect('Space', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}
|
|
11
11
|
>
|
|
12
12
|
<Card padding={1} shadow={1}>
|
|
13
|
-
<Text>Inline item</Text>
|
|
13
|
+
<Text size={1}>Inline item</Text>
|
|
14
14
|
</Card>
|
|
15
15
|
|
|
16
16
|
<Card padding={2} shadow={1}>
|
|
17
|
-
<Text>Inline item</Text>
|
|
17
|
+
<Text size={1}>Inline item</Text>
|
|
18
18
|
</Card>
|
|
19
19
|
|
|
20
20
|
<Card padding={3} shadow={1}>
|
|
21
|
-
<Text>Inline item</Text>
|
|
21
|
+
<Text size={1}>Inline item</Text>
|
|
22
22
|
</Card>
|
|
23
23
|
</Inline>
|
|
24
24
|
</Flex>
|
|
@@ -6,37 +6,37 @@ export default function OpticalAlignment() {
|
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<Stack space={1}>
|
|
8
8
|
<Flex>
|
|
9
|
-
<Card padding={0}
|
|
9
|
+
<Card padding={0} tone="suggest">
|
|
10
10
|
<Label size={4}>Hamburgefonstiv M</Label>
|
|
11
11
|
</Card>
|
|
12
12
|
</Flex>
|
|
13
13
|
|
|
14
14
|
<Flex>
|
|
15
|
-
<Card padding={0}
|
|
15
|
+
<Card padding={0} tone="suggest">
|
|
16
16
|
<Label size={3}>Hamburgefonstiv M</Label>
|
|
17
17
|
</Card>
|
|
18
18
|
</Flex>
|
|
19
19
|
|
|
20
20
|
<Flex>
|
|
21
|
-
<Card padding={0}
|
|
21
|
+
<Card padding={0} tone="suggest">
|
|
22
22
|
<Label size={2}>Hamburgefonstiv M</Label>
|
|
23
23
|
</Card>
|
|
24
24
|
</Flex>
|
|
25
25
|
|
|
26
26
|
<Flex>
|
|
27
|
-
<Card padding={0}
|
|
27
|
+
<Card padding={0} tone="suggest">
|
|
28
28
|
<Label size={1}>Hamburgefonstiv M</Label>
|
|
29
29
|
</Card>
|
|
30
30
|
</Flex>
|
|
31
31
|
|
|
32
32
|
<Flex>
|
|
33
|
-
<Card padding={0}
|
|
33
|
+
<Card padding={0} tone="suggest">
|
|
34
34
|
<Label size={0}>Hamburgefonstiv M</Label>
|
|
35
35
|
</Card>
|
|
36
36
|
</Flex>
|
|
37
37
|
|
|
38
38
|
<Flex>
|
|
39
|
-
<Card padding={2}
|
|
39
|
+
<Card padding={2} tone="suggest">
|
|
40
40
|
<Label>
|
|
41
41
|
<AddCircleIcon />
|
|
42
42
|
</Label>
|
|
@@ -24,7 +24,7 @@ export default function AlignedStory() {
|
|
|
24
24
|
const popoverElementRef = useRef<HTMLDivElement | null>(null)
|
|
25
25
|
|
|
26
26
|
const content = (
|
|
27
|
-
<Text>
|
|
27
|
+
<Text size={1}>
|
|
28
28
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at nisl at sem tempor
|
|
29
29
|
hendrerit scelerisque ut libero. Maecenas iaculis efficitur lorem, ac faucibus mi imperdiet
|
|
30
30
|
quis. Cras a consectetur erat. Fusce imperdiet, dolor et pellentesque iaculis, ex quam luctus
|
|
@@ -11,8 +11,8 @@ export default function MatchReferenceWidthStory() {
|
|
|
11
11
|
<Popover
|
|
12
12
|
arrow={arrow}
|
|
13
13
|
content={
|
|
14
|
-
<Box padding={
|
|
15
|
-
<Text>Content</Text>
|
|
14
|
+
<Box padding={3}>
|
|
15
|
+
<Text size={1}>Content</Text>
|
|
16
16
|
</Box>
|
|
17
17
|
}
|
|
18
18
|
matchReferenceWidth
|
|
@@ -22,7 +22,7 @@ export default function MatchReferenceWidthStory() {
|
|
|
22
22
|
>
|
|
23
23
|
<Container width={0}>
|
|
24
24
|
<Stack>
|
|
25
|
-
<Button fontSize={
|
|
25
|
+
<Button fontSize={1} mode="ghost" selected text="Button" />
|
|
26
26
|
</Stack>
|
|
27
27
|
</Container>
|
|
28
28
|
</Popover>
|
|
@@ -3,7 +3,7 @@ import {Button, Card, Popover, Text} from '@sanity/ui'
|
|
|
3
3
|
export default function OpenOnMountStory() {
|
|
4
4
|
return (
|
|
5
5
|
<Card height="fill" padding={3} sizing="border">
|
|
6
|
-
<Popover content={<Text>popover content</Text>} open padding={3}>
|
|
6
|
+
<Popover content={<Text size={1}>popover content</Text>} open padding={3}>
|
|
7
7
|
<Button text="This button is the popover reference" />
|
|
8
8
|
</Popover>
|
|
9
9
|
</Card>
|
|
@@ -48,7 +48,7 @@ export default function PlainStory() {
|
|
|
48
48
|
arrow={arrow}
|
|
49
49
|
boundaryElement={boundaryElementFlag ? boundaryElement : undefined}
|
|
50
50
|
constrainSize={constrainSize}
|
|
51
|
-
content={<Text>popover content</Text>}
|
|
51
|
+
content={<Text size={1}>popover content</Text>}
|
|
52
52
|
fallbackPlacements={['top', 'bottom']}
|
|
53
53
|
matchReferenceWidth={matchReferenceWidth}
|
|
54
54
|
open={open}
|
|
@@ -366,9 +366,12 @@ export const Popover = memo(
|
|
|
366
366
|
)
|
|
367
367
|
|
|
368
368
|
const child = useMemo(() => {
|
|
369
|
+
// If a reference element is defined, we don't need to clone the child
|
|
370
|
+
if (referenceElement) return childProp
|
|
371
|
+
|
|
369
372
|
if (!childProp) return null
|
|
370
373
|
|
|
371
|
-
return cloneElement(childProp, {ref:
|
|
374
|
+
return cloneElement(childProp, {ref: setReference})
|
|
372
375
|
}, [childProp, referenceElement, setReference])
|
|
373
376
|
|
|
374
377
|
useEffect(() => {
|
|
@@ -382,10 +385,8 @@ export const Popover = memo(
|
|
|
382
385
|
}, [update, updateRef])
|
|
383
386
|
|
|
384
387
|
useEffect(() => {
|
|
385
|
-
if (referenceElement)
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
}, [referenceElement, refs, child])
|
|
388
|
+
if (referenceElement) refs.setReference(referenceElement)
|
|
389
|
+
}, [referenceElement, refs])
|
|
389
390
|
|
|
390
391
|
if (disabled) {
|
|
391
392
|
return childProp || <></>
|
|
@@ -2,8 +2,8 @@ import {Flex, Radio} from '@sanity/ui'
|
|
|
2
2
|
import {useAction, useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
4
|
export default function PlainStory() {
|
|
5
|
-
const checked = useBoolean('Checked
|
|
6
|
-
const disabled = useBoolean('Disabled
|
|
5
|
+
const checked = useBoolean('Checked', false, 'Props')
|
|
6
|
+
const disabled = useBoolean('Disabled', false, 'Props')
|
|
7
7
|
const id = 'radioStory'
|
|
8
8
|
const name = 'radioStory'
|
|
9
9
|
const onBlur = useAction('onBlur')
|
|
@@ -9,7 +9,7 @@ export default function ReadOnlyStory() {
|
|
|
9
9
|
Select
|
|
10
10
|
</Label>
|
|
11
11
|
|
|
12
|
-
<Select id="select-example"
|
|
12
|
+
<Select id="select-example" readOnly>
|
|
13
13
|
<option value="a">Option A</option>
|
|
14
14
|
<option value="b">Option B</option>
|
|
15
15
|
<option value="c">Option C</option>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Container, Flex, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
3
|
import {
|
|
4
4
|
WORKSHOP_TEXT_ALIGN_OPTIONS,
|
|
@@ -11,7 +11,7 @@ export default function TextStory() {
|
|
|
11
11
|
const accent = useBoolean('Accent', false, 'Props')
|
|
12
12
|
const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS, '', 'Props') || undefined
|
|
13
13
|
const muted = useBoolean('Muted', false, 'Props')
|
|
14
|
-
const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
14
|
+
const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS, 1, 'Props')
|
|
15
15
|
const text = useText('Text', 'Hello, world', 'Props')
|
|
16
16
|
|
|
17
17
|
const textOverflow =
|
|
@@ -20,8 +20,8 @@ export default function TextStory() {
|
|
|
20
20
|
const weight = useSelect('Weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
24
|
-
<
|
|
23
|
+
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
24
|
+
<Container width={0}>
|
|
25
25
|
<Text
|
|
26
26
|
accent={accent}
|
|
27
27
|
align={align}
|
|
@@ -32,7 +32,7 @@ export default function TextStory() {
|
|
|
32
32
|
>
|
|
33
33
|
{text}
|
|
34
34
|
</Text>
|
|
35
|
-
</
|
|
36
|
-
</
|
|
35
|
+
</Container>
|
|
36
|
+
</Flex>
|
|
37
37
|
)
|
|
38
38
|
}
|
|
@@ -6,47 +6,37 @@ export default function OpticalAlignment() {
|
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<Stack space={1}>
|
|
8
8
|
<Flex>
|
|
9
|
-
<Card padding={0}
|
|
10
|
-
<Text
|
|
11
|
-
Hamburgefonstiv M
|
|
12
|
-
</Text>
|
|
9
|
+
<Card padding={0} tone="neutral">
|
|
10
|
+
<Text size={4}>Hamburgefonstiv M</Text>
|
|
13
11
|
</Card>
|
|
14
12
|
</Flex>
|
|
15
13
|
|
|
16
14
|
<Flex>
|
|
17
|
-
<Card padding={0}
|
|
18
|
-
<Text
|
|
19
|
-
Hamburgefonstiv M
|
|
20
|
-
</Text>
|
|
15
|
+
<Card padding={0} tone="neutral">
|
|
16
|
+
<Text size={3}>Hamburgefonstiv M</Text>
|
|
21
17
|
</Card>
|
|
22
18
|
</Flex>
|
|
23
19
|
|
|
24
20
|
<Flex>
|
|
25
|
-
<Card padding={0}
|
|
26
|
-
<Text
|
|
27
|
-
Hamburgefonstiv M
|
|
28
|
-
</Text>
|
|
21
|
+
<Card padding={0} tone="neutral">
|
|
22
|
+
<Text size={2}>Hamburgefonstiv M</Text>
|
|
29
23
|
</Card>
|
|
30
24
|
</Flex>
|
|
31
25
|
|
|
32
26
|
<Flex>
|
|
33
|
-
<Card padding={0}
|
|
34
|
-
<Text
|
|
35
|
-
Hamburgefonstiv M
|
|
36
|
-
</Text>
|
|
27
|
+
<Card padding={0} tone="neutral">
|
|
28
|
+
<Text size={1}>Hamburgefonstiv M</Text>
|
|
37
29
|
</Card>
|
|
38
30
|
</Flex>
|
|
39
31
|
|
|
40
32
|
<Flex>
|
|
41
|
-
<Card padding={0}
|
|
42
|
-
<Text
|
|
43
|
-
Hamburgefonstiv M
|
|
44
|
-
</Text>
|
|
33
|
+
<Card padding={0} tone="neutral">
|
|
34
|
+
<Text size={0}>Hamburgefonstiv M</Text>
|
|
45
35
|
</Card>
|
|
46
36
|
</Flex>
|
|
47
37
|
|
|
48
38
|
<Flex>
|
|
49
|
-
<Card padding={2}
|
|
39
|
+
<Card padding={2} tone="neutral">
|
|
50
40
|
<Text>
|
|
51
41
|
<AddCircleIcon />
|
|
52
42
|
</Text>
|
|
@@ -25,7 +25,7 @@ export interface TextProps {
|
|
|
25
25
|
* Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
|
|
26
26
|
* @beta
|
|
27
27
|
*/
|
|
28
|
-
textOverflow?: 'ellipsis'
|
|
28
|
+
textOverflow?: 'ellipsis'
|
|
29
29
|
weight?: ThemeFontWeightKey
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -67,8 +67,6 @@ export const Text = forwardRef(function Text(
|
|
|
67
67
|
|
|
68
68
|
if (textOverflow === 'ellipsis') {
|
|
69
69
|
children = <SpanWithTextOverflow>{children}</SpanWithTextOverflow>
|
|
70
|
-
} else {
|
|
71
|
-
children = <span>{children}</span>
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
return (
|
|
@@ -82,7 +80,7 @@ export const Text = forwardRef(function Text(
|
|
|
82
80
|
$size={useArrayProp(size)}
|
|
83
81
|
$weight={weight}
|
|
84
82
|
>
|
|
85
|
-
{children}
|
|
83
|
+
<span>{children}</span>
|
|
86
84
|
</Root>
|
|
87
85
|
)
|
|
88
86
|
})
|
|
@@ -17,7 +17,7 @@ export default function PlainStory() {
|
|
|
17
17
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2, 'Props')
|
|
18
18
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
19
19
|
const placeholder = useText('Placeholder', '', 'Props') || undefined
|
|
20
|
-
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS,
|
|
20
|
+
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2, 'Props')
|
|
21
21
|
const readOnly = useBoolean('Read only', false, 'Props')
|
|
22
22
|
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS, undefined, 'Props')
|
|
23
23
|
|
|
@@ -35,11 +35,6 @@ export default defineScope({
|
|
|
35
35
|
title: 'Read only',
|
|
36
36
|
component: lazy(() => import('./readOnly')),
|
|
37
37
|
},
|
|
38
|
-
{
|
|
39
|
-
name: 'multiple-tones',
|
|
40
|
-
title: 'Multiple tones',
|
|
41
|
-
component: lazy(() => import('./multipleTones')),
|
|
42
|
-
},
|
|
43
38
|
{
|
|
44
39
|
name: 'states',
|
|
45
40
|
title: 'States',
|
|
@@ -57,7 +57,7 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
57
57
|
const iconRight = useSelect(
|
|
58
58
|
'Icon (right)',
|
|
59
59
|
WORKSHOP_ICON_SYMBOL_OPTIONS,
|
|
60
|
-
'
|
|
60
|
+
'cube',
|
|
61
61
|
'Props',
|
|
62
62
|
) as IconSymbol
|
|
63
63
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
@@ -83,7 +83,6 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
83
83
|
icon={icon && icons[icon]}
|
|
84
84
|
iconRight={iconRight && icons[iconRight]}
|
|
85
85
|
id="text-input-example"
|
|
86
|
-
name="email"
|
|
87
86
|
onChange={handleChange}
|
|
88
87
|
padding={padding}
|
|
89
88
|
placeholder={placeholder}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {TextInput} from '@sanity/ui'
|
|
1
|
+
import {Flex, TextInput} from '@sanity/ui'
|
|
2
2
|
|
|
3
3
|
export default function ReadOnlyStory() {
|
|
4
|
-
return
|
|
4
|
+
return (
|
|
5
|
+
<Flex padding={4}>
|
|
6
|
+
<TextInput id="text-input-example" readOnly />
|
|
7
|
+
</Flex>
|
|
8
|
+
)
|
|
5
9
|
}
|
|
@@ -3,7 +3,9 @@ import {useBoolean} from '@sanity/ui-workshop'
|
|
|
3
3
|
|
|
4
4
|
export default function TonesStory() {
|
|
5
5
|
const transparentTone = useBoolean('Transparent', true)
|
|
6
|
+
const neutralTone = useBoolean('Neutral', true)
|
|
6
7
|
const primaryTone = useBoolean('Primary', true)
|
|
8
|
+
const suggestTone = useBoolean('Suggest', true)
|
|
7
9
|
const positiveTone = useBoolean('Positive', true)
|
|
8
10
|
const cautionTone = useBoolean('Caution', true)
|
|
9
11
|
const criticalTone = useBoolean('Critical', true)
|
|
@@ -49,6 +51,24 @@ export default function TonesStory() {
|
|
|
49
51
|
</Card>
|
|
50
52
|
)}
|
|
51
53
|
|
|
54
|
+
{neutralTone && (
|
|
55
|
+
<Card padding={3} tone="neutral">
|
|
56
|
+
<TextInput
|
|
57
|
+
placeholder="neutral"
|
|
58
|
+
prefix={
|
|
59
|
+
<Box padding={3}>
|
|
60
|
+
<Text>prefix</Text>
|
|
61
|
+
</Box>
|
|
62
|
+
}
|
|
63
|
+
suffix={
|
|
64
|
+
<Box padding={3}>
|
|
65
|
+
<Text>suffix</Text>
|
|
66
|
+
</Box>
|
|
67
|
+
}
|
|
68
|
+
/>
|
|
69
|
+
</Card>
|
|
70
|
+
)}
|
|
71
|
+
|
|
52
72
|
{primaryTone && (
|
|
53
73
|
<Card padding={3} tone="primary">
|
|
54
74
|
<TextInput
|
|
@@ -67,6 +87,24 @@ export default function TonesStory() {
|
|
|
67
87
|
</Card>
|
|
68
88
|
)}
|
|
69
89
|
|
|
90
|
+
{suggestTone && (
|
|
91
|
+
<Card padding={3} tone="suggest">
|
|
92
|
+
<TextInput
|
|
93
|
+
placeholder="suggest"
|
|
94
|
+
prefix={
|
|
95
|
+
<Box padding={3}>
|
|
96
|
+
<Text>prefix</Text>
|
|
97
|
+
</Box>
|
|
98
|
+
}
|
|
99
|
+
suffix={
|
|
100
|
+
<Box padding={3}>
|
|
101
|
+
<Text>suffix</Text>
|
|
102
|
+
</Box>
|
|
103
|
+
}
|
|
104
|
+
/>
|
|
105
|
+
</Card>
|
|
106
|
+
)}
|
|
107
|
+
|
|
70
108
|
{positiveTone && (
|
|
71
109
|
<Card padding={3} tone="positive">
|
|
72
110
|
<TextInput
|
|
@@ -55,10 +55,18 @@ export function _cardColorStyle(
|
|
|
55
55
|
'--card-badge-default-dot-color': color.badge.default.dot,
|
|
56
56
|
'--card-badge-default-fg-color': color.badge.default.fg,
|
|
57
57
|
'--card-badge-default-icon-color': color.badge.default.icon,
|
|
58
|
+
'--card-badge-neutral-bg-color': color.badge.neutral?.bg,
|
|
59
|
+
'--card-badge-neutral-dot-color': color.badge.neutral?.dot,
|
|
60
|
+
'--card-badge-neutral-fg-color': color.badge.neutral?.fg,
|
|
61
|
+
'--card-badge-neutral-icon-color': color.badge.neutral?.icon,
|
|
58
62
|
'--card-badge-primary-bg-color': color.badge.primary.bg,
|
|
59
63
|
'--card-badge-primary-dot-color': color.badge.primary.dot,
|
|
60
64
|
'--card-badge-primary-fg-color': color.badge.primary.fg,
|
|
61
65
|
'--card-badge-primary-icon-color': color.badge.primary.icon,
|
|
66
|
+
'--card-badge-suggest-bg-color': color.badge.suggest?.bg,
|
|
67
|
+
'--card-badge-suggest-dot-color': color.badge.suggest?.dot,
|
|
68
|
+
'--card-badge-suggest-fg-color': color.badge.suggest?.fg,
|
|
69
|
+
'--card-badge-suggest-icon-color': color.badge.suggest?.icon,
|
|
62
70
|
'--card-badge-positive-bg-color': color.badge.positive.bg,
|
|
63
71
|
'--card-badge-positive-dot-color': color.badge.positive.dot,
|
|
64
72
|
'--card-badge-positive-fg-color': color.badge.positive.fg,
|
|
@@ -71,14 +79,6 @@ export function _cardColorStyle(
|
|
|
71
79
|
'--card-badge-critical-dot-color': color.badge.critical.dot,
|
|
72
80
|
'--card-badge-critical-fg-color': color.badge.critical.fg,
|
|
73
81
|
'--card-badge-critical-icon-color': color.badge.critical.icon,
|
|
74
|
-
'--card-badge-prospect-bg-color': color.badge.prospect.bg,
|
|
75
|
-
'--card-badge-prospect-dot-color': color.badge.prospect.dot,
|
|
76
|
-
'--card-badge-prospect-fg-color': color.badge.prospect.fg,
|
|
77
|
-
'--card-badge-prospect-icon-color': color.badge.prospect.icon,
|
|
78
|
-
'--card-badge-explore-bg-color': color.badge.explore.bg,
|
|
79
|
-
'--card-badge-explore-dot-color': color.badge.explore.dot,
|
|
80
|
-
'--card-badge-explore-fg-color': color.badge.explore.fg,
|
|
81
|
-
'--card-badge-explore-icon-color': color.badge.explore.icon,
|
|
82
82
|
|
|
83
83
|
'--card-code-bg-color': color.code.bg,
|
|
84
84
|
'--card-code-fg-color': color.code.fg,
|