@infonomic/uikit 5.44.0 → 6.0.1
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 +12 -3
- 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/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 +1 -1
- 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/styles/components-vanilla.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 +2 -6
- 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/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/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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
@layer infonomic-base,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
7
|
|
|
8
8
|
@layer infonomic-components {
|
|
9
|
+
|
|
9
10
|
.tabs-root,
|
|
10
11
|
:global(.infonomic-tabs-root) {
|
|
11
12
|
display: flex;
|
|
@@ -38,18 +39,8 @@
|
|
|
38
39
|
white-space: nowrap;
|
|
39
40
|
width: 100%;
|
|
40
41
|
|
|
41
|
-
/* &[data-state="active"] {
|
|
42
|
-
color: var(----primary-600);
|
|
43
|
-
box-shadow:
|
|
44
|
-
inset 0 -1px 0 0 currentColor,
|
|
45
|
-
0 1px 0 0 currentColor;
|
|
46
|
-
} */
|
|
47
|
-
|
|
48
42
|
&:focus {
|
|
49
43
|
position: relative;
|
|
50
|
-
/* NOTE: will override ring shadows for buttons */
|
|
51
|
-
/* Will revisit as we're going to rewrite our uikit tabs component */
|
|
52
|
-
/* box-shadow: 0 0 0 2px black; */
|
|
53
44
|
}
|
|
54
45
|
}
|
|
55
46
|
|
|
@@ -59,7 +50,7 @@
|
|
|
59
50
|
padding: 6px;
|
|
60
51
|
outline: none;
|
|
61
52
|
|
|
62
|
-
&[data-
|
|
53
|
+
&[data-hidden] {
|
|
63
54
|
display: none;
|
|
64
55
|
}
|
|
65
56
|
|
|
@@ -71,4 +62,4 @@
|
|
|
71
62
|
outline: none;
|
|
72
63
|
}
|
|
73
64
|
}
|
|
74
|
-
}
|
|
65
|
+
}
|
|
@@ -27,14 +27,14 @@ export const Tabs = (): React.JSX.Element => (
|
|
|
27
27
|
>
|
|
28
28
|
<TabsComponent style={{ width: '400px', minHeight: '235px' }} defaultValue="detailsTab">
|
|
29
29
|
<TabsComponent.List>
|
|
30
|
-
<TabsComponent.Trigger
|
|
31
|
-
|
|
30
|
+
<TabsComponent.Trigger value="detailsTab" render={<Button size="sm" />}>
|
|
31
|
+
Details
|
|
32
32
|
</TabsComponent.Trigger>
|
|
33
|
-
<TabsComponent.Trigger
|
|
34
|
-
|
|
33
|
+
<TabsComponent.Trigger value="rolesTab" render={<Button size="sm" />}>
|
|
34
|
+
Roles
|
|
35
35
|
</TabsComponent.Trigger>
|
|
36
36
|
</TabsComponent.List>
|
|
37
|
-
<TabsComponent.Content value="detailsTab"
|
|
37
|
+
<TabsComponent.Content value="detailsTab" keepMounted={true}>
|
|
38
38
|
<p>Details tab content here. Some more text to make this tab content area a bit longer.</p>
|
|
39
39
|
<p>Details tab content here. Some more text to make this tab content area a bit longer.</p>
|
|
40
40
|
</TabsComponent.Content>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import type * as React from 'react'
|
|
4
4
|
|
|
5
|
+
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'
|
|
5
6
|
import cx from 'classnames'
|
|
6
|
-
import { Tabs as TabsPrimitive } from 'radix-ui'
|
|
7
7
|
|
|
8
8
|
import styles from './tabs.module.css'
|
|
9
9
|
|
|
@@ -11,8 +11,8 @@ const Tabs = ({
|
|
|
11
11
|
ref,
|
|
12
12
|
className,
|
|
13
13
|
...props
|
|
14
|
-
}: React.
|
|
15
|
-
ref?: React.RefObject<
|
|
14
|
+
}: React.ComponentProps<typeof TabsPrimitive.Root> & {
|
|
15
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
16
16
|
}) => (
|
|
17
17
|
<TabsPrimitive.Root
|
|
18
18
|
ref={ref}
|
|
@@ -20,14 +20,14 @@ const Tabs = ({
|
|
|
20
20
|
{...props}
|
|
21
21
|
/>
|
|
22
22
|
)
|
|
23
|
-
Tabs.displayName =
|
|
23
|
+
Tabs.displayName = 'Tabs'
|
|
24
24
|
|
|
25
25
|
const TabsList = ({
|
|
26
26
|
ref,
|
|
27
27
|
className,
|
|
28
28
|
...props
|
|
29
|
-
}: React.
|
|
30
|
-
ref?: React.RefObject<
|
|
29
|
+
}: React.ComponentProps<typeof TabsPrimitive.List> & {
|
|
30
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
31
31
|
}) => (
|
|
32
32
|
<TabsPrimitive.List
|
|
33
33
|
ref={ref}
|
|
@@ -35,38 +35,39 @@ const TabsList = ({
|
|
|
35
35
|
{...props}
|
|
36
36
|
/>
|
|
37
37
|
)
|
|
38
|
-
TabsList.displayName =
|
|
38
|
+
TabsList.displayName = 'TabsList'
|
|
39
39
|
|
|
40
40
|
const TabsTrigger = ({
|
|
41
41
|
ref,
|
|
42
42
|
className,
|
|
43
43
|
...props
|
|
44
|
-
}: React.
|
|
45
|
-
ref?: React.RefObject<
|
|
44
|
+
}: React.ComponentProps<typeof TabsPrimitive.Tab> & {
|
|
45
|
+
ref?: React.RefObject<HTMLButtonElement>
|
|
46
46
|
}) => (
|
|
47
|
-
<TabsPrimitive.
|
|
47
|
+
<TabsPrimitive.Tab
|
|
48
48
|
ref={ref}
|
|
49
49
|
className={cx(styles['tabs-trigger'], 'infonomic-tabs-trigger', className)}
|
|
50
50
|
{...props}
|
|
51
51
|
/>
|
|
52
52
|
)
|
|
53
|
-
TabsTrigger.displayName =
|
|
53
|
+
TabsTrigger.displayName = 'TabsTrigger'
|
|
54
54
|
|
|
55
55
|
const TabsContent = ({
|
|
56
56
|
ref,
|
|
57
57
|
className,
|
|
58
|
+
keepMounted = true,
|
|
58
59
|
...props
|
|
59
|
-
}: React.
|
|
60
|
-
ref?: React.RefObject<
|
|
60
|
+
}: React.ComponentProps<typeof TabsPrimitive.Panel> & {
|
|
61
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
61
62
|
}) => (
|
|
62
|
-
<TabsPrimitive.
|
|
63
|
+
<TabsPrimitive.Panel
|
|
63
64
|
ref={ref}
|
|
64
|
-
|
|
65
|
+
keepMounted={keepMounted}
|
|
65
66
|
className={cx(styles['tabs-content'], 'infonomic-tabs-content', className)}
|
|
66
67
|
{...props}
|
|
67
68
|
/>
|
|
68
69
|
)
|
|
69
|
-
TabsContent.displayName =
|
|
70
|
+
TabsContent.displayName = 'TabsContent'
|
|
70
71
|
|
|
71
72
|
Tabs.List = TabsList
|
|
72
73
|
Tabs.Trigger = TabsTrigger
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
@layer infonomic-base,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
7
|
|
|
8
8
|
@layer infonomic-components {
|
|
9
|
+
|
|
9
10
|
.tooltip,
|
|
10
11
|
:global(.infonomic-tooltip) {
|
|
11
12
|
font-size: 0.75rem;
|
|
@@ -25,24 +26,56 @@
|
|
|
25
26
|
|
|
26
27
|
/* Dark mode handled by semantic tokens in theme layer */
|
|
27
28
|
|
|
28
|
-
.tooltip[data-
|
|
29
|
+
.tooltip[data-open][data-side="top"] :global {
|
|
29
30
|
animation-name: slideDownAndFade;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
.tooltip[data-
|
|
33
|
+
.tooltip[data-open][data-side="right"] :global {
|
|
33
34
|
animation-name: slideLeftAndFade;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
.tooltip[data-
|
|
37
|
+
.tooltip[data-open][data-side="left"] :global {
|
|
37
38
|
animation-name: slideRightAndFade;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
.tooltip[data-
|
|
41
|
+
.tooltip[data-open][data-side="bottom"] :global {
|
|
41
42
|
animation-name: slideUpAndFade;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
.tooltip-arrow,
|
|
45
46
|
:global(.infonomic-tooltip-arrow) {
|
|
47
|
+
display: flex;
|
|
48
|
+
|
|
49
|
+
&[data-side='top'] {
|
|
50
|
+
bottom: -6px;
|
|
51
|
+
rotate: 180deg;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&[data-side='bottom'] {
|
|
55
|
+
top: -6px;
|
|
56
|
+
rotate: 0deg;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-side='left'] {
|
|
60
|
+
right: -10px;
|
|
61
|
+
rotate: 90deg;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&[data-side='right'] {
|
|
65
|
+
left: -10px;
|
|
66
|
+
rotate: -90deg;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.arrow-fill {
|
|
71
|
+
fill: var(--surface-panel-elevated);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.arrow-outer-stroke {
|
|
46
75
|
fill: var(--surface-panel-border);
|
|
47
76
|
}
|
|
48
|
-
|
|
77
|
+
|
|
78
|
+
.arrow-inner-stroke {
|
|
79
|
+
fill: var(--surface-panel-elevated);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -21,22 +21,22 @@ export const Tooltip = (): React.JSX.Element => {
|
|
|
21
21
|
padding: '16px',
|
|
22
22
|
}}
|
|
23
23
|
>
|
|
24
|
-
<TooltipComponent text="I'm a tooltip" side="top" sideOffset={
|
|
24
|
+
<TooltipComponent text="I'm a tooltip" side="top" sideOffset={8}>
|
|
25
25
|
<Button fullWidth={true} size="sm">
|
|
26
26
|
Top
|
|
27
27
|
</Button>
|
|
28
28
|
</TooltipComponent>
|
|
29
|
-
<TooltipComponent text="I'm a tooltip" side="left" sideOffset={
|
|
29
|
+
<TooltipComponent text="I'm a tooltip" side="left" sideOffset={8}>
|
|
30
30
|
<Button fullWidth={true} size="sm">
|
|
31
31
|
Left
|
|
32
32
|
</Button>
|
|
33
33
|
</TooltipComponent>
|
|
34
|
-
<TooltipComponent text="I'm a tooltip" side="right" sideOffset={
|
|
34
|
+
<TooltipComponent text="I'm a tooltip" side="right" sideOffset={8}>
|
|
35
35
|
<Button fullWidth={true} size="sm">
|
|
36
36
|
Right
|
|
37
37
|
</Button>
|
|
38
38
|
</TooltipComponent>
|
|
39
|
-
<TooltipComponent text="I'm a tooltip" side="bottom" sideOffset={
|
|
39
|
+
<TooltipComponent text="I'm a tooltip" side="bottom" sideOffset={8}>
|
|
40
40
|
<Button fullWidth={true} size="sm">
|
|
41
41
|
Bottom
|
|
42
42
|
</Button>
|
|
@@ -2,53 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
import type React from 'react'
|
|
4
4
|
|
|
5
|
+
import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip'
|
|
5
6
|
import cx from 'classnames'
|
|
6
|
-
import { Tooltip as TooltipPrimitive } from 'radix-ui'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import styles from './tooltip.module.css'
|
|
9
|
+
|
|
10
|
+
export interface TooltipProps {
|
|
10
11
|
text: string
|
|
11
12
|
delay?: number
|
|
12
|
-
side?: 'bottom' | 'top' | 'right' | 'left'
|
|
13
|
+
side?: 'bottom' | 'top' | 'right' | 'left'
|
|
13
14
|
sideOffset?: number
|
|
14
|
-
|
|
15
|
+
disableHoverablePopup?: boolean
|
|
15
16
|
open?: boolean
|
|
16
17
|
onOpenChange?: (open: boolean) => void
|
|
18
|
+
children: React.ReactElement
|
|
19
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
function ArrowSvg(props: React.ComponentProps<'svg'>) {
|
|
23
|
+
return (
|
|
24
|
+
<svg width="15" height="8" viewBox="0 0 20 10" fill="none" aria-hidden role="presentation" {...props}>
|
|
25
|
+
<path
|
|
26
|
+
d="M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z"
|
|
27
|
+
className={styles['arrow-fill']}
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z"
|
|
31
|
+
className={styles['arrow-outer-stroke']}
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z"
|
|
35
|
+
className={styles['arrow-inner-stroke']}
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
20
40
|
|
|
21
41
|
export const Tooltip = function Tooltip({
|
|
22
42
|
ref,
|
|
23
43
|
text,
|
|
24
44
|
delay = 500,
|
|
25
45
|
side = 'top',
|
|
26
|
-
sideOffset =
|
|
27
|
-
|
|
46
|
+
sideOffset = 10,
|
|
47
|
+
disableHoverablePopup,
|
|
28
48
|
open,
|
|
29
49
|
onOpenChange,
|
|
30
50
|
children,
|
|
31
|
-
}: TooltipProps
|
|
32
|
-
ref?: React.RefObject<HTMLDivElement>
|
|
33
|
-
}): React.JSX.Element {
|
|
51
|
+
}: TooltipProps): React.JSX.Element {
|
|
34
52
|
return (
|
|
35
|
-
<TooltipPrimitive.Provider
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<TooltipPrimitive.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
<TooltipPrimitive.Provider delay={delay}>
|
|
54
|
+
<TooltipPrimitive.Root
|
|
55
|
+
open={open}
|
|
56
|
+
onOpenChange={onOpenChange}
|
|
57
|
+
disableHoverablePopup={disableHoverablePopup}
|
|
58
|
+
>
|
|
59
|
+
<TooltipPrimitive.Trigger
|
|
60
|
+
render={children}
|
|
61
|
+
/>
|
|
62
|
+
<TooltipPrimitive.Portal>
|
|
63
|
+
<TooltipPrimitive.Positioner
|
|
64
|
+
ref={ref}
|
|
65
|
+
side={side}
|
|
66
|
+
sideOffset={sideOffset}
|
|
67
|
+
>
|
|
68
|
+
<TooltipPrimitive.Popup
|
|
69
|
+
className={cx(styles.tooltip, 'infonomic-tooltip')}
|
|
70
|
+
>
|
|
71
|
+
<TooltipPrimitive.Arrow
|
|
72
|
+
className={cx(styles['tooltip-arrow'], 'infonomic-tooltip-arrow')}
|
|
73
|
+
>
|
|
74
|
+
<ArrowSvg />
|
|
75
|
+
</TooltipPrimitive.Arrow>
|
|
76
|
+
{text}
|
|
77
|
+
</TooltipPrimitive.Popup>
|
|
78
|
+
</TooltipPrimitive.Positioner>
|
|
79
|
+
</TooltipPrimitive.Portal>
|
|
52
80
|
</TooltipPrimitive.Root>
|
|
53
81
|
</TooltipPrimitive.Provider>
|
|
54
82
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFocusTrap } from './use-focus-trap.js'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope tab key navigation within a container.
|
|
3
|
+
*
|
|
4
|
+
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
+
* Original work licensed under the MIT License.
|
|
6
|
+
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
+
*
|
|
8
|
+
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { findTabbableDescendants } from './tabbable.js'
|
|
12
|
+
|
|
13
|
+
export function scopeTab(node: HTMLElement, event: KeyboardEvent) {
|
|
14
|
+
const tabbable = findTabbableDescendants(node)
|
|
15
|
+
if (!tabbable.length) {
|
|
16
|
+
event.preventDefault()
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1]
|
|
21
|
+
const root = node.getRootNode() as unknown as DocumentOrShadowRoot
|
|
22
|
+
let leavingFinalTabbable = finalTabbable === root.activeElement || node === root.activeElement
|
|
23
|
+
|
|
24
|
+
const activeElement = root.activeElement as Element
|
|
25
|
+
const activeElementIsRadio =
|
|
26
|
+
activeElement.tagName === 'INPUT' && activeElement.getAttribute('type') === 'radio'
|
|
27
|
+
|
|
28
|
+
if (activeElementIsRadio) {
|
|
29
|
+
const activeRadioGroup = tabbable.filter(
|
|
30
|
+
(element) =>
|
|
31
|
+
element.getAttribute('type') === 'radio' &&
|
|
32
|
+
element.getAttribute('name') === activeElement.getAttribute('name')
|
|
33
|
+
)
|
|
34
|
+
leavingFinalTabbable = activeRadioGroup.includes(finalTabbable)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!leavingFinalTabbable) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
event.preventDefault()
|
|
42
|
+
|
|
43
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0]
|
|
44
|
+
|
|
45
|
+
if (target) {
|
|
46
|
+
target.focus()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus-trap tabbable element utilities.
|
|
3
|
+
*
|
|
4
|
+
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
+
* Original work licensed under the MIT License.
|
|
6
|
+
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
+
*
|
|
8
|
+
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const TABBABLE_NODES = /input|select|textarea|button|object/
|
|
12
|
+
|
|
13
|
+
export const FOCUS_SELECTOR = 'a, input, select, textarea, button, object, [tabindex]'
|
|
14
|
+
|
|
15
|
+
function hidden(element: HTMLElement) {
|
|
16
|
+
return element.style.display === 'none'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function visible(element: HTMLElement) {
|
|
20
|
+
const isHidden =
|
|
21
|
+
element.getAttribute('aria-hidden') ||
|
|
22
|
+
element.getAttribute('hidden') ||
|
|
23
|
+
element.getAttribute('type') === 'hidden'
|
|
24
|
+
|
|
25
|
+
if (isHidden) {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let parentElement: HTMLElement = element
|
|
30
|
+
while (parentElement) {
|
|
31
|
+
if (parentElement === document.body || parentElement.nodeType === 11) {
|
|
32
|
+
break
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (hidden(parentElement)) {
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
parentElement = parentElement.parentNode as HTMLElement
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getElementTabIndex(element: HTMLElement) {
|
|
46
|
+
let tabIndex: string | null | undefined = element.getAttribute('tabindex')
|
|
47
|
+
if (tabIndex === null) {
|
|
48
|
+
tabIndex = undefined
|
|
49
|
+
}
|
|
50
|
+
return Number.parseInt(tabIndex as string, 10)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function focusable(element: HTMLElement) {
|
|
54
|
+
const nodeName = element.nodeName.toLowerCase()
|
|
55
|
+
const isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element))
|
|
56
|
+
const res =
|
|
57
|
+
// @ts-expect-error function accepts any html element but if it is a button, it should not be disabled
|
|
58
|
+
(TABBABLE_NODES.test(nodeName) && !element.disabled) ||
|
|
59
|
+
(element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
60
|
+
|
|
61
|
+
return res && visible(element)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function tabbable(element: HTMLElement) {
|
|
65
|
+
const tabIndex = getElementTabIndex(element)
|
|
66
|
+
const isTabIndexNaN = Number.isNaN(tabIndex)
|
|
67
|
+
return (isTabIndexNaN || tabIndex >= 0) && focusable(element)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function findTabbableDescendants(element: HTMLElement): HTMLElement[] {
|
|
71
|
+
return Array.from(element.querySelectorAll<HTMLElement>(FOCUS_SELECTOR)).filter(tabbable)
|
|
72
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus trap hook — traps keyboard focus within a container element.
|
|
3
|
+
*
|
|
4
|
+
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
+
* Original work licensed under the MIT License.
|
|
6
|
+
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
+
*
|
|
8
|
+
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useCallback, useEffect, useRef } from 'react'
|
|
12
|
+
|
|
13
|
+
import { scopeTab } from './scope-tab.js'
|
|
14
|
+
import { FOCUS_SELECTOR, focusable, tabbable } from './tabbable.js'
|
|
15
|
+
|
|
16
|
+
export function useFocusTrap(active = true): React.RefCallback<HTMLElement | null> {
|
|
17
|
+
const ref = useRef<HTMLElement>(null)
|
|
18
|
+
|
|
19
|
+
const focusNode = useCallback((node: HTMLElement) => {
|
|
20
|
+
let focusElement: HTMLElement | null = node.querySelector('[data-autofocus]')
|
|
21
|
+
|
|
22
|
+
if (!focusElement) {
|
|
23
|
+
const children = Array.from<HTMLElement>(node.querySelectorAll(FOCUS_SELECTOR))
|
|
24
|
+
focusElement = children.find(tabbable) || children.find(focusable) || null
|
|
25
|
+
if (!focusElement && focusable(node)) {
|
|
26
|
+
focusElement = node
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (focusElement) {
|
|
31
|
+
focusElement.focus({ preventScroll: true })
|
|
32
|
+
}
|
|
33
|
+
}, [])
|
|
34
|
+
|
|
35
|
+
const setRef = useCallback(
|
|
36
|
+
(node: HTMLElement | null) => {
|
|
37
|
+
if (!active) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (node === null) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (ref.current === node) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (node) {
|
|
50
|
+
// Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
if (node.getRootNode()) {
|
|
53
|
+
focusNode(node)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
ref.current = node
|
|
58
|
+
} else {
|
|
59
|
+
ref.current = null
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[active, focusNode]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!active) {
|
|
67
|
+
return undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ref.current && setTimeout(() => focusNode(ref.current!))
|
|
71
|
+
|
|
72
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
73
|
+
if (event.key === 'Tab' && ref.current) {
|
|
74
|
+
scopeTab(ref.current, event)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
document.addEventListener('keydown', handleKeyDown)
|
|
79
|
+
return () => document.removeEventListener('keydown', handleKeyDown)
|
|
80
|
+
}, [active, focusNode])
|
|
81
|
+
|
|
82
|
+
return setRef
|
|
83
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import cx from 'classnames'
|
|
4
|
+
|
|
5
|
+
import { IconElement } from './icon-element.js'
|
|
6
|
+
import styles from './icons.module.css'
|
|
7
|
+
import type { IconProps } from './types/icon.js'
|
|
8
|
+
|
|
9
|
+
export const ChevronUpIcon = ({
|
|
10
|
+
className,
|
|
11
|
+
svgClassName,
|
|
12
|
+
...rest
|
|
13
|
+
}: IconProps): React.JSX.Element => {
|
|
14
|
+
const applied = cx(styles['fill-current'], svgClassName)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<IconElement className={cx('chevron-up-icon', className)} {...rest}>
|
|
18
|
+
<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
className={applied}
|
|
21
|
+
role="presentation"
|
|
22
|
+
focusable="false"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
viewBox="0 0 15 15"
|
|
25
|
+
strokeWidth={2}
|
|
26
|
+
>
|
|
27
|
+
<path
|
|
28
|
+
d="M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z"
|
|
29
|
+
fillRule="evenodd"
|
|
30
|
+
clipRule="evenodd"
|
|
31
|
+
></path>
|
|
32
|
+
</svg>
|
|
33
|
+
</IconElement>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ChevronUpIcon.displayName = 'ChevronUpIcon'
|