@dotss/ui 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Accordion/Accordion.cjs +13 -7
  2. package/Accordion/Accordion.d.ts +2 -0
  3. package/Accordion/Accordion.es.js +86 -65
  4. package/Autocomplete/Autocomplete.cjs +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/Autocomplete/Autocomplete.es.js +235 -80
  7. package/BottomSheet/BottomSheet.cjs +5 -5
  8. package/BottomSheet/BottomSheet.d.ts +3 -0
  9. package/BottomSheet/BottomSheet.es.js +88 -70
  10. package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
  11. package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
  12. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
  13. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
  14. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
  15. package/Button/Button.cjs +6 -6
  16. package/Button/Button.es.js +35 -29
  17. package/ChainPicker/ChainPicker.cjs +16 -6
  18. package/ChainPicker/ChainPicker.d.ts +4 -2
  19. package/ChainPicker/ChainPicker.es.js +155 -110
  20. package/ChainPicker/ChainPicker.stories.d.ts +1 -1
  21. package/Checkbox/Checkbox.cjs +3 -3
  22. package/Checkbox/Checkbox.es.js +12 -10
  23. package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
  24. package/CircularProgressIndicator/CircularProgressIndicator.es.js +25 -22
  25. package/DatePicker/DatePicker.cjs +37 -20
  26. package/DatePicker/DatePicker.d.ts +2 -1
  27. package/DatePicker/DatePicker.es.js +345 -320
  28. package/DatePicker/DatePicker.stories.d.ts +1 -0
  29. package/DatePicker/EventDot/EventDot.cjs +8 -0
  30. package/DatePicker/EventDot/EventDot.d.ts +8 -0
  31. package/DatePicker/EventDot/EventDot.es.js +19 -0
  32. package/DatePicker/EventDot/index.cjs +1 -0
  33. package/DatePicker/EventDot/index.d.ts +3 -0
  34. package/DatePicker/EventDot/index.es.js +4 -0
  35. package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
  36. package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
  37. package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
  38. package/DatePicker/EventDotGroup/index.cjs +1 -0
  39. package/DatePicker/EventDotGroup/index.d.ts +3 -0
  40. package/DatePicker/EventDotGroup/index.es.js +4 -0
  41. package/DatePicker/index.cjs +1 -1
  42. package/DatePicker/index.d.ts +2 -0
  43. package/DatePicker/index.es.js +6 -2
  44. package/Dialog/Dialog.cjs +2 -2
  45. package/Dialog/Dialog.d.ts +2 -0
  46. package/Dialog/Dialog.es.js +45 -40
  47. package/Dialog/Dialog.stories.d.ts +10 -0
  48. package/Dialog/DialogText/DialogText.cjs +1 -1
  49. package/Dialog/DialogText/DialogText.es.js +1 -1
  50. package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
  51. package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
  52. package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
  53. package/FocusBoundary/FocusBoundary.cjs +1 -1
  54. package/FocusBoundary/FocusBoundary.d.ts +3 -1
  55. package/FocusBoundary/FocusBoundary.es.js +49 -42
  56. package/FormControlText/FormControlText.cjs +7 -5
  57. package/FormControlText/FormControlText.d.ts +2 -0
  58. package/FormControlText/FormControlText.es.js +50 -40
  59. package/Icon/Icon.cjs +1 -1
  60. package/Icon/Icon.es.js +1 -1
  61. package/IconButton/IconButton.cjs +8 -8
  62. package/IconButton/IconButton.es.js +32 -25
  63. package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
  64. package/LineProgressIndicator/LineProgressIndicator.es.js +34 -22
  65. package/Menu/Menu.cjs +16 -16
  66. package/Menu/Menu.d.ts +3 -2
  67. package/Menu/Menu.es.js +115 -81
  68. package/Menu/Menu.stories.d.ts +1 -0
  69. package/Menu/MenuBlock/MenuBlock.cjs +14 -7
  70. package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
  71. package/Menu/MenuBlock/MenuBlock.es.js +47 -35
  72. package/Menu/MenuButton/MenuButton.cjs +1 -0
  73. package/Menu/MenuButton/MenuButton.d.ts +10 -0
  74. package/Menu/MenuButton/MenuButton.es.js +44 -0
  75. package/Menu/MenuButton/index.cjs +1 -0
  76. package/Menu/MenuButton/index.d.ts +3 -0
  77. package/Menu/MenuButton/index.es.js +4 -0
  78. package/Menu/index.cjs +1 -1
  79. package/Menu/index.d.ts +1 -0
  80. package/Menu/index.es.js +4 -2
  81. package/NumberKeypad/NumberKeypad.cjs +2 -2
  82. package/NumberKeypad/NumberKeypad.es.js +18 -16
  83. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
  84. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
  85. package/PageControl/PageControl.cjs +16 -5
  86. package/PageControl/PageControl.d.ts +3 -0
  87. package/PageControl/PageControl.es.js +77 -24
  88. package/PageControl/PageControl.stories.d.ts +1 -0
  89. package/Radio/Radio.cjs +3 -3
  90. package/Radio/Radio.es.js +22 -20
  91. package/RadioGroup/RadioGroup.cjs +1 -0
  92. package/RadioGroup/RadioGroup.d.ts +8 -0
  93. package/RadioGroup/RadioGroup.es.js +28 -0
  94. package/RadioGroup/RadioGroup.stories.d.ts +14 -0
  95. package/RadioGroup/index.cjs +1 -0
  96. package/RadioGroup/index.d.ts +3 -0
  97. package/RadioGroup/index.es.js +4 -0
  98. package/SegmentedButton/SegmentedButton.cjs +14 -3
  99. package/SegmentedButton/SegmentedButton.es.js +108 -34
  100. package/Select/Select.cjs +4 -4
  101. package/Select/Select.es.js +95 -86
  102. package/Slider/Slider.cjs +27 -12
  103. package/Slider/Slider.d.ts +1 -0
  104. package/Slider/Slider.es.js +177 -90
  105. package/Switch/Switch.cjs +28 -11
  106. package/Switch/Switch.d.ts +2 -0
  107. package/Switch/Switch.es.js +185 -65
  108. package/Switch/Switch.stories.d.ts +1 -0
  109. package/Tab/Tab.es.js +2 -4
  110. package/TextArea/TextArea.cjs +42 -34
  111. package/TextArea/TextArea.es.js +116 -82
  112. package/TextArea/TextArea.stories.d.ts +1 -1
  113. package/TextField/TextField.cjs +29 -13
  114. package/TextField/TextField.d.ts +2 -1
  115. package/TextField/TextField.es.js +122 -79
  116. package/TextField/TextField.stories.d.ts +1 -0
  117. package/Tooltip/Tooltip.cjs +7 -6
  118. package/Tooltip/Tooltip.d.ts +8 -3
  119. package/Tooltip/Tooltip.es.js +248 -146
  120. package/Tooltip/Tooltip.stories.d.ts +1 -0
  121. package/hooks/index.cjs +1 -1
  122. package/hooks/index.d.ts +3 -0
  123. package/hooks/index.es.js +7 -1
  124. package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
  125. package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
  126. package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
  127. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
  128. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
  129. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
  130. package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
  131. package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
  132. package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
  133. package/index.cjs +1 -1
  134. package/index.d.ts +2 -1
  135. package/index.es.js +97 -90
  136. package/package.json +3 -3
  137. package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
  138. package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
  139. package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
  140. package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
  141. package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
  142. package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
  143. package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
  144. package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
  145. package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
  146. package/resources/tictoccroc/icons/line/index.d.ts +4 -0
  147. package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
  148. package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
  149. package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
  150. package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
  151. package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
  152. package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
  153. package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
  154. package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
  155. package/utils/getIconLabel/getIconLabel.cjs +1 -1
  156. package/utils/getIconLabel/getIconLabel.es.js +8 -1
  157. package/utils/getSibling/getSibling.es.js +1 -2
  158. package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
  159. 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(g, { size: r, disabled: i, isHoverPossible: c, children: t }) });
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 i=require("@emotion/react/jsx-runtime"),f=require("react"),g=require("@emotion/styled"),m=e=>e&&e.__esModule?e:{default:e},n=m(g),y=n.default.div`
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
- `,h=n.default.span`
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:t})=>t==="primary"?e[10]:e[30]};
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:t,isActive:r})=>r?{width:24,borderRadius:8,backgroundColor:t==="primary"?e.primary.pageControl:e.primary.tooltip,cursor:"default"}:null}
15
- `,b=f.forwardRef(function({totalCount:t=1,page:r=1,onChange:a,color:s="primary",inlineCSS:u,...c},d){const p=l=>{typeof a=="function"&&a(Number(l.currentTarget.dataset.page))};return i.jsx(y,{ref:d,...c,css:u,children:Array.from({length:t},(l,o)=>i.jsx(h,{isActive:o+1===r,color:s,"data-page":o+1,onClick:p},o))})});exports.default=b;
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 n } from "@emotion/react/jsx-runtime";
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 f = p.div`
6
+ const H = p.div`
5
7
  display: flex;
