@sanity/ui 3.0.0-static.19 → 3.0.0-static.20

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.
Files changed (131) hide show
  1. package/dist/_chunks-cjs/_visual-editing.cjs +109 -112
  2. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.cjs +30 -24
  4. package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
  5. package/dist/_chunks-es/_visual-editing.js +110 -113
  6. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  7. package/dist/cli.cjs +1 -1
  8. package/dist/css.cjs +379 -358
  9. package/dist/css.cjs.map +1 -1
  10. package/dist/css.d.cts +45 -10
  11. package/dist/css.d.ts +45 -10
  12. package/dist/css.js +379 -358
  13. package/dist/css.js.map +1 -1
  14. package/dist/index.d.cts +0 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/theme.cjs +89 -64
  17. package/dist/theme.cjs.map +1 -1
  18. package/dist/theme.d.cts +28 -2
  19. package/dist/theme.d.ts +28 -2
  20. package/dist/theme.js +89 -64
  21. package/dist/theme.js.map +1 -1
  22. package/dist/ui-system.css +1236 -801
  23. package/dist/ui-system.min.css +1 -1
  24. package/dist/ui-theme.css +413 -82
  25. package/dist/ui-theme.min.css +1 -1
  26. package/dist/ui.css +1649 -883
  27. package/dist/ui.min.css +1 -1
  28. package/exports/_visual-editing.ts +0 -1
  29. package/package.json +6 -6
  30. package/src/cli/buildCommand.ts +48 -41
  31. package/src/core/components/autocomplete/__workshop__/async.tsx +1 -1
  32. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  33. package/src/core/components/autocomplete/__workshop__/custom.tsx +12 -11
  34. package/src/core/components/autocomplete/__workshop__/example.tsx +13 -12
  35. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +53 -54
  36. package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -2
  37. package/src/core/components/dialog/__workshop__/autoFocus.tsx +2 -2
  38. package/src/core/components/dialog/__workshop__/onScroll.tsx +16 -4
  39. package/src/core/components/dialog/__workshop__/position.tsx +3 -3
  40. package/src/core/components/dialog/__workshop__/props.tsx +6 -6
  41. package/src/core/components/menu/__workshop__/menuButton.tsx +3 -3
  42. package/src/core/components/menu/__workshop__/tones.tsx +3 -3
  43. package/src/core/components/skeleton/__workshop__/delay.tsx +2 -2
  44. package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
  45. package/src/core/components/tab/__workshop__/example.tsx +1 -1
  46. package/src/core/components/toast/__workshop__/toast.tsx +5 -5
  47. package/src/core/primitives/avatar/__workshop__/asButton.tsx +2 -2
  48. package/src/core/primitives/avatar/__workshop__/stack.tsx +2 -2
  49. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
  50. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
  51. package/src/core/primitives/badge/__workshop__/props.tsx +5 -8
  52. package/src/core/primitives/box/__workshop__/props.tsx +2 -2
  53. package/src/core/primitives/box/box.tsx +2 -0
  54. package/src/core/primitives/button/__workshop__/props.tsx +17 -19
  55. package/src/core/primitives/button/__workshop__/stacked.tsx +12 -12
  56. package/src/core/primitives/card/__workshop__/asButton.tsx +1 -1
  57. package/src/core/primitives/card/__workshop__/interactive.tsx +2 -2
  58. package/src/core/primitives/card/__workshop__/props.tsx +11 -11
  59. package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
  60. package/src/core/primitives/checkbox/__workshop__/props.tsx +5 -5
  61. package/src/core/primitives/code/__workshop__/props.tsx +4 -7
  62. package/src/core/primitives/code/code.tsx +1 -1
  63. package/src/core/primitives/container/__workshop__/example.tsx +2 -2
  64. package/src/core/primitives/flex/__workshop__/example.tsx +2 -2
  65. package/src/core/primitives/heading/__workshop__/plain.tsx +11 -7
  66. package/src/core/primitives/heading/heading.tsx +1 -1
  67. package/src/core/primitives/inline/__workshop__/plain.tsx +2 -5
  68. package/src/core/primitives/label/__workshop__/plain.tsx +7 -8
  69. package/src/core/primitives/label/label.tsx +1 -1
  70. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +6 -6
  71. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
  72. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
  73. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
  74. package/src/core/primitives/popover/__workshop__/TestStory.tsx +3 -1
  75. package/src/core/primitives/radio/__workshop__/example.tsx +2 -2
  76. package/src/core/primitives/radio/__workshop__/plain.tsx +3 -3
  77. package/src/core/primitives/select/__workshop__/plain.tsx +5 -8
  78. package/src/core/primitives/spinner/__workshop__/Props.tsx +3 -3
  79. package/src/core/primitives/stack/__workshop__/plain.tsx +2 -2
  80. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  81. package/src/core/primitives/text/__workshop__/example.tsx +8 -11
  82. package/src/core/primitives/textArea/__workshop__/plain.tsx +11 -12
  83. package/src/core/primitives/textArea/textArea.tsx +10 -7
  84. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
  85. package/src/core/primitives/textInput/__workshop__/plain.tsx +30 -18
  86. package/src/core/primitives/textInput/__workshop__/states.tsx +1 -1
  87. package/src/core/primitives/textInput/__workshop__/typed.tsx +2 -2
  88. package/src/core/primitives/textInput/textInput.tsx +11 -20
  89. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +3 -3
  90. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
  91. package/src/core/primitives/tooltip/__workshop__/props.tsx +4 -4
  92. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
  93. package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -3
  94. package/src/css/_system.style.ts +2 -0
  95. package/src/css/aspects/font/font.style.ts +9 -8
  96. package/src/css/aspects/index.ts +1 -0
  97. package/src/css/aspects/margin/margin.style.ts +13 -0
  98. package/src/css/aspects/margin/types.ts +12 -7
  99. package/src/css/aspects/minHeight/index.ts +2 -0
  100. package/src/css/aspects/minHeight/minHeight.style.ts +9 -0
  101. package/src/css/aspects/minHeight/minHeight.ts +8 -0
  102. package/src/css/aspects/minHeight/types.ts +9 -0
  103. package/src/css/components/skeleton/skeleton.style.ts +7 -10
  104. package/src/css/primitives/_input/_input.style.ts +30 -51
  105. package/src/css/primitives/_selectable/_selectable.style.ts +2 -3
  106. package/src/css/primitives/box/box.style.ts +0 -3
  107. package/src/css/primitives/box/box.ts +2 -0
  108. package/src/css/primitives/box/types.ts +2 -0
  109. package/src/css/primitives/card/card.style.ts +3 -0
  110. package/src/css/primitives/code/code.style.ts +1 -0
  111. package/src/css/primitives/heading/heading.style.ts +1 -0
  112. package/src/css/primitives/label/label.style.ts +1 -0
  113. package/src/css/primitives/text/text.style.ts +1 -0
  114. package/src/css/primitives/textArea/textArea.style.ts +1 -3
  115. package/src/css/primitives/textInput/textInput.style.ts +10 -18
  116. package/src/css/primitives/textInput/textInput.ts +15 -0
  117. package/src/css/primitives/tooltip/tooltip.style.ts +0 -13
  118. package/src/css/primitives/tooltip/tooltip.ts +0 -5
  119. package/src/css/theme/resolveTheme.ts +29 -18
  120. package/src/theme/v0/font.ts +0 -1
  121. package/src/theme/v2/defaults/fonts.ts +0 -1
  122. package/src/theme/v3/_parseColorToken.ts +0 -5
  123. package/src/theme/v3/buildTheme_v3.ts +2 -2
  124. package/src/theme/v3/defaultFonts.ts +250 -0
  125. package/src/theme/v3/defaultTokens.ts +39 -35
  126. package/src/theme/v3/types.ts +35 -2
  127. package/src/theme/versioning/v3_v2.ts +1 -0
  128. package/src/css/primitives/_input/__workshop__/customInput.tsx +0 -16
  129. package/src/css/primitives/_input/__workshop__/index.ts +0 -14
  130. /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/apiStore.ts +0 -0
  131. /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/countries.ts +0 -0
