chiplet 0.3.0-dev.3 → 0.3.0

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 (237) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +46 -13
  3. package/dist/article.css +143 -0
  4. package/dist/component/button/Button.js.map +1 -1
  5. package/dist/component/button/Interactive.js +1 -0
  6. package/dist/component/button/Interactive.js.map +1 -1
  7. package/dist/component/button/style/index.css.vanilla.js +5 -5
  8. package/dist/component/button/style/index.css.vanilla.js.map +1 -1
  9. package/dist/component/checkbox/Checkbox.js +1 -1
  10. package/dist/component/checkbox/Checkbox.js.map +1 -1
  11. package/dist/component/checkbox/CheckboxGroup.js +1 -0
  12. package/dist/component/checkbox/CheckboxGroup.js.map +1 -1
  13. package/dist/component/checkbox/Radio.js +1 -0
  14. package/dist/component/checkbox/Radio.js.map +1 -1
  15. package/dist/component/checkbox/RadioGroup.js +1 -0
  16. package/dist/component/checkbox/RadioGroup.js.map +1 -1
  17. package/dist/component/checkbox/icon/CheckboxChecked.svg.js.map +1 -1
  18. package/dist/component/checkbox/icon/CheckboxIndeterminate.svg.js.map +1 -1
  19. package/dist/component/checkbox/icon/CheckboxUnchecked.svg.js.map +1 -1
  20. package/dist/component/checkbox/icon/RadioChecked.svg.js.map +1 -1
  21. package/dist/component/checkbox/icon/RadioUnchecked.svg.js.map +1 -1
  22. package/dist/component/checkbox/icon/index.js +7 -5
  23. package/dist/component/checkbox/icon/index.js.map +1 -1
  24. package/dist/component/checkbox/style/index.css.vanilla.js +14 -14
  25. package/dist/component/checkbox/style/index.css.vanilla.js.map +1 -1
  26. package/dist/component/header/style/index.css.vanilla.js +1 -1
  27. package/dist/component/header/style/index.css.vanilla.js.map +1 -1
  28. package/dist/component/icon/set/Checkmark24Filled.svg.js.map +1 -1
  29. package/dist/component/icon/set/Checkmark24Regular.svg.js.map +1 -1
  30. package/dist/component/icon/set/ChevronDown24Filled.svg.js.map +1 -1
  31. package/dist/component/icon/set/ChevronDown24Regular.svg.js.map +1 -1
  32. package/dist/component/icon/set/Dismiss24Filled.svg.js.map +1 -1
  33. package/dist/component/icon/set/Dismiss24Regular.svg.js.map +1 -1
  34. package/dist/component/icon/set/Search24Filled.svg.js.map +1 -1
  35. package/dist/component/icon/set/Search24Regular.svg.js.map +1 -1
  36. package/dist/component/index.js +1 -0
  37. package/dist/component/index.js.map +1 -1
  38. package/dist/component/input/Input.js +1 -0
  39. package/dist/component/input/Input.js.map +1 -1
  40. package/dist/component/input/SearchInput.js +4 -1
  41. package/dist/component/input/SearchInput.js.map +1 -1
  42. package/dist/component/input/style/index.css.vanilla.js +8 -8
  43. package/dist/component/input/style/index.css.vanilla.js.map +1 -1
  44. package/dist/component/menu/Menu.js +7 -5
  45. package/dist/component/menu/Menu.js.map +1 -1
  46. package/dist/component/menu/MenuItem.js +1 -0
  47. package/dist/component/menu/MenuItem.js.map +1 -1
  48. package/dist/component/menu/MenuItemCheckbox.js +7 -5
  49. package/dist/component/menu/MenuItemCheckbox.js.map +1 -1
  50. package/dist/component/menu/MenuItemRadio.js +7 -5
  51. package/dist/component/menu/MenuItemRadio.js.map +1 -1
  52. package/dist/component/popover/Dialog.js +1 -0
  53. package/dist/component/popover/Dialog.js.map +1 -1
  54. package/dist/component/popover/DismissButton.js +1 -0
  55. package/dist/component/popover/DismissButton.js.map +1 -1
  56. package/dist/component/popover/Popover.js +1 -0
  57. package/dist/component/popover/Popover.js.map +1 -1
  58. package/dist/component/popover/Tooltip.js +1 -0
  59. package/dist/component/popover/Tooltip.js.map +1 -1
  60. package/dist/component/popover/style/index.css.vanilla.js +8 -8
  61. package/dist/component/popover/style/index.css.vanilla.js.map +1 -1
  62. package/dist/component/progress/style/index.css.vanilla.js +4 -4
  63. package/dist/component/progress/style/index.css.vanilla.js.map +1 -1
  64. package/dist/component/select/AutoComplete.js +7 -5
  65. package/dist/component/select/AutoComplete.js.map +1 -1
  66. package/dist/component/select/Group.js +13 -4
  67. package/dist/component/select/Group.js.map +1 -1
  68. package/dist/component/select/Option.js +1 -0
  69. package/dist/component/select/Option.js.map +1 -1
  70. package/dist/component/select/Select.js +7 -5
  71. package/dist/component/select/Select.js.map +1 -1
  72. package/dist/component/select/style/index.css.vanilla.js +16 -15
  73. package/dist/component/select/style/index.css.vanilla.js.map +1 -1
  74. package/dist/component/style/article.css.vanilla.js +6 -0
  75. package/dist/component/style/article.css.vanilla.js.map +1 -0
  76. package/dist/component/style/index.js +3 -0
  77. package/dist/component/style/index.js.map +1 -0
  78. package/dist/component/typography/style/index.css.vanilla.js +4 -4
  79. package/dist/component/typography/style/index.css.vanilla.js.map +1 -1
  80. package/dist/{theme/global.css → global.css} +7 -7
  81. package/dist/hook/accessibility/keyboard/Keyboard.js +7 -2
  82. package/dist/hook/accessibility/keyboard/Keyboard.js.map +1 -1
  83. package/dist/hook/accessibility/keyboard/Roving.js +1 -0
  84. package/dist/hook/accessibility/keyboard/Roving.js.map +1 -1
  85. package/dist/hook/accessibility/keyboard/hook/useLastFocused.js +1 -0
  86. package/dist/hook/accessibility/keyboard/hook/useLastFocused.js.map +1 -1
  87. package/dist/hook/accessibility/keyboard/hook/useMoveFocus.js.map +1 -1
  88. package/dist/hook/accessibility/keyboard/hook/useNavigate.js +2 -4
  89. package/dist/hook/accessibility/keyboard/hook/useNavigate.js.map +1 -1
  90. package/dist/hook/accessibility/keyboard/resolve.js +1 -0
  91. package/dist/hook/accessibility/keyboard/resolve.js.map +1 -1
  92. package/dist/hook/accessibility/keyboard/sort.js +1 -1
  93. package/dist/hook/accessibility/keyboard/sort.js.map +1 -1
  94. package/dist/hook/accessibility/keyboard/tree.js +1 -0
  95. package/dist/hook/accessibility/keyboard/tree.js.map +1 -1
  96. package/dist/hook/accessibility/keyboard/useController.js +1 -0
  97. package/dist/hook/accessibility/keyboard/useController.js.map +1 -1
  98. package/dist/hook/accessibility/keyboard/useKeyboard.js +1 -0
  99. package/dist/hook/accessibility/keyboard/useKeyboard.js.map +1 -1
  100. package/dist/hook/document/useHighlight.js +1 -1
  101. package/dist/hook/document/useHighlight.js.map +1 -1
  102. package/dist/hook/form/useAutoComplete.js +1 -3
  103. package/dist/hook/form/useAutoComplete.js.map +1 -1
  104. package/dist/hook/form/useCheckbox.js +1 -0
  105. package/dist/hook/form/useCheckbox.js.map +1 -1
  106. package/dist/hook/form/useChecked.js +1 -0
  107. package/dist/hook/form/useChecked.js.map +1 -1
  108. package/dist/hook/form/useDefault.js +2 -0
  109. package/dist/hook/form/useDefault.js.map +1 -1
  110. package/dist/hook/form/useForm.js +2 -1
  111. package/dist/hook/form/useForm.js.map +1 -1
  112. package/dist/hook/form/useGroup.js +2 -0
  113. package/dist/hook/form/useGroup.js.map +1 -1
  114. package/dist/hook/form/useOption.js +1 -0
  115. package/dist/hook/form/useOption.js.map +1 -1
  116. package/dist/hook/form/useRadio.js +1 -0
  117. package/dist/hook/form/useRadio.js.map +1 -1
  118. package/dist/hook/form/useSelect.js +1 -0
  119. package/dist/hook/form/useSelect.js.map +1 -1
  120. package/dist/hook/form/useValue.js +1 -0
  121. package/dist/hook/form/useValue.js.map +1 -1
  122. package/dist/hook/popover/useAnchorPositioning.js +1 -0
  123. package/dist/hook/popover/useAnchorPositioning.js.map +1 -1
  124. package/dist/hook/popover/useDialog.js +1 -0
  125. package/dist/hook/popover/useDialog.js.map +1 -1
  126. package/dist/hook/popover/useLightDismiss.js +1 -1
  127. package/dist/hook/popover/useLightDismiss.js.map +1 -1
  128. package/dist/hook/popover/useOverlay.js +1 -0
  129. package/dist/hook/popover/useOverlay.js.map +1 -1
  130. package/dist/hook/popover/usePopover.js +6 -2
  131. package/dist/hook/popover/usePopover.js.map +1 -1
  132. package/dist/hook/popover/usePositioning.js +1 -0
  133. package/dist/hook/popover/usePositioning.js.map +1 -1
  134. package/dist/hook/popover/useTooltip.js +3 -1
  135. package/dist/hook/popover/useTooltip.js.map +1 -1
  136. package/dist/hook/react/refValue.js +1 -0
  137. package/dist/hook/react/refValue.js.map +1 -1
  138. package/dist/hook/react/useActivate.js +1 -1
  139. package/dist/hook/react/useActivate.js.map +1 -1
  140. package/dist/hook/react/useConst.js.map +1 -1
  141. package/dist/hook/react/useInteractive.js +1 -0
  142. package/dist/hook/react/useInteractive.js.map +1 -1
  143. package/dist/hook/react/useUniqueId.js +3 -2
  144. package/dist/hook/react/useUniqueId.js.map +1 -1
  145. package/dist/index.js +5 -1
  146. package/dist/index.js.map +1 -1
  147. package/dist/index3.css +138 -0
  148. package/dist/index5.css +167 -0
  149. package/dist/{component/checkbox/style/index.css → index6.css} +79 -71
  150. package/dist/{component/input/style/index.css → index7.css} +29 -30
  151. package/dist/{component/button/style/index.css → index8.css} +37 -37
  152. package/dist/infra/logging/logger.js +10 -12
  153. package/dist/infra/logging/logger.js.map +1 -1
  154. package/dist/theme/ColorScheme.js.map +1 -1
  155. package/dist/theme/defineTheme.js +1 -0
  156. package/dist/theme/defineTheme.js.map +1 -1
  157. package/dist/theme/global.css.vanilla.js +11 -11
  158. package/dist/theme/global.css.vanilla.js.map +1 -1
  159. package/dist/theme/theme.css.vanilla.js +3 -3
  160. package/dist/theme/theme.css.vanilla.js.map +1 -1
  161. package/dist/theme/token.css.vanilla.js +1 -1
  162. package/dist/theme/token.css.vanilla.js.map +1 -1
  163. package/dist/{theme/theme.css → theme.css} +23 -27
  164. package/dist/util/document/accessibility.css.vanilla.js +4 -4
  165. package/dist/util/document/accessibility.css.vanilla.js.map +1 -1
  166. package/dist/util/index.js +4 -1
  167. package/dist/util/index.js.map +1 -1
  168. package/dist/util/random/generateDeterministicId.js +12 -0
  169. package/dist/util/random/generateDeterministicId.js.map +1 -0
  170. package/dist/util/random/generateDigest.js +12 -0
  171. package/dist/util/random/generateDigest.js.map +1 -0
  172. package/dist/util/random/generateUniqueId.js +9 -0
  173. package/dist/util/random/generateUniqueId.js.map +1 -0
  174. package/dist/util/random/index.js +4 -1
  175. package/dist/util/random/index.js.map +1 -1
  176. package/dist/util/random/toHex.js +10 -0
  177. package/dist/util/random/toHex.js.map +1 -0
  178. package/package.json +102 -105
  179. package/src/component/button/Button.tsx +1 -5
  180. package/src/component/button/style/index.css.ts +1 -1
  181. package/src/component/checkbox/Checkbox.tsx +2 -3
  182. package/src/component/checkbox/Radio.tsx +1 -2
  183. package/src/component/checkbox/RadioGroup.tsx +1 -2
  184. package/src/component/checkbox/style/index.css.ts +34 -25
  185. package/src/component/icon/README.md +17 -3
  186. package/src/component/index.ts +1 -0
  187. package/src/component/input/Input.tsx +1 -2
  188. package/src/component/input/SearchInput.tsx +4 -3
  189. package/src/component/input/style/index.css.ts +42 -41
  190. package/src/component/popover/Tooltip.tsx +1 -3
  191. package/src/component/popover/style/index.css.ts +100 -103
  192. package/src/component/select/Group.tsx +11 -3
  193. package/src/component/select/Option.tsx +1 -2
  194. package/src/component/select/style/index.css.ts +59 -53
  195. package/src/component/style/article.css.ts +189 -0
  196. package/src/component/style/index.ts +1 -0
  197. package/src/hook/accessibility/keyboard/Keyboard.tsx +6 -1
  198. package/src/hook/accessibility/keyboard/hook/useLastFocused.ts +1 -0
  199. package/src/hook/accessibility/keyboard/hook/useMoveFocus.ts +2 -0
  200. package/src/hook/accessibility/keyboard/hook/useNavigate.ts +5 -5
  201. package/src/hook/accessibility/keyboard/sort.ts +1 -1
  202. package/src/hook/document/useHighlight.ts +1 -27
  203. package/src/hook/form/useAutoComplete.ts +3 -3
  204. package/src/hook/form/useDefault.ts +2 -0
  205. package/src/hook/form/useForm.ts +2 -2
  206. package/src/hook/form/useGroup.ts +2 -1
  207. package/src/hook/popover/useLightDismiss.ts +1 -1
  208. package/src/hook/popover/usePopover.ts +7 -12
  209. package/src/hook/popover/usePositioning.ts +2 -1
  210. package/src/hook/popover/useTooltip.ts +3 -1
  211. package/src/hook/react/useActivate.ts +1 -1
  212. package/src/hook/react/useConst.ts +1 -1
  213. package/src/hook/react/useUniqueId.ts +2 -2
  214. package/src/infra/logging/logger.ts +26 -13
  215. package/src/theme/ColorScheme.tsx +1 -5
  216. package/src/theme/global.css.ts +2 -2
  217. package/src/theme/theme.css.ts +1 -5
  218. package/src/util/document/accessibility.css.ts +3 -3
  219. package/src/util/random/generateDeterministicId.ts +10 -0
  220. package/src/util/random/generateDigest.ts +11 -0
  221. package/src/util/random/{createUniqueId.ts → generateUniqueId.ts} +4 -6
  222. package/src/util/random/index.ts +4 -1
  223. package/src/util/random/toHex.ts +6 -0
  224. package/dist/component/popover/style/index.css +0 -175
  225. package/dist/component/select/style/index.css +0 -135
  226. package/dist/util/random/createUniqueId.js +0 -8
  227. package/dist/util/random/createUniqueId.js.map +0 -1
  228. package/src/component/style/font/font.css +0 -23
  229. package/src/component/style/font/proxima-nova-bold.woff +0 -0
  230. package/src/component/style/font/proxima-nova-light.woff +0 -0
  231. package/src/component/style/font/proxima-nova-regular.woff +0 -0
  232. package/src/component/style/font/proxima-nova-semibold.woff +0 -0
  233. package/src/component/style/press.module.css +0 -204
  234. /package/dist/{component/select/index.css → index.css} +0 -0
  235. /package/dist/{component/select/index2.css → index2.css} +0 -0
  236. /package/dist/{component/progress/style/index.css → index4.css} +0 -0
  237. /package/dist/{theme/token.css → token.css} +0 -0