6
8
  align-items: center;
7
- gap: ${({ theme: { spacing: r } }) => r.content(2)}px;
8
- `, g = p.span`
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: r }
30
+ palette: { grey: t }
15
31
  },
16
- color: t
17
- }) => t === "primary" ? r[10] : r[30]};
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: r }
40
+ palette: { brand: t }
25
41
  },
26
- color: t,
42
+ color: r,
27
43
  isActive: o
28
44
  }) => o ? {
29
45
  width: 24,
30
46
  borderRadius: 8,
31
- backgroundColor: t === "primary" ? r.primary.pageControl : r.primary.tooltip,
47
+ backgroundColor: r === "primary" ? t.primary.pageControl : t.primary.tooltip,
32
48
  cursor: "default"
33
49
  } : null}
34
- `, C = u(function({ totalCount: t = 1, page: o = 1, onChange: a, color: l = "primary", inlineCSS: s, ...c }, d) {
35
- const m = (i) => {
36
- typeof a == "function" && a(Number(i.currentTarget.dataset.page));
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__ */ n(f, { ref: d, ...c, css: s, children: Array.from({ length: t }, (i, e) => /* @__PURE__ */ n(
39
- g,
70
+ return /* @__PURE__ */ f(
71
+ H,
40
72
  {
41
- isActive: e + 1 === o,
42
- color: l,
43
- "data-page": e + 1,
44
- onClick: m
45
- },
46
- e
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
- C as default
103
+ O as default
51
104
  };
@@ -11,3 +11,4 @@ declare const meta: {
11
11
  export default meta;
12
12
  type Story = StoryObj<typeof meta>;
13
13
  export declare const Default: Story;
14
+ export declare const WithScreenReaderSupport: Story;
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"),y=require("@emotion/styled"),m=require("../core/useTheme.cjs"),c=t=>t&&t.__esModule?t:{default:t},p=c(y),C=p.default.span`
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
- opacity: 0;
10
+ appearance: none;
11
11
  cursor: pointer;