@@ -1,16 +1,13 @@
1
1
  import {Badge, Flex} from '@sanity/ui'
2
2
  import {useAction, useSelect, useText} from '@sanity/ui-workshop'
3
3
 
4
- import {
5
- WORKSHOP_BADGE_TONE_OPTIONS,
6
- WORKSHOP_SPACE_OPTIONS,
7
- } from '../../../../../workshop/constants'
4
+ import {WORKSHOP_BADGE_TONE_OPTIONS, WORKSHOP_SPACE_OPTIONS} from '$workshop'
8
5
 
9
6
  export default function PropsStory() {
10
- const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 1, 'Props')
11
- const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 1, 'Props')
12
- const tone = useSelect('Tone', WORKSHOP_BADGE_TONE_OPTIONS, 'default', 'Props')
13
- const textProp = useText('Text', 'Label', 'Props')
7
+ const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 1)
8
+ const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 1)
9
+ const tone = useSelect('Tone', WORKSHOP_BADGE_TONE_OPTIONS, 'default')
10
+ const textProp = useText('Text', 'Label')
14
11
 
15
12
  return (
16
13
  <Flex align="center" height="fill" justify="center">
@@ -1,10 +1,10 @@
1
1
  import {Box, Card, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_SPACE_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function PropsStory() {
7
- const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 0, 'Props')
7
+ const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 0)
8
8
 
9
9
  return (
10
10
  <Box padding={[4, 5, 6]}>
@@ -94,6 +94,7 @@ export function Box<E extends BoxElementType = typeof DEFAULT_BOX_ELEMENT>(props
94
94
  marginBottom,
95
95
  marginLeft,
96
96
  maxWidth,
97
+ minHeight = 0,
97
98
  minWidth = 0,
98
99
  muted,
99
100
  outline,
@@ -162,6 +163,7 @@ export function Box<E extends BoxElementType = typeof DEFAULT_BOX_ELEMENT>(props
162
163
  marginBottom,
163
164
  marginLeft,
164
165
  maxWidth,
166
+ minHeight,
165
167
  minWidth,
166
168
  muted,
167
169
  outline,
@@ -9,28 +9,26 @@ import {
9
9
  WORKSHOP_FLEX_JUSTIFY_OPTIONS,
10
10
  WORKSHOP_ICON_SYMBOL_OPTIONS,
11
11
  WORKSHOP_SPACE_OPTIONS,
12
- WORKSHOP_TEXT_SIZE_OPTIONS,
12
+ WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
13
13
  WORKSHOP_TEXT_WEIGHT_OPTIONS,
14
- } from '../../../../../workshop/constants'
14
+ } from '$workshop'
15
15
 
16
16
  export default function ButtonStory() {
17
- const disabled = useBoolean('Disabled', false, 'Props')
18
- const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
19
- const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
20
- const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props')
21
- const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props')
22
- const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props')
23
- const loading = useBoolean('Loading', false, 'Props')
24
- const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default', 'Props')
25
- const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
26
- const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
27
- const selected = useBoolean('Selected', false, 'Props')
28
- const tone = useSelect('Tone', WORKSHOP_BUTTON_TONE_OPTIONS, 'default', 'Props')
29
- const textAlign =
30
- useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS, undefined, 'Props') || undefined
31
- const textProp = useText('Text', 'Label', 'Props')
32
- const textWeight =
33
- useSelect('Text weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
17
+ const disabled = useBoolean('Disabled')
18
+ const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
19
+ const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS)
20
+ const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS)
21
+ const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS)
22
+ const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS)
23
+ const loading = useBoolean('Loading')
24
+ const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS)
25
+ const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS)
26
+ const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS)
27
+ const selected = useBoolean('Selected')
28
+ const tone = useSelect('Tone', WORKSHOP_BUTTON_TONE_OPTIONS)
29
+ const textAlign = useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS)
30
+ const textProp = useText('Text', 'Label')
31
+ const textWeight = useSelect('Text weight', WORKSHOP_TEXT_WEIGHT_OPTIONS)
34
32
 
