@westpac/ui 0.50.3 → 0.53.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/CHANGELOG.md +58 -0
- package/dist/component-type.json +1 -1
- package/dist/components/accordion/components/accordion-item/accordion-item.component.js +15 -4
- package/dist/components/accordion/components/accordion-item/accordion-item.styles.d.ts +27 -0
- package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +10 -1
- package/dist/components/alert/alert.styles.js +1 -1
- package/dist/components/autocomplete/autocomplete.styles.js +1 -1
- package/dist/components/badge/badge.styles.d.ts +2 -2
- package/dist/components/badge/badge.styles.js +2 -2
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +2 -2
- package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.js +1 -1
- package/dist/components/button/button.styles.js +1 -1
- package/dist/components/button-dropdown/button-dropdown.component.d.ts +1 -1
- package/dist/components/button-dropdown/button-dropdown.component.js +5 -3
- package/dist/components/button-dropdown/button-dropdown.types.d.ts +7 -2
- package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.js +1 -1
- package/dist/components/collapsible/collapsible.styles.js +1 -1
- package/dist/components/compacta/compacta.styles.js +1 -1
- package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.d.ts +2 -2
- package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.js +1 -1
- package/dist/components/filter/components/filter-buttons/filter-buttons.component.js +2 -3
- package/dist/components/filter/components/filter-buttons/filter-buttons.styles.js +5 -5
- package/dist/components/filter/filter.component.js +1 -1
- package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.d.ts +2 -2
- package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.js +1 -1
- package/dist/components/flexi-cell/flexi-cell.styles.js +1 -1
- package/dist/components/footer/footer.styles.js +1 -1
- package/dist/components/header/header.component.d.ts +1 -1
- package/dist/components/header/header.component.js +13 -10
- package/dist/components/header/header.styles.js +1 -1
- package/dist/components/header/header.types.d.ts +7 -1
- package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.d.ts +2 -2
- package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.js +3 -3
- package/dist/components/input-group/input-group.component.js +2 -1
- package/dist/components/modal/components/modal-dialog/index.d.ts +1 -0
- package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +1 -1
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/pagination/components/pagination-item/pagination-item.component.js +8 -2
- package/dist/components/pagination/components/pagination-item/pagination-item.styles.d.ts +12 -0
- package/dist/components/pagination/components/pagination-item/pagination-item.styles.js +5 -1
- package/dist/components/pagination/components/pagination-presentational/pagination-presentational.styles.js +1 -1
- package/dist/components/panel/components/panel-footer/panel-footer.styles.js +1 -1
- package/dist/components/panel/panel.styles.js +1 -1
- package/dist/components/popover/components/panel/panel.component.js +5 -4
- package/dist/components/popover/components/panel/panel.styles.js +2 -2
- package/dist/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.js +37 -19
- package/dist/components/repeater/repeater.styles.js +1 -1
- package/dist/components/select/components/index.d.ts +2 -0
- package/dist/components/select/components/index.js +2 -0
- package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.d.ts +13 -0
- package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.js +22 -0
- package/dist/components/select/components/select-with-tooltip/select-with-tooltip.styles.d.ts +56 -0
- package/dist/components/select/components/select-with-tooltip/select-with-tooltip.styles.js +30 -0
- package/dist/components/select/components/styled-select/styled-select.component.d.ts +13 -0
- package/dist/components/select/components/styled-select/styled-select.component.js +19 -0
- package/dist/components/select/components/styled-select/styled-select.styles.d.ts +104 -0
- package/dist/components/select/components/styled-select/styled-select.styles.js +46 -0
- package/dist/components/select/select.component.d.ts +1 -0
- package/dist/components/select/select.component.js +7 -14
- package/dist/components/select/select.styles.d.ts +180 -45
- package/dist/components/select/select.styles.js +60 -15
- package/dist/components/select/select.types.d.ts +6 -0
- package/dist/components/table/table.styles.js +1 -1
- package/dist/components/tabs/components/tabs-tab/tabs-tab.styles.js +1 -1
- package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.d.ts +2 -2
- package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.js +1 -1
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.d.ts +2 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.js +9 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.d.ts +1 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.js +4 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.types.d.ts +5 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.types.js +1 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.component.d.ts +2 -0
- package/dist/components/tooltip/tooltip.component.js +55 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +4 -0
- package/dist/components/tooltip/tooltip.types.d.ts +7 -0
- package/dist/components/tooltip/tooltip.types.js +1 -0
- package/dist/components/well/well.styles.d.ts +2 -2
- package/dist/components/well/well.styles.js +1 -1
- package/dist/css/westpac-ui.css +113 -9
- package/dist/css/westpac-ui.min.css +113 -9
- package/package.json +3 -3
- package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +22 -4
- package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +10 -1
- package/src/components/alert/alert.styles.ts +1 -1
- package/src/components/autocomplete/autocomplete.styles.ts +1 -1
- package/src/components/badge/badge.styles.ts +2 -2
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +2 -2
- package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +1 -1
- package/src/components/button/button.styles.ts +1 -1
- package/src/components/button-dropdown/button-dropdown.component.tsx +8 -1
- package/src/components/button-dropdown/button-dropdown.types.ts +7 -2
- package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.ts +1 -1
- package/src/components/collapsible/collapsible.styles.ts +1 -1
- package/src/components/compacta/compacta.styles.ts +1 -1
- package/src/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.ts +1 -1
- package/src/components/filter/components/filter-buttons/filter-buttons.component.tsx +1 -2
- package/src/components/filter/components/filter-buttons/filter-buttons.styles.ts +5 -5
- package/src/components/filter/filter.component.tsx +1 -1
- package/src/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.ts +1 -1
- package/src/components/flexi-cell/flexi-cell.styles.ts +1 -1
- package/src/components/footer/footer.styles.ts +1 -1
- package/src/components/header/header.component.tsx +17 -4
- package/src/components/header/header.styles.ts +1 -1
- package/src/components/header/header.types.ts +7 -1
- package/src/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.ts +3 -3
- package/src/components/input-group/input-group.component.tsx +1 -0
- package/src/components/modal/components/modal-dialog/index.ts +1 -0
- package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +1 -1
- package/src/components/modal/index.ts +1 -0
- package/src/components/pagination/components/pagination-item/pagination-item.component.tsx +9 -2
- package/src/components/pagination/components/pagination-item/pagination-item.styles.ts +5 -1
- package/src/components/pagination/components/pagination-presentational/pagination-presentational.styles.ts +1 -1
- package/src/components/panel/components/panel-footer/panel-footer.styles.ts +1 -1
- package/src/components/panel/panel.styles.ts +1 -1
- package/src/components/popover/components/panel/panel.component.tsx +8 -5
- package/src/components/popover/components/panel/panel.styles.ts +2 -2
- package/src/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.tsx +62 -38
- package/src/components/repeater/repeater.styles.ts +1 -1
- package/src/components/select/components/index.ts +2 -0
- package/src/components/select/components/select-with-tooltip/select-with-tooltip.component.tsx +31 -0
- package/src/components/select/components/select-with-tooltip/select-with-tooltip.styles.ts +26 -0
- package/src/components/select/components/styled-select/styled-select.component.tsx +25 -0
- package/src/components/select/components/styled-select/styled-select.styles.ts +42 -0
- package/src/components/select/select.component.tsx +9 -14
- package/src/components/select/select.styles.ts +18 -15
- package/src/components/select/select.types.ts +6 -0
- package/src/components/table/table.styles.ts +1 -1
- package/src/components/tabs/components/tabs-tab/tabs-tab.styles.ts +1 -1
- package/src/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.ts +1 -1
- package/src/components/tooltip/components/tooltip-content/tooltip-content.component.tsx +12 -0
- package/src/components/tooltip/components/tooltip-content/tooltip-content.styles.ts +5 -0
- package/src/components/tooltip/components/tooltip-content/tooltip-content.types.ts +6 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/tooltip/tooltip.component.tsx +61 -0
- package/src/components/tooltip/tooltip.styles.ts +3 -0
- package/src/components/tooltip/tooltip.types.ts +8 -0
- package/src/components/well/well.styles.ts +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
isFocusVisible: {
|
|
3
|
+
true: string;
|
|
4
|
+
false: string;
|
|
5
|
+
};
|
|
2
6
|
firstItem: {
|
|
3
7
|
true: string;
|
|
4
8
|
false: string;
|
|
@@ -18,6 +22,10 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
18
22
|
}, undefined, "typography-body-10 relative block min-w-7 border border-border px-2 py-1.5 text-center text-text", {
|
|
19
23
|
responsiveVariants: string[];
|
|
20
24
|
}, {
|
|
25
|
+
isFocusVisible: {
|
|
26
|
+
true: string;
|
|
27
|
+
false: string;
|
|
28
|
+
};
|
|
21
29
|
firstItem: {
|
|
22
30
|
true: string;
|
|
23
31
|
false: string;
|
|
@@ -35,6 +43,10 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
35
43
|
false: string;
|
|
36
44
|
};
|
|
37
45
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
46
|
+
isFocusVisible: {
|
|
47
|
+
true: string;
|
|
48
|
+
false: string;
|
|
49
|
+
};
|
|
38
50
|
firstItem: {
|
|
39
51
|
true: string;
|
|
40
52
|
false: string;
|
|
@@ -2,6 +2,10 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
base: 'typography-body-10 relative block min-w-7 border border-border px-2 py-1.5 text-center text-text',
|
|
4
4
|
variants: {
|
|
5
|
+
isFocusVisible: {
|
|
6
|
+
true: 'z-10 focus-outline',
|
|
7
|
+
false: ''
|
|
8
|
+
},
|
|
5
9
|
firstItem: {
|
|
6
10
|
true: 'rounded-l',
|
|
7
11
|
false: 'ml-[-1px]'
|
|
@@ -11,7 +15,7 @@ export const styles = tv({
|
|
|
11
15
|
false: ''
|
|
12
16
|
},
|
|
13
17
|
active: {
|
|
14
|
-
true: '
|
|
18
|
+
true: 'border-hero bg-hero text-white',
|
|
15
19
|
false: 'hover:bg-light'
|
|
16
20
|
},
|
|
17
21
|
disabled: {
|
|
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
base: 'flex flex-col items-center',
|
|
5
|
-
ul: 'flex
|
|
5
|
+
ul: 'flex',
|
|
6
6
|
emptyItem: 'typography-body-10 relative block min-w-7 cursor-default border-y border-border px-2 py-1.5 text-center text-text'
|
|
7
7
|
},
|
|
8
8
|
variants: {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'border-0 border-t border-border bg-light px-2 py-[0.625rem] sm:px-4'
|
|
4
|
+
base: 'border-0 border-t border-border bg-light px-2 py-[0.625rem] sm:px-4 [&_:focus-visible]:focus-outline'
|
|
5
5
|
},
|
|
6
6
|
variants: {}
|
|
7
7
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'group/panel overflow-hidden rounded border border-hero',
|
|
4
|
+
base: 'group/panel overflow-hidden rounded border border-hero [&_:focus-visible]:focus-outline',
|
|
5
5
|
header: 'px-2 py-[0.625rem] sm:px-4'
|
|
6
6
|
},
|
|
7
7
|
variants: {
|
|
@@ -28,11 +28,12 @@ export function BasePanel({ state, heading, headingTag: Tag = 'h1', content, pla
|
|
|
28
28
|
ref: popoverRef
|
|
29
29
|
}, React.createElement("div", {
|
|
30
30
|
className: styles.content()
|
|
31
|
-
}, React.createElement(Tag, {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
}, heading && React.createElement(Tag, {
|
|
32
|
+
className: styles.heading(),
|
|
33
|
+
tabIndex: 0
|
|
34
34
|
}, heading), React.createElement("div", {
|
|
35
|
-
className: styles.body()
|
|
35
|
+
className: styles.body(),
|
|
36
|
+
tabIndex: 0
|
|
36
37
|
}, content), React.createElement(Button, {
|
|
37
38
|
look: "link",
|
|
38
39
|
size: "small",
|
|
@@ -9,8 +9,8 @@ export const styles = tv({
|
|
|
9
9
|
`,
|
|
10
10
|
closeBtn: 'absolute right-1 top-1 h-3 p-0 hover:opacity-80',
|
|
11
11
|
content: 'w-[17.625rem] rounded-[3px] bg-white py-4 pl-3 pr-5',
|
|
12
|
-
heading: 'typography-body-9 mb-2 font-medium text-text',
|
|
13
|
-
body: 'typography-body-10 text-text'
|
|
12
|
+
heading: 'typography-body-9 mb-2 font-medium text-text focus-visible:focus-outline',
|
|
13
|
+
body: 'typography-body-10 text-text focus-visible:focus-outline'
|
|
14
14
|
},
|
|
15
15
|
variants: {
|
|
16
16
|
placement: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useId, useMemo } from 'react';
|
|
1
|
+
import { LazyMotion, m, useAnimate } from 'motion/react';
|
|
2
|
+
import React, { useEffect, useId, useMemo, useState } from 'react';
|
|
3
3
|
import { useFocusRing } from 'react-aria';
|
|
4
4
|
import { Circle, VisuallyHidden } from '../../../index.js';
|
|
5
5
|
import { ProgressRopeStep } from '../index.js';
|
|
6
6
|
import { styles as progressRopeGroupStyles } from './progress-rope-group-step.styles.js';
|
|
7
7
|
const loadAnimations = ()=>import('./progress-rope-group-step.utils.js').then((res)=>res.default);
|
|
8
8
|
export function ProgressRopeGroupStep({ steps, currentKey, furthestVisitedStep, children, firstItem, opened, onToggle, tag: Tag }) {
|
|
9
|
+
const [scope, animate] = useAnimate();
|
|
9
10
|
const id = useId();
|
|
10
11
|
const stepsContainerID = `progress-rope-group-steps-container-${id}`;
|
|
11
12
|
const current = useMemo(()=>{
|
|
@@ -55,6 +56,32 @@ export function ProgressRopeGroupStep({ steps, currentKey, furthestVisitedStep,
|
|
|
55
56
|
state,
|
|
56
57
|
isFocusVisible
|
|
57
58
|
});
|
|
59
|
+
const [overflowVisible, setOverflowVisible] = useState(false);
|
|
60
|
+
useEffect(()=>{
|
|
61
|
+
if (opened) {
|
|
62
|
+
animate(scope.current, {
|
|
63
|
+
height: 'auto'
|
|
64
|
+
}, {
|
|
65
|
+
duration: 0.2,
|
|
66
|
+
ease: 'easeInOut',
|
|
67
|
+
onComplete: ()=>{
|
|
68
|
+
setOverflowVisible(true);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
animate(scope.current, {
|
|
73
|
+
height: 0
|
|
74
|
+
}, {
|
|
75
|
+
duration: 0.2,
|
|
76
|
+
ease: 'easeInOut',
|
|
77
|
+
onPlay: ()=>{
|
|
78
|
+
setOverflowVisible(false);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, [
|
|
83
|
+
opened
|
|
84
|
+
]);
|
|
58
85
|
return React.createElement(Tag, null, React.createElement("button", {
|
|
59
86
|
"aria-expanded": opened,
|
|
60
87
|
className: styles.circleWrapper({}),
|
|
@@ -66,23 +93,13 @@ export function ProgressRopeGroupStep({ steps, currentKey, furthestVisitedStep,
|
|
|
66
93
|
"aria-hidden": "true"
|
|
67
94
|
}), children, React.createElement(VisuallyHidden, null, visuallyHiddenMessage)), React.createElement(LazyMotion, {
|
|
68
95
|
features: loadAnimations
|
|
69
|
-
}, React.createElement(
|
|
70
|
-
|
|
71
|
-
}, opened && React.createElement(m.div, {
|
|
96
|
+
}, React.createElement(m.div, {
|
|
97
|
+
ref: scope,
|
|
72
98
|
initial: {
|
|
73
|
-
height: 0
|
|
74
|
-
overflow: 'hidden'
|
|
75
|
-
},
|
|
76
|
-
animate: {
|
|
77
|
-
height: 'auto'
|
|
78
|
-
},
|
|
79
|
-
exit: {
|
|
80
|
-
height: 0,
|
|
81
|
-
overflow: 'hidden'
|
|
99
|
+
height: opened ? 'auto' : 0
|
|
82
100
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ease: 'easeInOut'
|
|
101
|
+
style: {
|
|
102
|
+
overflow: overflowVisible ? 'visible' : 'hidden'
|
|
86
103
|
}
|
|
87
104
|
}, React.createElement("ol", {
|
|
88
105
|
className: styles.stepsWrapper({}),
|
|
@@ -97,6 +114,7 @@ export function ProgressRopeGroupStep({ steps, currentKey, furthestVisitedStep,
|
|
|
97
114
|
onClick: (furthestVisitedStep || 0) >= step.index ? step.onClick : undefined,
|
|
98
115
|
current: step.index === currentKey,
|
|
99
116
|
visited: (furthestVisitedStep || 0) > step.index,
|
|
100
|
-
furthest: furthestVisitedStep === step.index
|
|
101
|
-
|
|
117
|
+
furthest: furthestVisitedStep === step.index,
|
|
118
|
+
tabIndex: opened ? 0 : -1
|
|
119
|
+
}, step.text)))))));
|
|
102
120
|
}
|
|
@@ -5,7 +5,7 @@ export const styles = tv({
|
|
|
5
5
|
list: 'm-0 flex list-none flex-col pl-0',
|
|
6
6
|
item: 'relative',
|
|
7
7
|
itemIndex: 'mb-3 font-bold',
|
|
8
|
-
content: '',
|
|
8
|
+
content: '[&_:focus-visible]:focus-outline',
|
|
9
9
|
removeBtn: 'absolute right-0 top-0 h-auto p-0 no-underline hover:underline',
|
|
10
10
|
footer: 'flex justify-between pt-[0.875rem]',
|
|
11
11
|
addBtn: 'h-auto p-0 no-underline hover:underline'
|
package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const SelectWithTooltip: React.ForwardRefExoticComponent<{
|
|
3
|
+
enableTooltip?: boolean;
|
|
4
|
+
invalid?: boolean | {
|
|
5
|
+
[x: string]: boolean | undefined;
|
|
6
|
+
} | undefined;
|
|
7
|
+
size?: "small" | "xlarge" | "medium" | "large" | {
|
|
8
|
+
[x: string]: "small" | "xlarge" | "medium" | "large" | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
width?: "auto" | 1 | 2 | "full" | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 | 30 | {
|
|
11
|
+
[x: string]: "auto" | 1 | 2 | "full" | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 | 30 | undefined;
|
|
12
|
+
} | undefined;
|
|
13
|
+
} & Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> & React.RefAttributes<HTMLSelectElement>>;
|
package/dist/components/select/components/select-with-tooltip/select-with-tooltip.component.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
|
+
import { Tooltip } from '../../../tooltip/index.js';
|
|
3
|
+
import { StyledSelect } from '../styled-select/styled-select.component.js';
|
|
4
|
+
import { styles } from './select-with-tooltip.styles.js';
|
|
5
|
+
function BaseSelectWithTooltip({ width = 'auto', children, onChange, ...props }, ref) {
|
|
6
|
+
const [selectedOption, setSelectedOption] = useState('');
|
|
7
|
+
return React.createElement(Tooltip, {
|
|
8
|
+
tooltip: selectedOption,
|
|
9
|
+
className: styles({
|
|
10
|
+
width
|
|
11
|
+
})
|
|
12
|
+
}, React.createElement(StyledSelect, {
|
|
13
|
+
ref: ref,
|
|
14
|
+
onChange: (e)=>{
|
|
15
|
+
setSelectedOption(e.target.options[e.target.selectedIndex].text);
|
|
16
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
17
|
+
},
|
|
18
|
+
width: width,
|
|
19
|
+
...props
|
|
20
|
+
}, children));
|
|
21
|
+
}
|
|
22
|
+
export const SelectWithTooltip = forwardRef(BaseSelectWithTooltip);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
width: {
|
|
3
|
+
auto: string;
|
|
4
|
+
full: string;
|
|
5
|
+
1: string;
|
|
6
|
+
2: string;
|
|
7
|
+
3: string;
|
|
8
|
+
4: string;
|
|
9
|
+
5: string;
|
|
10
|
+
6: string;
|
|
11
|
+
7: string;
|
|
12
|
+
8: string;
|
|
13
|
+
9: string;
|
|
14
|
+
10: string;
|
|
15
|
+
20: string;
|
|
16
|
+
30: string;
|
|
17
|
+
};
|
|
18
|
+
}, undefined, "", {
|
|
19
|
+
responsiveVariants: string[];
|
|
20
|
+
}, {
|
|
21
|
+
width: {
|
|
22
|
+
auto: string;
|
|
23
|
+
full: string;
|
|
24
|
+
1: string;
|
|
25
|
+
2: string;
|
|
26
|
+
3: string;
|
|
27
|
+
4: string;
|
|
28
|
+
5: string;
|
|
29
|
+
6: string;
|
|
30
|
+
7: string;
|
|
31
|
+
8: string;
|
|
32
|
+
9: string;
|
|
33
|
+
10: string;
|
|
34
|
+
20: string;
|
|
35
|
+
30: string;
|
|
36
|
+
};
|
|
37
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
38
|
+
width: {
|
|
39
|
+
auto: string;
|
|
40
|
+
full: string;
|
|
41
|
+
1: string;
|
|
42
|
+
2: string;
|
|
43
|
+
3: string;
|
|
44
|
+
4: string;
|
|
45
|
+
5: string;
|
|
46
|
+
6: string;
|
|
47
|
+
7: string;
|
|
48
|
+
8: string;
|
|
49
|
+
9: string;
|
|
50
|
+
10: string;
|
|
51
|
+
20: string;
|
|
52
|
+
30: string;
|
|
53
|
+
};
|
|
54
|
+
}, undefined, "", {
|
|
55
|
+
responsiveVariants: string[];
|
|
56
|
+
}, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const styles = tv({
|
|
3
|
+
base: '',
|
|
4
|
+
variants: {
|
|
5
|
+
width: {
|
|
6
|
+
auto: 'flex-1',
|
|
7
|
+
full: 'w-full flex-1',
|
|
8
|
+
1: 'w-[1.81ex]',
|
|
9
|
+
2: 'w-[3.62ex]',
|
|
10
|
+
3: 'w-[5.43ex]',
|
|
11
|
+
4: 'w-[7.24ex]',
|
|
12
|
+
5: 'w-[9.05ex]',
|
|
13
|
+
6: 'w-[10.86ex]',
|
|
14
|
+
7: 'w-[12.67ex]',
|
|
15
|
+
8: 'w-[14.48ex]',
|
|
16
|
+
9: 'w-[16.29ex]',
|
|
17
|
+
10: 'w-[18.1ex]',
|
|
18
|
+
20: 'w-[36.2ex]',
|
|
19
|
+
30: 'w-[54.3ex]'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, {
|
|
23
|
+
responsiveVariants: [
|
|
24
|
+
'xsl',
|
|
25
|
+
'sm',
|
|
26
|
+
'md',
|
|
27
|
+
'lg',
|
|
28
|
+
'xl'
|
|
29
|
+
]
|
|
30
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const StyledSelect: React.ForwardRefExoticComponent<{
|
|
3
|
+
enableTooltip?: boolean;
|
|
4
|
+
invalid?: boolean | {
|
|
5
|
+
[x: string]: boolean | undefined;
|
|
6
|
+
} | undefined;
|
|
7
|
+
size?: "small" | "xlarge" | "medium" | "large" | {
|
|
8
|
+
[x: string]: "small" | "xlarge" | "medium" | "large" | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
width?: "auto" | 1 | 2 | "full" | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 | 30 | {
|
|
11
|
+
[x: string]: "auto" | 1 | 2 | "full" | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 | 30 | undefined;
|
|
12
|
+
} | undefined;
|
|
13
|
+
} & Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { mergeProps, useFocusRing } from 'react-aria';
|
|
3
|
+
import { styles } from './styled-select.styles.js';
|
|
4
|
+
function BaseSelect({ className, size = 'medium', invalid = false, width = 'auto', children, ...props }, ref) {
|
|
5
|
+
const { isFocused, isFocusVisible, focusProps } = useFocusRing();
|
|
6
|
+
return React.createElement("select", {
|
|
7
|
+
ref: ref,
|
|
8
|
+
className: styles({
|
|
9
|
+
className,
|
|
10
|
+
size,
|
|
11
|
+
invalid,
|
|
12
|
+
isFocused,
|
|
13
|
+
isFocusVisible,
|
|
14
|
+
width
|
|
15
|
+
}),
|
|
16
|
+
...mergeProps(props, focusProps)
|
|
17
|
+
}, children);
|
|
18
|
+
}
|
|
19
|
+
export const StyledSelect = forwardRef(BaseSelect);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
size: {
|
|
3
|
+
small: string;
|
|
4
|
+
medium: string;
|
|
5
|
+
large: string;
|
|
6
|
+
xlarge: string;
|
|
7
|
+
};
|
|
8
|
+
invalid: {
|
|
9
|
+
true: string;
|
|
10
|
+
false: string;
|
|
11
|
+
};
|
|
12
|
+
isFocusVisible: {
|
|
13
|
+
true: string;
|
|
14
|
+
};
|
|
15
|
+
isFocused: {
|
|
16
|
+
true: string;
|
|
17
|
+
};
|
|
18
|
+
width: {
|
|
19
|
+
auto: string;
|
|
20
|
+
full: string;
|
|
21
|
+
1: string;
|
|
22
|
+
2: string;
|
|
23
|
+
3: string;
|
|
24
|
+
4: string;
|
|
25
|
+
5: string;
|
|
26
|
+
6: string;
|
|
27
|
+
7: string;
|
|
28
|
+
8: string;
|
|
29
|
+
9: string;
|
|
30
|
+
10: string;
|
|
31
|
+
20: string;
|
|
32
|
+
30: string;
|
|
33
|
+
};
|
|
34
|
+
}, undefined, "form-control overflow-hidden overflow-ellipsis whitespace-nowrap bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0", {
|
|
35
|
+
responsiveVariants: string[];
|
|
36
|
+
}, {
|
|
37
|
+
size: {
|
|
38
|
+
small: string;
|
|
39
|
+
medium: string;
|
|
40
|
+
large: string;
|
|
41
|
+
xlarge: string;
|
|
42
|
+
};
|
|
43
|
+
invalid: {
|
|
44
|
+
true: string;
|
|
45
|
+
false: string;
|
|
46
|
+
};
|
|
47
|
+
isFocusVisible: {
|
|
48
|
+
true: string;
|
|
49
|
+
};
|
|
50
|
+
isFocused: {
|
|
51
|
+
true: string;
|
|
52
|
+
};
|
|
53
|
+
width: {
|
|
54
|
+
auto: string;
|
|
55
|
+
full: string;
|
|
56
|
+
1: string;
|
|
57
|
+
2: string;
|
|
58
|
+
3: string;
|
|
59
|
+
4: string;
|
|
60
|
+
5: string;
|
|
61
|
+
6: string;
|
|
62
|
+
7: string;
|
|
63
|
+
8: string;
|
|
64
|
+
9: string;
|
|
65
|
+
10: string;
|
|
66
|
+
20: string;
|
|
67
|
+
30: string;
|
|
68
|
+
};
|
|
69
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
70
|
+
size: {
|
|
71
|
+
small: string;
|
|
72
|
+
medium: string;
|
|
73
|
+
large: string;
|
|
74
|
+
xlarge: string;
|
|
75
|
+
};
|
|
76
|
+
invalid: {
|
|
77
|
+
true: string;
|
|
78
|
+
false: string;
|
|
79
|
+
};
|
|
80
|
+
isFocusVisible: {
|
|
81
|
+
true: string;
|
|
82
|
+
};
|
|
83
|
+
isFocused: {
|
|
84
|
+
true: string;
|
|
85
|
+
};
|
|
86
|
+
width: {
|
|
87
|
+
auto: string;
|
|
88
|
+
full: string;
|
|
89
|
+
1: string;
|
|
90
|
+
2: string;
|
|
91
|
+
3: string;
|
|
92
|
+
4: string;
|
|
93
|
+
5: string;
|
|
94
|
+
6: string;
|
|
95
|
+
7: string;
|
|
96
|
+
8: string;
|
|
97
|
+
9: string;
|
|
98
|
+
10: string;
|
|
99
|
+
20: string;
|
|
100
|
+
30: string;
|
|
101
|
+
};
|
|
102
|
+
}, undefined, "form-control overflow-hidden overflow-ellipsis whitespace-nowrap bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0", {
|
|
103
|
+
responsiveVariants: string[];
|
|
104
|
+
}, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const styles = tv({
|
|
3
|
+
base: 'form-control overflow-hidden overflow-ellipsis whitespace-nowrap bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0',
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
small: 'form-control-small bg-[right_0.5625rem_center] pr-[calc(0.5rem+14px+0.5625rem)]',
|
|
7
|
+
medium: 'form-control-medium bg-[right_0.75rem_center] pr-[calc(0.5rem+14px+0.75rem)]',
|
|
8
|
+
large: 'form-control-large bg-[right_0.9375rem_center] pr-[calc(0.5rem+14px+0.9375rem)]',
|
|
9
|
+
xlarge: 'form-control-xlarge bg-[right_1.125rem_center] pr-[calc(0.5rem+14px+1.125rem)]'
|
|
10
|
+
},
|
|
11
|
+
invalid: {
|
|
12
|
+
true: 'border-danger',
|
|
13
|
+
false: 'border-borderDark'
|
|
14
|
+
},
|
|
15
|
+
isFocusVisible: {
|
|
16
|
+
true: 'focus-outline'
|
|
17
|
+
},
|
|
18
|
+
isFocused: {
|
|
19
|
+
true: 'outline-none'
|
|
20
|
+
},
|
|
21
|
+
width: {
|
|
22
|
+
auto: 'flex-1',
|
|
23
|
+
full: 'w-full flex-1',
|
|
24
|
+
1: 'box-content w-[1.81ex]',
|
|
25
|
+
2: 'box-content w-[3.62ex]',
|
|
26
|
+
3: 'box-content w-[5.43ex]',
|
|
27
|
+
4: 'box-content w-[7.24ex]',
|
|
28
|
+
5: 'box-content w-[9.05ex]',
|
|
29
|
+
6: 'box-content w-[10.86ex]',
|
|
30
|
+
7: 'box-content w-[12.67ex]',
|
|
31
|
+
8: 'box-content w-[14.48ex]',
|
|
32
|
+
9: 'box-content w-[16.29ex]',
|
|
33
|
+
10: 'box-content w-[18.1ex]',
|
|
34
|
+
20: 'box-content w-[36.2ex]',
|
|
35
|
+
30: 'box-content w-[54.3ex]'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
responsiveVariants: [
|
|
40
|
+
'xsl',
|
|
41
|
+
'sm',
|
|
42
|
+
'md',
|
|
43
|
+
'lg',
|
|
44
|
+
'xl'
|
|
45
|
+
]
|
|
46
|
+
});
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { isFocused, isFocusVisible, focusProps } = useFocusRing();
|
|
7
|
-
return React.createElement("select", {
|
|
3
|
+
import { SelectWithTooltip, StyledSelect } from './components/index.js';
|
|
4
|
+
function BaseSelect({ children, enableTooltip, ...props }, ref) {
|
|
5
|
+
return enableTooltip ? React.createElement(SelectWithTooltip, {
|
|
8
6
|
ref: ref,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
isFocused,
|
|
14
|
-
isFocusVisible,
|
|
15
|
-
width
|
|
16
|
-
}),
|
|
17
|
-
...mergeProps(props, focusProps)
|
|
7
|
+
...props
|
|
8
|
+
}, children) : React.createElement(StyledSelect, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
18
11
|
}, children);
|
|
19
12
|
}
|
|
20
13
|
export const Select = forwardRef(BaseSelect);
|