@@ -7,12 +7,12 @@ import {
7
7
  } from '@vanilla-extract/css'
8
8
  import { recipe } from '@vanilla-extract/recipes'
9
9
 
10
+ const outset = createVar()
10
11
  const gap = createVar()
11
12
  const width = createVar()
12
13
  const height = createVar()
13
- const margin = createVar()
14
- const padding = createVar()
15
14
  const size = createVar()
15
+ const padding = createVar()
16
16
  const color = createVar()
17
17
  const colorHover = createVar()
18
18
  const colorActive = createVar()
@@ -27,9 +27,10 @@ const backgroundChecked = createVar()
27
27
  const backgroundDisabled = createVar()
28
28
  const scale = createVar()
29
29
  const scaleActive = createVar()
30
+ const scaleDisabled = createVar()
31
+ const translate = createVar()
32
+ const translateChecked = createVar()
30
33
  const transition = createVar()
31
- const offset = createVar()
32
- const offsetChecked = createVar()
33
34
 
34
35
  export const CheckboxGroupStyle = style({
35
36
  vars: {
@@ -83,16 +84,16 @@ export const CheckboxStyle = recipe({
83
84
  outlineOffset: theme.checkbox.outline,
84
85
  transition,
85
86
  selectors: {
86
- // https://larsmagnus.co/blog/focus-visible-within-the-missing-pseudo-class#using-has-to-emulate-focus-visible-within
87
- '&:has(:focus-visible)': {
88
- outline: theme.outline,
89
- },
90
87
  // https://kizu.dev/label-to-input/
91
- '&:has(:focus-visible, :hover)': {
88
+ '&:has(:hover, :focus-visible)': {
92
89
  vars: {
93
90
  [color]: colorHover,
94
91
  },
95
92
  },
93
+ // https://larsmagnus.co/blog/focus-visible-within-the-missing-pseudo-class#using-has-to-emulate-focus-visible-within
94
+ '&:has(:focus-visible)': {
95
+ outline: theme.outline,
96
+ },
96
97
  '&:has(:active)': {
97
98
  vars: {
98
99
  [color]: colorActive,
@@ -103,7 +104,7 @@ export const CheckboxStyle = recipe({
103
104
  [color]: colorChecked,
104
105
  },
105
106
  },
106
- '&:has(:indeterminate, :checked):where(:has(:focus-visible, :hover))': {
107
+ '&:has(:indeterminate, :checked):where(:has(:hover, :focus-visible))': {
107
108
  vars: {
108
109
  [color]: colorCheckedHover,
109
110
  },
@@ -125,19 +126,19 @@ export const CheckboxStyle = recipe({
125
126
  size: {
126
127
  small: {
127
128
  vars: {
128
- [margin]: theme.checkbox.margin,
129
+ [outset]: theme.checkbox.outset,
129
130
  [size]: theme.checkbox.size.small,
130
131
  },
131
132
  },
132
133
  medium: {
133
134
  vars: {
134
- [margin]: theme.checkbox.margin,
135
+ [outset]: theme.checkbox.outset,
135
136
  [size]: theme.checkbox.size.medium,
136
137
  },
137
138
  },
138
139
  large: {
139
140
  vars: {
140
- [margin]: theme.checkbox.margin,
141
+ [outset]: theme.checkbox.outset,
141
142
  [size]: theme.checkbox.size.large,
142
143
  },
143
144
  },
@@ -147,7 +148,7 @@ export const CheckboxStyle = recipe({
147
148
 
148
149
  globalStyle(`${CheckboxStyle.classNames.base} > input`, {
149
150
  position: 'absolute',
150
- inset: `calc(-1 * ${margin})`,
151
+ inset: `calc(-1 * ${outset})`,
151
152
  margin: '0',
152
153
  appearance: 'none',
153
154
  cursor: 'inherit',
@@ -227,13 +228,20 @@ export const SwitchStyle = recipe({
227
228
  [backgroundDisabled]: theme.disabled.background,
228
229
  [scale]: '1',
229
230
  [scaleActive]: '1.25',
231
+ [scaleDisabled]: '1',
232
+ [translate]: padding,
233
+ [translateChecked]: `calc(${width} - ${size} * ${scale} - ${padding})`,
230
234
  [transition]: theme.switch.transition,
231
- [offset]: padding,
232
- [offsetChecked]: `calc(100% - ${size} * ${scale} - ${padding})`,
233
235
  },
234
236
  position: 'relative',
237
+ boxSizing: 'border-box',
238
+ display: 'inline-flex',
239
+ flexShrink: '0',
240
+ placeContent: 'center',
241
+ placeItems: 'center',
235
242
  inlineSize: width,
236
243
  blockSize: height,
244
+ padding,
237
245
  color,
238
246
  cursor,
239
247
  outlineOffset: theme.switch.outline,
@@ -242,14 +250,14 @@ export const SwitchStyle = recipe({
242
250
  transition,
243
251
  '::after': {
244
252
  position: 'absolute',
245
- insetBlockStart: padding,
246
- insetInlineStart: offset,
253
+ insetInlineStart: '0',
247
254
  inlineSize: `calc(${size} * ${scale})`,
248
255
  blockSize: size,
249
256
  pointerEvents: 'none',
250
257
  content: '',
251
258
  background: 'currentcolor',
252
- borderRadius: size,
259
+ borderRadius: 'inherit',
260
+ translate,
253
261
  transition: 'inherit',
254
262
  },
255
263
  selectors: {
@@ -265,14 +273,15 @@ export const SwitchStyle = recipe({
265
273
  vars: {
266
274
  [color]: colorChecked,
267
275
  [background]: backgroundChecked,
268
- [offset]: offsetChecked,
276
+ [translate]: translateChecked,
269
277
  },
270
278
  },
271
279
  '&:has(:disabled)': {
272
280
  vars: {
273
281
  [color]: colorDisabled,
274
- [background]: backgroundDisabled,
275
282
  [cursor]: cursorDisabled,
283
+ [background]: backgroundDisabled,
284
+ [scale]: scaleDisabled,
276
285
  },
277
286
  },
278
287
  },
@@ -281,26 +290,26 @@ export const SwitchStyle = recipe({
281
290
  size: {
282
291
  small: {
283
292
  vars: {
293
+ [outset]: theme.switch.outset,
284
294
  [width]: theme.switch.width.small,
285
295
  [height]: theme.switch.height.small,
286
296
  [padding]: theme.switch.padding.small,
287
- [margin]: theme.switch.outset,
288
297
  },
289
298
  },
290
299
  medium: {
291
300
  vars: {
301
+ [outset]: theme.switch.outset,
292
302
  [width]: theme.switch.width.medium,
293
303
  [height]: theme.switch.height.medium,
294
304
  [padding]: theme.switch.padding.medium,
295
- [margin]: theme.switch.outset,
296
305
  },
297
306
  },
298
307
  large: {
299
308
  vars: {
309
+ [outset]: theme.switch.outset,
300
310
  [width]: theme.switch.width.large,
301
311
  [height]: theme.switch.height.large,
302
312
  [padding]: theme.switch.padding.large,
303
- [margin]: theme.switch.outset,
304
313
  },
305
314
  },
306
315
  },
@@ -309,7 +318,7 @@ export const SwitchStyle = recipe({
309
318
 
310
319
  export const SwitchInputStyle = style({
311
320
  position: 'absolute',
312
- inset: `calc(-1 * ${margin})`,
321
+ inset: `calc(-1 * ${outset})`,
313
322
  margin: '0',
314
323
  appearance: 'none',
315
324
  cursor: 'inherit',
@@ -1,4 +1,18 @@
1
- # How to simplify SVG files
1
+ # Simplify SVG files
2
2
 
3
- 1. `pip3 install picosvg`
4
- 2. `for svg in *.svg ; do python3 -m 'picosvg.picosvg' "$svg" --output_file "$svg" ; done`
3
+ Install picosvg:
4
+
5
+ ```sh
6
+ python3 -m pip install picosvg
7
+ ```
8
+
9
+ From the repository root, write simplified copies to a separate directory so the originals remain unchanged:
10
+
11
+ ```sh
12
+ mkdir -p "$TMPDIR/chiplet-icons"
13
+ for svg in src/component/icon/set/*.svg; do
14
+ python3 -m picosvg.picosvg "$svg" --output_file "$TMPDIR/chiplet-icons/$(basename "$svg")" || exit 1
15
+ done
16
+ ```
17
+
18
+ Review the generated files before replacing any source icons.
@@ -1,5 +1,6 @@
1
1
  export * from './icon'
2
2
  export * from './popover'
3
+ export * from './style'
3
4
  export * from './typography'
4
5
 
5
6
  export * from './button'
@@ -16,8 +16,7 @@ export interface InputProps extends Omit<
16
16
  defaultValue?: string | undefined
17
17
  value?: string | undefined
18
18
  onChange?:
19
- | ChangeCallback<React.ChangeEvent<HTMLInputElement>, string>
20
- | undefined
19
+ ChangeCallback<React.ChangeEvent<HTMLInputElement>, string> | undefined
21
20
  before?: JSX.Element | null | undefined
22
21
  after?: JSX.Element | null | undefined
23
22
  slot?: {
@@ -2,14 +2,13 @@ import type { ChangeCallback } from '#hook'
2
2
  import { isEnterKey } from '#util'
3
3
  import clsx from 'clsx'
4
4
  import { useCallback } from 'react'
5
+ import { Input, type InputProps } from '.'
5
6
  import { Search24Regular } from '../icon'
6
7
  import { InputBeforeStyle, SearchInputBeforeStyle } from './style/index.css'
7
- import { Input, type InputProps } from '.'
8
8
 
9
9
  export interface SearchInputProps extends InputProps {
10
10
  onSearch?:
11
- | ChangeCallback<React.KeyboardEvent<HTMLInputElement>, string>
12
- | undefined
11
+ ChangeCallback<React.KeyboardEvent<HTMLInputElement>, string> | undefined
13
12
  }
14
13
 
15
14
  export function SearchInput(props: SearchInputProps) {
@@ -28,6 +27,7 @@ export function SearchInput(props: SearchInputProps) {
28
27
  const { onKeyDown } = attrs
29
28
 
30
29
  attrs.onKeyDown = useCallback<NonNullable<typeof onKeyDown>>(
30
+ // eslint-disable-next-line react-hooks/preserve-manual-memoization
31
31
  (ev) => {
32
32
  onKeyDown?.(ev)
33
33
 
@@ -35,6 +35,7 @@ export function SearchInput(props: SearchInputProps) {
35
35
  onSearch?.(ev, ev.currentTarget.value)
36
36
  }
37
37
  },
38
+ // eslint-disable-next-line react-hooks/preserve-manual-memoization
38
39
  [onKeyDown, onSearch]
39
40
  )
40
41
 
@@ -1,4 +1,4 @@
1
- import { stretch, theme } from '#theme'
1
+ import { radiusVar, SquircleStyle, stretch, theme } from '#theme'
2
2
  import { createVar, globalStyle, style } from '@vanilla-extract/css'
3
3
  import { recipe } from '@vanilla-extract/recipes'
4
4
 
@@ -19,52 +19,53 @@ const borderColorHover = createVar()
19
19
  const borderColorFocus = createVar()
20
20
  const borderColorDisabled = createVar()
21
21
  const borderSize = createVar()
22
- const radius = createVar()
23
22
  const placeholder = createVar()
24
23
  const before = createVar()
25
24
  const after = createVar()
26
25
 
27
26
  export const InputStyle = recipe({
28
- base: {
29
- vars: {
30
- [border]: `${borderSize} solid`,
31
- [placeholder]: theme.input.placeholder,
32
- [before]: theme.input.before,
33
- [after]: theme.input.after,
34
- },
35
- boxSizing: 'border-box',
36
- display: 'flex',
37
- placeItems: 'center',
38
- blockSize: height,
39
- font,
40
- color,
41
- background,
42
- border,
43
- borderColor,
44
- borderRadius: radius,
45
- ':hover': {
27
+ base: [
28
+ SquircleStyle,
29
+ {
46
30
  vars: {
47
- [background]: backgroundHover,
48
- [borderColor]: borderColorHover,
31
+ [border]: `${borderSize} solid`,
32
+ [placeholder]: theme.input.placeholder,
33
+ [before]: theme.input.before,
34
+ [after]: theme.input.after,
49
35
  },
50
- },
51
- ':focus-within': {
52
- vars: {
53
- [background]: backgroundFocus,
54
- [borderColor]: borderColorFocus,
36
+ boxSizing: 'border-box',
37
+ display: 'flex',
38
+ placeItems: 'center',
39
+ blockSize: height,
40
+ font,
41
+ color,
42
+ background,
43
+ border,
44
+ borderColor,
45
+ ':hover': {
46
+ vars: {
47
+ [background]: backgroundHover,
48
+ [borderColor]: borderColorHover,
49
+ },
55
50
  },
56
- },
57
- selectors: {
58
- '&:has(> input:disabled)': {
51
+ ':focus-within': {
59
52
  vars: {
60
- [color]: colorDisabled,
61
- [background]: backgroundDisabled,
62
- [borderColor]: borderColorDisabled,
63
- [placeholder]: color,
53
+ [background]: backgroundFocus,
54
+ [borderColor]: borderColorFocus,
55
+ },
56
+ },
57
+ selectors: {
58
+ '&:has(> input:disabled)': {
59
+ vars: {
60
+ [color]: colorDisabled,
61
+ [background]: backgroundDisabled,
62
+ [borderColor]: borderColorDisabled,
63
+ [placeholder]: color,
64
+ },
64
65
  },
65
66
  },
66
67
  },
67
- },
68
+ ],
68
69
  variants: {
69
70
  variant: {
70
71
  primary: {
@@ -103,9 +104,9 @@ export const InputStyle = recipe({
103
104
  [height]: theme.input.height.small,
104
105
  [padding]: theme.input.padding.small,
105
106
  [font]: theme.input.font.small,
106
- [borderSize]: theme.input.border.small,
107
- [radius]: theme.input.radius.small,
108
107
  [icon]: theme.icon.size.small,
108
+ [borderSize]: theme.input.border.small,
109
+ [radiusVar]: theme.input.radius.small,
109
110
  },
110
111
  },
111
112
  medium: {
@@ -114,9 +115,9 @@ export const InputStyle = recipe({
114
115
  [height]: theme.input.height.medium,
115
116
  [padding]: theme.input.padding.medium,
116
117
  [font]: theme.input.font.medium,
117
- [borderSize]: theme.input.border.medium,
118
- [radius]: theme.input.radius.medium,
119
118
  [icon]: theme.icon.size.medium,
119
+ [borderSize]: theme.input.border.medium,
120
+ [radiusVar]: theme.input.radius.medium,
120
121
  },
121
122
  },
122
123
  large: {
@@ -125,9 +126,9 @@ export const InputStyle = recipe({
125
126
  [height]: theme.input.height.large,
126
127
  [padding]: theme.input.padding.large,
127
128
  [font]: theme.input.font.large,
128
- [borderSize]: theme.input.border.large,
129
- [radius]: theme.input.radius.large,
130
129
  [icon]: theme.icon.size.large,
130
+ [borderSize]: theme.input.border.large,
131
+ [radiusVar]: theme.input.radius.large,
131
132
  },
132
133
  },
133
134
  },
@@ -9,9 +9,7 @@ import { Portal } from './Portal'
9
9
  import { TooltipArrowStyle, TooltipStyle } from './style/index.css'
10
10
 
11
11
  export type TooltipContent =
12
- | ((tooltip: Tooltip) => React.ReactNode)
13
- | string
14
- | React.ReactElement
12
+ ((tooltip: Tooltip) => React.ReactNode) | string | React.ReactElement
15
13
 
16
14
  export interface TooltipProps
17
15
  extends
@@ -1,21 +1,17 @@
1
- import { stretch, theme } from '#theme'
1
+ import { radiusVar, SquircleStyle, stretch, theme } from '#theme'
2
2
  import { createVar, style } from '@vanilla-extract/css'
3
3
  import { recipe } from '@vanilla-extract/recipes'
4
4
 
5
5
  const width = createVar()
6
6
  const maxWidth = createVar()
7
- const minHeight = createVar()
8
7
  const maxHeight = createVar()
9
8
  const padding = createVar()
10
9
  const paddingBlock = createVar()
11
10
  const paddingInline = createVar()
12
11
  const margin = createVar()
13
- const fontSize = createVar()
14
- const lineHeight = createVar()
15
12
  const color = createVar()
16
13
  const background = createVar()
17
14
  const border = createVar()
18
- const radius = createVar()
19
15
  const shadow = createVar()
20
16
  const backdrop = createVar()
21
17
  const filter = createVar()
@@ -27,48 +23,50 @@ const transition = createVar()
27
23
  const transitionProperty = `background, opacity, transform, display, overlay`
28
24
 
29
25
  export const DialogStyle = recipe({
30
- base: {
31
- vars: {
32
- [maxWidth]: `calc(100% - 2 * ${margin})`,
33
- [maxHeight]: `calc(100% - 2 * ${margin})`,
34
- [margin]: theme.dialog.margin,
35
- [color]: theme.dialog.color,
36
- [background]: theme.dialog.background,
37
- [backdrop]: theme.dialog.backdrop,
38
- [radius]: theme.dialog.radius,
39
- [shadow]: theme.dialog.shadow,
40
- [filter]: theme.dialog.filter,
41
- [transform]: 'none',
42
- [transition]: theme.dialog.transition,
43
- },
44
- boxSizing: 'border-box',
45
- maxInlineSize: maxWidth,
46
- maxBlockSize: maxHeight,
47
- padding: '0',
48
- margin: 'auto',
49
- overflow: 'clip auto',
50
- color,
51
- background,
52
- border: 'none',
53
- borderRadius: radius,
54
- boxShadow: shadow,
55
- transform: 'none',
56
- transition,
57
- transitionProperty,
58
- '::backdrop': {
59
- background: backdrop,
60
- backdropFilter: filter,
61
- transition: 'inherit',
62
- },
63
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@starting-style
64
- '@starting-style': {
65
- opacity: 0,
66
- transform,
26
+ base: [
27
+ SquircleStyle,
28
+ {
29
+ vars: {
30
+ [maxWidth]: `calc(100% - 2 * ${margin})`,
31
+ [maxHeight]: `calc(100% - 2 * ${margin})`,
32
+ [margin]: theme.dialog.margin,
33
+ [color]: theme.dialog.color,
34
+ [background]: theme.dialog.background,
35
+ [backdrop]: theme.dialog.backdrop,
36
+ [radiusVar]: theme.dialog.radius,
37
+ [shadow]: theme.dialog.shadow,
38
+ [filter]: theme.dialog.filter,
39
+ [transform]: 'none',
40
+ [transition]: theme.dialog.transition,
41
+ },
42
+ boxSizing: 'border-box',
43
+ maxInlineSize: maxWidth,
44
+ maxBlockSize: maxHeight,
45
+ padding: '0',
46
+ margin: 'auto',
47
+ overflow: 'clip auto',
48
+ color,
49
+ background,
50
+ border: 'none',
51
+ boxShadow: shadow,
52
+ transform: 'none',
53
+ transition,
54
+ transitionProperty,
67
55
  '::backdrop': {
68
- background: 'none',
56
+ background: backdrop,
57
+ backdropFilter: filter,
58
+ transition: 'inherit',
59
+ },
60
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@starting-style
61
+ '@starting-style': {
62
+ opacity: 0,
63
+ transform,
64
+ '::backdrop': {
65
+ background: 'none',
66
+ },
69
67
  },
70
68
  },
71
- },
69
+ ],
72
70
  variants: {
73
71
  size: {
74
72
  auto: {
@@ -91,37 +89,39 @@ export const DialogStyle = recipe({
91
89
  })
92
90
 
93
91
  export const PopoverStyle = recipe({
94
- base: {
95
- vars: {
96
- [color]: theme.popover.color,
97
- [background]: theme.popover.background,
98
- [border]: theme.popover.border,
99
- [radius]: theme.popover.radius,
100
- [shadow]: theme.popover.shadow,
101
- [transform]: `${translate} scale(0.95)`,
102
- [translateValue]: '0.5rem',
103
- [transition]: theme.popover.transition,
104
- },
105
- boxSizing: 'border-box',
106
- padding: '0',
107
- margin: '0',
108
- overflow: 'hidden auto',
109
- color,
110
- background,
111
- border,
112
- borderRadius: radius,
113
- boxShadow: shadow,
114
- transform: 'none',
115
- transformOrigin,
116
- transition,
117
- transitionProperty,
118
- '@starting-style': {
119
- opacity: 0,
120
- // Do not set the CSS 'translate' property here;
121
- // it is controlled by the 'usePositioning' hook.
122
- transform,
92
+ base: [
93
+ SquircleStyle,
94
+ {
95
+ vars: {
96
+ [color]: theme.popover.color,
97
+ [background]: theme.popover.background,
98
+ [border]: theme.popover.border,
99
+ [radiusVar]: theme.popover.radius,
100
+ [shadow]: theme.popover.shadow,
101
+ [transform]: `${translate} scale(0.95)`,
102
+ [translateValue]: '0.5rem',
103
+ [transition]: theme.popover.transition,
104
+ },
105
+ boxSizing: 'border-box',
106
+ padding: '0',
107
+ margin: '0',
108
+ overflow: 'clip auto',
109
+ color,
110
+ background,
111
+ border,
112
+ boxShadow: shadow,
113
+ transform: 'none',
114
+ transformOrigin,
115
+ transition,
116
+ transitionProperty,
117
+ '@starting-style': {
118
+ opacity: 0,
119
+ // Do not set the CSS 'translate' property here;
120
+ // it is controlled by the 'usePositioning' hook.
121
+ transform,
122
+ },
123
123
  },
124
- },
124
+ ],
125
125
  variants: {
126
126
  position: {
127
127
  'above': {
@@ -200,47 +200,44 @@ export const PopoverStyle = recipe({
200
200
  },
201
201
  })
202
202
 
203
- export const TooltipStyle = style({
204
- vars: {
205
- [minHeight]: theme.tooltip.minHeight,
206
- [padding]: `${paddingBlock} ${paddingInline}`,
207
- [paddingBlock]: `calc((${minHeight} - ${lineHeight}) / 2)`,
208
- [paddingInline]: theme.tooltip.padding,
209
- [fontSize]: theme.tooltip.fontSize,
210
- [lineHeight]: theme.tooltip.lineHeight,
211
- [color]: theme.tooltip.color,
212
- [background]: theme.tooltip.background,
213
- [border]: theme.tooltip.border,
214
- [radius]: theme.tooltip.radius,
215
- [filter]: theme.tooltip.filter,
203
+ export const TooltipStyle = style([
204
+ SquircleStyle,
205
+ {
206
+ vars: {
207
+ [padding]: `${paddingBlock} ${paddingInline}`,
208
+ [paddingBlock]: `calc((${theme.tooltip.minHeight} - 1lh) / 2)`,
209
+ [paddingInline]: theme.tooltip.padding,
210
+ [color]: theme.tooltip.color,
211
+ [background]: theme.tooltip.background,
212
+ [border]: theme.tooltip.border,
213
+ [radiusVar]: theme.tooltip.radius,
214
+ [filter]: theme.tooltip.filter,
215
+ },
216
+ boxSizing: 'border-box',
217
+ inlineSize: 'fit-content',
218
+ blockSize: 'fit-content',
219
+ padding,
220
+ margin: '0',
221
+ overflow: 'visible',
222
+ color,
223
+ background,
224
+ border,
225
+ filter,
216
226
  },
217
- boxSizing: 'border-box',
218
- inlineSize: 'fit-content',
219
- blockSize: 'fit-content',
220
- padding,
221
- margin: '0',
222
- overflow: 'visible',
223
- fontSize,
224
- lineHeight,
225
- color,
226
- background,
227
- border,
228
- borderRadius: radius,
229
- filter,
230
- })
227
+ ])
231
228
 
232
229
  export const TooltipArrowStyle = recipe({
233
230
  base: {
234
231
  vars: {
235
232
  [width]: theme.tooltip.arrow.size,
236
- [radius]: theme.tooltip.arrow.radius,
233
+ [radiusVar]: theme.tooltip.arrow.radius,
237
234
  },
238
235
  position: 'absolute',
239
236
  zIndex: '-1',
240
237
  inlineSize: width,
241
238
  aspectRatio: '1 / 1',
242
239
  background: 'inherit',
243
- borderRadius: radius,
240
+ borderRadius: radiusVar,
244
241
  transform: 'skew(15deg, 15deg)',
245
242
  },
246
243
  variants: {