12
12
 
13
13
  &:disabled {
14
14
  cursor: default;
15
15
  }
16
- `;function g({size:t,color:i="primary",checked:s,disabled:n}){const{palette:{brand:r,grey:e,background:d}}=m.default();let l=e.white,u=e[50],o=e[10];return s&&(l=i==="primary"?r.primary.main:r[i],u=i==="primary"?r.primary.main:r[i],o=i==="primary"?e.white:e[10]),!s&&n&&(l=d.primary,u=e[30],o=e[20]),s&&n&&(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",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 h=f.forwardRef(function({size:i="medium",color:s="primary",checked:n,disabled:r,inlineCSS:e,...d},l){return a.jsxs(C,{ref:l,css:e,children:[a.jsx(x,{type:"radio",checked:n,disabled:r,...d}),a.jsx(g,{size:i,color:s,checked:n,disabled:r})]})});exports.default=h;
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 o } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as y } from "react";
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 u from "../core/useTheme.es.js";
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
- opacity: 0;
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: r = "primary",
24
- checked: a,
25
- disabled: p
23
+ color: i = "primary",
24
+ checked: t,
25
+ disabled: n
26
26
  }) {
27
27
  const {
28
- palette: { brand: t, grey: i, background: d }
29
- } = u();
30
- let e = i.white, l = i[50], n = i[10];
31
- return a && (e = r === "primary" ? t.primary.main : t[r], l = r === "primary" ? t.primary.main : t[r], n = r === "primary" ? i.white : i[10]), !a && p && (e = d.primary, l = i[30], n = i[20]), a && p && (e = r === "primary" ? t.primary.disable : i[30], l = r === "primary" ? t.primary.disable : i[30], n = r === "primary" ? i.white : i[10]), /* @__PURE__ */ s(
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__ */ o(
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: e
46
+ fill: a
45
47
  }
46
48
  ),
47
- /* @__PURE__ */ o(
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__ */ o("circle", { cx: "12", cy: "12", r: "4", fill: n })
58
+ /* @__PURE__ */ p("circle", { cx: "12", cy: "12", r: "4", fill: o })
57
59
  ]
58
60
  }
59
61
  );
60
62
  }
61
- const b = y(function({ size: r = "medium", color: a = "primary", checked: p, disabled: t, inlineCSS: i, ...d }, e) {
62
- return /* @__PURE__ */ s(C, { ref: e, css: i, children: [
63
- /* @__PURE__ */ o(h, { type: "radio", checked: p, disabled: t, ...d }),
64
- /* @__PURE__ */ o(w, { size: r, color: a, checked: p, disabled: t })
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
- b as default
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;
@@ -0,0 +1,3 @@
1
+ import { default as RadioGroup } from './RadioGroup';
2
+
3
+ export default RadioGroup;
@@ -0,0 +1,4 @@
1
+ import r from "./RadioGroup.es.js";
2
+ export {
3
+ r as default
4
+ };
@@ -1,7 +1,18 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("@emotion/react/jsx-runtime"),n=require("react"),m=require("@emotion/styled"),x=e=>e&&e.__esModule?e:{default:e},b=x(m),j=b.default.div`
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:e})=>e?{width:"100%","& > button":{width:"100%",flexShrink:1}}:null}
7
- `,k=n.forwardRef(function({children:u,variant:d="outlined",color:c="primary",rounded:a=!0,onChange:r,value:f,fullWidth:p,inlineCSS:y,disabled:_,...g},h){const v=(t,i)=>o=>{typeof r=="function"&&r(t),typeof i=="function"&&i(o)};return S.jsx(j,{ref:h,fullWidth:p,...g,css:y,children:n.Children.map(u,(t,i)=>{var o,s,l;return n.isValidElement(t)?n.cloneElement(t,{...t.props,variant:d,color:c,rounded:a,disabled:_,isActive:f===((o=t.props)==null?void 0:o.value),isFirst:i===0,isLast:n.Children.count(u)-1===i,onClick:v((s=t.props)==null?void 0:s.value,(l=t.props)==null?void 0:l.onClick)}):null})})});exports.default=k;
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 x } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as S, Children as u, isValidElement as k, cloneElement as w } from "react";
3
- import B from "@emotion/styled";
4
- const C = B.div`
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: r }) => r ? {
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
- `, A = S(function({
17
- children: n,
18
- variant: f = "outlined",
19
- color: l = "primary",
20
- rounded: d = !0,
21
- onChange: s,
22
- value: c,
23
- fullWidth: a,
24
- inlineCSS: m,
25
- disabled: y,
26
- ...h
27
- }, g) {
28
- const v = (t, o) => (i) => {
29
- typeof s == "function" && s(t), typeof o == "function" && o(i);
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__ */ x(C, { ref: g, fullWidth: a, ...h, css: m, children: u.map(n, (t, o) => {
32
- var i, e, p;
33
- return k(t) ? w(t, {
34
- ...t.props,
35
- variant: f,
36
- color: l,
37
- rounded: d,
38
- disabled: y,
39
- isActive: c === ((i = t.props) == null ? void 0 : i.value),
40
- isFirst: o === 0,
41
- isLast: u.count(n) - 1 === o,
42
- onClick: v((e = t.props) == null ? void 0 : e.value, (p = t.props) == null ? void 0 : p.onClick)
43
- }) : null;
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
- A as default
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 c=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"),I=require("../utils/getSibling/getSibling.cjs"),G=e=>e&&e.__esModule?e:{default:e},m=G(X),J=m.default.div`
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:b})=>{let s={};switch(b){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}}
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:b})=>{const s={fontSize:e.b2R.size,fontWeight:e.b2R.size,lineHeight:e.b2R.lineHeight,letterSpacing:e.b2R.letterSpacing,"&[disabled]":{color:r[30]}};return b?{...s,color:r[100]}:{...s,color:r[50]}}}
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:b,open:s,onOpen:$,onClose:v,variant:E="outlined",size:q="large",startAdornment:j,placeholder:O="TEXT",disabled:C=!1,fullWidth:W,children:g,inlineCSS:D,...w},z){const _=i.useId(),p=i.useRef(null),H=i.useRef(null),x=i.useRef(""),[d,u]=i.useState(s||!1),[a,l]=i.useState(""),[S,k]=i.useState({top:0,bottom:0,left:0,width:0}),f=(w==null?void 0:w.id)||_,B=()=>{s===void 0?u(t=>!t):s===!1&&$&&typeof $=="function"&&$()},y=t=>()=>{b(t.toString()),R()},R=()=>{s===void 0?(u(!1),l("")):s===!0&&v&&typeof v=="function"&&v()},L=t=>{if(t.preventDefault(),t.code==="Escape"&&u(!1),t.code==="Space"||t.code==="Enter")if(x.current?l(x.current):a||l(`${f}-0`),d){if(a){const n=document.querySelector(`#${CSS.escape(a)}`);n&&n.hasAttribute("value")&&(x.current=n==null?void 0:n.id,y(n.value)())}u(!1)}else u(!0);if(t.code==="ArrowDown"||t.code==="ArrowUp"){if(d||u(!0),x.current?l(x.current):l(`${f}-0`),!a)return;const n=document.querySelector(`#${CSS.escape(a)}`);if(!n)return;if(t.code==="ArrowDown"){const o=I.default(n,"next",{skipDisabled:!0});o&&o.id?(l(o.id),o.scrollIntoView({block:"end"})):l(a)}if(t.code==="ArrowUp"){const o=I.default(n,"prev",{skipDisabled:!0});o&&o.id&&(l(o.id),o.scrollIntoView({block:"end"}))}}if(t.code==="Home"&&l(`${f}-0`),t.code==="End"){const n=i.Children.count(g);l(`${f}-${n-1}`)}},V=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(p.current){const n=p.current.getBoundingClientRect(),o=i.Children.count(g),h=40,A=24,F=h*o>476?476:h*o,M=p.current.getBoundingClientRect().bottom+F+A>window.innerHeight;k(M?{bottom:24,left:n.left,width:p.current.offsetWidth}:{top:n.top+n.height,left:n.left,width:p.current.offsetWidth})}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[g]),i.useEffect(()=>{s!==void 0&&u(s)},[s]),c.jsxs(T.default,{ref:z,inlineCSS:{position:"relative"},children:[c.jsxs(J,{role:"combobox",ref:p,tabIndex:0,variant:E,size:q,disabled:C,fullWidth:W,isFocused:d,onClick:B,onKeyDown:L,"aria-controls":f,"aria-expanded":d,"aria-haspopup":"listbox","aria-activedescendant":a,...w,css:D,children:[c.jsxs(N,{value:r==="0"||!!r,disabled:C,children:[j&&c.jsx(K.default,{justifyContent:"center",alignItems:"center",children:j}),c.jsx(Q,{children:V(g)||O})]}),c.jsx(Y,{isFocused:d,children:c.jsx(U.default,{name:"ChevronDownLine",size:"small",color:C?"grey.30":"grey.100"})})]}),c.jsx(P.default,{open:d,onClose:R,inlineCSS:{backgroundColor:"transparent"},children:c.jsx(Z,{id:f,role:"listbox",ref:H,tabIndex:-1,isFocused:d,style:{top:S.top,bottom:S.bottom,left:S.left,width:S.width},children:i.Children.map(g,(t,n)=>{if(!i.isValidElement(t)||!t.props.value)return null;const o=`${f}-${n}`,h=r===t.props.value;return h&&(x.current=o),i.cloneElement(t,{id:o,selected:h,focused:o===a,onClick:y(t.props.value)})})})})]})});exports.default=ee;
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;