35
33
  return (
36
34
  <Flex align="center" height="fill" justify="center">
@@ -8,22 +8,22 @@ import {
8
8
  WORKSHOP_FLEX_JUSTIFY_OPTIONS,
9
9
  WORKSHOP_ICON_SYMBOL_OPTIONS,
10
10
  WORKSHOP_SPACE_OPTIONS,
11
- WORKSHOP_TEXT_SIZE_OPTIONS,
12
- } from '../../../../../workshop/constants'
11
+ WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
12
+ } from '$workshop'
13
13
 
14
14
  export default function StackedStory() {
15
15
  const tones = Object.entries(WORKSHOP_BUTTON_TONE_OPTIONS)
16
- const disabled = useBoolean('Disabled', false, 'Props')
17
- const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
18
- const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
19
- const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props')
20
- const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props')
21
- const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props')
22
- const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default', 'Props')
16
+ const disabled = useBoolean('Disabled', false)
17
+ const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
18
+ const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3)
19
+ const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle')
20
+ const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS)
21
+ const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center')
22
+ const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default')
23
23
  const onClick = useAction('onClick')
24
- const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
25
- const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
26
- const selected = useBoolean('Selected', false, 'Props')
24
+ const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3)
25
+ const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3)
26
+ const selected = useBoolean('Selected', false)
27
27
 
