@loadsmart/loadsmart-ui 6.0.14 → 6.0.16

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 (55) hide show
  1. package/dist/components/Banner/Banner.d.ts +4 -4
  2. package/dist/components/Banner/Banner.stories.d.ts +2 -1
  3. package/dist/components/Button/Button.stories.d.ts +3 -2
  4. package/dist/components/DatePicker/useDatePicker.d.ts +8 -2
  5. package/dist/components/DatePicker/useDateRangePicker.d.ts +12 -3
  6. package/dist/components/Dialog/Dialog.d.ts +4 -4
  7. package/dist/components/DragDropFile/DragDropFile.d.ts +2 -1
  8. package/dist/components/DragDropFile/components/Wrapper.d.ts +2 -1
  9. package/dist/components/DragDropFile/styles.d.ts +3 -2
  10. package/dist/components/ErrorMessage/ErrorMessage.d.ts +2 -1
  11. package/dist/components/Modal/Modal.d.ts +1 -1
  12. package/dist/components/Popover/Popover.types.d.ts +6 -8
  13. package/dist/components/Section/Section.d.ts +2 -2
  14. package/dist/components/SideNavigation/Menu/Menu.d.ts +1 -1
  15. package/dist/components/SideNavigation/SideNavigation.d.ts +1 -1
  16. package/dist/components/Tabs/Tabs.d.ts +5 -5
  17. package/dist/components/Tag/Tag.stories.d.ts +2 -1
  18. package/dist/components/Text/Text.d.ts +1 -1
  19. package/dist/index.js +284 -243
  20. package/dist/index.js.map +1 -1
  21. package/dist/miranda-compatibility.theme-22a9ce26.js +2 -0
  22. package/dist/miranda-compatibility.theme-22a9ce26.js.map +1 -0
  23. package/dist/{prop-82e9ff9d.js → prop-201ffe28.js} +2 -2
  24. package/dist/{prop-82e9ff9d.js.map → prop-201ffe28.js.map} +1 -1
  25. package/dist/testing/index.js +1 -1
  26. package/dist/theming/index.js +1 -1
  27. package/dist/theming/themes/alice.theme.d.ts +70 -15
  28. package/dist/theming/themes/loadsmart.theme.d.ts +70 -15
  29. package/dist/theming/themes/miranda-compatibility.theme.d.ts +141 -85
  30. package/dist/tools/index.js +1 -1
  31. package/package.json +5 -5
  32. package/src/common/CloseButton/CloseButton.tsx +4 -1
  33. package/src/common/SelectionWrapper.tsx +8 -0
  34. package/src/components/Button/Button.tsx +44 -21
  35. package/src/components/Checkbox/Checkbox.tsx +1 -1
  36. package/src/components/Dropdown/Dropdown.test.tsx +1 -1
  37. package/src/components/Dropdown/DropdownMenu.tsx +3 -0
  38. package/src/components/Dropdown/DropdownTrigger.tsx +9 -11
  39. package/src/components/Link/Link.tsx +9 -0
  40. package/src/components/Popover/Popover.test.tsx +1 -2
  41. package/src/components/Popover/Popover.tsx +25 -68
  42. package/src/components/Popover/Popover.types.ts +6 -8
  43. package/src/components/Radio/Radio.tsx +1 -1
  44. package/src/components/Select/SelectTrigger.tsx +2 -9
  45. package/src/components/Switch/Switch.tsx +3 -1
  46. package/src/components/Tag/Tag.tsx +24 -4
  47. package/src/components/TextField/TextField.tsx +5 -2
  48. package/src/components/Textarea/Textarea.tsx +5 -2
  49. package/src/components/ToggleGroup/Toggle.tsx +3 -1
  50. package/src/components/Tooltip/Tooltip.tsx +1 -8
  51. package/src/theming/themes/alice.theme.ts +83 -15
  52. package/src/theming/themes/loadsmart.theme.ts +85 -16
  53. package/src/theming/themes/miranda-compatibility.theme.ts +181 -113
  54. package/dist/miranda-compatibility.theme-f99913ed.js +0 -2
  55. package/dist/miranda-compatibility.theme-f99913ed.js.map +0 -1
