@conveyorhq/arrow-ds 2.0.0-beta.7 → 2.0.0-beta.9

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 (181) hide show
  1. package/package.json +15 -14
  2. package/public/components/Accordion/Accordion.js +8 -10
  3. package/public/components/Avatar/Avatar.js +20 -19
  4. package/public/components/Button/Button.js +2 -2
  5. package/public/components/ConveyorLogo/ConveyorLogo.js +6 -6
  6. package/public/components/Drawer/Drawer.js +7 -7
  7. package/public/components/Frame/Frame.d.ts +1 -1
  8. package/public/components/Icon/Icon.d.ts +1 -0
  9. package/public/components/Icon/Icon.js +3 -1
  10. package/public/components/MenuRenderer/MenuRenderer.js +4 -7
  11. package/public/components/Modal/Modal.js +1 -1
  12. package/public/components/OptionButton/OptionButton.js +18 -13
  13. package/public/components/Select/Select.js +4 -4
  14. package/public/components/Select/SelectPopover.js +6 -6
  15. package/public/components/Select/index.d.ts +2 -0
  16. package/public/components/Select/index.js +3 -0
  17. package/public/components/Select/theme.js +22 -22
  18. package/public/components/Svg/Svg.d.ts +3 -3
  19. package/public/components/Svg/Svg.js +1 -2
  20. package/public/components/Tooltip/Tooltip.js +11 -19
  21. package/public/components/VisuallyHidden/VisuallyHidden.d.ts +2 -1
  22. package/public/components/VisuallyHidden/VisuallyHidden.js +3 -5
  23. package/public/css/styles.css +139 -59
  24. package/public/css/styles.min.css +1 -1
  25. package/public/css/styles.min.css.map +1 -1
  26. package/public/hooks/index.d.ts +3 -0
  27. package/public/hooks/index.js +7 -1
  28. package/public/hooks/useMatchMedia.d.ts +1 -0
  29. package/public/hooks/useMatchMedia.js +27 -0
  30. package/public/hooks/usePrefersReducedMotion.d.ts +1 -0
  31. package/public/hooks/usePrefersReducedMotion.js +9 -0
  32. package/public/hooks/useScreenOrientation.d.ts +1 -0
  33. package/public/hooks/useScreenOrientation.js +24 -0
  34. package/public/{style-dictionary → src/style-dictionary}/dist/tokens.css +1 -0
  35. package/public/src/style-dictionary/dist/tokens.d.ts +428 -0
  36. package/public/src/style-dictionary/dist/tokens.js +428 -0
  37. package/public/src/style-dictionary/dist/tokens.module.js +428 -0
  38. package/public/src/style-dictionary/tailwind.config.js +87 -0
  39. package/public/storybook-components/EnumTable.js +2 -1
  40. package/public/storybook-components/Story.d.ts +2 -1
  41. package/public/storybook-components/Story.js +4 -1
  42. package/public/style-dictionary/dist/tokens.d.ts +428 -422
  43. package/public/style-dictionary/dist/tokens.js +415 -416
  44. package/public/style-dictionary/dist/tokens.module.d.ts +431 -0
  45. package/public/style-dictionary/dist/tokens.module.js +412 -415
  46. package/public/style-dictionary/src/border-radius.d.ts +31 -0
  47. package/public/style-dictionary/src/border-radius.js +10 -9
  48. package/public/style-dictionary/src/border-width.d.ts +21 -0
  49. package/public/style-dictionary/src/border-width.js +9 -8
  50. package/public/style-dictionary/src/color.d.ts +249 -0
  51. package/public/style-dictionary/src/color.js +97 -95
  52. package/public/style-dictionary/src/font-size.d.ts +45 -0
  53. package/public/style-dictionary/src/font-size.js +14 -13
  54. package/public/style-dictionary/src/font-weight.d.ts +13 -0
  55. package/public/style-dictionary/src/font-weight.js +6 -5
  56. package/public/style-dictionary/src/height.d.ts +215 -0
  57. package/public/style-dictionary/src/height.js +10 -10
  58. package/public/style-dictionary/src/leading.d.ts +17 -0
  59. package/public/style-dictionary/src/leading.js +7 -6
  60. package/public/style-dictionary/src/screen-width.d.ts +17 -0
  61. package/public/style-dictionary/src/screen-width.js +7 -6
  62. package/public/style-dictionary/src/shadow.d.ts +63 -0
  63. package/public/style-dictionary/src/shadow.js +19 -18
  64. package/public/style-dictionary/src/spacing.d.ts +197 -0
  65. package/public/style-dictionary/src/spacing.js +68 -67
  66. package/public/style-dictionary/src/tracking.d.ts +13 -0
  67. package/public/style-dictionary/src/tracking.js +6 -5
  68. package/public/style-dictionary/src/type.d.ts +13 -0
  69. package/public/style-dictionary/src/type.js +32 -31
  70. package/public/style-dictionary/src/width.d.ts +287 -0
  71. package/public/style-dictionary/src/width.js +29 -29
  72. package/public/style-dictionary/src/z-index.d.ts +53 -0
  73. package/public/style-dictionary/src/z-index.js +20 -19
  74. package/public/style-dictionary/tailwind.config.d.ts +392 -0
  75. package/public/style-dictionary/tailwind.config.js +51 -72
  76. package/src/components/Accordion/Accordion.tsx +39 -27
  77. package/src/components/Avatar/Avatar.tsx +20 -19
  78. package/src/components/Button/Button.tsx +3 -3
  79. package/src/components/Button/index.css +12 -1
  80. package/src/components/Card/Card.story.mdx +45 -37
  81. package/src/components/ConveyorLogo/ConveyorLogo.tsx +6 -6
  82. package/src/components/Drawer/Drawer.tsx +1 -1
  83. package/src/components/Frame/Frame.story.mdx +140 -5
  84. package/src/components/Frame/Frame.tsx +1 -1
  85. package/src/components/Frame/index.css +8 -13
  86. package/src/components/Icon/Icon.tsx +3 -0
  87. package/src/components/MenuRenderer/MenuRenderer.tsx +7 -9
  88. package/src/components/Modal/Modal.tsx +1 -1
  89. package/src/components/Modal/index.css +8 -3
  90. package/src/components/OptionButton/OptionButton.story.mdx +91 -36
  91. package/src/components/OptionButton/OptionButton.tsx +19 -18
  92. package/src/components/OptionButton/index.css +13 -0
  93. package/src/components/Overlay/Overlay.story.mdx +26 -0
  94. package/src/components/Select/Select.tsx +4 -4
  95. package/src/components/Select/SelectPopover.tsx +6 -6
  96. package/src/components/Select/index.ts +14 -0
  97. package/src/components/Select/theme.ts +22 -22
  98. package/src/components/Svg/Svg.story.mdx +36 -0
  99. package/src/components/Svg/Svg.tsx +6 -4
  100. package/src/components/Text/Text.story.mdx +34 -0
  101. package/src/components/Tooltip/Tooltip.story.mdx +21 -0
  102. package/src/components/Tooltip/Tooltip.tsx +23 -27
  103. package/src/components/Tooltip/index.css +31 -0
  104. package/src/components/VisuallyHidden/VisuallyHidden.story.mdx +54 -0
  105. package/src/components/VisuallyHidden/VisuallyHidden.tsx +10 -5
  106. package/src/components/VisuallyHidden/index.css +3 -0
  107. package/src/css/components.css +2 -0
  108. package/src/docs/Colors.story.mdx +13 -13
  109. package/src/docs/Spacing.story.mdx +4 -20
  110. package/src/docs/Tokens.story.mdx +230 -0
  111. package/src/docs/Typography.story.mdx +17 -94
  112. package/src/docs/hooks/useDisclosureHook.story.mdx +58 -0
  113. package/src/docs/hooks/useKeyPressHook.story.mdx +54 -0
  114. package/src/docs/hooks/useMatchMediaHook.story.mdx +42 -0
  115. package/src/docs/hooks/useOutsideClickHook.story.mdx +56 -0
  116. package/src/docs/hooks/usePrefersReducedMotion.story.mdx +61 -0
  117. package/src/docs/hooks/useScreenOrientationHook.story.mdx +56 -0
  118. package/src/docs/hooks/useStepHook.story.mdx +102 -0
  119. package/src/hooks/index.ts +3 -0
  120. package/src/hooks/useMatchMedia.ts +40 -0
  121. package/src/hooks/usePrefersReducedMotion.ts +9 -0
  122. package/src/hooks/useScreenOrientation.ts +27 -0
  123. package/src/storybook-components/EnumTable.tsx +3 -2
  124. package/src/storybook-components/Story.tsx +13 -1
  125. package/src/style-dictionary/dist/tokens.css +378 -0
  126. package/src/style-dictionary/dist/tokens.d.ts +428 -0
  127. package/src/style-dictionary/dist/tokens.js +428 -0
  128. package/src/style-dictionary/dist/tokens.module.js +428 -0
  129. package/src/style-dictionary/src/border-radius.js +11 -0
  130. package/src/style-dictionary/src/border-width.js +10 -0
  131. package/src/style-dictionary/src/color.js +98 -0
  132. package/src/style-dictionary/src/font-size.js +15 -0
  133. package/src/style-dictionary/src/font-weight.js +7 -0
  134. package/src/style-dictionary/src/height.js +13 -0
  135. package/src/style-dictionary/src/leading.js +8 -0
  136. package/src/style-dictionary/src/screen-width.js +8 -0
  137. package/src/style-dictionary/src/shadow.js +19 -0
  138. package/src/style-dictionary/src/spacing.js +69 -0
  139. package/src/style-dictionary/src/tracking.js +7 -0
  140. package/src/style-dictionary/src/type.js +34 -0
  141. package/src/style-dictionary/src/width.js +32 -0
  142. package/src/style-dictionary/src/z-index.js +21 -0
  143. package/src/style-dictionary/tailwind.config.js +87 -0
  144. package/src/tokens/borders.ts +6 -0
  145. package/src/tokens/box-shadow.ts +3 -0
  146. package/src/tokens/colors.ts +6 -0
  147. package/src/tokens/font-family.ts +3 -0
  148. package/src/tokens/font-size.ts +3 -0
  149. package/src/tokens/font-weight.ts +3 -0
  150. package/src/tokens/height.ts +3 -0
  151. package/src/tokens/index.ts +3 -2
  152. package/src/tokens/letter-spacing.ts +3 -0
  153. package/src/tokens/line-height.ts +3 -0
  154. package/src/tokens/margin.ts +3 -0
  155. package/src/tokens/padding.ts +3 -0
  156. package/src/tokens/screens.ts +3 -0
  157. package/src/tokens/sizing-scale.ts +6 -0
  158. package/src/tokens/width.ts +9 -0
  159. package/src/tokens/will-change.ts +3 -0
  160. package/src/tokens/z-index.ts +3 -0
  161. package/src/types/index.ts +3 -0
  162. package/public/components/Overlay/Overlay.story.d.ts +0 -1
  163. package/public/components/Overlay/Overlay.story.js +0 -12
  164. package/public/components/Svg/Svg.story.d.ts +0 -1
  165. package/public/components/Svg/Svg.story.js +0 -14
  166. package/public/components/Text/Text.story.d.ts +0 -1
  167. package/public/components/Text/Text.story.js +0 -31
  168. package/public/components/VisuallyHidden/VisuallyHidden.story.d.ts +0 -1
  169. package/public/components/VisuallyHidden/VisuallyHidden.story.js +0 -36
  170. package/public/components/useStep/ExampleSetupWizard.d.ts +0 -4
  171. package/public/components/useStep/ExampleSetupWizard.js +0 -33
  172. package/src/components/Overlay/Overlay.md +0 -14
  173. package/src/components/Overlay/Overlay.story.tsx +0 -12
  174. package/src/components/Svg/Svg.md +0 -14
  175. package/src/components/Svg/Svg.story.tsx +0 -15
  176. package/src/components/Text/Text.md +0 -14
  177. package/src/components/Text/Text.story.tsx +0 -12
  178. package/src/components/VisuallyHidden/VisuallyHidden.md +0 -23
  179. package/src/components/VisuallyHidden/VisuallyHidden.story.tsx +0 -19
  180. package/src/components/useStep/ExampleSetupWizard.tsx +0 -63
  181. package/src/components/useStep/useStep.story.mdx +0 -76
