@dotss/ui 0.0.10 → 0.0.11
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/Accordion/Accordion.cjs +13 -7
- package/Accordion/Accordion.d.ts +2 -0
- package/Accordion/Accordion.es.js +86 -65
- package/Autocomplete/Autocomplete.cjs +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.es.js +235 -80
- package/BottomSheet/BottomSheet.cjs +5 -5
- package/BottomSheet/BottomSheet.d.ts +3 -0
- package/BottomSheet/BottomSheet.es.js +88 -70
- package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
- package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
- package/Button/Button.cjs +6 -6
- package/Button/Button.es.js +35 -29
- package/ChainPicker/ChainPicker.cjs +16 -6
- package/ChainPicker/ChainPicker.d.ts +4 -2
- package/ChainPicker/ChainPicker.es.js +155 -110
- package/ChainPicker/ChainPicker.stories.d.ts +1 -1
- package/Checkbox/Checkbox.cjs +3 -3
- package/Checkbox/Checkbox.es.js +12 -10
- package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
- package/CircularProgressIndicator/CircularProgressIndicator.es.js +26 -23
- package/DatePicker/DatePicker.cjs +37 -20
- package/DatePicker/DatePicker.d.ts +2 -1
- package/DatePicker/DatePicker.es.js +345 -320
- package/DatePicker/DatePicker.stories.d.ts +1 -0
- package/DatePicker/EventDot/EventDot.cjs +8 -0
- package/DatePicker/EventDot/EventDot.d.ts +8 -0
- package/DatePicker/EventDot/EventDot.es.js +19 -0
- package/DatePicker/EventDot/index.cjs +1 -0
- package/DatePicker/EventDot/index.d.ts +3 -0
- package/DatePicker/EventDot/index.es.js +4 -0
- package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
- package/DatePicker/EventDotGroup/index.cjs +1 -0
- package/DatePicker/EventDotGroup/index.d.ts +3 -0
- package/DatePicker/EventDotGroup/index.es.js +4 -0
- package/DatePicker/index.cjs +1 -1
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.es.js +6 -2
- package/Dialog/Dialog.cjs +2 -2
- package/Dialog/Dialog.d.ts +2 -0
- package/Dialog/Dialog.es.js +45 -40
- package/Dialog/Dialog.stories.d.ts +10 -0
- package/Dialog/DialogText/DialogText.cjs +1 -1
- package/Dialog/DialogText/DialogText.es.js +1 -1
- package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
- package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
- package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
- package/FocusBoundary/FocusBoundary.cjs +1 -1
- package/FocusBoundary/FocusBoundary.d.ts +3 -1
- package/FocusBoundary/FocusBoundary.es.js +49 -42
- package/FormControlText/FormControlText.cjs +7 -5
- package/FormControlText/FormControlText.d.ts +2 -0
- package/FormControlText/FormControlText.es.js +50 -40
- package/Icon/Icon.cjs +1 -1
- package/Icon/Icon.es.js +1 -1
- package/IconButton/IconButton.cjs +8 -8
- package/IconButton/IconButton.es.js +32 -25
- package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
- package/LineProgressIndicator/LineProgressIndicator.es.js +35 -23
- package/Menu/Menu.cjs +16 -16
- package/Menu/Menu.d.ts +3 -2
- package/Menu/Menu.es.js +115 -81
- package/Menu/Menu.stories.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.cjs +14 -7
- package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.es.js +47 -35
- package/Menu/MenuButton/MenuButton.cjs +1 -0
- package/Menu/MenuButton/MenuButton.d.ts +10 -0
- package/Menu/MenuButton/MenuButton.es.js +44 -0
- package/Menu/MenuButton/index.cjs +1 -0
- package/Menu/MenuButton/index.d.ts +3 -0
- package/Menu/MenuButton/index.es.js +4 -0
- package/Menu/index.cjs +1 -1
- package/Menu/index.d.ts +1 -0
- package/Menu/index.es.js +4 -2
- package/NumberKeypad/NumberKeypad.cjs +2 -2
- package/NumberKeypad/NumberKeypad.es.js +18 -16
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
- package/PageControl/PageControl.cjs +16 -5
- package/PageControl/PageControl.d.ts +3 -0
- package/PageControl/PageControl.es.js +77 -24
- package/PageControl/PageControl.stories.d.ts +1 -0
- package/Radio/Radio.cjs +3 -3
- package/Radio/Radio.es.js +22 -20
- package/RadioGroup/RadioGroup.cjs +1 -0
- package/RadioGroup/RadioGroup.d.ts +8 -0
- package/RadioGroup/RadioGroup.es.js +28 -0
- package/RadioGroup/RadioGroup.stories.d.ts +14 -0
- package/RadioGroup/index.cjs +1 -0
- package/RadioGroup/index.d.ts +3 -0
- package/RadioGroup/index.es.js +4 -0
- package/SegmentedButton/SegmentedButton.cjs +14 -3
- package/SegmentedButton/SegmentedButton.es.js +108 -34
- package/Select/Select.cjs +4 -4
- package/Select/Select.es.js +95 -86
- package/Slider/Slider.cjs +27 -12
- package/Slider/Slider.d.ts +1 -0
- package/Slider/Slider.es.js +177 -90
- package/Switch/Switch.cjs +28 -11
- package/Switch/Switch.d.ts +2 -0
- package/Switch/Switch.es.js +185 -65
- package/Switch/Switch.stories.d.ts +1 -0
- package/Tab/Tab.es.js +2 -4
- package/TextArea/TextArea.cjs +42 -34
- package/TextArea/TextArea.es.js +116 -82
- package/TextArea/TextArea.stories.d.ts +1 -1
- package/TextField/TextField.cjs +29 -13
- package/TextField/TextField.d.ts +2 -1
- package/TextField/TextField.es.js +122 -79
- package/TextField/TextField.stories.d.ts +1 -0
- package/Tooltip/Tooltip.cjs +7 -6
- package/Tooltip/Tooltip.d.ts +8 -3
- package/Tooltip/Tooltip.es.js +248 -146
- package/Tooltip/Tooltip.stories.d.ts +1 -0
- package/hooks/index.cjs +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.es.js +7 -1
- package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
- package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
- package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
- package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -1
- package/index.es.js +97 -90
- package/package.json +3 -3
- package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
- package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
- package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
- package/resources/tictoccroc/icons/line/index.d.ts +4 -0
- package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
- package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
- package/utils/getIconLabel/getIconLabel.cjs +1 -1
- package/utils/getIconLabel/getIconLabel.es.js +8 -1
- package/utils/getSibling/getSibling.es.js +1 -2
- package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
- package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
color: ${({theme:{palette:{grey:e}}})=>e[30]};
|
|
32
32
|
cursor: not-allowed;
|
|
33
33
|
}
|
|
34
|
-
`,b=d.forwardRef(function({children:t,size:r,disabled:i,inlineCSS:n,...s},a){const{isHoverPossible:c}=u.default();return o.jsx(f,{ref:a,...s,css:n,children:o.jsx(m,{size:r,disabled:i,isHoverPossible:c,children:t})})});exports.default=b;
|
|
34
|
+
`,b=d.forwardRef(function({children:t,size:r,disabled:i,inlineCSS:n,...s},a){const{isHoverPossible:c}=u.default();return o.jsx(f,{ref:a,...s,css:n,children:o.jsx(m,{type:"button",size:r,disabled:i,isHoverPossible:c,children:t})})});exports.default=b;
|
|
@@ -98,7 +98,16 @@ const m = n.div`
|
|
|
98
98
|
`, v = p(
|
|
99
99
|
function({ children: t, size: r, disabled: i, inlineCSS: l, ...a }, s) {
|
|
100
100
|
const { isHoverPossible: c } = d();
|
|
101
|
-
return /* @__PURE__ */ o(m, { ref: s, ...a, css: l, children: /* @__PURE__ */ o(
|
|
101
|
+
return /* @__PURE__ */ o(m, { ref: s, ...a, css: l, children: /* @__PURE__ */ o(
|
|
102
|
+
g,
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
size: r,
|
|
106
|
+
disabled: i,
|
|
107
|
+
isHoverPossible: c,
|
|
108
|
+
children: t
|
|
109
|
+
}
|
|
110
|
+
) });
|
|
102
111
|
}
|
|
103
112
|
);
|
|
104
113
|
export {
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),n=require("react"),j=require("../Flexbox/Flexbox.cjs"),q=require("../hooks/useCheckHasFocus/useCheckHasFocus.cjs"),A=require("@emotion/styled"),D=e=>e&&e.__esModule?e:{default:e},d=D(A),L=d.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: ${({theme:{spacing:e}})=>e.content(2)}px;
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
@supports selector(:has(:focus-visible)) {
|
|
7
|
+
&:has(:focus-visible) {
|
|
8
|
+
outline: ${({theme:e})=>e.palette.grey[100]} solid 2px;
|
|
9
|
+
outline-offset: 2px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@supports not selector(:has(:focus-visible)) {
|
|
14
|
+
${({focusWithin:e,theme:r})=>e?{outline:`${r.palette.grey[100]} solid 2px`,outlineOffset:2}:{}}
|
|
15
|
+
}
|
|
16
|
+
`,S=d.default.button`
|
|
6
17
|
width: 8px;
|
|
7
18
|
height: 8px;
|
|
8
19
|
border-radius: 4px;
|
|
9
|
-
background-color: ${({theme:{palette:{grey:e}},color:
|
|
20
|
+
background-color: ${({theme:{palette:{grey:e}},color:r})=>r==="primary"?e[10]:e[30]};
|
|
10
21
|
cursor: pointer;
|
|
11
22
|
transition: all 150ms ease;
|
|
12
23
|
transition-property: width, border-radius, background-color, cursor;
|
|
13
24
|
|
|
14
|
-
${({theme:{palette:{brand:e}},color:
|
|
15
|
-
`,
|
|
25
|
+
${({theme:{palette:{brand:e}},color:r,isActive:o})=>o?{width:24,borderRadius:8,backgroundColor:r==="primary"?e.primary.pageControl:e.primary.tooltip,cursor:"default"}:null}
|
|
26
|
+
`,F=n.forwardRef(function({totalCount:r=1,page:o=1,onChange:l,color:p="primary",inlineCSS:y,tabIdPrefix:b,controlIdPrefix:m,tabProps:x,...h},$){const k=n.useRef(null),R=$??k,f=n.useRef(null),{hasFocus:w}=q.default({ref:f}),P=n.useId(),v=n.useId(),a=`${b??P}-`,I=`${m??v}-`,_=i=>t=>{t.preventDefault(),typeof l=="function"&&l(i)},g=i=>{let t=o;if(i.key==="ArrowLeft"?o>1?t=o-1:o===1&&(t=r):i.key==="ArrowRight"?o<r?t=o+1:o===r&&(t=1):i.key==="Home"?t=1:i.key==="End"&&(t=r),t!==o){const s=document.getElementById(`${a}${t}`);s==null||s.focus(),l==null||l(t)}};return c.jsx(L,{ref:R,role:"tablist",...h,css:y,focusWithin:w,children:c.jsx(j.default,{ref:f,gap:2,children:Array.from({length:r},(i,t)=>{const s=t+1,u=s===o;return c.jsx(S,{id:`${a}${s}`,"aria-controls":`${I}${s}`,isActive:u,"data-page":s,onClick:_(s),role:"tab",type:"button","aria-selected":u,onKeyDown:g,tabIndex:u?0:-1,...x,color:p},t)})})})});exports.default=F;
|
|
@@ -6,6 +6,9 @@ export interface PageControlProps extends GeneralComponentProps<Omit<HTMLAttribu
|
|
|
6
6
|
totalCount?: number;
|
|
7
7
|
page?: number;
|
|
8
8
|
color?: Extract<BrandColorKey, 'primary' | 'secondary'>;
|
|
9
|
+
tabIdPrefix?: string;
|
|
10
|
+
controlIdPrefix?: string;
|
|
11
|
+
tabProps?: GeneralComponentProps<HTMLAttributes<HTMLButtonElement>>;
|
|
9
12
|
onChange?: (page: number) => void;
|
|
10
13
|
}
|
|
11
14
|
declare const PageControl: import('react').ForwardRefExoticComponent<PageControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,51 +1,104 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as u } from "react";
|
|
1
|
+
import { jsx as f } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D, useRef as u, useId as d } from "react";
|
|
3
|
+
import F from "../Flexbox/Flexbox.es.js";
|
|
4
|
+
import E from "../hooks/useCheckHasFocus/useCheckHasFocus.es.js";
|
|
3
5
|
import p from "@emotion/styled";
|
|
4
|
-
const
|
|
6
|
+
const H = p.div`
|
|
5
7
|
display: flex;
|
|
6
8
|
align-items: center;
|
|
7
|
-
gap: ${({ theme: { spacing:
|
|
8
|
-
|
|
9
|
+
gap: ${({ theme: { spacing: t } }) => t.content(2)}px;
|
|
10
|
+
|
|
11
|
+
@supports selector(:has(:focus-visible)) {
|
|
12
|
+
&:has(:focus-visible) {
|
|
13
|
+
outline: ${({ theme: t }) => t.palette.grey[100]} solid 2px;
|
|
14
|
+
outline-offset: 2px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@supports not selector(:has(:focus-visible)) {
|
|
19
|
+
${({ focusWithin: t, theme: r }) => t ? {
|
|
20
|
+
outline: `${r.palette.grey[100]} solid 2px`,
|
|
21
|
+
outlineOffset: 2
|
|
22
|
+
} : {}}
|
|
23
|
+
}
|
|
24
|
+
`, K = p.button`
|
|
9
25
|
width: 8px;
|
|
10
26
|
height: 8px;
|
|
11
27
|
border-radius: 4px;
|
|
12
28
|
background-color: ${({
|
|
13
29
|
theme: {
|
|
14
|
-
palette: { grey:
|
|
30
|
+
palette: { grey: t }
|
|
15
31
|
},
|
|
16
|
-
color:
|
|
17
|
-
}) =>
|
|
32
|
+
color: r
|
|
33
|
+
}) => r === "primary" ? t[10] : t[30]};
|
|
18
34
|
cursor: pointer;
|
|
19
35
|
transition: all 150ms ease;
|
|
20
36
|
transition-property: width, border-radius, background-color, cursor;
|
|
21
37
|
|
|
22
38
|
${({
|
|
23
39
|
theme: {
|
|
24
|
-
palette: { brand:
|
|
40
|
+
palette: { brand: t }
|
|
25
41
|
},
|
|
26
|
-
color:
|
|
42
|
+
color: r,
|
|
27
43
|
isActive: o
|
|
28
44
|
}) => o ? {
|
|
29
45
|
width: 24,
|
|
30
46
|
borderRadius: 8,
|
|
31
|
-
backgroundColor:
|
|
47
|
+
backgroundColor: r === "primary" ? t.primary.pageControl : t.primary.tooltip,
|
|
32
48
|
cursor: "default"
|
|
33
49
|
} : null}
|
|
34
|
-
`,
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
`, O = D(function({
|
|
51
|
+
totalCount: r = 1,
|
|
52
|
+
page: o = 1,
|
|
53
|
+
onChange: l,
|
|
54
|
+
color: m = "primary",
|
|
55
|
+
inlineCSS: y,
|
|
56
|
+
tabIdPrefix: b,
|
|
57
|
+
controlIdPrefix: x,
|
|
58
|
+
tabProps: h,
|
|
59
|
+
...$
|
|
60
|
+
}, k) {
|
|
61
|
+
const w = u(null), P = k ?? w, c = u(null), { hasFocus: I } = E({ ref: c }), R = d(), v = d(), a = `${b ?? R}-`, g = `${x ?? v}-`, A = (s) => (e) => {
|
|
62
|
+
e.preventDefault(), typeof l == "function" && l(s);
|
|
63
|
+
}, L = (s) => {
|
|
64
|
+
let e = o;
|
|
65
|
+
if (s.key === "ArrowLeft" ? o > 1 ? e = o - 1 : o === 1 && (e = r) : s.key === "ArrowRight" ? o < r ? e = o + 1 : o === r && (e = 1) : s.key === "Home" ? e = 1 : s.key === "End" && (e = r), e !== o) {
|
|
66
|
+
const i = document.getElementById(`${a}${e}`);
|
|
67
|
+
i == null || i.focus(), l == null || l(e);
|
|
68
|
+
}
|
|
37
69
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
|
|
70
|
+
return /* @__PURE__ */ f(
|
|
71
|
+
H,
|
|
40
72
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
ref: P,
|
|
74
|
+
role: "tablist",
|
|
75
|
+
...$,
|
|
76
|
+
css: y,
|
|
77
|
+
focusWithin: I,
|
|
78
|
+
children: /* @__PURE__ */ f(F, { ref: c, gap: 2, children: Array.from({ length: r }, (s, e) => {
|
|
79
|
+
const i = e + 1, n = i === o;
|
|
80
|
+
return /* @__PURE__ */ f(
|
|
81
|
+
K,
|
|
82
|
+
{
|
|
83
|
+
id: `${a}${i}`,
|
|
84
|
+
"aria-controls": `${g}${i}`,
|
|
85
|
+
isActive: n,
|
|
86
|
+
"data-page": i,
|
|
87
|
+
onClick: A(i),
|
|
88
|
+
role: "tab",
|
|
89
|
+
type: "button",
|
|
90
|
+
"aria-selected": n,
|
|
91
|
+
onKeyDown: L,
|
|
92
|
+
tabIndex: n ? 0 : -1,
|
|
93
|
+
...h,
|
|
94
|
+
color: m
|
|
95
|
+
},
|
|
96
|
+
e
|
|
97
|
+
);
|
|
98
|
+
}) })
|
|
99
|
+
}
|
|
100
|
+
);
|
|
48
101
|
});
|
|
49
102
|
export {
|
|
50
|
-
|
|
103
|
+
O as default
|
|
51
104
|
};
|
package/Radio/Radio.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),f=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),f=require("react"),m=require("@emotion/styled"),y=require("../core/useTheme.cjs"),c=t=>t&&t.__esModule?t:{default:t},p=c(m),C=p.default.span`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
`,x=p.default.input`
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
height: 100%;
|
|
8
8
|
top: 0;
|
|
9
9
|
left: 0;
|
|
10
|
-
|
|
10
|
+
appearance: none;
|
|
11
11
|
cursor: pointer;
|
|
12
12
|
|
|
13
13
|
&:disabled {
|
|
14
14
|
cursor: default;
|
|
15
15
|
}
|
|
16
|
-
`;function
|
|
16
|
+
`;function h({size:t,color:i="primary",checked:n,disabled:s}){const{palette:{brand:r,grey:e,background:d}}=y.default();let l=e.white,u=e[50],o=e[10];return n&&(l=i==="primary"?r.primary.main:r[i],u=i==="primary"?r.primary.main:r[i],o=i==="primary"?e.white:e[10]),!n&&s&&(l=d.primary,u=e[30],o=e[20]),n&&s&&(l=i==="primary"?r.primary.disable:e[30],u=i==="primary"?r.primary.disable:e[30],o=i==="primary"?e.white:e[10]),a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t==="2xLarge"?48:24,height:t==="2xLarge"?48:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,focusable:"false",children:[a.jsx("path",{d:"M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",fill:l}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",fill:u}),a.jsx("circle",{cx:"12",cy:"12",r:"4",fill:o})]})}const g=f.forwardRef(function({size:i="medium",color:n="primary",checked:s,disabled:r,inlineCSS:e,...d},l){return a.jsxs(C,{ref:l,css:e,children:[a.jsx(x,{type:"radio",checked:s,disabled:r,...d}),a.jsx(h,{size:i,color:n,checked:s,disabled:r})]})});exports.default=g;
|
package/Radio/Radio.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as s, jsx as p } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u } from "react";
|
|
3
3
|
import f from "@emotion/styled";
|
|
4
|
-
import
|
|
4
|
+
import y from "../core/useTheme.es.js";
|
|
5
5
|
const C = f.span`
|
|
6
6
|
position: relative;
|
|
7
7
|
display: inline-flex;
|
|
@@ -11,7 +11,7 @@ const C = f.span`
|
|
|
11
11
|
height: 100%;
|
|
12
12
|
top: 0;
|
|
13
13
|
left: 0;
|
|
14
|
-
|
|
14
|
+
appearance: none;
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
|
|
17
17
|
&:disabled {
|
|
@@ -20,15 +20,15 @@ const C = f.span`
|
|
|
20
20
|
`;
|
|
21
21
|
function w({
|
|
22
22
|
size: m,
|
|
23
|
-
color:
|
|
24
|
-
checked:
|
|
25
|
-
disabled:
|
|
23
|
+
color: i = "primary",
|
|
24
|
+
checked: t,
|
|
25
|
+
disabled: n
|
|
26
26
|
}) {
|
|
27
27
|
const {
|
|
28
|
-
palette: { brand:
|
|
29
|
-
} =
|
|
30
|
-
let
|
|
31
|
-
return
|
|
28
|
+
palette: { brand: e, grey: r, background: d }
|
|
29
|
+
} = y();
|
|
30
|
+
let a = r.white, l = r[50], o = r[10];
|
|
31
|
+
return t && (a = i === "primary" ? e.primary.main : e[i], l = i === "primary" ? e.primary.main : e[i], o = i === "primary" ? r.white : r[10]), !t && n && (a = d.primary, l = r[30], o = r[20]), t && n && (a = i === "primary" ? e.primary.disable : r[30], l = i === "primary" ? e.primary.disable : r[30], o = i === "primary" ? r.white : r[10]), /* @__PURE__ */ s(
|
|
32
32
|
"svg",
|
|
33
33
|
{
|
|
34
34
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -36,15 +36,17 @@ function w({
|
|
|
36
36
|
height: m === "2xLarge" ? 48 : 24,
|
|
37
37
|
viewBox: "0 0 24 24",
|
|
38
38
|
fill: "none",
|
|
39
|
+
"aria-hidden": !0,
|
|
40
|
+
focusable: "false",
|
|
39
41
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ p(
|
|
41
43
|
"path",
|
|
42
44
|
{
|
|
43
45
|
d: "M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",
|
|
44
|
-
fill:
|
|
46
|
+
fill: a
|
|
45
47
|
}
|
|
46
48
|
),
|
|
47
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ p(
|
|
48
50
|
"path",
|
|
49
51
|
{
|
|
50
52
|
fillRule: "evenodd",
|
|
@@ -53,17 +55,17 @@ function w({
|
|
|
53
55
|
fill: l
|
|
54
56
|
}
|
|
55
57
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ p("circle", { cx: "12", cy: "12", r: "4", fill: o })
|
|
57
59
|
]
|
|
58
60
|
}
|
|
59
61
|
);
|
|
60
62
|
}
|
|
61
|
-
const
|
|
62
|
-
return /* @__PURE__ */ s(C, { ref:
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
63
|
+
const R = u(function({ size: i = "medium", color: t = "primary", checked: n, disabled: e, inlineCSS: r, ...d }, a) {
|
|
64
|
+
return /* @__PURE__ */ s(C, { ref: a, css: r, children: [
|
|
65
|
+
/* @__PURE__ */ p(h, { type: "radio", checked: n, disabled: e, ...d }),
|
|
66
|
+
/* @__PURE__ */ p(w, { size: i, color: t, checked: n, disabled: e })
|
|
65
67
|
] });
|
|
66
68
|
});
|
|
67
69
|
export {
|
|
68
|
-
|
|
70
|
+
R as default
|
|
69
71
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@emotion/react/jsx-runtime"),e=require("react"),c=require("../Flexbox/Flexbox.cjs"),d=require("../FormControlText/FormControlText.cjs"),p=require("../Radio/Radio.cjs"),f=e.forwardRef(function({children:n,name:u,inlineCSS:l,...a},s){const i=e.useId(),r=u||i;return m.jsx(c.default,{tag:"div",role:"radiogroup",ref:s,css:l,...a,children:e.Children.map(n,t=>{if(e.isValidElement(t)&&t.type===p.default)return e.cloneElement(t,{name:r});if(e.isValidElement(t)&&t.type===d.default){const o=t.props.control;if(e.isValidElement(o))return e.cloneElement(t,{...t.props,control:e.cloneElement(o,{...o.props,name:r})})}return null})})});exports.default=f;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { GeneralComponentProps } from '../typings/component';
|
|
3
|
+
|
|
4
|
+
export interface RadioGroupProps extends GeneralComponentProps<HTMLAttributes<HTMLDivElement>> {
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const RadioGroup: import('react').ForwardRefExoticComponent<RadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as u } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as l, useId as d, Children as x, isValidElement as t, cloneElement as e } from "react";
|
|
3
|
+
import c from "../Flexbox/Flexbox.es.js";
|
|
4
|
+
import R from "../FormControlText/FormControlText.es.js";
|
|
5
|
+
import E from "../Radio/Radio.es.js";
|
|
6
|
+
const b = l(function({ children: m, name: p, inlineCSS: a, ...f }, s) {
|
|
7
|
+
const i = d(), n = p || i;
|
|
8
|
+
return /* @__PURE__ */ u(c, { tag: "div", role: "radiogroup", ref: s, css: a, ...f, children: x.map(m, (o) => {
|
|
9
|
+
if (t(o) && o.type === E)
|
|
10
|
+
return e(o, { name: n });
|
|
11
|
+
if (t(o) && o.type === R) {
|
|
12
|
+
const r = o.props.control;
|
|
13
|
+
if (t(r))
|
|
14
|
+
return e(o, {
|
|
15
|
+
...o.props,
|
|
16
|
+
// @ts-expect-error - add name to control element
|
|
17
|
+
control: e(r, {
|
|
18
|
+
...r.props,
|
|
19
|
+
name: n
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}) });
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
b as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import('react').ForwardRefExoticComponent<import('./RadioGroup').RadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Default: Story;
|
|
14
|
+
export declare const Standalone: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./RadioGroup.cjs");exports.default=e.default;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("@emotion/react/jsx-runtime"),l=require("react"),A=require("../hooks/useCheckHasFocus/useCheckHasFocus.cjs"),M=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),v=require("../utils/getSibling/getSibling.cjs"),K=require("@emotion/styled"),P=o=>o&&o.__esModule?o:{default:o},$=P(K),j=$.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
height: 44px;
|
|
5
5
|
|
|
6
|
-
${({fullWidth:
|
|
7
|
-
|
|
6
|
+
${({fullWidth:o})=>o?{width:"100%","& > button":{width:"100%",flexShrink:1}}:null}
|
|
7
|
+
|
|
8
|
+
@supports selector(:has(:focus-visible)) {
|
|
9
|
+
&:has(:focus-visible) {
|
|
10
|
+
outline: ${({theme:o})=>o.palette.grey[100]} solid 2px;
|
|
11
|
+
outline-offset: 2px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@supports not selector(:has(:focus-visible)) {
|
|
16
|
+
${({focusWithin:o,theme:p})=>o?{outline:`${p.palette.grey[100]} solid 2px`,outlineOffset:2}:{}}
|
|
17
|
+
}
|
|
18
|
+
`,B=l.forwardRef(function({children:p,variant:b="outlined",color:k="primary",rounded:S=!0,onChange:e,value:m,fullWidth:h,inlineCSS:q,disabled:y,...w},x){const s=l.useRef(null);l.useImperativeHandle(x,()=>s.current);const{hasFocus:E}=A.default({ref:s}),{isKeyboardMode:D}=M.default(),_=(t,i)=>n=>{typeof e=="function"&&e(t),typeof i=="function"&&i(n)},R=t=>{var i,n,a,f,d;if(t.key==="ArrowRight"||t.key==="ArrowDown"){t.preventDefault(),t.stopPropagation();const r=(i=s.current)==null?void 0:i.querySelector('button[aria-checked="true"]');if(!r)return;const u=v.default(r,"next",{skipDisabled:!0});if(u&&typeof e=="function"&&(e(u.dataset.value),u.focus()),!u){const c=(n=s.current)==null?void 0:n.querySelector("button:first-child");c&&typeof e=="function"&&(e(c.dataset.value),c.focus())}}if(t.key==="ArrowLeft"||t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();const r=(a=s.current)==null?void 0:a.querySelector('button[aria-checked="true"]');if(!r)return;const u=v.default(r,"prev",{skipDisabled:!0});if(u&&typeof e=="function"&&(e(u.dataset.value),u.focus()),!u){const c=(f=s.current)==null?void 0:f.querySelector("button:last-child");c&&typeof e=="function"&&(e(c.dataset.value),c.focus())}}if(t.key==="Enter"||t.key===" "){t.preventDefault(),t.stopPropagation();const r=(d=s.current)==null?void 0:d.querySelector('button[aria-checked="true"]');r&&typeof e=="function"&&(e(r.dataset.value),r.focus())}};return g.jsx(j,{ref:s,fullWidth:h,role:"radiogroup",focusWithin:D&&E,onKeyDown:R,...w,css:q,children:l.Children.map(p,(t,i)=>{var a,f,d,r;if(!l.isValidElement(t))return null;const n=m===((a=t.props)==null?void 0:a.value);return l.cloneElement(t,{...t.props,variant:b,color:k,rounded:S,disabled:y,isActive:n,isFirst:i===0,isLast:l.Children.count(p)-1===i,tabIndex:n?0:-1,role:"radio","aria-checked":n,"aria-disabled":y,"data-value":(f=t.props)==null?void 0:f.value,onClick:_((d=t.props)==null?void 0:d.value,(r=t.props)==null?void 0:r.onClick)})})})});exports.default=B;
|
|
@@ -1,48 +1,122 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { jsx as K } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as R, useRef as $, useImperativeHandle as g, Children as y, isValidElement as B, cloneElement as F } from "react";
|
|
3
|
+
import P from "../hooks/useCheckHasFocus/useCheckHasFocus.es.js";
|
|
4
|
+
import H from "../hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js";
|
|
5
|
+
import m from "../utils/getSibling/getSibling.es.js";
|
|
6
|
+
import I from "@emotion/styled";
|
|
7
|
+
const L = I.div`
|
|
5
8
|
display: flex;
|
|
6
9
|
align-items: center;
|
|
7
10
|
height: 44px;
|
|
8
11
|
|
|
9
|
-
${({ fullWidth:
|
|
12
|
+
${({ fullWidth: c }) => c ? {
|
|
10
13
|
width: "100%",
|
|
11
14
|
"& > button": {
|
|
12
15
|
width: "100%",
|
|
13
16
|
flexShrink: 1
|
|
14
17
|
}
|
|
15
18
|
} : null}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
|
|
20
|
+
@supports selector(:has(:focus-visible)) {
|
|
21
|
+
&:has(:focus-visible) {
|
|
22
|
+
outline: ${({ theme: c }) => c.palette.grey[100]} solid 2px;
|
|
23
|
+
outline-offset: 2px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@supports not selector(:has(:focus-visible)) {
|
|
28
|
+
${({ focusWithin: c, theme: p }) => c ? {
|
|
29
|
+
outline: `${p.palette.grey[100]} solid 2px`,
|
|
30
|
+
outlineOffset: 2
|
|
31
|
+
} : {}}
|
|
32
|
+
}
|
|
33
|
+
`, J = R(function({
|
|
34
|
+
children: p,
|
|
35
|
+
variant: v = "outlined",
|
|
36
|
+
color: k = "primary",
|
|
37
|
+
rounded: b = !0,
|
|
38
|
+
onChange: e,
|
|
39
|
+
value: w,
|
|
40
|
+
fullWidth: h,
|
|
41
|
+
inlineCSS: S,
|
|
42
|
+
disabled: d,
|
|
43
|
+
...x
|
|
44
|
+
}, E) {
|
|
45
|
+
const i = $(null);
|
|
46
|
+
g(E, () => i.current);
|
|
47
|
+
const { hasFocus: D } = P({ ref: i }), { isKeyboardMode: q } = H(), A = (t, u) => (s) => {
|
|
48
|
+
typeof e == "function" && e(t), typeof u == "function" && u(s);
|
|
30
49
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
return /* @__PURE__ */ K(
|
|
51
|
+
L,
|
|
52
|
+
{
|
|
53
|
+
ref: i,
|
|
54
|
+
fullWidth: h,
|
|
55
|
+
role: "radiogroup",
|
|
56
|
+
focusWithin: q && D,
|
|
57
|
+
onKeyDown: (t) => {
|
|
58
|
+
var u, s, f, l, a;
|
|
59
|
+
if (t.key === "ArrowRight" || t.key === "ArrowDown") {
|
|
60
|
+
t.preventDefault(), t.stopPropagation();
|
|
61
|
+
const r = (u = i.current) == null ? void 0 : u.querySelector(
|
|
62
|
+
'button[aria-checked="true"]'
|
|
63
|
+
);
|
|
64
|
+
if (!r) return;
|
|
65
|
+
const o = m(r, "next", { skipDisabled: !0 });
|
|
66
|
+
if (o && typeof e == "function" && (e(o.dataset.value), o.focus()), !o) {
|
|
67
|
+
const n = (s = i.current) == null ? void 0 : s.querySelector("button:first-child");
|
|
68
|
+
n && typeof e == "function" && (e(n.dataset.value), n.focus());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (t.key === "ArrowLeft" || t.key === "ArrowUp") {
|
|
72
|
+
t.preventDefault(), t.stopPropagation();
|
|
73
|
+
const r = (f = i.current) == null ? void 0 : f.querySelector(
|
|
74
|
+
'button[aria-checked="true"]'
|
|
75
|
+
);
|
|
76
|
+
if (!r) return;
|
|
77
|
+
const o = m(r, "prev", { skipDisabled: !0 });
|
|
78
|
+
if (o && typeof e == "function" && (e(o.dataset.value), o.focus()), !o) {
|
|
79
|
+
const n = (l = i.current) == null ? void 0 : l.querySelector("button:last-child");
|
|
80
|
+
n && typeof e == "function" && (e(n.dataset.value), n.focus());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
84
|
+
t.preventDefault(), t.stopPropagation();
|
|
85
|
+
const r = (a = i.current) == null ? void 0 : a.querySelector(
|
|
86
|
+
'button[aria-checked="true"]'
|
|
87
|
+
);
|
|
88
|
+
r && typeof e == "function" && (e(r.dataset.value), r.focus());
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
...x,
|
|
92
|
+
css: S,
|
|
93
|
+
children: y.map(p, (t, u) => {
|
|
94
|
+
var f, l, a, r;
|
|
95
|
+
if (!B(t))
|
|
96
|
+
return null;
|
|
97
|
+
const s = w === ((f = t.props) == null ? void 0 : f.value);
|
|
98
|
+
return F(t, {
|
|
99
|
+
...t.props,
|
|
100
|
+
variant: v,
|
|
101
|
+
color: k,
|
|
102
|
+
rounded: b,
|
|
103
|
+
disabled: d,
|
|
104
|
+
isActive: s,
|
|
105
|
+
isFirst: u === 0,
|
|
106
|
+
isLast: y.count(p) - 1 === u,
|
|
107
|
+
tabIndex: s ? 0 : -1,
|
|
108
|
+
role: "radio",
|
|
109
|
+
"aria-checked": s,
|
|
110
|
+
"aria-disabled": d,
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
112
|
+
// @ts-expect-error
|
|
113
|
+
"data-value": (l = t.props) == null ? void 0 : l.value,
|
|
114
|
+
onClick: A((a = t.props) == null ? void 0 : a.value, (r = t.props) == null ? void 0 : r.onClick)
|
|
115
|
+
});
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
);
|
|
45
119
|
});
|
|
46
120
|
export {
|
|
47
|
-
|
|
121
|
+
J as default
|
|
48
122
|
};
|
package/Select/Select.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),i=require("react"),P=require("../Backdrop/Backdrop.cjs"),T=require("../Box/Box.cjs"),K=require("../Flexbox/Flexbox.cjs"),U=require("../Icon/Icon.cjs"),X=require("@emotion/styled"),E=require("../utils/getSibling/getSibling.cjs"),G=e=>e&&e.__esModule?e:{default:e},m=G(X),J=m.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
color: inherit;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
${({theme:{palette:{grey:e,background:r}},variant:
|
|
15
|
+
${({theme:{palette:{grey:e,background:r}},variant:g})=>{let s={};switch(g){case"outlined":s={border:`1px solid ${e[50]}`,"&[disabled]":{backgroundColor:e[10],border:`1px solid ${e[30]}`,color:e[30],pointerEvents:"none"}};break;case"filled":s={border:"1px solid transparent",backgroundColor:r.primary,"&[disabled]":{backgroundColor:e[10],color:e[30],pointerEvents:"none"}};break}return s}}
|
|
16
16
|
|
|
17
17
|
${({theme:{palette:{brand:e}},isFocused:r})=>r?{border:`1px solid ${e.primary.line}`}:{}}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
color: inherit;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
${({theme:{typography:e,palette:{grey:r}},value:
|
|
28
|
+
${({theme:{typography:e,palette:{grey:r}},value:g})=>{const s={fontSize:e.b2R.size,fontWeight:e.b2R.size,lineHeight:e.b2R.lineHeight,letterSpacing:e.b2R.letterSpacing,"&[disabled]":{color:r[30]}};return g?{...s,color:r[100]}:{...s,color:r[50]}}}
|
|
29
29
|
`,Q=m.default.div`
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
text-overflow: ellipsis;
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
box-shadow: ${({theme:{elevation:e}})=>e[4]};
|
|
51
51
|
transition: opacity 200ms linear;
|
|
52
52
|
opacity: ${({isFocused:e})=>e?1:0};
|
|
53
|
-
`,ee=i.forwardRef(function({value:r,onChange:
|
|
53
|
+
`,ee=i.forwardRef(function({value:r,onChange:g,open:s,onOpen:v,onClose:C,variant:O="outlined",size:q="large",startAdornment:j,placeholder:W="TEXT",disabled:k=!1,fullWidth:D,children:h,inlineCSS:z,...S},V){const _=i.useId(),b=i.useRef(null),w=i.useRef(null),x=i.useRef(""),[d,u]=i.useState(s||!1),[f,c]=i.useState(""),[$,y]=i.useState({top:0,bottom:0,left:0,width:0}),p=(S==null?void 0:S.id)||_,H=()=>{s===void 0?u(t=>!t):s===!1&&v&&typeof v=="function"&&v()},I=t=>()=>{g(t.toString()),R()},R=()=>{s===void 0?(u(!1),c("")):s===!0&&C&&typeof C=="function"&&C()},B=t=>{if(t.preventDefault(),t.code==="Escape"&&u(!1),t.code==="Space"||t.code==="Enter")if(x.current?c(x.current):f||c(`${p}-0`),d){if(f){const n=document.querySelector(`#${CSS.escape(f)}`);n&&n.hasAttribute("value")&&(x.current=n==null?void 0:n.id,I(n.value)())}u(!1)}else u(!0);if(t.code==="ArrowDown"||t.code==="ArrowUp"){if(d||u(!0),x.current?c(x.current):c(`${p}-0`),!w.current||!f)return;const n=w.current.querySelector(`#${CSS.escape(f)}`);if(!n)return;if(t.code==="ArrowDown"){const o=E.default(n,"next",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=w.current.firstElementChild;l&&(c(l.id),l.scrollIntoView({block:"start"}))}}if(t.code==="ArrowUp"){const o=E.default(n,"prev",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=w.current.lastElementChild;l&&(c(l.id),l.scrollIntoView({block:"end"}))}}}if(t.code==="Home"&&c(`${p}-0`),t.code==="End"){const n=i.Children.count(h);c(`${p}-${n-1}`)}},L=t=>{const n=i.Children.map(t,o=>i.isValidElement(o)&&o&&o.props.value===r?o.props.children:null);return n&&n.length?n[0]:""};return i.useEffect(()=>{const t=()=>{if(b.current){const n=b.current.getBoundingClientRect(),o=i.Children.count(h),l=40,A=24,F=l*o>476?476:l*o,M=b.current.getBoundingClientRect().bottom+F+A>window.innerHeight;y(M?{bottom:24,left:n.left,width:b.current.offsetWidth}:{top:n.top+n.height,left:n.left,width:b.current.offsetWidth})}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[h]),i.useEffect(()=>{s!==void 0&&u(s)},[s]),a.jsxs(T.default,{ref:V,inlineCSS:{position:"relative"},children:[a.jsxs(J,{role:"combobox",ref:b,tabIndex:0,variant:O,size:q,disabled:k,fullWidth:D,isFocused:d,onClick:H,onKeyDown:B,"aria-controls":p,"aria-expanded":d,"aria-haspopup":"listbox","aria-activedescendant":f,...S,css:z,children:[a.jsxs(N,{value:r==="0"||!!r,disabled:k,children:[j&&a.jsx(K.default,{justifyContent:"center",alignItems:"center",children:j}),a.jsx(Q,{children:L(h)||W})]}),a.jsx(Y,{isFocused:d,children:a.jsx(U.default,{name:"ChevronDownLine",size:"small",color:k?"grey.30":"grey.100"})})]}),a.jsx(P.default,{open:d,onClose:R,inlineCSS:{backgroundColor:"transparent"},children:a.jsx(Z,{id:p,role:"listbox",ref:w,tabIndex:-1,isFocused:d,style:{top:$.top,bottom:$.bottom,left:$.left,width:$.width},children:i.Children.map(h,(t,n)=>{if(!i.isValidElement(t)||!t.props.value)return null;const o=`${p}-${n}`,l=r===t.props.value;return l&&(x.current=o),i.cloneElement(t,{id:o,selected:l,focused:o===f,onClick:I(t.props.value),...t.props})})})})]})});exports.default=ee;
|