@@ -142,11 +142,12 @@ const StyledButton = styled(BaseStyledButton)<{
142
142
 
143
143
  color: ${conditional({
144
144
  'button-primary-color': whenProps({ $variant: 'primary' }),
145
- 'button-secondary-color': whenProps({ $variant: ['secondary', 'tertiary'], $scheme: 'light' }),
145
+ 'button-secondary-color': whenProps({ $variant: 'secondary', $scheme: 'light' }),
146
146
  'button-secondary-dark-color': whenProps({
147
- $variant: ['secondary', 'tertiary'],
147
+ $variant: 'secondary',
148
148
  $scheme: 'dark',
149
149
  }),
150
+ 'button-tertiary-color': whenProps({ $variant: 'tertiary' }),
150
151
  'button-warning-color': whenProps({ $variant: 'warning' }),
151
152
  'button-icon-color': whenProps({ $variant: 'icon' }),
152
153
  })};
@@ -154,13 +155,16 @@ const StyledButton = styled(BaseStyledButton)<{
154
155
  background: ${conditional({
155
156
  'button-primary-background': whenProps({ $variant: 'primary' }),
156
157
  'button-secondary-background': whenProps({
157
- $variant: ['secondary', 'tertiary'],
158
+ $variant: 'secondary',
158
159
  $scheme: 'light',
159
160
  }),
160
161
  'button-secondary-dark-background': whenProps({
161
- $variant: ['secondary', 'tertiary'],
162
+ $variant: 'secondary',
162
163
  $scheme: 'dark',
163
164
  }),
165
+ 'button-tertiary': whenProps({
166
+ $variant: 'tertiary',
167
+ }),
164
168
  'button-warning-background': whenProps({ $variant: 'warning' }),
165
169
  'button-icon-background': whenProps({ $variant: 'icon' }),
166
170
  })};
@@ -169,9 +173,9 @@ const StyledButton = styled(BaseStyledButton)<{
169
173
  'button-primary-border-color': whenProps({ $variant: 'primary' }),
170
174
  'button-secondary-border-color': whenProps({ $variant: 'secondary', $scheme: 'light' }),
171
175
  'button-secondary-dark-border-color': whenProps({ $variant: 'secondary', $scheme: 'dark' }),
176
+ 'button-tertiary-border-color': whenProps({ $variant: 'tertiary' }),
172
177
  'button-warning-border-color': whenProps({ $variant: 'warning' }),
173
178
  'button-icon-border-color': whenProps({ $variant: 'icon' }),
174
- 'color-transparent': whenProps({ $variant: 'tertiary' }),
175
179
  })};
176
180
  border-radius: ${conditional({
177
181
  'button-border-radius': whenProps({ $variant: ['primary', 'secondary', 'warning'] }),
@@ -182,13 +186,16 @@ const StyledButton = styled(BaseStyledButton)<{
182
186
  background: ${conditional({
183
187
  'button-primary-background--hover': whenProps({ $variant: 'primary' }),
184
188
  'button-secondary-background--hover': whenProps({
185
- $variant: ['secondary', 'tertiary'],
189
+ $variant: 'secondary',
186
190
  $scheme: 'light',
187
191
  }),
188
192
  'button-secondary-dark-background--hover': whenProps({
189
- $variant: ['secondary', 'tertiary'],
193
+ $variant: 'secondary',
190
194
  $scheme: 'dark',
191
195
  }),
196
+ 'button-tertiary-background--hover': whenProps({
197
+ $variant: 'tertiary',
198
+ }),
192
199
  'button-warning-background--hover': whenProps({ $variant: 'warning' }),
193
200
  'button-icon-background--hover': whenProps({ $variant: 'icon' }),
194
201
  })};
@@ -202,20 +209,21 @@ const StyledButton = styled(BaseStyledButton)<{
202
209
  $variant: 'secondary',
203
210
  $scheme: 'dark',
204
211
  }),
212
+ 'button-tertiary-border-color--hover': whenProps({ $variant: 'tertiary' }),
205
213
  'button-warning-border-color--hover': whenProps({ $variant: 'warning' }),
206
214
  'button-icon-border-color--hover': whenProps({ $variant: 'icon' }),
207
- 'color-transparent': whenProps({ $variant: 'tertiary' }),
208
215
  })};
