@infonomic/uikit 5.43.1 → 6.0.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.
- package/README.md +1 -1
- package/dist/components/accordion/accordion.d.ts +9 -9
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/accordion/accordion.module.css +6 -5
- package/dist/components/accordion/accordion_module.css +4 -4
- package/dist/components/avatar/avatar.js +2 -2
- package/dist/components/badge/badge.d.ts +5 -13
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +12 -9
- package/dist/components/button/button-group.d.ts +9 -7
- package/dist/components/button/button-group.d.ts.map +1 -1
- package/dist/components/button/button-group.js +26 -36
- package/dist/components/button/button.d.ts +6 -13
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +19 -18
- package/dist/components/button/button.module.css +32 -54
- package/dist/components/button/button_module.css +7 -10
- package/dist/components/button/combo-button.d.ts +1 -1
- package/dist/components/button/combo-button.d.ts.map +1 -1
- package/dist/components/button/combo-button.js +13 -9
- package/dist/components/button/combo-button.module.css +16 -7
- package/dist/components/button/combo-button_module.css +22 -4
- package/dist/components/button/icon-button.d.ts +2 -3
- package/dist/components/button/icon-button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +5 -12
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +13 -9
- package/dist/components/chips/chip.d.ts +5 -11
- package/dist/components/chips/chip.d.ts.map +1 -1
- package/dist/components/chips/chip.js +36 -28
- package/dist/components/chips/chip.module.css +22 -36
- package/dist/components/chips/chip_module.css +3 -6
- package/dist/components/dropdown/dropdown.d.ts +28 -14
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +34 -20
- package/dist/components/forms/calendar.d.ts +1 -1
- package/dist/components/forms/calendar.d.ts.map +1 -1
- package/dist/components/forms/calendar.js +38 -29
- package/dist/components/forms/checkbox.astro +13 -8
- package/dist/components/forms/checkbox.d.ts +6 -2
- package/dist/components/forms/checkbox.d.ts.map +1 -1
- package/dist/components/forms/checkbox.js +11 -7
- package/dist/components/forms/checkbox.module.css +20 -20
- package/dist/components/forms/checkbox_module.css +13 -10
- package/dist/components/forms/input.module.css +10 -11
- package/dist/components/forms/input_module.css +3 -5
- package/dist/components/forms/radio-group.d.ts +6 -5
- package/dist/components/forms/radio-group.d.ts.map +1 -1
- package/dist/components/forms/radio-group.js +9 -4
- package/dist/components/forms/radio-group.module.css +13 -22
- package/dist/components/forms/radio-group_module.css +6 -24
- package/dist/components/forms/select.d.ts +4 -5
- package/dist/components/forms/select.d.ts.map +1 -1
- package/dist/components/forms/select.js +27 -29
- package/dist/components/forms/select.module.css +22 -22
- package/dist/components/forms/select.module.js +15 -15
- package/dist/components/forms/select_module.css +15 -15
- package/dist/components/hamburger/hamburger.astro +23 -15
- package/dist/components/hamburger/hamburger.d.ts +8 -6
- package/dist/components/hamburger/hamburger.d.ts.map +1 -1
- package/dist/components/hamburger/hamburger.js +18 -22
- package/dist/components/hamburger/hamburger.module.css +142 -0
- package/dist/components/hamburger/hamburger.module.js +10 -0
- package/dist/components/hamburger/hamburger_module.css +169 -0
- package/dist/components/notifications/@types/toast.d.ts +9 -7
- package/dist/components/notifications/@types/toast.d.ts.map +1 -1
- package/dist/components/notifications/toast.d.ts +12 -16
- package/dist/components/notifications/toast.d.ts.map +1 -1
- package/dist/components/notifications/toast.js +73 -57
- package/dist/components/notifications/toast.module.css +151 -177
- package/dist/components/notifications/toast.module.js +8 -12
- package/dist/components/notifications/toast_module.css +114 -159
- package/dist/components/pager/first-button.d.ts +2 -2
- package/dist/components/pager/first-button.d.ts.map +1 -1
- package/dist/components/pager/first-button.js +23 -16
- package/dist/components/pager/last-button.d.ts +2 -2
- package/dist/components/pager/last-button.d.ts.map +1 -1
- package/dist/components/pager/last-button.js +23 -16
- package/dist/components/pager/next-button.d.ts +2 -2
- package/dist/components/pager/next-button.d.ts.map +1 -1
- package/dist/components/pager/next-button.js +27 -20
- package/dist/components/pager/number-button.d.ts +2 -2
- package/dist/components/pager/number-button.d.ts.map +1 -1
- package/dist/components/pager/number-button.js +28 -23
- package/dist/components/pager/pagination.d.ts +8 -13
- package/dist/components/pager/pagination.d.ts.map +1 -1
- package/dist/components/pager/previous-button.d.ts +2 -2
- package/dist/components/pager/previous-button.d.ts.map +1 -1
- package/dist/components/pager/previous-button.js +25 -18
- package/dist/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +4 -2
- package/dist/components/tabs/tabs.d.ts +13 -13
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +8 -8
- package/dist/components/tabs/tabs.module.css +8 -17
- package/dist/components/tabs/tabs_module.css +2 -6
- package/dist/components/tooltip/tooltip.d.ts +6 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +49 -20
- package/dist/components/tooltip/tooltip.module.css +43 -10
- package/dist/components/tooltip/tooltip.module.js +7 -1
- package/dist/components/tooltip/tooltip_module.css +36 -4
- package/dist/hooks/use-focus-trap/index.d.ts +2 -0
- package/dist/hooks/use-focus-trap/index.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/index.js +1 -0
- package/dist/hooks/use-focus-trap/scope-tab.d.ts +11 -0
- package/dist/hooks/use-focus-trap/scope-tab.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/scope-tab.js +19 -0
- package/dist/hooks/use-focus-trap/tabbable.d.ts +14 -0
- package/dist/hooks/use-focus-trap/tabbable.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/tabbable.js +36 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts +11 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.js +45 -0
- package/dist/icons/chevron-up-icon.d.ts +7 -0
- package/dist/icons/chevron-up-icon.d.ts.map +1 -0
- package/dist/icons/chevron-up-icon.js +27 -0
- package/dist/lib/ripple.d.ts +25 -0
- package/dist/lib/ripple.d.ts.map +1 -0
- package/dist/lib/ripple.js +53 -0
- package/dist/loaders/@types/index.d.ts.map +1 -0
- package/dist/loaders/ellipses.d.ts +1 -1
- package/dist/loaders/ellipses.d.ts.map +1 -1
- package/dist/loaders/ring.d.ts +1 -1
- package/dist/loaders/ring.d.ts.map +1 -1
- package/dist/loaders/spinner.d.ts +1 -1
- package/dist/loaders/spinner.d.ts.map +1 -1
- package/dist/styles/components-vanilla.css +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/widgets/datepicker/datepicker.d.ts +1 -1
- package/dist/widgets/datepicker/datepicker.d.ts.map +1 -1
- package/dist/widgets/datepicker/datepicker.js +118 -116
- package/dist/widgets/datepicker/datepicker.module.css +6 -5
- package/dist/widgets/datepicker/datepicker_module.css +4 -4
- package/dist/widgets/drawer/drawer-wrapper.d.ts.map +1 -1
- package/dist/widgets/drawer/drawer-wrapper.js +1 -1
- package/dist/widgets/modal/modal-wrapper.d.ts.map +1 -1
- package/dist/widgets/modal/modal-wrapper.js +1 -1
- package/package.json +21 -29
- package/src/astro.d.ts +2 -2
- package/src/components/accordion/accordion.module.css +6 -5
- package/src/components/accordion/accordion.stories.tsx +10 -13
- package/src/components/accordion/accordion.tsx +13 -13
- package/src/components/avatar/avatar.tsx +2 -2
- package/src/components/badge/badge.tsx +20 -29
- package/src/components/button/button-group.tsx +60 -44
- package/src/components/button/button.module.css +32 -54
- package/src/components/button/button.tsx +35 -47
- package/src/components/button/combo-button.module.css +16 -7
- package/src/components/button/combo-button.tsx +17 -9
- package/src/components/button/icon-button.tsx +3 -5
- package/src/components/card/card.tsx +20 -32
- package/src/components/chips/chip.module.css +22 -36
- package/src/components/chips/chip.stories.tsx +2 -2
- package/src/components/chips/chip.tsx +59 -57
- package/src/components/dropdown/dropdown.stories.tsx +2 -4
- package/src/components/dropdown/dropdown.tsx +86 -40
- package/src/components/forms/calendar.tsx +43 -33
- package/src/components/forms/checkbox-group.tsx +1 -1
- package/src/components/forms/checkbox.astro +13 -8
- package/src/components/forms/checkbox.module.css +20 -20
- package/src/components/forms/checkbox.tsx +11 -6
- package/src/components/forms/input.module.css +10 -11
- package/src/components/forms/radio-group.module.css +13 -22
- package/src/components/forms/radio-group.tsx +13 -11
- package/src/components/forms/select.module.css +22 -22
- package/src/components/forms/select.tsx +36 -33
- package/src/components/hamburger/hamburger.astro +23 -15
- package/src/components/hamburger/hamburger.module.css +142 -0
- package/src/components/hamburger/hamburger.stories.tsx +35 -0
- package/src/components/hamburger/hamburger.tsx +37 -29
- package/src/components/notifications/@types/toast.ts +9 -7
- package/src/components/notifications/toast.module.css +151 -177
- package/src/components/notifications/toast.stories.tsx +21 -23
- package/src/components/notifications/toast.tsx +90 -86
- package/src/components/pager/first-button.tsx +24 -26
- package/src/components/pager/last-button.tsx +24 -25
- package/src/components/pager/next-button.tsx +24 -23
- package/src/components/pager/number-button.tsx +37 -36
- package/src/components/pager/pagination.tsx +4 -11
- package/src/components/pager/previous-button.tsx +24 -24
- package/src/components/scroll-area/scroll-area.tsx +3 -3
- package/src/components/tabs/tabs.module.css +8 -17
- package/src/components/tabs/tabs.stories.tsx +5 -5
- package/src/components/tabs/tabs.tsx +17 -16
- package/src/components/tooltip/tooltip.module.css +43 -10
- package/src/components/tooltip/tooltip.stories.tsx +4 -4
- package/src/components/tooltip/tooltip.tsx +56 -28
- package/src/hooks/use-focus-trap/index.ts +1 -0
- package/src/hooks/use-focus-trap/scope-tab.ts +48 -0
- package/src/hooks/use-focus-trap/tabbable.ts +72 -0
- package/src/hooks/use-focus-trap/use-focus-trap.ts +83 -0
- package/src/icons/chevron-up-icon.tsx +37 -0
- package/src/lib/ripple.ts +95 -0
- package/src/loaders/ellipses.tsx +1 -1
- package/src/loaders/ring.tsx +1 -1
- package/src/loaders/spinner.tsx +1 -1
- package/src/styles/components/hamburger.css +8 -6
- package/src/styles/functional/colors.css +97 -202
- package/src/styles/theme/theme.css +1 -1
- package/src/widgets/datepicker/datepicker.module.css +6 -5
- package/src/widgets/datepicker/datepicker.tsx +137 -135
- package/src/widgets/drawer/drawer-wrapper.tsx +1 -1
- package/src/widgets/modal/modal-wrapper.tsx +1 -1
- package/dist/loaders/types/index.d.ts.map +0 -1
- /package/dist/loaders/{types → @types}/index.d.ts +0 -0
- /package/dist/loaders/{types → @types}/index.js +0 -0
- /package/src/loaders/{types → @types}/index.ts +0 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import type React from 'react'
|
|
4
4
|
|
|
5
|
+
import { Radio } from '@base-ui/react/radio'
|
|
6
|
+
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'
|
|
5
7
|
import cx from 'classnames'
|
|
6
|
-
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui'
|
|
7
8
|
|
|
8
9
|
import styles from './radio-group.module.css'
|
|
9
10
|
import type { Intent } from '../@types/shared'
|
|
@@ -22,24 +23,26 @@ export const RadioGroupItem = ({
|
|
|
22
23
|
label,
|
|
23
24
|
ref: forwardedRef,
|
|
24
25
|
...props
|
|
25
|
-
}:
|
|
26
|
+
}: Omit<React.ComponentProps<typeof Radio.Root>, 'value'> & {
|
|
26
27
|
intent?: Intent
|
|
27
28
|
className?: string
|
|
28
29
|
id: string
|
|
29
30
|
value: string
|
|
30
31
|
label: string
|
|
31
|
-
ref?: React.RefObject<
|
|
32
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
32
33
|
}) => {
|
|
33
34
|
return (
|
|
34
35
|
<div ref={forwardedRef} className={styles['item-container']}>
|
|
35
|
-
<
|
|
36
|
+
<Radio.Root
|
|
36
37
|
{...props}
|
|
37
38
|
className={cx(styles.item, styles[intent])}
|
|
38
39
|
value={value}
|
|
39
40
|
id={id}
|
|
41
|
+
nativeButton
|
|
42
|
+
render={<button type="button" />}
|
|
40
43
|
>
|
|
41
|
-
<
|
|
42
|
-
</
|
|
44
|
+
<Radio.Indicator className={styles.indicator} />
|
|
45
|
+
</Radio.Root>
|
|
43
46
|
<label className={styles.label} htmlFor={id}>
|
|
44
47
|
{label}
|
|
45
48
|
</label>
|
|
@@ -53,18 +56,17 @@ export const RadioGroup = ({
|
|
|
53
56
|
direction = 'column',
|
|
54
57
|
children,
|
|
55
58
|
...props
|
|
56
|
-
}:
|
|
59
|
+
}: React.ComponentProps<typeof RadioGroupPrimitive> & {
|
|
57
60
|
direction?: 'row' | 'column'
|
|
58
61
|
className?: string
|
|
59
62
|
children: React.ReactNode
|
|
60
|
-
ref?: React.RefObject<
|
|
63
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
61
64
|
}) => (
|
|
62
|
-
<RadioGroupPrimitive
|
|
65
|
+
<RadioGroupPrimitive
|
|
63
66
|
ref={forwardedRef}
|
|
64
67
|
className={cx('infonomic-radio-group', styles[direction], className)}
|
|
65
|
-
// aria-label="View density"
|
|
66
68
|
{...props}
|
|
67
69
|
>
|
|
68
70
|
{children}
|
|
69
|
-
</RadioGroupPrimitive
|
|
71
|
+
</RadioGroupPrimitive>
|
|
70
72
|
)
|
|
@@ -7,13 +7,13 @@ infonomic-components;
|
|
|
7
7
|
|
|
8
8
|
@layer infonomic-components {
|
|
9
9
|
|
|
10
|
-
.
|
|
11
|
-
:global(.infonomic-select-
|
|
10
|
+
.positioner,
|
|
11
|
+
:global(.infonomic-select-positioner) {
|
|
12
12
|
z-index: 50;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.
|
|
16
|
-
:global(.infonomic-select-
|
|
15
|
+
.popup,
|
|
16
|
+
:global(.infonomic-select-popup) {
|
|
17
17
|
z-index: 50;
|
|
18
18
|
margin-top: 2px;
|
|
19
19
|
border: 1px solid var(--surface-panel-border);
|
|
@@ -23,33 +23,33 @@ infonomic-components;
|
|
|
23
23
|
padding: 6px;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.popup-xs {
|
|
27
27
|
padding: 4px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.popup-sm {
|
|
31
31
|
padding: 4px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.popup-md {
|
|
35
35
|
padding: 6px;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.popup-lg {
|
|
39
39
|
padding: 6px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.popup-xl {
|
|
43
43
|
padding: 8px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
47
|
-
:global(.infonomic-select-
|
|
46
|
+
.list,
|
|
47
|
+
:global(.infonomic-select-list) {
|
|
48
48
|
z-index: 50;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.scroll-
|
|
52
|
-
:global(.infonomic-select-scroll-
|
|
51
|
+
.scroll-arrow,
|
|
52
|
+
:global(.infonomic-select-scroll-arrow) {
|
|
53
53
|
display: flex;
|
|
54
54
|
align-items: center;
|
|
55
55
|
justify-content: center;
|
|
@@ -101,7 +101,7 @@ infonomic-components;
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/* size variants — treat current values as 'md' */
|
|
104
|
-
.
|
|
104
|
+
.popup-xs .select-item {
|
|
105
105
|
font-size: 0.75rem;
|
|
106
106
|
height: 24px;
|
|
107
107
|
padding-right: 28px;
|
|
@@ -109,11 +109,11 @@ infonomic-components;
|
|
|
109
109
|
border-radius: 4px;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
.
|
|
112
|
+
.popup-xs .select-item-indicator {
|
|
113
113
|
width: 20px;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
.popup-sm .select-item {
|
|
117
117
|
font-size: 0.875rem;
|
|
118
118
|
height: 28px;
|
|
119
119
|
padding-right: 30px;
|
|
@@ -121,13 +121,13 @@ infonomic-components;
|
|
|
121
121
|
border-radius: 5px;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.
|
|
124
|
+
.popup-sm .select-item-indicator {
|
|
125
125
|
width: 22px;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
/* .
|
|
128
|
+
/* .popup-md — inherits base .select-item values */
|
|
129
129
|
|
|
130
|
-
.
|
|
130
|
+
.popup-lg .select-item {
|
|
131
131
|
font-size: 1.125rem;
|
|
132
132
|
height: 34px;
|
|
133
133
|
padding-right: 32px;
|
|
@@ -135,11 +135,11 @@ infonomic-components;
|
|
|
135
135
|
border-radius: 6px;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.
|
|
138
|
+
.popup-lg .select-item-indicator {
|
|
139
139
|
width: 24px;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
.
|
|
142
|
+
.popup-xl .select-item {
|
|
143
143
|
font-size: 1.25rem;
|
|
144
144
|
height: 40px;
|
|
145
145
|
padding-right: 36px;
|
|
@@ -147,7 +147,7 @@ infonomic-components;
|
|
|
147
147
|
border-radius: 8px;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.
|
|
150
|
+
.popup-xl .select-item-indicator {
|
|
151
151
|
width: 28px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type React from 'react'
|
|
4
|
-
import type { ComponentPropsWithoutRef } from 'react'
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { Select as SelectPrimitive } from '@base-ui/react/select'
|
|
7
6
|
import cx from 'classnames'
|
|
8
|
-
import { Select as SelectPrimitive } from 'radix-ui'
|
|
9
7
|
|
|
8
|
+
import { CheckIcon } from '../../icons/check-icon.js'
|
|
9
|
+
import { ChevronDownIcon } from '../../icons/chevron-down-icon.js'
|
|
10
|
+
import { ChevronUpIcon } from '../../icons/chevron-up-icon.js'
|
|
10
11
|
import { Button } from '../button/button.js'
|
|
11
12
|
import { HelpText } from './help-text.js'
|
|
12
13
|
import styles from './select.module.css'
|
|
@@ -20,7 +21,7 @@ export interface SelectValue {
|
|
|
20
21
|
suffix?: string
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
type SelectProps =
|
|
24
|
+
type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> & {
|
|
24
25
|
id?: string
|
|
25
26
|
intent?: Intent
|
|
26
27
|
variant?: Variant
|
|
@@ -52,38 +53,40 @@ export function Select({
|
|
|
52
53
|
return (
|
|
53
54
|
<div className={cx('infonomic-select-container', containerClassName)}>
|
|
54
55
|
<SelectPrimitive.Root {...rest}>
|
|
55
|
-
<SelectPrimitive.Trigger
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
<SelectPrimitive.Trigger
|
|
57
|
+
aria-label={ariaLabel ?? 'Select'}
|
|
58
|
+
render={
|
|
59
|
+
<Button
|
|
60
|
+
id={id}
|
|
61
|
+
intent={intent}
|
|
62
|
+
variant={variant}
|
|
63
|
+
size={size}
|
|
64
|
+
className={cx('whitespace-nowrap', className)}
|
|
65
|
+
/>
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
<SelectPrimitive.Value placeholder={placeholder} />
|
|
69
|
+
<SelectPrimitive.Icon>
|
|
70
|
+
<ChevronDownIcon />
|
|
71
|
+
</SelectPrimitive.Icon>
|
|
68
72
|
</SelectPrimitive.Trigger>
|
|
69
73
|
<SelectPrimitive.Portal>
|
|
70
|
-
<SelectPrimitive.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
ref={(ref) => {
|
|
74
|
-
if (ref == null) return
|
|
75
|
-
}}
|
|
74
|
+
<SelectPrimitive.Positioner
|
|
75
|
+
className={styles.positioner}
|
|
76
|
+
alignItemWithTrigger={position !== 'popper'}
|
|
76
77
|
>
|
|
77
|
-
<SelectPrimitive.
|
|
78
|
+
<SelectPrimitive.ScrollUpArrow className={styles['scroll-arrow']}>
|
|
78
79
|
<ChevronUpIcon />
|
|
79
|
-
</SelectPrimitive.
|
|
80
|
-
<SelectPrimitive.
|
|
81
|
-
<SelectPrimitive.
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
</SelectPrimitive.ScrollUpArrow>
|
|
81
|
+
<SelectPrimitive.Popup className={cx(styles.popup, size != null && styles[`popup-${size}`])}>
|
|
82
|
+
<SelectPrimitive.List className={styles.list}>
|
|
83
|
+
{children}
|
|
84
|
+
</SelectPrimitive.List>
|
|
85
|
+
</SelectPrimitive.Popup>
|
|
86
|
+
<SelectPrimitive.ScrollDownArrow className={styles['scroll-arrow']}>
|
|
84
87
|
<ChevronDownIcon />
|
|
85
|
-
</SelectPrimitive.
|
|
86
|
-
</SelectPrimitive.
|
|
88
|
+
</SelectPrimitive.ScrollDownArrow>
|
|
89
|
+
</SelectPrimitive.Positioner>
|
|
87
90
|
</SelectPrimitive.Portal>
|
|
88
91
|
</SelectPrimitive.Root>
|
|
89
92
|
{helpText != null && helpText?.length > 0 && <HelpText text={helpText} />}
|
|
@@ -96,8 +99,8 @@ export const SelectItem = ({
|
|
|
96
99
|
children,
|
|
97
100
|
className,
|
|
98
101
|
...props
|
|
99
|
-
}: SelectPrimitive.
|
|
100
|
-
ref?: React.RefObject<
|
|
102
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item> & {
|
|
103
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
101
104
|
}) => {
|
|
102
105
|
return (
|
|
103
106
|
<SelectPrimitive.Item
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
//
|
|
2
|
+
// NOTE: In Astro, open/closed state is managed externally
|
|
3
|
+
// (e.g. via nanostores). Toggle the 'infonomic-hamburger-open'
|
|
4
|
+
// class on the button and update aria-expanded from client JS.
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
// Instead we set open / closed state via nanostores.
|
|
6
|
-
// and then apply global classes according.
|
|
7
|
-
// Class overrides for inner span colors are set in
|
|
8
|
-
// Astro app.css
|
|
9
|
-
|
|
10
|
-
interface HamburgerProps {
|
|
6
|
+
interface Props {
|
|
11
7
|
class?: string
|
|
8
|
+
colorScheme?: 'auto' | 'onDark' | 'onLight'
|
|
12
9
|
ariaLabel?: string
|
|
13
10
|
ariaControls?: string
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
import styles from './hamburger.module.css'
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
class: className,
|
|
17
|
+
colorScheme = 'auto',
|
|
18
|
+
ariaLabel = 'Toggle menu',
|
|
19
|
+
ariaControls,
|
|
20
|
+
...rest
|
|
21
|
+
} = Astro.props as Props
|
|
22
|
+
|
|
23
|
+
const colorSchemeClass =
|
|
24
|
+
colorScheme === 'onDark' ? styles.onDark : colorScheme === 'onLight' ? styles.onLight : undefined
|
|
17
25
|
---
|
|
18
26
|
|
|
19
27
|
<button
|
|
20
|
-
|
|
21
|
-
class:list={['
|
|
22
|
-
tabindex="0"
|
|
28
|
+
type="button"
|
|
29
|
+
class:list={['infonomic-hamburger', styles.hamburger, colorSchemeClass, className]}
|
|
23
30
|
aria-label={ariaLabel}
|
|
24
31
|
aria-controls={ariaControls}
|
|
25
|
-
aria-
|
|
32
|
+
aria-expanded="false"
|
|
33
|
+
{...rest}
|
|
26
34
|
>
|
|
27
|
-
<span class=
|
|
28
|
-
<span class=
|
|
35
|
+
<span class:list={['infonomic-hamburger-box', styles.box]} aria-hidden="true">
|
|
36
|
+
<span class:list={['infonomic-hamburger-inner', styles.inner]}></span>
|
|
29
37
|
</span>
|
|
30
38
|
</button>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@layer infonomic-base,
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
|
+
|
|
8
|
+
@layer infonomic-components {
|
|
9
|
+
|
|
10
|
+
.hamburger,
|
|
11
|
+
:global(.infonomic-hamburger) {
|
|
12
|
+
--hamburger-color: currentColor;
|
|
13
|
+
--hamburger-focus-ring-color: currentColor;
|
|
14
|
+
|
|
15
|
+
display: flex;
|
|
16
|
+
position: relative;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
z-index: 200;
|
|
20
|
+
width: 42px;
|
|
21
|
+
height: 34px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition-property: opacity, filter;
|
|
25
|
+
transition-duration: 0.15s;
|
|
26
|
+
transition-timing-function: ease;
|
|
27
|
+
font: inherit;
|
|
28
|
+
color: inherit;
|
|
29
|
+
text-transform: none;
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
border: 0;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
border-radius: var(--border-radius-sm);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.hamburger:focus-visible,
|
|
38
|
+
:global(.infonomic-hamburger):focus-visible {
|
|
39
|
+
outline: 2px solid var(--hamburger-focus-ring-color);
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Box container for the bars */
|
|
44
|
+
.box,
|
|
45
|
+
:global(.infonomic-hamburger-box) {
|
|
46
|
+
width: 24px;
|
|
47
|
+
height: 24px;
|
|
48
|
+
display: block;
|
|
49
|
+
position: relative;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Inner bar + ::before/::after pseudo-elements form the 3 lines */
|
|
54
|
+
.inner,
|
|
55
|
+
:global(.infonomic-hamburger-inner) {
|
|
56
|
+
display: block;
|
|
57
|
+
top: 50%;
|
|
58
|
+
margin-top: -1px;
|
|
59
|
+
transition-duration: 0.075s;
|
|
60
|
+
transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.inner,
|
|
64
|
+
.inner::before,
|
|
65
|
+
.inner::after,
|
|
66
|
+
:global(.infonomic-hamburger-inner),
|
|
67
|
+
:global(.infonomic-hamburger-inner)::before,
|
|
68
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 24px;
|
|
71
|
+
height: 2px;
|
|
72
|
+
border-radius: 0;
|
|
73
|
+
background-color: var(--hamburger-color);
|
|
74
|
+
transition-property: transform;
|
|
75
|
+
transition-duration: 0.15s;
|
|
76
|
+
transition-timing-function: ease;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.inner::before,
|
|
80
|
+
.inner::after,
|
|
81
|
+
:global(.infonomic-hamburger-inner)::before,
|
|
82
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
83
|
+
content: "";
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.inner::before,
|
|
88
|
+
:global(.infonomic-hamburger-inner)::before {
|
|
89
|
+
top: -8px;
|
|
90
|
+
transition:
|
|
91
|
+
top 0.075s 0.12s ease,
|
|
92
|
+
opacity 0.075s ease;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.inner::after,
|
|
96
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
97
|
+
bottom: -8px;
|
|
98
|
+
transition:
|
|
99
|
+
bottom 0.075s 0.12s ease,
|
|
100
|
+
transform 0.075s cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Open state */
|
|
104
|
+
.open .inner,
|
|
105
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner) {
|
|
106
|
+
transform: rotate(45deg);
|
|
107
|
+
transition-delay: 0.12s;
|
|
108
|
+
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.open .inner::before,
|
|
112
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner)::before {
|
|
113
|
+
top: 0;
|
|
114
|
+
opacity: 0;
|
|
115
|
+
transition:
|
|
116
|
+
top 0.075s ease,
|
|
117
|
+
opacity 0.075s 0.12s ease;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.open .inner::after,
|
|
121
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner)::after {
|
|
122
|
+
bottom: 0;
|
|
123
|
+
transform: rotate(-90deg);
|
|
124
|
+
transition:
|
|
125
|
+
bottom 0.075s ease,
|
|
126
|
+
transform 0.075s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Color scheme: onDark (white bars for dark backgrounds) */
|
|
130
|
+
.onDark,
|
|
131
|
+
:global(.infonomic-hamburger-on-dark) {
|
|
132
|
+
--hamburger-color: white;
|
|
133
|
+
--hamburger-focus-ring-color: rgba(255, 255, 255, 0.7);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Color scheme: onLight (dark bars for light backgrounds) */
|
|
137
|
+
.onLight,
|
|
138
|
+
:global(.infonomic-hamburger-on-light) {
|
|
139
|
+
--hamburger-color: var(--foreground, #1a1a1a);
|
|
140
|
+
--hamburger-focus-ring-color: var(--foreground, #1a1a1a);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import type { Meta } from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
import { Section } from '../section/section.js'
|
|
8
|
+
import { Hamburger as HamburgerComponent } from './hamburger.js'
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof HamburgerComponent> = {
|
|
11
|
+
/* 👇 The title prop is optional.
|
|
12
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
13
|
+
* to learn how to generate automatic titles
|
|
14
|
+
*/
|
|
15
|
+
title: 'Components/Hamburger',
|
|
16
|
+
component: HamburgerComponent,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
|
|
21
|
+
export const Hamburger = (): React.JSX.Element => {
|
|
22
|
+
|
|
23
|
+
const [open, setOpen] = useState(false)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Section style={{ height: '100vh', margin: '2rem auto' }}>
|
|
27
|
+
<HamburgerComponent
|
|
28
|
+
open={open}
|
|
29
|
+
onChange={(open) => {
|
|
30
|
+
setOpen(open)
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Section>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -1,65 +1,73 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type React from 'react'
|
|
4
|
-
import { useCallback, useEffect
|
|
4
|
+
import { useCallback, useEffect } from 'react'
|
|
5
5
|
|
|
6
6
|
import cx from 'classnames'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import styles from './hamburger.module.css'
|
|
9
|
+
|
|
10
|
+
type ColorScheme = 'auto' | 'onDark' | 'onLight'
|
|
11
|
+
|
|
12
|
+
export interface HamburgerProps {
|
|
9
13
|
className?: string
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
open: boolean
|
|
13
|
-
|
|
14
|
+
colorScheme?: ColorScheme
|
|
15
|
+
open?: boolean
|
|
16
|
+
onChange?: (open: boolean) => void
|
|
17
|
+
ariaLabel?: string
|
|
18
|
+
ariaControls?: string
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export function Hamburger({
|
|
17
22
|
className,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
open,
|
|
23
|
+
colorScheme = 'auto',
|
|
24
|
+
open = false,
|
|
21
25
|
onChange,
|
|
26
|
+
ariaLabel = 'Toggle menu',
|
|
27
|
+
ariaControls,
|
|
22
28
|
...other
|
|
23
29
|
}: HamburgerProps): React.JSX.Element {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
|
27
|
-
setIsOpen(!isOpen)
|
|
28
|
-
onChange(event)
|
|
30
|
+
const handleClick = (): void => {
|
|
31
|
+
onChange?.(!open)
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
const handleEscapeKey = useCallback(
|
|
32
35
|
(event: KeyboardEvent): void => {
|
|
33
|
-
if (event.key === 'Escape') {
|
|
34
|
-
|
|
35
|
-
setIsOpen(false)
|
|
36
|
-
onChange(null)
|
|
37
|
-
}
|
|
36
|
+
if (event.key === 'Escape' && open) {
|
|
37
|
+
onChange?.(false)
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
[
|
|
40
|
+
[open, onChange]
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
|
-
setIsOpen(open)
|
|
45
44
|
document.addEventListener('keydown', handleEscapeKey, false)
|
|
46
45
|
return () => {
|
|
47
46
|
document.removeEventListener('keydown', handleEscapeKey, false)
|
|
48
47
|
}
|
|
49
|
-
}, [
|
|
48
|
+
}, [handleEscapeKey])
|
|
50
49
|
|
|
51
50
|
return (
|
|
52
51
|
<button
|
|
52
|
+
type="button"
|
|
53
53
|
onClick={handleClick}
|
|
54
|
-
className={cx(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
className={cx(
|
|
55
|
+
'infonomic-hamburger',
|
|
56
|
+
styles.hamburger,
|
|
57
|
+
{
|
|
58
|
+
[styles.open]: open,
|
|
59
|
+
[styles.onDark]: colorScheme === 'onDark',
|
|
60
|
+
[styles.onLight]: colorScheme === 'onLight',
|
|
61
|
+
},
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
aria-label={ariaLabel}
|
|
65
|
+
aria-controls={ariaControls}
|
|
66
|
+
aria-expanded={open}
|
|
59
67
|
{...other}
|
|
60
68
|
>
|
|
61
|
-
<span className=
|
|
62
|
-
<span className={cx('inner',
|
|
69
|
+
<span className={cx('infonomic-hamburger-box', styles.box)} aria-hidden="true">
|
|
70
|
+
<span className={cx('infonomic-hamburger-inner', styles.inner)} />
|
|
63
71
|
</span>
|
|
64
72
|
</button>
|
|
65
73
|
)
|
|
@@ -25,14 +25,14 @@ import type { Icons as i, Position as p, Intent as t } from '../../@types/shared
|
|
|
25
25
|
export type Intent = 'primary' | t
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Screen corner position for the toast
|
|
28
|
+
* Screen corner position for the toast viewport.
|
|
29
29
|
*
|
|
30
30
|
* - `top-left` — top-left corner of the viewport
|
|
31
31
|
* - `top-right` — top-right corner of the viewport (default)
|
|
32
32
|
* - `bottom-left` — bottom-left corner of the viewport
|
|
33
33
|
* - `bottom-right` — bottom-right corner of the viewport
|
|
34
34
|
*
|
|
35
|
-
* @default '
|
|
35
|
+
* @default 'bottom-right'
|
|
36
36
|
*/
|
|
37
37
|
export type Position = 'top-right' | p
|
|
38
38
|
|
|
@@ -43,9 +43,11 @@ export type Position = 'top-right' | p
|
|
|
43
43
|
export type IconType = 'success' | i
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* Use this to sync dismissal with external state.
|
|
48
|
-
*
|
|
49
|
-
* @param open - `true` when the toast becomes visible, `false` when dismissed
|
|
46
|
+
* Custom data passed to each toast via the toast manager's `add()` method.
|
|
50
47
|
*/
|
|
51
|
-
export
|
|
48
|
+
export interface ToastData {
|
|
49
|
+
intent?: Intent
|
|
50
|
+
iconType?: IconType
|
|
51
|
+
icon?: boolean
|
|
52
|
+
close?: boolean
|
|
53
|
+
}
|