28
28
  return (
29
29
  <Card height="fill">
@@ -1,6 +1,6 @@
1
1
  import {Box, Card, Container, Flex, Grid, Stack, Text} from '@sanity/ui'
2
2
 
3
- import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../../../workshop/constants'
3
+ import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
4
4
 
5
5
  export default function AsButtonStory() {
6
6
  const tones = Object.entries(WORKSHOP_CARD_TONE_OPTIONS)
@@ -2,8 +2,8 @@ import {Card, Flex, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean} from '@sanity/ui-workshop'
3
3
 
4
4
  export default function InteractiveCardStory() {
5
- const pressed = useBoolean('Pressed', false, 'Props')
6
- const selected = useBoolean('Selected', false, 'Props')
5
+ const pressed = useBoolean('Pressed', false)
6
+ const selected = useBoolean('Selected', false)
7
7
 
8
8
  return (
9
9
  <Flex align="center" height="fill" justify="center">
@@ -7,19 +7,19 @@ import {
7
7
  WORKSHOP_RADIUS_OPTIONS,
8
8
  WORKSHOP_SHADOW_OPTIONS,
9
9
  WORKSHOP_SPACE_OPTIONS,
10
- } from '../../../../../workshop/constants'
10
+ } from '$workshop'
11
11
 
12
12
  export default function PropsStory() {
13
- const as = useSelect('As', WORKSHOP_CARD_AS_OPTIONS, 'div', 'Props')
14
- const border = useBoolean('Border', false, 'Props')
15
- const checkered = useBoolean('Checkered', false, 'Props')
16
- const muted = useBoolean('Muted', false, 'Props')
17
- const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
18
- const pressed = useBoolean('Pressed', false, 'Props')
19
- const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0, 'Props')
20
- const selected = useBoolean('Selected', false, 'Props')
21
- const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 0, 'Props')
22
- const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS, 'default', 'Props')
13
+ const as = useSelect('As', WORKSHOP_CARD_AS_OPTIONS, 'div')
14
+ const border = useBoolean('Border', false)
15
+ const checkered = useBoolean('Checkered', false)
16
+ const muted = useBoolean('Muted', false)
17
+ const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
18
+ const pressed = useBoolean('Pressed', false)
19
+ const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0)
20
+ const selected = useBoolean('Selected', false)
21
+ const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 0)
22
+ const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS, 'default')
23
23
 