209
216
  color: ${conditional({
210
217
  'button-primary-color--hover': whenProps({ $variant: 'primary' }),
211
218
  'button-secondary-color--hover': whenProps({
212
- $variant: ['secondary', 'tertiary'],
219
+ $variant: 'secondary',
213
220
  $scheme: 'light',
214
221
  }),
215
222
  'button-secondary-dark-color--hover': whenProps({
216
- $variant: ['secondary', 'tertiary'],
223
+ $variant: 'secondary',
217
224
  $scheme: 'dark',
218
225
  }),
226
+ 'button-tertiary-color--hover': whenProps({ $variant: 'tertiary' }),
219
227
  'button-warning-color--hover': whenProps({ $variant: 'warning' }),
220
228
  'button-icon-color--hover': whenProps({ $variant: 'icon' }),
221
229
  })};
@@ -225,13 +233,14 @@ const StyledButton = styled(BaseStyledButton)<{
225
233
  background: ${conditional({
226
234
  'button-primary-background--disabled': whenProps({ $variant: 'primary' }),
227
235
  'button-secondary-background--disabled': whenProps({
228
- $variant: ['secondary', 'tertiary'],
236
+ $variant: 'secondary',
229
237
  $scheme: 'light',
230
238
  }),
231
239
  'button-secondary-dark-background--disabled': whenProps({
232
- $variant: ['secondary', 'tertiary'],
240
+ $variant: 'secondary',
233
241
  $scheme: 'dark',
234
242
  }),
243
+ 'button-tertiary-background--disabled': whenProps({ $variant: 'tertiary' }),
235
244
  'button-warning-background--disabled': whenProps({ $variant: 'warning' }),
236
245
  'button-icon-background--disabled': whenProps({ $variant: 'icon' }),
237
246
  })};
@@ -245,20 +254,21 @@ const StyledButton = styled(BaseStyledButton)<{
245
254
  $variant: 'secondary',
246
255
  $scheme: 'dark',
247
256
  }),
257
+ 'button-tertiary-border-color--disabled': whenProps({ $variant: 'tertiary' }),
248
258
  'button-warning-border-color--disabled': whenProps({ $variant: 'warning' }),
249
259
  'button-icon-border-color--disabled': whenProps({ $variant: 'icon' }),
250
- 'color-transparent': whenProps({ $variant: 'tertiary' }),
251
260
  })};
252
261
  color: ${conditional({
253
262
  'button-primary-color--disabled': whenProps({ $variant: 'primary' }),
254
263
  'button-secondary-color--disabled': whenProps({
255
- $variant: ['secondary', 'tertiary'],
264
+ $variant: 'secondary',
256
265
  $scheme: 'light',
257
266
  }),
258
267
  'button-secondary-dark-color--disabled': whenProps({
259
- $variant: ['secondary', 'tertiary'],
268
+ $variant: 'secondary',
260
269
  $scheme: 'dark',
261
270
  }),
271
+ 'button-tertiary-color--disabled': whenProps({ $variant: 'tertiary' }),
262
272
  'button-warning-color--disabled': whenProps({ $variant: 'warning' }),
263
273
  'button-icon-color--disabled': whenProps({ $variant: 'icon' }),
264
274
  })};
@@ -268,13 +278,14 @@ const StyledButton = styled(BaseStyledButton)<{
268
278
  background: ${conditional({
269
279
  'button-primary-background--focus': whenProps({ $variant: 'primary' }),
270
280
  'button-secondary-background--focus': whenProps({
271
- $variant: ['secondary', 'tertiary'],
281
+ $variant: 'secondary',
272
282
  $scheme: 'light',
273
283
  }),
274
284
  'button-secondary-dark-background--focus': whenProps({
275
- $variant: ['secondary', 'tertiary'],
285
+ $variant: 'secondary',
276
286
  $scheme: 'dark',
277
287
  }),
288
+ 'button-tertiary-background--focus': whenProps({ $variant: 'tertiary' }),
278
289
  'button-warning-background--focus': whenProps({ $variant: 'warning' }),
279
290
  'button-icon-background--focus': whenProps({ $variant: 'icon' }),
280
291
  })};
@@ -285,30 +296,42 @@ const StyledButton = styled(BaseStyledButton)<{
285
296
  $scheme: 'light',
286
297
  }),
287
298
  'button-secondary-dark-border-color--focus': whenProps({
288
- $variant: ['secondary', 'tertiary'],
299
+ $variant: 'secondary',
289
300
  $scheme: 'dark',
290
301
  }),
302
+ 'button-tertiary-border-color--focus': whenProps({ $variant: 'tertiary' }),
291
303
  'button-warning-border-color--focus': whenProps({ $variant: 'warning' }),
