@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.
- 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 +25 -22
- 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 +34 -22
- 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
package/Switch/Switch.es.js
CHANGED
|
@@ -1,59 +1,100 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { jsxs as E, jsx as c } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as j, useState as b, useRef as v, useEffect as T } from "react";
|
|
3
|
+
import h from "@emotion/styled";
|
|
4
|
+
import U from "../core/useTheme.es.js";
|
|
5
|
+
const B = h.div`
|
|
5
6
|
position: relative;
|
|
6
7
|
display: flex;
|
|
7
|
-
width: 56px;
|
|
8
|
+
min-width: 56px;
|
|
8
9
|
height: 32px;
|
|
9
|
-
padding: ${({ theme: { spacing:
|
|
10
|
+
padding: ${({ theme: { spacing: t } }) => `${t.content(1)}px`};
|
|
10
11
|
align-items: center;
|
|
11
12
|
border-radius: 20px;
|
|
12
|
-
transition: ${({ transitionDuration:
|
|
13
|
-
pointer-events: ${({ disabled:
|
|
13
|
+
transition: ${({ transitionDuration: t }) => `background-color ${t}ms ease-in-out`};
|
|
14
|
+
pointer-events: ${({ disabled: t }) => t ? "none" : "auto"};
|
|
14
15
|
|
|
15
16
|
${({
|
|
16
17
|
theme: {
|
|
17
|
-
palette: { brand:
|
|
18
|
+
palette: { brand: t, grey: r }
|
|
18
19
|
},
|
|
19
20
|
selected: o,
|
|
20
|
-
disabled:
|
|
21
|
-
}) => o &&
|
|
22
|
-
backgroundColor:
|
|
23
|
-
} : o && !
|
|
24
|
-
backgroundColor:
|
|
25
|
-
} : !o &&
|
|
26
|
-
backgroundColor:
|
|
27
|
-
} : !o && !
|
|
28
|
-
backgroundColor:
|
|
21
|
+
disabled: n
|
|
22
|
+
}) => o && n ? {
|
|
23
|
+
backgroundColor: t.primary.bg
|
|
24
|
+
} : o && !n ? {
|
|
25
|
+
backgroundColor: t.primary.main
|
|
26
|
+
} : !o && n ? {
|
|
27
|
+
backgroundColor: r[20]
|
|
28
|
+
} : !o && !n ? {
|
|
29
|
+
backgroundColor: r[40]
|
|
29
30
|
} : {}}
|
|
30
|
-
`,
|
|
31
|
+
`, I = h.div`
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: ${({ withLabel: t }) => t ? "24px" : "auto"};
|
|
31
34
|
width: 24px;
|
|
32
35
|
height: 24px;
|
|
33
36
|
border-radius: 50%;
|
|
34
|
-
transition: ${({ transitionDuration:
|
|
37
|
+
transition: ${({ transitionDuration: t }) => `all ${t}ms ease-in-out`};
|
|
35
38
|
transition-property: background-color, transform, filter;
|
|
36
39
|
|
|
37
40
|
${({
|
|
38
41
|
theme: {
|
|
39
|
-
palette: { grey:
|
|
42
|
+
palette: { grey: t, background: r },
|
|
43
|
+
spacing: o
|
|
40
44
|
},
|
|
41
|
-
selected:
|
|
42
|
-
disabled:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
selected: n,
|
|
46
|
+
disabled: e,
|
|
47
|
+
labelWidth: u,
|
|
48
|
+
withLabel: s
|
|
49
|
+
}) => {
|
|
50
|
+
if (s) {
|
|
51
|
+
if (n && e)
|
|
52
|
+
return {
|
|
53
|
+
backgroundColor: t.white,
|
|
54
|
+
transform: `translateX(calc(100% - ${o.content(1)}px))`
|
|
55
|
+
};
|
|
56
|
+
if (n && !e)
|
|
57
|
+
return {
|
|
58
|
+
backgroundColor: t.white,
|
|
59
|
+
filter: "drop-shadow(0px 0px 16px rgba(69, 55, 55, 0.2))",
|
|
60
|
+
transform: `translateX(calc(100% - ${o.content(1)}px))`
|
|
61
|
+
};
|
|
62
|
+
if (!n && e)
|
|
63
|
+
return {
|
|
64
|
+
backgroundColor: r.primary,
|
|
65
|
+
transform: `translateX(calc(100% - ${u + o.content(1)}px))`
|
|
66
|
+
};
|
|
67
|
+
if (!n && !e)
|
|
68
|
+
return {
|
|
69
|
+
backgroundColor: t.white,
|
|
70
|
+
filter: "drop-shadow(0px 0px 16px rgba(0, 0, 0, 0.20))",
|
|
71
|
+
transform: `translateX(calc(100% - ${u + o.content(1)}px))`
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
if (n && e)
|
|
75
|
+
return {
|
|
76
|
+
backgroundColor: t.white,
|
|
77
|
+
transform: "translateX(100%)"
|
|
78
|
+
};
|
|
79
|
+
if (n && !e)
|
|
80
|
+
return {
|
|
81
|
+
backgroundColor: t.white,
|
|
82
|
+
filter: "drop-shadow(0px 0px 16px rgba(69, 55, 55, 0.2))",
|
|
83
|
+
transform: "translateX(100%)"
|
|
84
|
+
};
|
|
85
|
+
if (!n && e)
|
|
86
|
+
return {
|
|
87
|
+
backgroundColor: r.primary
|
|
88
|
+
};
|
|
89
|
+
if (!n && !e)
|
|
90
|
+
return {
|
|
91
|
+
backgroundColor: t.white,
|
|
92
|
+
filter: "drop-shadow(0px 0px 16px rgba(0, 0, 0, 0.20))"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {};
|
|
96
|
+
}}
|
|
97
|
+
`, q = h.input`
|
|
57
98
|
position: absolute;
|
|
58
99
|
appearance: none;
|
|
59
100
|
width: 100%;
|
|
@@ -62,50 +103,129 @@ const x = i.div`
|
|
|
62
103
|
left: 0;
|
|
63
104
|
border-radius: 20px;
|
|
64
105
|
cursor: pointer;
|
|
65
|
-
`,
|
|
66
|
-
|
|
106
|
+
`, C = h.div`
|
|
107
|
+
position: absolute;
|
|
108
|
+
opacity: ${({ selected: t }) => t ? 1 : 0};
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
transition: opacity 0.2s;
|
|
111
|
+
|
|
112
|
+
${({ theme: { spacing: t }, variant: r }) => {
|
|
113
|
+
switch (r) {
|
|
114
|
+
case "unselected":
|
|
115
|
+
return {
|
|
116
|
+
right: t.content(2)
|
|
117
|
+
};
|
|
118
|
+
case "selected":
|
|
119
|
+
return {
|
|
120
|
+
left: t.content(2)
|
|
121
|
+
};
|
|
122
|
+
default:
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
}}
|
|
126
|
+
|
|
127
|
+
${({
|
|
128
|
+
theme: {
|
|
129
|
+
typography: t,
|
|
130
|
+
palette: { grey: r }
|
|
131
|
+
}
|
|
132
|
+
}) => ({
|
|
133
|
+
fontSize: t.c2M.size,
|
|
134
|
+
fontWeight: t.c2M.weight,
|
|
135
|
+
lineHeight: t.c2M.lineHeight,
|
|
136
|
+
color: r.white
|
|
137
|
+
})}
|
|
138
|
+
`, S = h.div`
|
|
139
|
+
${({ theme: { spacing: t }, variant: r }) => {
|
|
140
|
+
switch (r) {
|
|
141
|
+
case "unselected":
|
|
142
|
+
return {
|
|
143
|
+
marginRight: `${t.content(8)}px`
|
|
144
|
+
};
|
|
145
|
+
case "selected":
|
|
146
|
+
return {
|
|
147
|
+
marginRight: `${t.content(8)}px`
|
|
148
|
+
};
|
|
149
|
+
default:
|
|
150
|
+
return {};
|
|
151
|
+
}
|
|
152
|
+
}}
|
|
153
|
+
|
|
154
|
+
visibility: hidden;
|
|
155
|
+
|
|
156
|
+
${({
|
|
157
|
+
theme: {
|
|
158
|
+
typography: t,
|
|
159
|
+
palette: { grey: r }
|
|
160
|
+
}
|
|
161
|
+
}) => ({
|
|
162
|
+
fontSize: t.c2M.size,
|
|
163
|
+
fontWeight: t.c2M.weight,
|
|
164
|
+
lineHeight: t.c2M.lineHeight,
|
|
165
|
+
color: r.white
|
|
166
|
+
})}
|
|
167
|
+
`, G = j(function({
|
|
168
|
+
selected: r,
|
|
67
169
|
disabled: o,
|
|
68
|
-
onChange:
|
|
69
|
-
transitionDuration:
|
|
70
|
-
inputProps:
|
|
71
|
-
thumbProps:
|
|
72
|
-
inlineCSS:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
170
|
+
onChange: n,
|
|
171
|
+
transitionDuration: e = 150,
|
|
172
|
+
inputProps: u,
|
|
173
|
+
thumbProps: s,
|
|
174
|
+
inlineCSS: W,
|
|
175
|
+
selectedLabel: i,
|
|
176
|
+
unselectedLabel: a,
|
|
177
|
+
...z
|
|
178
|
+
}, R) {
|
|
179
|
+
const { spacing: f } = U(), [l, M] = b(0), [m, X] = b(0), d = v(null), w = v(null), H = !!i || !!a, L = r ? m || l : l || m;
|
|
180
|
+
return T(() => {
|
|
181
|
+
const p = () => {
|
|
182
|
+
var $, k;
|
|
183
|
+
const x = (($ = w.current) == null ? void 0 : $.offsetWidth) ?? 0, g = ((k = d.current) == null ? void 0 : k.offsetWidth) ?? 0;
|
|
184
|
+
x > 0 && X(x + f.content(2)), g > 0 && M(g + f.content(2));
|
|
185
|
+
};
|
|
186
|
+
return p(), window.addEventListener("resize", p), () => {
|
|
187
|
+
window.removeEventListener("resize", p);
|
|
188
|
+
};
|
|
189
|
+
}, [f, a, i, r]), /* @__PURE__ */ E(
|
|
190
|
+
B,
|
|
77
191
|
{
|
|
78
|
-
ref:
|
|
79
|
-
selected:
|
|
192
|
+
ref: R,
|
|
193
|
+
selected: r,
|
|
80
194
|
disabled: o,
|
|
81
|
-
transitionDuration:
|
|
82
|
-
css:
|
|
83
|
-
...
|
|
195
|
+
transitionDuration: e,
|
|
196
|
+
css: W,
|
|
197
|
+
...z,
|
|
84
198
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
199
|
+
/* @__PURE__ */ c(
|
|
200
|
+
I,
|
|
87
201
|
{
|
|
88
|
-
selected:
|
|
202
|
+
selected: r,
|
|
89
203
|
disabled: o,
|
|
90
|
-
|
|
91
|
-
|
|
204
|
+
labelWidth: L,
|
|
205
|
+
withLabel: H,
|
|
206
|
+
transitionDuration: e,
|
|
207
|
+
...s
|
|
92
208
|
}
|
|
93
209
|
),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
210
|
+
/* @__PURE__ */ c(
|
|
211
|
+
q,
|
|
96
212
|
{
|
|
97
213
|
type: "checkbox",
|
|
98
214
|
role: "switch",
|
|
99
|
-
checked:
|
|
215
|
+
checked: r,
|
|
100
216
|
disabled: o,
|
|
101
|
-
onChange:
|
|
102
|
-
...
|
|
217
|
+
onChange: n,
|
|
218
|
+
...u
|
|
103
219
|
}
|
|
104
|
-
)
|
|
220
|
+
),
|
|
221
|
+
a && !r && /* @__PURE__ */ c(S, { ref: d, variant: "unselected", "aria-hidden": !0, children: a }),
|
|
222
|
+
i && r && /* @__PURE__ */ c(S, { ref: w, variant: "selected", "aria-hidden": !0, children: i }),
|
|
223
|
+
a && /* @__PURE__ */ c(C, { variant: "unselected", selected: !r, "aria-hidden": r, children: a }),
|
|
224
|
+
i && /* @__PURE__ */ c(C, { variant: "selected", selected: r, "aria-hidden": !r, children: i })
|
|
105
225
|
]
|
|
106
226
|
}
|
|
107
227
|
);
|
|
108
228
|
});
|
|
109
229
|
export {
|
|
110
|
-
|
|
230
|
+
G as default
|
|
111
231
|
};
|
package/Tab/Tab.es.js
CHANGED
|
@@ -40,8 +40,7 @@ const tt = D.div`
|
|
|
40
40
|
)), _ = (t) => (n) => {
|
|
41
41
|
v.current && (T(t, n.currentTarget), v.current = !1);
|
|
42
42
|
}, G = (t) => {
|
|
43
|
-
if (!s.current)
|
|
44
|
-
return;
|
|
43
|
+
if (!s.current) return;
|
|
45
44
|
const n = s.current.querySelectorAll(
|
|
46
45
|
'[role="tab"]:not([disabled])'
|
|
47
46
|
), o = Array.from(n).findIndex((e) => e === document.activeElement);
|
|
@@ -109,8 +108,7 @@ const tt = D.div`
|
|
|
109
108
|
};
|
|
110
109
|
}, [m, l, w]), F(() => {
|
|
111
110
|
const t = s.current, n = (r) => {
|
|
112
|
-
if (!g || !s.current)
|
|
113
|
-
return;
|
|
111
|
+
if (!g || !s.current) return;
|
|
114
112
|
const a = x - r;
|
|
115
113
|
let c = E + a;
|
|
116
114
|
const p = s.current.scrollWidth - s.current.clientWidth;
|
package/TextArea/TextArea.cjs
CHANGED
|
@@ -1,68 +1,76 @@
|
|
|
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 l=require("@emotion/react/jsx-runtime"),a=require("react"),_=require("@emotion/styled"),h=require("../Typography/Typography.cjs"),q=e=>e&&e.__esModule?e:{default:e},d=q(_),A=d.default.div`
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
${({fullWidth:e})=>e?{width:"100%"}:null};
|
|
6
|
+
`,T=d.default.div`
|
|
2
7
|
position: relative;
|
|
3
8
|
border-radius: 12px;
|
|
4
9
|
height: auto;
|
|
5
10
|
overflow: hidden;
|
|
6
11
|
|
|
7
|
-
${({theme:{palette:{brand:
|
|
12
|
+
${({theme:{palette:{brand:e,background:t,grey:n}},variant:c,isFocused:r})=>c==="filled"?{backgroundColor:t.primary,border:"1px solid transparent"}:c==="outlined"?r?{backgroundColor:n.white,border:`1px solid ${e.primary.line}`}:{backgroundColor:n.white,border:`1px solid ${n[50]}`}:{}};
|
|
8
13
|
|
|
9
|
-
${({theme:{palette:{etc:
|
|
14
|
+
${({theme:{palette:{etc:e}},variant:t,helper:n})=>t==="outlined"&&((n==null?void 0:n.severity)==="error"||n!=null&&n.message)?{borderColor:e.red}:{}}
|
|
10
15
|
|
|
11
|
-
${({theme:{palette:{grey:
|
|
16
|
+
${({theme:{palette:{grey:e}},variant:t,disabled:n})=>t==="outlined"&&n?{backgroundColor:e[10],borderColor:e[30]}:{}}
|
|
12
17
|
|
|
13
|
-
${({fullWidth:
|
|
14
|
-
`,
|
|
18
|
+
${({fullWidth:e})=>e?{width:"100%"}:{}}
|
|
19
|
+
`,F=d.default.textarea`
|
|
15
20
|
width: 100%;
|
|
16
21
|
overflow: hidden;
|
|
17
22
|
resize: none;
|
|
18
23
|
border: none;
|
|
19
24
|
outline: 0;
|
|
20
25
|
background: transparent;
|
|
21
|
-
padding: ${({theme:
|
|
22
|
-
min-height: ${({minHeight:
|
|
26
|
+
padding: ${({theme:e})=>`${e.spacing.content(3)}px ${e.spacing.content(4)}px ${e.spacing.content(2)}px`};
|
|
27
|
+
min-height: ${({minHeight:e})=>e}px;
|
|
23
28
|
|
|
24
|
-
${({theme:{typography:{b2R:
|
|
29
|
+
${({theme:{typography:{b2R:e}}})=>({fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing})};
|
|
25
30
|
|
|
26
31
|
@media (max-width: 360px) {
|
|
27
|
-
${({theme:{typography:{b3R:
|
|
32
|
+
${({theme:{typography:{b3R:e}}})=>({fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing})};
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
&::placeholder
|
|
31
|
-
|
|
35
|
+
&::placeholder,
|
|
36
|
+
&::-webkit-input-placeholder,
|
|
37
|
+
&::-ms-input-placeholder,
|
|
38
|
+
&::-moz-placeholder {
|
|
39
|
+
color: ${({theme:e})=>e.palette.grey[50]};
|
|
32
40
|
text-align: justify;
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
&[disabled] {
|
|
36
|
-
color: ${({theme:
|
|
44
|
+
color: ${({theme:e})=>e.palette.grey[30]};
|
|
37
45
|
cursor: not-allowed;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
&[disabled]::placeholder {
|
|
41
|
-
color: ${({theme:
|
|
49
|
+
color: ${({theme:e})=>e.palette.grey[30]};
|
|
42
50
|
}
|
|
43
|
-
`,
|
|
44
|
-
color: ${({theme:
|
|
51
|
+
`,B=d.default.div`
|
|
52
|
+
color: ${({theme:e,disabled:t})=>t?e.palette.grey[30]:e.palette.grey[50]};
|
|
45
53
|
text-align: right;
|
|
46
|
-
padding-right: ${({theme:
|
|
47
|
-
padding-bottom: ${({theme:
|
|
54
|
+
padding-right: ${({theme:e})=>e.spacing.content(4)}px;
|
|
55
|
+
padding-bottom: ${({theme:e})=>e.spacing.content(3)}px;
|
|
48
56
|
|
|
49
|
-
${({theme:{typography:{b4R:
|
|
57
|
+
${({theme:{typography:{b4R:e}}})=>({fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing})};
|
|
50
58
|
|
|
51
59
|
& > span {
|
|
52
|
-
color: ${({theme:
|
|
60
|
+
color: ${({theme:e,disabled:t})=>t?e.palette.grey[30]:e.palette.grey[100]};
|
|
53
61
|
}
|
|
54
|
-
`,
|
|
55
|
-
margin-top: ${({theme:{spacing:t}})=>t.content(1)}px;
|
|
56
|
-
color: ${({theme:t})=>t.palette.etc.red};
|
|
57
|
-
|
|
58
|
-
${({theme:{typography:{c3R:t}}})=>({fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing})};
|
|
59
|
-
`,T=c.default.p`
|
|
62
|
+
`,D=d.default.p`
|
|
60
63
|
position: absolute;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
left: 0;
|
|
65
|
+
bottom: calc(
|
|
66
|
+
${({theme:{spacing:e}})=>-e.content(1)}px -
|
|
67
|
+
${({theme:{typography:{c3R:e}}})=>e.lineHeight}
|
|
68
|
+
);
|
|
69
|
+
color: ${({theme:e})=>e.palette.etc.red};
|
|
70
|
+
|
|
71
|
+
${({theme:{typography:{c3R:e}}})=>({fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing})};
|
|
72
|
+
|
|
73
|
+
&:empty {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
`,E=a.forwardRef(({onChange:e,value:t,variant:n="filled",size:c="large",maxLength:r=290,onFocus:y,onBlur:x,helper:o,disabled:u=!1,fullWidth:H,wrapperProps:g,...v},j)=>{const f=a.useRef(null),p=a.useRef(c==="large"?112.5:57.5),[b,$]=a.useState(!1),S=a.useId(),w=a.useId(),m=a.useId(),z=i=>{i.target.value.length>r&&(i.target.value=i.target.value.slice(0,r)),typeof e=="function"&&e(i)},C=i=>{$(!0),typeof y=="function"&&y(i)},k=i=>{$(!1),typeof x=="function"&&x(i)},I=()=>{var s;const i=(s=f.current)==null?void 0:s.querySelector("textarea");i&&i.focus()};return a.useEffect(()=>{var s;const i=(s=f.current)==null?void 0:s.querySelector("textarea");if(i){i.style.height="auto";const{scrollHeight:M,clientHeight:W}=i;i.style.height=`${p.current}px`,i.style.height=`${Math.max(M,p.current,W)}px`}},[t]),l.jsxs(A,{fullWidth:H,children:[l.jsxs(T,{ref:f,isFocused:b,variant:n,helper:o,disabled:u,...g,css:g==null?void 0:g.inlineCSS,children:[l.jsx(F,{ref:j,id:w,onChange:z,onFocus:C,onBlur:k,value:t,disabled:u,"aria-invalid":(o==null?void 0:o.severity)==="error","aria-describedby":o!=null&&o.message?S:m,minHeight:p.current,...v}),l.jsxs(B,{disabled:u,onClick:I,"aria-label":`현재 ${t.length}자 입력됨, 최대 ${r}자까지 입력 가능`,children:["(",l.jsx("span",{children:t.length})," / ",r,")"]})]}),l.jsx(D,{id:S,helper:o,"aria-live":"assertive",role:"alert",children:!u&&(o==null?void 0:o.message)}),l.jsxs(h.default,{visuallyHidden:!0,id:m,children:["최대 ",r,"까지 입력 가능"]}),l.jsx(h.default,{visuallyHidden:!0,"aria-live":"assertive",role:"alert",children:t.length>=r&&`최대 입력 글자 수에 도달하였습니다. ${r} 자까지 입력이 가능합니다.`}),l.jsx(h.default,{visuallyHidden:!0,role:"status",children:t.length>=r*.8&&t.length<r&&`최대 입력 가능한 글자 수의 80퍼센트에 도달했습니다. ${r*.8}자 입력됨.`})]})});exports.default=E;
|