@@ -198,7 +198,7 @@ export const ModalFooterMultiStep = ({
198
198
  </Box>
199
199
  </Flex>
200
200
 
201
- <Box className="relative">
201
+ <Box className={bem(cn, { e: "progressDots-container" })}>
202
202
  {children}
203
203
 
204
204
  <Flex className={bem(cn, { e: "progressDots" })}>
@@ -4,7 +4,8 @@
4
4
  }
5
5
 
6
6
  .ads-ModalContainer {
7
- @apply top-0
7
+ @apply fixed
8
+ top-0
8
9
  left-0
9
10
  z-modal
10
11
  flex
@@ -90,12 +91,12 @@
90
91
  .ads-Modal-body {
91
92
  @apply flex
92
93
  flex-col
93
- justify-between;
94
+ justify-between
95
+ overflow-y-auto;
94
96
 
95
97
  max-height: calc(
96
98
  var(--modal-max-height) - theme("height.15") - theme("height.20")
97
99
  );
98
- overflow-y: auto;
99
100
  }
100
101
 
101
102
  .ads-Modal-body--padded {
@@ -103,6 +104,10 @@
103
104
  py-4;
104
105
  }
105
106
 
107
+ .ads-Modal-progressDots-container {
108
+ @apply relative;
109
+ }
110
+
106
111
  .ads-Modal-progressDots {
107
112
  @apply absolute
108
113
  w-full
@@ -1,4 +1,11 @@
1
- import { Story, Preview, Props, Meta } from "@storybook/addon-docs/blocks";
1
+ import {
2
+ Story,
3
+ Preview,
4
+ Props,
5
+ Meta,
6
+ SourceState,
7
+ } from "@storybook/addon-docs/blocks";
8
+ import classNames from "classnames";
2
9
  import { OptionButton } from "./OptionButton";
3
10
  import { Box } from "../Box";
4
11
  import { Button, BUTTON_SIZE } from "../Button";
@@ -19,7 +26,7 @@ The option button component is a fancy radio button used as an option selector.
19
26
  import { OptionButton } from "@conveyorhq/arrow-ds";
20
27
  ```
21
28
 
22
- <Preview>
29
+ <Preview withSource={SourceState.OPEN}>
23
30
  <Story name="OptionButton">
24
31
  <OptionButton
25
32
  heading="Manual"
@@ -72,7 +79,9 @@ Extends `BoxProps`
72
79
 
73
80
  ## Component tree
74
81
 
75
- Each piece of the `OptionButton` component can be used individually to create a component with a custom layout.
82
+ Each piece of the `OptionButton` component can be used individually to create a
83
+ component with a custom layout. You’ll also be able to control the style of each
84
+ individual element.
76
85
 
77
86
  The component tree is as follows:
78
87
 
@@ -100,39 +109,34 @@ When building a custom implementation, the following components are considered o
100
109
 
101
110
  This example shows how you can create a list of custom checkboxes.
102
111
 
103
- <Preview>
112
+ <Preview withSource={SourceState.OPEN}>
104
113
  <Story name="Custom implementation">
105
114
  <OptionButton.Group name="iconTypes" type="checkbox" spacing={4}>
106
- <OptionButton.Root className="rounded p-3">
107
- <OptionButton.Content>
108
- <Flex className="items-center gap-x-2">
109
- <Icon icon={ICON_TYPE.CALCULATOR} />
110
- <Text className="font-medium">Calculator icon</Text>
111
- </Flex>
112
- </OptionButton.Content>
113
- <OptionButton.Input value="calculator" />
114
- <OptionButton.Backdrop className="bg-white border border-border rounded" />
115
- </OptionButton.Root>
116
- <OptionButton.Root className="rounded p-3">
117
- <OptionButton.Content>
118
- <Flex className="items-center gap-x-2">
119
- <Icon icon={ICON_TYPE.ENVELOPE} />
120
- <Text className="font-medium">Envelope icon</Text>
121
- </Flex>
122
- </OptionButton.Content>
123
- <OptionButton.Input value="envelope" />
124
- <OptionButton.Backdrop className="bg-white border border-border rounded" />
125
- </OptionButton.Root>
126
- <OptionButton.Root className="rounded p-3">
127
- <OptionButton.Content>
128
- <Flex className="items-center gap-x-2">
129
- <Icon icon={ICON_TYPE.PAPERCLIP} />
130
- <Text className="font-medium">Paperclip icon</Text>
131
- </Flex>
132
- </OptionButton.Content>
133
- <OptionButton.Input value="paperclip" />
134
- <OptionButton.Backdrop className="bg-white border border-border rounded" />
135
- </OptionButton.Root>
115
+ {[
116
+ {
117
+ icon: ICON_TYPE.CALCULATOR,
118
+ name: "Calculator",
119
+ },
120
+ {
121
+ icon: ICON_TYPE.ENVELOPE,
122
+ name: "Envelope",
123
+ },
124
+ {
125
+ icon: ICON_TYPE.PAPERCLIP,
126
+ name: "Paperclip",
127
+ },
128
+ ].map((option) => (
129
+ <OptionButton.Root key={option.name} className="rounded p-3">
130
+ <OptionButton.Content>
131
+ <Flex className="items-center gap-x-2">
132
+ <Icon icon={option.icon} />
133
+ <Text className="font-medium">{option.name} icon</Text>
134
+ </Flex>
135
+ </OptionButton.Content>
136
+ <OptionButton.Input value="calculator" disabled={option.disabled} />
137
+ <OptionButton.Backdrop className="bg-white border border-border rounded" />
138
+ </OptionButton.Root>
139
+ ))}
136
140
  </OptionButton.Group>
137
141
  </Story>
138
142
  </Preview>
@@ -145,7 +149,7 @@ The `name` prop can be added to `OptionButton.Group` and it will be passed onto
145
149
 
146
150
  This example renders each `OptionButton` as a radio button (default), but they can also be made checkboxes by passing `type="checkbox"` to the group or each `OptionButton`.
147
151
 
148
- <Preview>
152
+ <Preview withSource={SourceState.OPEN}>
149
153
  <Story name="Within Group">
150
154
  <OptionButton.Group name="template" type="radio" spacing={4}>
151
155
  <OptionButton
@@ -169,7 +173,7 @@ This example renders each `OptionButton` as a radio button (default), but they c
169
173
 
170
174
  ### Within Modal
171
175
 
172
- <Preview>
176
+ <Preview withSource={SourceState.OPEN}>
173
177
  <Story name="Within Modal">
174
178
  {() => {
175
179
  const { isOpen, onOpen, onClose } = useDisclosure();
@@ -215,3 +219,54 @@ This example renders each `OptionButton` as a radio button (default), but they c
215
219
  }}
216
220
  </Story>
217
221
  </Preview>
222
+
223
+ ### Disabling an option
224
+
225
+ If you need to disable an option, you can do so by passing `disabled` to
226
+ OptionButton. This will apply different styles to the OptionButton which can’t
227
+ be changed.
228
+
229
+ <Preview withSource={SourceState.OPEN}>
230
+ <Story name="Disabled">
231
+ <OptionButton
232
+ heading="Manual"
233
+ description="Don’t create any tickets for me, I’ll make them myself."
234
+ disabled
235
+ />
236
+ </Story>
237
+ </Preview>
238
+
239
+ You can also build your own custom OptionButton by composing each piece and in
240
+ doing so, you’ll be able to set your own styles for the disabled state.
241
+
242
+ <Preview withSource={SourceState.OPEN}>
243
+ <Story name="Disabled custom">
244
+ {() => {
245
+ const isDisabled = true;
246
+ return (
247
+ <OptionButton.Root
248
+ className={classNames(
249
+ isDisabled && "cursor-not-allowed",
250
+ "rounded p-3",
251
+ )}
252
+ >
253
+ <OptionButton.Content
254
+ className={classNames(isDisabled && "opacity-50")}
255
+ >
256
+ <Flex className="items-center gap-x-2">
257
+ <Icon icon={ICON_TYPE.CALCULATOR} />
258
+ <Text className="font-medium">Calculator icon</Text>
259
+ </Flex>
260
+ </OptionButton.Content>
261
+ <OptionButton.Input value="calculator" disabled={isDisabled} />
262
+ <OptionButton.Backdrop
263
+ className={classNames(
264
+ isDisabled ? "bg-gray-300" : "bg-white",
265
+ "border border-border rounded",
266
+ )}
267
+ />
268
+ </OptionButton.Root>
269
+ );
270
+ }}
271
+ </Story>
272
+ </Preview>
@@ -6,12 +6,12 @@ import { Input } from "../Input";
6
6
  import { Text, TextProps } from "../Text";
7
7
  import { Icon, ICON_TYPE } from "../Icon";
8
8
  import { Stack, StackProps } from "../Stack";
9
- import { bem } from "../../utilities/bem";
9
+ import { bemHOF } from "../../utilities/bem";
10
10
  import isUndefined from "../../utilities/isUndefined";
11
11
  import { ORIENTATION } from "../../types";
12
12
  import { OptionButtonContext, useOptionButtonContext } from "./context";
13
13
 
14
- const cn = "OptionButton";
14
+ const cn = bemHOF("OptionButton");
15
15
 
16
16
  /**
17
17
  * OptionButton.Group
@@ -66,7 +66,7 @@ export const OptionButtonRoot = ({
66
66
  }: OptionButtonRootProps) => {
67
67
  return (
68
68
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
69
- <label className={classNames(bem(cn), className)} {...rest}>
69
+ <label className={classNames(cn(), className)} {...rest}>
70
70
  {children}
71
71
  </label>
72
72
  );
@@ -104,7 +104,7 @@ export const OptionButtonInput = (props: OptionButtonInputProps) => {
104
104
  name={name}
105
105
  type={type}
106
106
  checked={checked}
107
- className={classNames([bem(cn, { e: "input" }), className])}
107
+ className={classNames([cn({ e: "input" }), className])}
108
108
  defaultValue={defaultValue}
109
109
  aria-checked={checked ? "true" : "false"}
110
110
  {...rest}
@@ -121,7 +121,7 @@ export const OptionButtonContent = ({
121
121
  children,
122
122
  ...rest
123
123
  }: BoxProps) => (
124
- <Box className={classNames([bem(cn, { e: "content" }), className])} {...rest}>
124
+ <Box className={classNames([cn({ e: "content" }), className])} {...rest}>
125
125
  {children}
126
126
  </Box>
127
127
  );
@@ -137,7 +137,7 @@ export const OptionButtonHeading = ({
137
137
  }: TextProps) => (
138
138
  <Text
139
139
  as="div"
140
- className={classNames([bem(cn, { e: "heading" }), className])}
140
+ className={classNames([cn({ e: "heading" }), className])}
141
141
  {...rest}
142
142
  >
143
143
  {children}
@@ -155,7 +155,7 @@ export const OptionButtonDescription = ({
155
155
  }: TextProps) => (
156
156
  <Text
157
157
  as="div"
158
- className={classNames([bem(cn, { e: "description" }), className])}
158
+ className={classNames([cn({ e: "description" }), className])}
159
159
  {...rest}
160
160
  >
161
161
  {children}
@@ -167,10 +167,7 @@ export const OptionButtonDescription = ({
167
167
  * =============================================================================
168
168
  */
169
169
  export const OptionButtonBackdrop = ({ className, ...rest }: BoxProps) => (
170
- <Box
171
- className={classNames([bem(cn, { e: "backdrop" }), className])}
172
- {...rest}
173
- />
170
+ <Box className={classNames([cn({ e: "backdrop" }), className])} {...rest} />
174
171
  );
175
172
 
176
173
  /**
@@ -178,11 +175,8 @@ export const OptionButtonBackdrop = ({ className, ...rest }: BoxProps) => (
178
175
  * =============================================================================
179
176
  */
180
177
  export const OptionButtonSelectedIcon = ({ className, ...rest }: BoxProps) => (
181
- <Box
182
- className={classNames([bem(cn, { e: "selected" }), className])}
183
- {...rest}
184
- >
185
- <Icon className={bem(cn, { e: "icon" })} icon={ICON_TYPE.CHECK} />
178
+ <Box className={classNames([cn({ e: "selected" }), className])} {...rest}>
179
+ <Icon className={cn({ e: "icon" })} icon={ICON_TYPE.CHECK} />
186
180
  Selected
187
181
  </Box>
188
182
  );
@@ -210,16 +204,22 @@ export const OptionButton = (props: OptionButtonProps) => {
210
204
  className,
211
205
  defaultValue,
212
206
  type: typeProp = "radio",
207
+ disabled = false,
213
208
  ...rest
214
209
  } = props;
215
210
 
216
- const fallbackId = `OptionButton:${useId()}`;
211
+ const fallbackId = `OptionButton-${useId()}`;
217
212
  const id = isUndefined(idProp) ? fallbackId : idProp;
218
213
  const name = isUndefined(nameFromContext) ? nameProp : nameFromContext;
219
214
  const type = isUndefined(typeFromContext) ? typeProp : typeFromContext;
215
+ const rootClassName = classNames([
216
+ cn(),
217
+ disabled && cn({ m: "disabled" }),
218
+ className,
219
+ ]);
220
220
 
221
221
  return (
222
- <OptionButtonRoot className={classNames(bem(cn), className)}>
222
+ <OptionButtonRoot className={rootClassName}>
223
223
  <OptionButtonContent>
224
224
  {heading && <OptionButtonHeading>{heading}</OptionButtonHeading>}
225
225
 
@@ -235,6 +235,7 @@ export const OptionButton = (props: OptionButtonProps) => {
235
235
  checked={checked}
236
236
  defaultValue={defaultValue}
237
237
  aria-checked={checked ? "true" : "false"}
238
+ disabled={disabled}
238
239
  {...rest}
239
240
  />
240
241
 
@@ -11,6 +11,10 @@
11
11
  flex: 1 1 0;
12
12
  }
13
13
 
14
+ .ads-OptionButton--disabled {
15
+ @apply cursor-not-allowed;
16
+ }
17
+
14
18
  .ads-OptionButton-content {
15
19
  @apply relative
16
20
  z-default;
@@ -32,6 +36,11 @@
32
36
  leading-normal;
33
37
  }
34
38
 
39
+ .ads-OptionButton--disabled .ads-OptionButton-heading,
40
+ .ads-OptionButton--disabled .ads-OptionButton-description {
41
+ @apply text-gray-600;
42
+ }
43
+
35
44
  .ads-OptionButton-input {
36
45
  @apply visually-hidden;
37
46
  }
@@ -60,6 +69,10 @@
60
69
  @apply shadow-focus;
61
70
  }
62
71
 
72
+ .ads-OptionButton--disabled .ads-OptionButton-backdrop {
73
+ @apply bg-gray-300;
74
+ }
75
+
63
76
  .ads-OptionButton-selected {
64
77
  @apply items-center
65
78
  justify-center
@@ -0,0 +1,26 @@
1
+ import { Meta, Preview, Props, Story } from "@storybook/addon-docs/blocks";
2
+ import { ComponentHeading } from "../../storybook-components";
3
+ import { Overlay } from "./Overlay";
4
+
5
+ <Meta title="Components/Popovers/Overlay" component={Overlay} />
6
+
7
+ <ComponentHeading
8
+ componentName="Overlay"
9
+ description=""
10
+ sourcePath="src/components/Overlay/Overlay.tsx"
11
+ hideDemosLink
12
+ />
13
+
14
+ ```jsx
15
+ import { Overlay } from "@conveyorhq/arrow-ds";
16
+ ```
17
+
18
+ <Preview>
19
+ <Story name="Overlay">
20
+ <Overlay />
21
+ </Story>
22
+ </Preview>
23
+
24
+ ## Props
25
+
26
+ <Props of={Overlay} />
@@ -16,7 +16,7 @@ import ReactSelectCreatable, {
16
16
  import ReactSelectAsync, {
17
17
  Props as ReactSelectAsyncProps,
18
18
  } from "react-select/async";
19
- import { colors, height, zIndex } from "../../tokens";
19
+ import { tokens } from "../../style-dictionary/dist/tokens";
20
20
  import { STATUS_VARIANT } from "../../types";
21
21
  import { bemHOF, toNumber } from "../../utilities";
22
22
  import { BoxProps, Box } from "../Box";
@@ -173,7 +173,7 @@ const generateHardcodedProps = ({
173
173
  ...styles,
174
174
  menuPortal: (base: CSSProperties): CSSProperties => ({
175
175
  ...base,
176
- zIndex: zIndex.max,
176
+ zIndex: tokens.zIndex.max,
177
177
  }),
178
178
  singleValue: (base: CSSProperties, state: any): CSSProperties => {
179
179
  return {
@@ -181,7 +181,7 @@ const generateHardcodedProps = ({
181
181
  paddingLeft: state.selectProps.isSearchable ? "2px" : "0",
182
182
  color:
183
183
  state.selectProps.menuIsOpen && state.selectProps.isSearchable
184
- ? colors.gray["600"]
184
+ ? tokens.color.gray["600"]
185
185
  : base.color,
186
186
  };
187
187
  },
@@ -218,7 +218,7 @@ const SelectBase = ({
218
218
  variant: variantProp = STATUS_VARIANT.DEFAULT,
219
219
  id: idProp,
220
220
  className,
221
- height: controlHeight = toNumber(height["10"]),
221
+ height: controlHeight = toNumber(tokens.height["10"]),
222
222
  menuInPortal = false,
223
223
  menuRef,
224
224
  components,
@@ -3,7 +3,7 @@ import classNames from "classnames";
3
3
  import { Modifier } from "react-popper";
4
4
  import { MenuListComponentProps } from "react-select";
5
5
  import FocusLock from "react-focus-lock";
6
- import { tokens } from "../../tokens";
6
+ import { tokens } from "../../style-dictionary/dist/tokens";
7
7
  import { useOutsideClick } from "../../hooks";
8
8
  import { Box } from "../Box";
9
9
  import { Flex } from "../Flex";
@@ -55,19 +55,19 @@ export const SelectPopover = ({
55
55
  const selectStyles = {
56
56
  control: (provided: any) => ({
57
57
  ...provided,
58
- width: `calc(100% - ${tokens.margin[6]})`,
59
- margin: tokens.margin[3],
58
+ width: `calc(100% - ${tokens.spacing[6]})`,
59
+ margin: tokens.spacing[3],
60
60
  }),
61
61
  menu: (provided: any) => ({
62
62
  ...provided,
63
63
  boxShadow: "none !important", // override Arrow classname
64
64
  borderRadius: "0 !important", // override Arrow classname
65
65
  zIndex: "1 !important", // override Arrow classname
66
- backgroundColor: tokens.colors.white,
66
+ backgroundColor: tokens.color.white,
67
67
  position: "relative",
68
- marginTop: tokens.margin[3],
68
+ marginTop: tokens.spacing[3],
69
69
  marginBottom: 0,
70
- borderTop: `1px solid ${tokens.colors.gray[300]}`,
70
+ borderTop: `1px solid ${tokens.color.gray[300]}`,
71
71
  maxHeight: "184px",
72
72
  overflowY: "auto",
73
73
  }),
@@ -1,2 +1,16 @@
1
1
  export * from "./Select";
2
2
  export * from "./SelectPopover";
3
+ export { components as ReactSelectComponents } from "react-select";
4
+ export type {
5
+ MenuProps as ReactSelectMenuProps,
6
+ GroupProps as ReactSelectGroupProps,
7
+ InputProps as ReactSelectInputProps,
8
+ OptionProps as ReactSelectOptionProps,
9
+ ControlProps as ReactSelectControlProps,
10
+ IndicatorProps as ReactSelectIndicatorProps,
11
+ MultiValueProps as ReactSelectMultiValueProps,
12
+ PlaceholderProps as ReactSelectPlaceholderProps,
13
+ SingleValueProps as ReactSelectSingleValueProps,
14
+ ValueContainerProps as ReactSelectValueContainerProps,
15
+ MenuListComponentProps as ReactSelectMenuListComponentProps,
16
+ } from "react-select";
@@ -1,31 +1,31 @@
1
1
  import { Theme } from "react-select";
2
- import { colors, borderRadius, height, margin } from "../../tokens";
2
+ import { tokens } from "../../style-dictionary/dist/tokens";
3
3
  import { toNumber } from "../../utilities/toNumber";
4
4
 
5
5
  export const adsTheme: Theme = {
6
- borderRadius: toNumber(borderRadius.DEFAULT),
6
+ borderRadius: toNumber(tokens.borderRadius.DEFAULT),
7
7
  colors: {
8
- danger: colors.red["400"],
9
- dangerLight: colors.red["300"],
10
- neutral0: colors.white,
11
- neutral5: colors.gray["100"],
12
- neutral10: colors.gray["100"],
13
- neutral20: colors.gray["200"],
14
- neutral30: colors.gray["400"],
15
- neutral40: colors.gray["500"],
16
- neutral50: colors.gray["600"],
17
- neutral60: colors.gray["700"],
18
- neutral70: colors.gray["800"],
19
- neutral80: colors.gray["900"],
20
- neutral90: colors.gray["900"],
21
- primary: colors.blue["500"],
22
- primary25: colors.gray["300"],
23
- primary50: colors.gray["300"],
24
- primary75: colors.blue["400"],
8
+ danger: tokens.color.red["400"],
9
+ dangerLight: tokens.color.red["300"],
10
+ neutral0: tokens.color.white,
11
+ neutral5: tokens.color.gray["100"],
12
+ neutral10: tokens.color.gray["100"],
13
+ neutral20: tokens.color.gray["200"],
14
+ neutral30: tokens.color.gray["400"],
15
+ neutral40: tokens.color.gray["500"],
16
+ neutral50: tokens.color.gray["600"],
17
+ neutral60: tokens.color.gray["700"],
18
+ neutral70: tokens.color.gray["800"],
19
+ neutral80: tokens.color.gray["900"],
20
+ neutral90: tokens.color.gray["900"],
21
+ primary: tokens.color.blue["500"],
22
+ primary25: tokens.color.gray["300"],
23
+ primary50: tokens.color.gray["300"],
24
+ primary75: tokens.color.blue["400"],
25
25
  },
26
26
  spacing: {
27
- baseUnit: toNumber(margin["1"]),
28
- controlHeight: toNumber(height["10"]),
29
- menuGutter: toNumber(margin["1"]),
27
+ baseUnit: toNumber(tokens.spacing["1"]),
28
+ controlHeight: toNumber(tokens.height["10"]),
29
+ menuGutter: toNumber(tokens.spacing["1"]),
30
30
  },
31
31
  };
@@ -0,0 +1,36 @@
1
+ import {
2
+ Story,
3
+ Preview,
4
+ Meta,
5
+ SourceState,
6
+ } from "@storybook/addon-docs/blocks";
7
+ import { colors } from "../../tokens";
8
+ import { Svg } from "./Svg";
9
+
10
+ <Meta title="Components/Images/Svg" component={Svg} />
11
+
12
+ # Svg
13
+
14
+ `Svg` is a component to display
15
+ [vector images](https://developer.mozilla.org/en-US/docs/Web/SVG).
16
+
17
+ ## Installation
18
+
19
+ ```jsx
20
+ import { Svg } from "@conveyorhq/arrow-ds";
21
+ ```
22
+
23
+ ## Basic usage
24
+
25
+ <Preview withSource={SourceState.OPEN}>
26
+ <Story name="Svg">
27
+ <Svg viewBox="0 0 300 100" fill={colors.gray["900"]}>
28
+ <circle cx="50" cy="50" r="40" />
29
+ </Svg>
30
+ </Story>
31
+ </Preview>
32
+
33
+ ## API
34
+
35
+ `Svg` has no special props; you may apply any valid
36
+ [attribute](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute).
@@ -1,7 +1,9 @@
1
- import React, { FunctionComponent, SVGAttributes } from "react";
1
+ import React from "react";
2
2
 
3
- export type SvgProps = SVGAttributes<SVGElement>;
3
+ export type SvgProps = React.SVGAttributes<SVGElement>;
4
4
 
5
- export const Svg: FunctionComponent<SvgProps> = (props: SvgProps) => (
6
- <svg xmlns="http://www.w3.org/2000/svg" {...props} />
5
+ export const Svg = React.forwardRef<SVGSVGElement, SvgProps>(
6
+ (props, forwardedRef) => (
7
+ <svg xmlns="http://www.w3.org/2000/svg" ref={forwardedRef} {...props} />
8
+ ),
7
9
  );
@@ -0,0 +1,34 @@
1
+ import { Meta, Preview, Props, Story } from "@storybook/addon-docs/blocks";
2
+ import {
3
+ ComponentHeading,
4
+ ComponentStatus,
5
+ COMPONENT_STATUS,
6
+ } from "../../storybook-components";
7
+ import { Text } from "./Text";
8
+
9
+ <Meta title="Components/Typography/Text" component={Text} />
10
+
11
+ <ComponentHeading
12
+ componentName="Text"
13
+ description="A generic container for wrapping text"
14
+ sourcePath="src/components/Text/Text.tsx"
15
+ hideDemosLink
16
+ />
17
+
18
+ <ComponentStatus status={COMPONENT_STATUS.DEPRECATED} />
19
+
20
+ This component has been deprecated. Use the `Paragraph`, `Heading` or `Box` components instead.
21
+
22
+ ```jsx
23
+ import { Text } from "@conveyorhq/arrow-ds";
24
+ ```
25
+
26
+ <Preview>
27
+ <Story name="Text">
28
+ <Text>This is the Text component</Text>
29
+ </Story>
30
+ </Preview>
31
+
32
+ ## Props
33
+
34
+ <Props of={Text} />
@@ -346,3 +346,24 @@ Demonstrates how to implement the Tooltip along with the `useCopyToClipboard` ho
346
346
  }}
347
347
  </Story>
348
348
  </Preview>
349
+
350
+ ### Leaving children empty
351
+
352
+ If the tooltip content (i.e., `children` prop) is empty for any reason, the
353
+ component will return the `referenceElement` instead.
354
+
355
+ <Preview>
356
+ <Story name="Tooltip empty content">
357
+ {() => {
358
+ const errors = [];
359
+ return (
360
+ <Tooltip
361
+ placement="top"
362
+ content={errors.length > 0 ? "You have errors" : ""}
363
+ >
364
+ <Button>Save Changes</Button>
365
+ </Tooltip>
366
+ );
367
+ }}
368
+ </Story>
369
+ </Preview>