292
304
  'button-icon-border-color--focus': whenProps({ $variant: 'icon' }),
293
- 'color-transparent': whenProps({ $variant: 'tertiary' }),
294
305
  })};
295
306
  color: ${conditional({
296
307
  'button-primary-color--focus': whenProps({ $variant: 'primary' }),
297
308
  'button-secondary-color--focus': whenProps({
298
- $variant: ['secondary', 'tertiary'],
309
+ $variant: 'secondary',
299
310
  $scheme: 'light',
300
311
  }),
301
312
  'button-secondary-dark-color--focus': whenProps({ $variant: 'secondary', $scheme: 'dark' }),
313
+ 'button-tertiary-color--focus': whenProps({ $variant: 'tertiary' }),
302
314
  'button-warning-color--focus': whenProps({ $variant: 'warning' }),
303
315
  'button-icon-color--focus': whenProps({ $variant: 'icon' }),
304
316
  })};
305
317
 
306
318
  box-shadow: ${conditional({
319
+ 'button-primary-box-shadow': whenProps({ $variant: 'primary' }),
320
+ 'button-secondary-box-shadow': whenProps({ $variant: 'secondary' }),
321
+ 'button-warning-box-shadow': whenProps({ $variant: 'warning' }),
322
+ 'button-tertiary-box-shadow': whenProps({ $variant: 'tertiary' }),
323
+ 'button-icon-box-shadow': whenProps({ $variant: 'icon' }),
324
+ })};
325
+
326
+ outline: ${conditional({
307
327
  'button-primary-outline': whenProps({ $variant: 'primary' }),
308
328
  'button-secondary-outline': whenProps({ $variant: 'secondary' }),
329
+ 'button-tertiary-outline': whenProps({ $variant: 'tertiary' }),
309
330
  'button-warning-outline': whenProps({ $variant: 'warning' }),
310
331
  'button-icon-outline': whenProps({ $variant: 'icon' }),
311
- })}
332
+ })};
333
+
334
+ outline-offset: ${token('button-outline-offset')};
312
335
  `}
313
336
 
314
337
  ${activatable`
@@ -127,7 +127,7 @@ const Selector = styled.input<SelectionStyleProps>`
127
127
  color: ${token('checkbox-selector-icon-color')};
128
128
  }
129
129
 
130
- box-shadow: ${token('checkbox-selector-outline')};
130
+ box-shadow: ${token('checkbox-selector-box-shadow')};
131
131
  `}
132
132
  `
133
133
 
@@ -10,7 +10,7 @@ const { Playground, WithSections, Extended } = composeStories(stories)
10
10
 
11
11
  describe('Dropdown', () => {
12
12
  describe('Generic', () => {
13
- const setup = (overrides?: stories.DropdownStoryProps) =>
13
+ const setup = (overrides?: Partial<stories.DropdownStoryProps>) =>
14
14
  renderer(<Playground {...overrides} />).render()
15
15
 
16
16
  it('starts collapsed', () => {
@@ -32,6 +32,7 @@ const StyledPopover = styled(Popover.Floating)`
32
32
  border: 1px solid ${token('dropdown-border-color')};
33
33
  border-radius: ${token('dropdown-border-radius')};
34
34
  box-shadow: ${token('dropdown-shadow')};
35
+ width: max-content;
35
36
  `
36
37
 
37
38
  const StyledSpan = styled.span`
@@ -154,6 +155,8 @@ const GenericDropdownMenuWrapper = styled.div`
154
155
  const DropdownMenuWrapper = styled(GenericDropdownMenuWrapper)`
155
156
  max-height: 240px;
156
157
  overflow-y: auto;
158
+ max-width: 100%;
159
+ width: 100%;
157
160
 
158
161
  ${DropdownItemWrapper} + ${DropdownItemWrapper},