24
24
  return (
25
25
  <Flex align="center" height="fill" justify="center" padding={4} sizing="border">
@@ -3,8 +3,8 @@ import {Box, Card, Container, Flex, Inline, Stack, Text} from '@sanity/ui'
3
3
  import {useBoolean} from '@sanity/ui-workshop'
4
4
 
5
5
  export default function SelectedStory() {
6
- const disabled = useBoolean('Disabled', false) || false
7
- const selected = useBoolean('Selected', false) || false
6
+ const disabled = useBoolean('Disabled', false)
7
+ const selected = useBoolean('Selected', false)
8
8
 
9
9
  return (
10
10
  <Flex align="center" height="fill" justify="center" padding={4} sizing="border">
@@ -2,14 +2,14 @@ import {Box, Checkbox, Flex, Text} from '@sanity/ui'
2
2
  import {useAction, useBoolean} from '@sanity/ui-workshop'
3
3
 
4
4
  export default function PropsStory() {
5
- const checked = useBoolean('Checked', false, 'Props')
6
- const disabled = useBoolean('Disabled', false, 'Props')
7
- const indeterminate = useBoolean('Indeterminate', false, 'Props')
8
- const invalid = useBoolean('Invalid', false, 'Props')
5
+ const checked = useBoolean('Checked', false)
6
+ const disabled = useBoolean('Disabled', false)
7
+ const indeterminate = useBoolean('Indeterminate', false)
8
+ const invalid = useBoolean('Invalid', false)
9
9
  const onChange = useAction('onChange')
10
10
  const onFocus = useAction('onFocus')
11
11
  const onBlur = useAction('onBlur')
12
- const readOnly = useBoolean('Read only', false, 'Props')
12
+ const readOnly = useBoolean('Read only', false)
13
13
 
14
14
  return (
15
15
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -1,15 +1,12 @@
1
1
  import {Box, Code} from '@sanity/ui'
2
2
  import {useSelect, useText} from '@sanity/ui-workshop'
3
3
 
4
- import {
5
- WORKSHOP_CODE_LANGUAGE_OPTIONS,
6
- WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
7
- } from '../../../../../workshop/constants'
4
+ import {WORKSHOP_CODE_LANGUAGE_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
8
5
 
9
6
  export default function PropsStory() {
10
- const code = useText('Code', `console.log('Hello, world')`, 'Props')
11
- const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript', 'Props')
12
- const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1, 'Props')
7
+ const code = useText('Code', `console.log('Hello, world')`)
8
+ const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript')
9
+ const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
13
10
 
14
11
  return (
15
12
  <Box padding={[4, 5, 6]}>
@@ -29,7 +29,7 @@ export function Code<E extends CodeElementType = typeof DEFAULT_CODE_ELEMENT>(pr
29
29
  className,
30
30
  language: languageProp,
31
31
  size = 2,
32
- weight,
32
+ weight = 'regular',
33
33
  ...rest
34
34
  } = props as CodeProps<typeof DEFAULT_CODE_ELEMENT>
35
35
 
@@ -1,10 +1,10 @@
1
1
  import {Card, Container, Flex, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function PlainStory() {
7
- const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 0, 'Props')
7
+ const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 0)
8
8
 
9
9
  return (
10
10
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -2,7 +2,7 @@ import {Card, Code, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
3
  import {styled} from 'styled-components'
4
4
 
5
- import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '../../../../../workshop/constants'
5
+ import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '$workshop'
6
6
 
7
7
  const DebugCard = styled(Card)`
8
8
  outline: 1px solid red;
@@ -14,7 +14,7 @@ const DebugCard = styled(Card)`
14
14
  `
15
15
 
16
16
  export default function ExampleStory() {
17
- const direction = useSelect('Direction', WORKSHOP_FLEX_DIRECTION_OPTIONS, 'row', 'Props')
17
+ const direction = useSelect('Direction', WORKSHOP_FLEX_DIRECTION_OPTIONS, 'row')
18
18
 
19
19
  return (
20
20
  <Flex direction={direction} height="fill" style={{width: '100%'}}>
@@ -5,15 +5,19 @@ import {
5
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
6
6
  WORKSHOP_HEADING_FONT_SIZE_OPTIONS,
7
7
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
8
- } from '../../../../../workshop/constants'
8
+ } from '$workshop'
9
9
 
10
10
  export default function PlainStory() {
11
- const muted = useBoolean('Muted', false, 'Props')
12
- const size = useSelect('Size', WORKSHOP_HEADING_FONT_SIZE_OPTIONS, 2, 'Props')
13
- const textChild = useText('Text', 'Hello, world', 'Props')
14
- const textOverflow =
15
- useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS, '', 'Props') || undefined
16
- const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS, '', 'Props') || undefined
11
+ const muted = useBoolean('Muted', false)
12
+ const size = useSelect('Size', WORKSHOP_HEADING_FONT_SIZE_OPTIONS, 2)
13
+ const textChild = useText('Text', 'Hello, world')
14
+ const textOverflow = useSelect(
15
+ 'Text overflow',
16
+ WORKSHOP_TEXT_OVERFLOW_OPTIONS,
17
+ undefined,
18
+ 'Props',
19
+ )
20
+ const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
17
21
 
18
22
  return (
19
23
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -51,7 +51,7 @@ export function Heading<E extends HeadingElementType = typeof DEFAULT_HEADING_EL
51
51
  muted = false,
52
52
  size = 2,
53
53
  textOverflow: textOverflowProp,
54
- weight,
54
+ weight = 'regular',
55
55
  ...rest
56
56
  } = props as HeadingProps<typeof DEFAULT_HEADING_ELEMENT>
57
57
 
@@ -1,15 +1,12 @@
1
1
  import {Card, Flex, Inline, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_SPACE_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function PlainStory() {
7
7
  return (
8
8
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
9
- <Inline
10
- gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}
11
- onClick={useAction('onClick')}
12
- >
9
+ <Inline gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0)} onClick={useAction('onClick')}>
13
10
  <Card padding={1} shadow={1}>
14
11
  <Text size={1}>Inline item</Text>
15
12
  </Card>
@@ -6,16 +6,15 @@ import {
6
6
  WORKSHOP_LABEL_FONT_SIZE_OPTIONS,
7
7
  WORKSHOP_TEXT_ALIGN_OPTIONS,
8
8
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
9
- } from '../../../../../workshop/constants'
9
+ } from '$workshop'
10
10
 
11
11
  export default function PlainStory() {
12
- const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS, undefined, 'Props') || undefined
13
- const muted = useBoolean('Muted', false, 'Props')
14
- const size = useSelect('Size', WORKSHOP_LABEL_FONT_SIZE_OPTIONS, undefined, 'Props')
15
- const textChild = useText('Text', 'Label text', 'Props')
16
- const textOverflow =
17
- useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS, '', 'Props') || undefined
18
- const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS, '', 'Props') || undefined
12
+ const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS)
13
+ const muted = useBoolean('Muted', false)
14
+ const size = useSelect('Size', WORKSHOP_LABEL_FONT_SIZE_OPTIONS)
15
+ const textChild = useText('Text', 'Label text')
16
+ const textOverflow = useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS)
17
+ const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
19
18
 
20
19
  return (
21
20
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -49,7 +49,7 @@ export function Label<E extends LabelElementType = typeof DEFAULT_LABEL_ELEMENT>
49
49
  muted = false,
50
50
  size = 1,
51
51
  textOverflow: textOverflowProp,
52
- weight = 'medium',
52
+ weight = 'regular',
53
53
  ...rest
54
54
  } = props
55
55
 
@@ -4,20 +4,20 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
4
4
  import {useCallback, useRef, useState} from 'react'
5
5
 
6
6
  import {
7
+ WORKSHOP_CONTAINER_WIDTH_OPTIONS,
7
8
  WORKSHOP_FLEX_ALIGN_OPTIONS,
8
9
  WORKSHOP_FLEX_JUSTIFY_OPTIONS,
9
10
  WORKSHOP_PLACEMENT_OPTIONS,
10
- WORKSHOP_WIDTH_OPTIONS,
11
- } from '../../../../../workshop/constants'
11
+ } from '$workshop'
12
12
 
13
13
  export default function AlignedStory() {
14
14
  const constrainSize = useBoolean('Constrain size', false)
15
- const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
15
+ const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS)
16
16
  const portal = useBoolean('Portal', true)
17
- const width = useSelect('Width', WORKSHOP_WIDTH_OPTIONS, 'auto')
17
+ const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 'auto')
18
18
 
19
- const flexAlign = useSelect('Align', WORKSHOP_FLEX_ALIGN_OPTIONS, 'flex-start')
20
- const flexJustify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'flex-end')
19
+ const flexAlign = useSelect('Align', WORKSHOP_FLEX_ALIGN_OPTIONS)
20
+ const flexJustify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS)
21
21
 
22
22
  const [open, setOpen] = useState(false)
23
23
  const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
@@ -1,11 +1,11 @@
1
1
  import {Box, Button, Container, Flex, Popover, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_PLACEMENT_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function MatchReferenceWidthStory() {
7
- const arrow = useBoolean('Arrow', true, 'Props')
8
- const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom', 'Props')
7
+ const arrow = useBoolean('Arrow', true)
8
+ const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
9
9
 
10
10
  return (
11
11
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -7,7 +7,7 @@ import {
7
7
  WORKSHOP_PLACEMENT_OPTIONS,
8
8
  WORKSHOP_RADIUS_OPTIONS,
9
9
  WORKSHOP_SPACE_OPTIONS,
10
- } from '../../../../../workshop/constants'
10
+ } from '$workshop'
11
11
 
12
12
  export default function PlainStory() {
13
13
  const arrow = useBoolean('Arrow', true)
@@ -1,7 +1,7 @@
1
1
  import {useSelect} from '@sanity/ui-workshop'
2
2
  import {useCallback, useEffect, useRef, useState} from 'react'
3
3
 
4
- import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
5
5
  import type {CardTone} from '../../../types'
6
6
  import {BoundaryElementProvider} from '../../../utils'
7
7
  import {Box} from '../../box'
@@ -3,9 +3,11 @@ import {useRef, useState} from 'react'
3
3
 
4
4
  import {
5
5
  WORKSHOP_CONTAINER_WIDTH_OPTIONS,
6
+ // WORKSHOP_CONTAINER_WIDTH_OPTIONS,
6
7
  WORKSHOP_PLACEMENT_OPTIONS,
7
8
  WORKSHOP_RADIUS_OPTIONS,
8
- } from '../../../../../workshop/constants'
9
+ } from '$workshop'
10
+
9
11
  import {BoundaryElementProvider, PortalProvider} from '../../../utils'
10
12
  import {Button} from '../../button'
11
13
  import {Card} from '../../card'
@@ -4,8 +4,8 @@ import {useCallback, useState} from 'react'
4
4
 
5
5
  export default function ExampleStory() {
6
6
  const [value, setValue] = useState('first-option')
7
- const disabled = useBoolean('Disabled', false, 'Props')
8
- const readOnly = useBoolean('Read only', false, 'Props')
7
+ const disabled = useBoolean('Disabled', false)
8
+ const readOnly = useBoolean('Read only', false)
9
9
 
10
10
  const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
11
11
  setValue(event.target.value)
@@ -2,14 +2,14 @@ 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', false, 'Props')
6
- const disabled = useBoolean('Disabled', false, 'Props')
5
+ const checked = useBoolean('Checked', false)
6
+ const disabled = useBoolean('Disabled', false)
7
7
  const id = 'radioStory'
8
8
  const name = 'radioStory'
9
9
  const onBlur = useAction('onBlur')
10
10
  const onChange = useAction('onChange')
11
11
  const onFocus = useAction('onFocus')
12
- const readOnly = useBoolean('Read only', false, 'Props')
12
+ const readOnly = useBoolean('Read only', false)
13
13
 
14
14
  return (
15
15
  <Flex align="center" height="fill" justify="center" padding={[3, 4, 5]} sizing="border">
@@ -1,17 +1,14 @@
1
1
  import {Card, Container, Label, Select, Stack} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {
5
- WORKSHOP_RADIUS_OPTIONS,
6
- WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
7
- } from '../../../../../workshop/constants'
4
+ import {WORKSHOP_RADIUS_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
8
5
 
9
6
  export default function PlainStory() {
10
7
  const border = useBoolean('Border', true)
11
- const disabled = useBoolean('Disabled', false, 'Props')
12
- const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2, 'Props')
13
- const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, undefined, 'Props')
14
- const readOnly = useBoolean('Read only', false, 'Props')
8
+ const disabled = useBoolean('Disabled', false)
9
+ const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
10
+ const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS)
11
+ const readOnly = useBoolean('Read only', false)
15
12
 
16
13
  return (
17
14
  <Container width={0}>
@@ -1,11 +1,11 @@
1
1
  import {Flex, Spinner} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_TEXT_SIZE_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function Props() {
7
- const muted = useBoolean('Muted', false, 'Props')
8
- const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
7
+ const muted = useBoolean('Muted', false)
8
+ const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
9
9
 
10
10
  return (
11
11
  <Flex align="center" height="fill" justify="center">
@@ -1,13 +1,13 @@
1
1
  import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
3
 
4
- import {WORKSHOP_SPACE_OPTIONS} from '../../../../../workshop/constants'
4
+ import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
5
5
 
6
6
  export default function PlainStory() {
7
7
  return (
8
8
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
9
9
  <Container width={0}>
10
- <Stack gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}>
10
+ <Stack gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0)}>
11
11
  <Card padding={[2, 3, 4]} shadow={1}>
12
12
  <Text align="center" muted>
13
13
  Stack item
@@ -4,14 +4,14 @@ import type {AvatarColor} from '@sanity/ui/theme'
4
4
  import {useSelect} from '@sanity/ui-workshop'
5
5
  import {styled} from 'styled-components'
6
6
 
7
- import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../../../workshop/constants'
7
+ import {WORKSHOP_AVATAR_COLOR_OPTIONS} from '$workshop'
8
8
 
9
9
  const ColoredText = styled(Text)<{$color: AvatarColor}>`
10
10
  ${varNames.color.fg}: ${({$color}) => vars.color.avatar[$color].bg};
11
11
  `
12
12
 
13
13
  export default function ColoredTextStory() {
14
- const color = useSelect('Color', WORKSHOP_SPOT_COLOR_OPTIONS, 'magenta') || 'magenta'
14
+ const color = useSelect('Color', WORKSHOP_AVATAR_COLOR_OPTIONS, 'gray') ?? 'gray'
15
15
 
16
16
  return (
17
17
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
@@ -3,21 +3,18 @@ import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
3
 
4
4
  import {
5
5
  WORKSHOP_TEXT_ALIGN_OPTIONS,
6
+ WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
6
7
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
7
- WORKSHOP_TEXT_SIZE_OPTIONS,
8
8
  WORKSHOP_TEXT_WEIGHT_OPTIONS,
9
- } from '../../../../../workshop/constants'
9
+ } from '$workshop'
10
10
 
11
11
  export default function TextStory() {
12
- const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS, '', 'Props') || undefined
13
- const muted = useBoolean('Muted', false, 'Props')
14
- const size = useSelect('Size', WORKSHOP_TEXT_SIZE_OPTIONS, 1, 'Props')
15
- const text = useText('Text', 'Hello, world', 'Props')
16
-
17
- const textOverflow =
18
- useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS, undefined, 'Props') || undefined
19
-
20
- const weight = useSelect('Weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
12
+ const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS)
13
+ const muted = useBoolean('Muted', false)
14
+ const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
15
+ const text = useText('Text', 'Hello, world')
16
+ const textOverflow = useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS)
17
+ const weight = useSelect('Weight', WORKSHOP_TEXT_WEIGHT_OPTIONS)
21
18
 
22
19
  return (
23
20
  <Flex align="center" height="fill" justify="center" padding={4} sizing="border">