159
162
  ${DropdownSectionHeader} + ${DropdownItemWrapper} {
@@ -64,6 +64,8 @@ const TriggerButton = styled(
64
64
 
65
65
  border: none;
66
66
 
67
+ height: ${token('dropdown-trigger-height')};
68
+
67
69
  text-transform: ${conditional({
68
70
  capitalize: whenProps({ outlined: false, variant: 'tertiary' }),
69
71
  uppercase: whenProps({ outlined: true }),
@@ -159,21 +161,15 @@ const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
159
161
  border-width: ${token('button-border-width')};
160
162
  border-style: solid;
161
163
  border-color: ${conditional({
162
- 'button-secondary-border-color': whenProps({ scheme: 'light', $outlined: true }),
163
- 'button-secondary-dark-border-color': whenProps({ scheme: 'dark', $outlined: true }),
164
- 'color-transparent': whenProps({ $outlined: false }),
164
+ 'dropdown-trigger-border-color': whenProps({ scheme: 'light', $outlined: true }),
165
+ 'dropdown-trigger-dark-border-color': whenProps({ scheme: 'dark', $outlined: true }),
166
+ 'dropdown-trigger-outlined-border-color': whenProps({ $outlined: false }),
165
167
  })};
166
168
 
167
169
  font-size: ${token('font-size-4')};
168
170
 
169
171
  color: ${token('color-neutral-darker')};
170
172
 
171
- height: ${conditional({
172
- 'dropdown-trigger-height': whenProps({ $scale: 'default' }),
173
- 'dropdown-trigger-small-height': whenProps({ $scale: 'small' }),
174
- 'dropdown-trigger-large-height': whenProps({ $scale: 'large' }),
175
- })};
176
-
177
173
  box-sizing: border-box;
178
174
 
179
175
  flex: 1;
@@ -210,7 +206,9 @@ const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
210
206
  'color-transparent': whenProps({ $outlined: false }),
211
207
  })};
212
208
 
213
- box-shadow: ${conditional({ 'shadow-glow-primary': whenProps({ $outlined: true }) })};
209
+ box-shadow: ${conditional({ 'dropdown-trigger-box-shadow': whenProps({ $outlined: true }) })};
210
+ outline: ${token('dropdown-trigger-outline')};
211
+ outline-offset: ${token('dropdown-trigger-outline-offset')};
214
212
  `}
215
213
 
216
214
  ${activatable`
@@ -231,7 +229,7 @@ const TriggerHandle = styled(BaseButton)`
231
229
  border-radius: 0 ${token('border-radius-s')} ${token('border-radius-s')} 0;
232
230
  border: none;
233
231
 
234
- height: calc(100% - 2px);
232
+ height: ${token('dropdown-trigger-height')};
235
233
  `
236
234
 
237
235
  const RotatableIcon = styled(DefaultIcon)<{ $rotate: boolean }>`
@@ -8,6 +8,7 @@ import font from 'styles/font'
8
8
  import transition from 'styles/transition'
9
9
  import ellipsizable from 'styles/ellipsizable'
10
10
  import hoverable from 'styles/hoverable'
11
+ import focusable from 'styles/focusable'
11
12
  import disableable from 'styles/disableable'
12
13
  import { getToken as token } from 'theming'
13
14
 
@@ -37,11 +38,19 @@ const StyledBaseAnchor = styled.a`
37
38
 
38
39
  min-height: 24px;
39
40
 
41
+ border-radius: ${token('border-radius-s')};
42
+
40
43
  ${hoverable`
41
44
  text-decoration: underline;
42
45
  font-weight: ${token('link-font-weight--hover')};
43
46
  `}
44
47
 
48
+ ${focusable`
49
+ box-shadow: ${token('link-box-shadow')};
50
+ outline: ${token('link-outline')};
51
+ outline-offset: ${token('link-outline-offset')};
52
+ `}
53
+
45
54
  ${disableable``}
46
55
 
47
56
  ${({ children }) =>
@@ -4,8 +4,7 @@ import { composeStories } from '@storybook/testing-react'
4
4
  import * as stories from './Popover.stories'
5
5
  import generator from '../../tests/generator'
6
6
  import renderer, { screen } from '../../tests/renderer'
7
-
8
- import type { PopoverProps } from './Popover'
7
+ import type { PopoverProps } from './Popover.types'
9
8
 
10
9
  const { Playground } = composeStories(stories)
11
10
 
@@ -1,7 +1,6 @@
1
- import React, { useMemo } from 'react'
2
- import { useFloating, autoUpdate } from '@floating-ui/react-dom'
3
- import { offset, flip, shift, arrow } from '@floating-ui/core'
4
- import type { Placement, MiddlewareState } from '@floating-ui/core'
1
+ import React, { CSSProperties, useMemo, useRef } from 'react'
2
+ import { useFloating, offset, flip, shift, arrow, autoUpdate } from '@floating-ui/react-dom'
3
+ import type { Placement } from '@floating-ui/react-dom'
5
4
 
6
5
  import type {
7
6
  PopoverAlign,
@@ -25,75 +24,50 @@ export function usePopover(): UsePopoverReturn {
25
24
  }
26
25
 
27
26
  function Popover(props: PopoverProps): JSX.Element {
28
- const arrowRef = React.useRef<HTMLElement | null>(null)
27
+ const arrowRef = useRef<HTMLElement | null>(null)
29
28
 
30
29
  const { position = 'bottom', align = 'start', strategy = 'fixed' } = props
31
30
 
32
- const desiredPlacement = `${position}${align === 'center' ? '' : `-${align}`}` as Placement
31
+ const desiredPlacement: Placement = `${position}${
32
+ align === 'center' ? '' : `-${align}`
33
+ }` as Placement
33
34
 
34
- const result = useFloating({
35
+ const floating = useFloating({
35
36
  placement: desiredPlacement,
36
37
  strategy,
37
- middleware: [
38
- offset(10),
39
- flip(),
40
- shift(),
41
- {
42
- name: 'arrow',
43
- fn(args: MiddlewareState) {
44
- if (arrowRef.current) {
45
- return arrow({ element: arrowRef.current, padding: 8 }).fn(args)
46
- }
47
-
48
- return {}
49
- },
50
- },
51
- ],
38
+ middleware: [offset(10), flip(), shift(), arrow({ element: arrowRef, padding: 8 })],
52
39
  // TODO: FloatingUI docs states that `autoUpdate` is expensive.
53
40
  // This should be properly investidated since it's the way to
54
41
  // update fixed positions after scrolling.
55
42
  whileElementsMounted: autoUpdate,
56
43
  })
57
44
 
58
- const registerArrow = React.useCallback(
59
- (node: HTMLElement) => {
60
- arrowRef.current = node
61
- result.update()
62
- },
63
- [result]
64
- )
65
-
66
- const [resultPosition = position, resultAlign = align] = result.placement.split('-') as [
45
+ const [resultPosition = position, resultAlign = align] = floating.placement.split('-') as [
67
46
  PopoverPosition,
68
47
  PopoverAlign
69
48
  ]
70
49
 
71
- const value = useMemo(
50
+ const value = useMemo<UsePopoverReturn>(
72
51
  () => ({
73
52
  strategy,
74
53
  register: {
75
- reference: result.refs.setReference,
76
- floating: result.refs.setFloating,
77
- arrow: registerArrow,
54
+ setReference: floating.refs.setReference,
55
+ setFloating: floating.refs.setFloating,
56
+ setArrow: arrowRef,
78
57
  },
79
58
  result: {
80
- floating: {
81
- top: result.y ?? 0,
82
- left: result.x ?? 0,
83
- },
84
- arrow: { top: result.middlewareData.arrow?.y, left: result.middlewareData.arrow?.x },
59
+ floatingStyles: floating.floatingStyles,
60
+ arrow: { top: floating.middlewareData.arrow?.y, left: floating.middlewareData.arrow?.x },
85
61
  position: resultPosition,
86
62
  align: resultAlign,
87
63
  },
88
64
  }),
89
65
  [
90
- registerArrow,
91
- result.refs.setFloating,
92
- result.middlewareData.arrow?.x,
93
- result.middlewareData.arrow?.y,
94
- result.refs.setReference,
95
- result.x,
96
- result.y,
66
+ floating.refs.setFloating,
67
+ floating.middlewareData.arrow?.x,
68
+ floating.middlewareData.arrow?.y,
69
+ floating.refs.setReference,
70
+ floating.floatingStyles,
97
71
  resultAlign,
98
72
  resultPosition,
99
73
  strategy,
@@ -104,41 +78,24 @@ function Popover(props: PopoverProps): JSX.Element {
104
78
  }
105
79
 
106
80
  function PopoverReference({ children, ...others }: PopoverReferenceProps): JSX.Element {
107
- const ref = React.useRef<HTMLDivElement | null>(null)
108
81
  const { register } = usePopover()
109
82
 
110
- React.useLayoutEffect(() => {
111
- if (ref.current) {
112
- register.reference(ref.current)
113
- }
114
- }, [register])
115
-
116
83
  return (
117
- <div ref={ref} {...others}>
84
+ <div ref={register.setReference} {...others}>
118
85
  {children}
119
86
  </div>
120
87
  )
121
88
  }
122
89
 
123
90
  function PopoverFloating({ children, style, ...others }: PopoverFloatingProps): JSX.Element {
124
- const { register, result, strategy } = usePopover()
125
-
126
- const ref = React.useRef<HTMLDivElement | null>(null)
127
-
128
- React.useLayoutEffect(() => {
129
- if (ref.current) {
130
- register.floating(ref.current)
131
- }
132
- }, [register])
91
+ const { register, result } = usePopover()
133
92
 
134
93
  return (
135
94
  <div
136
- ref={ref}
95
+ ref={register.setFloating}
137
96
  {...others}
138
97
  style={{
139
- position: strategy,
140
- top: result.floating.top,
141
- left: result.floating.left,
98
+ ...result.floatingStyles,
142
99
  ...style,
143
100
  }}
144
101
  >
@@ -1,16 +1,14 @@
1
- import type { HTMLAttributes, MutableRefObject, PropsWithChildren } from 'react'
1
+ import type { UseFloatingReturn } from '@floating-ui/react-dom'
2
+ import type { CSSProperties, HTMLAttributes, MutableRefObject, PropsWithChildren } from 'react'
2
3
 
3
4
  export interface UsePopoverReturn {
4
5
  register: {
5
- reference: (el: HTMLElement) => void
6
- floating: (el: HTMLElement) => void
7
- arrow: (el: HTMLElement) => void
6
+ setReference: UseFloatingReturn['refs']['setReference']
7
+ setFloating: UseFloatingReturn['refs']['setFloating']
8
+ setArrow: MutableRefObject<Element | null>
8
9
  }
9
10
  result: {
10
- floating: {
11
- top: number
12
- left: number
13
- }
11
+ floatingStyles: CSSProperties
14
12
  arrow: {
15
13
  top: number | undefined
16
14
  left: number | undefined
@@ -112,7 +112,7 @@ const Selector = styled.input<SelectionStyleProps>`
112
112
  'radio-dark-selector-border-color--focus': whenProps({ scheme: 'dark' }),
113
113
  })};
114
114
 
115
- box-shadow: ${token('radio-selector-outline')};
115
+ box-shadow: ${token('radio-selector-box-shadow')};
116
116
  `}
117
117
  `
118
118
 
@@ -24,7 +24,7 @@ const SelectTriggerSearchField = styled(TextField)`
24
24
  border: none;
25
25
  border-radius: ${token('border-radius-s')} 0 0 ${token('border-radius-s')};
26
26
 
27
- height: 100%;
27
+ height: ${token('select-trigger-height')};
28
28
 
29
29
  flex: 1;
30
30
 
@@ -49,16 +49,9 @@ const SelectTrigger = forwardRef<HTMLInputElement, SelectTriggerProps>(function
49
49
  ) {
50
50
  const { className, ...others } = props
51
51
  const { disabled, expanded, toggle } = useContext(DropdownContext)
52
- const triggerRef = React.useRef<HTMLElement | null>(null)
53
52
 
54
53
  const { register } = usePopover()
55
54
 
56
- React.useEffect(() => {
57
- if (triggerRef.current) {
58
- register.reference(triggerRef.current)
59
- }
60
- }, [register])
61
-
62
55
  function handleClick() {
63
56
  if (!expanded) {
64
57
  toggle()
@@ -75,7 +68,7 @@ const SelectTrigger = forwardRef<HTMLInputElement, SelectTriggerProps>(function
75
68
  ref(node)
76
69
  }
77
70
 
78
- triggerRef.current = node
71
+ register.setReference(node)
79
72
  }}
80
73
  type="search"
81
74
  disabled={disabled}
@@ -64,7 +64,9 @@ const SwitchWrapper = styled.label<WithAdditionalProps>`
64
64
  `}
65
65
 
66
66
  ${focusable`
67
- box-shadow: ${token('switch-outline')}
67
+ box-shadow: ${token('switch-box-shadow')};
68
+ outline: ${token('switch-outline')};
69
+ outline-offset: ${token('switch-outline-offset')};
68
70
  `}
69
71
 
70
72
  ${disableable``}
@@ -80,9 +80,14 @@ const StyledSpan = styled.span<TagProps>`
80
80
  })};
81
81
 
82
82
  padding: ${conditional({
83
- 'tag-spacing': whenProps({ removable: (removable) => !removable }),
84
- 'tag-spacing-removable': whenProps([{ size: (size) => size !== 'small', removable: true }]),
85
- 'tag-small-spacing-removable': whenProps([{ size: 'small', removable: true }]),
83
+ 'tag-small-spacing': whenProps({ size: 'small', removable: (removable) => !removable }),
84
+ 'tag-spacing': whenProps({
85
+ size: (size) => !['small', 'large'].includes(size ?? ''),
86
+ removable: (removable) => !removable,
87
+ }),
88
+ 'tag-large-spacing': whenProps({ size: 'large', removable: (removable) => !removable }),
89
+ 'tag-removable-spacing': whenProps([{ size: (size) => size !== 'small', removable: true }]),
90
+ 'tag-small-removable-spacing': whenProps([{ size: 'small', removable: true }]),
86
91
  })};
87
92
 
88
93
  min-width: ${token('tag-width')};
@@ -92,6 +97,12 @@ const StyledSpan = styled.span<TagProps>`
92
97
  'tag-large-height': whenProps({ size: 'large' }),
93
98
  })};
94
99
 
100
+ font-weight: ${conditional({
101
+ 'tag-font-weight': whenProps({ size: 'default' }),
102
+ 'tag-small-font-weight': whenProps({ size: 'small' }),
103
+ 'tag-large-font-weight': whenProps({ size: 'large' }),
104
+ })};
105
+
95
106
  color: ${conditional({
96
107
  'tag-default-color': whenProps({ variant: 'default' }),
97
108
  'tag-outlined-color': whenProps({ variant: 'outlined' }),
@@ -223,7 +234,16 @@ const StyledSpan = styled.span<TagProps>`
223
234
  'tag-warning-background--focus': whenProps({ variant: 'warning' }),
224
235
  'tag-danger-background--focus': whenProps({ variant: 'danger' }),
225
236
  })};
226
- box-shadow: ${token('tag-outline')};
237
+ box-shadow: ${token('tag-box-shadow')};
238
+ outline: ${conditional({
239
+ 'tag-default-outline': whenProps({ variant: 'default' }),
240
+ 'tag-outlined-outline': whenProps({ variant: 'outlined' }),
241
+ 'tag-accent-outline': whenProps({ variant: 'accent' }),
242
+ 'tag-success-outline': whenProps({ variant: 'success' }),
243
+ 'tag-warning-outline': whenProps({ variant: 'warning' }),
244
+ 'tag-danger-outline': whenProps({ variant: 'danger' }),
245
+ })};
246
+ outline-offset: ${token('tag-outline-offset')};
227
247
  `}
228
248
 
229
249
  ${disableable`
@@ -96,9 +96,12 @@ const InputWrapper = styled.div<WithAdditionalProps>`
96
96
  })};
97
97
 
98
98
  box-shadow: ${conditional({
99
- 'text-field-outline': whenProps({ scheme: 'light' }),
100
- 'text-field-dark-outline': whenProps({ scheme: 'dark' }),
99
+ 'text-field-box-shadow': whenProps({ scheme: 'light' }),
100
+ 'text-field-dark-box-shadow': whenProps({ scheme: 'dark' }),
101
101
  })};
102
+
103
+ outline: ${token('text-field-outline')};
104
+ outline-offset: ${token('text-field-outline-offset')};
102
105
  `}
103
106
 
104
107
  ${disableable()}
@@ -93,9 +93,12 @@ const TextareaWrapper = styled.div<WithAdditionalProps>`
93
93
  })};
94
94
 
95
95
  box-shadow: ${conditional({
96
- 'textarea-outline': whenProps({ scheme: 'light' }),
97
- 'textarea-dark-outline': whenProps({ scheme: 'dark' }),
96
+ 'textarea-box-shadow': whenProps({ scheme: 'light' }),
97
+ 'textarea-dark-box-shadow': whenProps({ scheme: 'dark' }),
98
98
  })};
99
+
100
+ outline: ${token('textarea-outline')};
101
+ outline-offset: ${token('textarea-outline-offset')};
99
102
  `}
100
103
 
101
104
  ${disableable()}
@@ -68,7 +68,9 @@ const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
68
68
  'toggle-checked-color--focus': whenProps({ 'aria-checked': true }),
69
69
  })};
70
70
 
71
- box-shadow: ${token('button-primary-outline')};
71
+ box-shadow: ${token('toggle-box-shadow')};
72
+ outline: ${token('toggle-outline')};
73
+ outline-offset: ${token('toggle-outline-offset')};
72
74
  `}
73
75
 
74
76
  ${activatable`