@cfx-dev/ui-components 4.5.1 → 4.5.3
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/dist/assets/all_css.css +2 -0
- package/dist/assets/css/Input.css +1 -1
- package/dist/assets/css/StyledInput.css +1 -0
- package/dist/assets/css/StyledTextarea.css +1 -0
- package/dist/assets/css/Textarea.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.js +139 -129
- package/dist/components/DropdownSelect/DropdownSelect.d.ts +2 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +53 -44
- package/dist/components/DropdownSelect/DropdownSelectShowcase.js +13 -12
- package/dist/components/Input/Input.d.ts +3 -2
- package/dist/components/Input/Input.js +94 -89
- package/dist/components/Input/Input.types.d.ts +2 -0
- package/dist/components/Input/Input.types.js +1 -0
- package/dist/components/Input/RichInput.d.ts +1 -1
- package/dist/components/Input/index.d.ts +2 -1
- package/dist/components/InputDropzone/InputDropzone.d.ts +1 -0
- package/dist/components/InputDropzone/InputDropzone.js +135 -134
- package/dist/components/InputDropzone/InputDropzoneShowcase.js +6 -5
- package/dist/components/Radio/Radio.d.ts +1 -0
- package/dist/components/Radio/Radio.js +21 -19
- package/dist/components/StyledInput/StyledInput.d.ts +12 -0
- package/dist/components/StyledInput/StyledInput.js +46 -0
- package/dist/components/StyledInput/index.d.ts +2 -0
- package/dist/components/StyledInput/index.js +4 -0
- package/dist/components/StyledTextarea/StyledTextarea.d.ts +10 -0
- package/dist/components/StyledTextarea/StyledTextarea.js +32 -0
- package/dist/components/StyledTextarea/index.d.ts +2 -0
- package/dist/components/StyledTextarea/index.js +4 -0
- package/dist/components/Switch/Switch.js +61 -49
- package/dist/components/Tabular/Tabular.d.ts +12 -0
- package/dist/components/Tabular/Tabular.js +34 -33
- package/dist/components/Tabular/index.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +7 -3
- package/dist/components/Textarea/Textarea.js +46 -43
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +57 -47
- package/dist/main.d.ts +5 -1
- package/dist/main.js +126 -122
- package/dist/rsc.d.ts +4 -0
- package/dist/rsc.js +12 -8
- package/dist/styles-scss/global.scss +1 -1
- package/dist/styles-scss/tokens.scss +19 -20
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export interface CheckboxProps extends Omit<CheckboxUi.CheckboxProps, 'color'>,
|
|
|
8
8
|
rootClassName?: string;
|
|
9
9
|
indicatorClassName?: string;
|
|
10
10
|
iconIndicator?: React.ComponentType;
|
|
11
|
+
name?: string;
|
|
11
12
|
}
|
|
12
13
|
declare function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare const _default: React.MemoExoticComponent<typeof Checkbox>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as a, jsxs as w, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
3
|
import G from "react";
|
|
4
4
|
import { c as K, P as E, d as X, u as B, e as q, f as J } from "../../index-DCuJlMqr.js";
|
|
5
5
|
import { u as Q } from "../../index-BZPx6jYI.js";
|
|
@@ -57,137 +57,137 @@ import "../Icons/cfx-icons-big/Warning.js";
|
|
|
57
57
|
import "../Icons/cfx-icons-big/Confirm.js";
|
|
58
58
|
import { clsx as g } from "../../utils/clsx.js";
|
|
59
59
|
import { getColor as Z } from "../../utils/color.js";
|
|
60
|
-
var
|
|
60
|
+
var y = "Checkbox", [ee, ko] = K(y), [oe, N] = ee(y);
|
|
61
61
|
function te(o) {
|
|
62
62
|
const {
|
|
63
|
-
__scopeCheckbox:
|
|
64
|
-
checked:
|
|
65
|
-
children:
|
|
63
|
+
__scopeCheckbox: i,
|
|
64
|
+
checked: c,
|
|
65
|
+
children: d,
|
|
66
66
|
defaultChecked: t,
|
|
67
67
|
disabled: e,
|
|
68
68
|
form: f,
|
|
69
69
|
name: _,
|
|
70
|
-
onCheckedChange:
|
|
71
|
-
required:
|
|
72
|
-
value:
|
|
70
|
+
onCheckedChange: m,
|
|
71
|
+
required: h,
|
|
72
|
+
value: l = "on",
|
|
73
73
|
// @ts-expect-error
|
|
74
|
-
internal_do_not_use_render:
|
|
75
|
-
} = o, [p,
|
|
76
|
-
prop:
|
|
74
|
+
internal_do_not_use_render: r
|
|
75
|
+
} = o, [p, v] = X({
|
|
76
|
+
prop: c,
|
|
77
77
|
defaultProp: t ?? !1,
|
|
78
|
-
onChange:
|
|
79
|
-
caller:
|
|
80
|
-
}), [
|
|
78
|
+
onChange: m,
|
|
79
|
+
caller: y
|
|
80
|
+
}), [k, b] = u.useState(null), [I, n] = u.useState(null), s = u.useRef(!1), R = k ? !!f || !!k.closest("form") : (
|
|
81
81
|
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
82
82
|
!0
|
|
83
83
|
), P = {
|
|
84
84
|
checked: p,
|
|
85
85
|
disabled: e,
|
|
86
|
-
setChecked:
|
|
87
|
-
control:
|
|
88
|
-
setControl:
|
|
86
|
+
setChecked: v,
|
|
87
|
+
control: k,
|
|
88
|
+
setControl: b,
|
|
89
89
|
name: _,
|
|
90
90
|
form: f,
|
|
91
|
-
value:
|
|
91
|
+
value: l,
|
|
92
92
|
hasConsumerStoppedPropagationRef: s,
|
|
93
|
-
required:
|
|
94
|
-
defaultChecked:
|
|
95
|
-
isFormControl:
|
|
93
|
+
required: h,
|
|
94
|
+
defaultChecked: x(t) ? !1 : t,
|
|
95
|
+
isFormControl: R,
|
|
96
96
|
bubbleInput: I,
|
|
97
|
-
setBubbleInput:
|
|
97
|
+
setBubbleInput: n
|
|
98
98
|
};
|
|
99
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ a(
|
|
100
100
|
oe,
|
|
101
101
|
{
|
|
102
|
-
scope:
|
|
102
|
+
scope: i,
|
|
103
103
|
...P,
|
|
104
|
-
children: re(
|
|
104
|
+
children: re(r) ? r(P) : d
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
|
-
var T = "CheckboxTrigger", M =
|
|
109
|
-
({ __scopeCheckbox: o, onKeyDown:
|
|
108
|
+
var T = "CheckboxTrigger", M = u.forwardRef(
|
|
109
|
+
({ __scopeCheckbox: o, onKeyDown: i, onClick: c, ...d }, t) => {
|
|
110
110
|
const {
|
|
111
111
|
control: e,
|
|
112
112
|
value: f,
|
|
113
113
|
disabled: _,
|
|
114
|
-
checked:
|
|
115
|
-
required:
|
|
116
|
-
setControl:
|
|
117
|
-
setChecked:
|
|
114
|
+
checked: m,
|
|
115
|
+
required: h,
|
|
116
|
+
setControl: l,
|
|
117
|
+
setChecked: r,
|
|
118
118
|
hasConsumerStoppedPropagationRef: p,
|
|
119
|
-
isFormControl:
|
|
120
|
-
bubbleInput:
|
|
121
|
-
} = N(T, o),
|
|
122
|
-
return
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
const s = () =>
|
|
126
|
-
return
|
|
119
|
+
isFormControl: v,
|
|
120
|
+
bubbleInput: k
|
|
121
|
+
} = N(T, o), b = B(t, l), I = u.useRef(m);
|
|
122
|
+
return u.useEffect(() => {
|
|
123
|
+
const n = e == null ? void 0 : e.form;
|
|
124
|
+
if (n) {
|
|
125
|
+
const s = () => r(I.current);
|
|
126
|
+
return n.addEventListener("reset", s), () => n.removeEventListener("reset", s);
|
|
127
127
|
}
|
|
128
|
-
}, [e,
|
|
128
|
+
}, [e, r]), /* @__PURE__ */ a(
|
|
129
129
|
E.button,
|
|
130
130
|
{
|
|
131
131
|
type: "button",
|
|
132
132
|
role: "checkbox",
|
|
133
|
-
"aria-checked":
|
|
134
|
-
"aria-required":
|
|
135
|
-
"data-state": O(
|
|
133
|
+
"aria-checked": x(m) ? "mixed" : m,
|
|
134
|
+
"aria-required": h,
|
|
135
|
+
"data-state": O(m),
|
|
136
136
|
"data-disabled": _ ? "" : void 0,
|
|
137
137
|
disabled: _,
|
|
138
138
|
value: f,
|
|
139
|
-
...
|
|
140
|
-
ref:
|
|
141
|
-
onKeyDown: q(
|
|
142
|
-
|
|
139
|
+
...d,
|
|
140
|
+
ref: b,
|
|
141
|
+
onKeyDown: q(i, (n) => {
|
|
142
|
+
n.key === "Enter" && n.preventDefault();
|
|
143
143
|
}),
|
|
144
|
-
onClick: q(
|
|
145
|
-
|
|
144
|
+
onClick: q(c, (n) => {
|
|
145
|
+
r((s) => x(s) ? !0 : !s), k && v && (p.current = n.isPropagationStopped(), p.current || n.stopPropagation());
|
|
146
146
|
})
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
);
|
|
151
151
|
M.displayName = T;
|
|
152
|
-
var U =
|
|
153
|
-
(o,
|
|
152
|
+
var U = u.forwardRef(
|
|
153
|
+
(o, i) => {
|
|
154
154
|
const {
|
|
155
|
-
__scopeCheckbox:
|
|
156
|
-
name:
|
|
155
|
+
__scopeCheckbox: c,
|
|
156
|
+
name: d,
|
|
157
157
|
checked: t,
|
|
158
158
|
defaultChecked: e,
|
|
159
159
|
required: f,
|
|
160
160
|
disabled: _,
|
|
161
|
-
value:
|
|
162
|
-
onCheckedChange:
|
|
163
|
-
form:
|
|
164
|
-
...
|
|
161
|
+
value: m,
|
|
162
|
+
onCheckedChange: h,
|
|
163
|
+
form: l,
|
|
164
|
+
...r
|
|
165
165
|
} = o;
|
|
166
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ a(
|
|
167
167
|
te,
|
|
168
168
|
{
|
|
169
|
-
__scopeCheckbox:
|
|
169
|
+
__scopeCheckbox: c,
|
|
170
170
|
checked: t,
|
|
171
171
|
defaultChecked: e,
|
|
172
172
|
disabled: _,
|
|
173
173
|
required: f,
|
|
174
|
-
onCheckedChange:
|
|
175
|
-
name:
|
|
176
|
-
form:
|
|
177
|
-
value:
|
|
174
|
+
onCheckedChange: h,
|
|
175
|
+
name: d,
|
|
176
|
+
form: l,
|
|
177
|
+
value: m,
|
|
178
178
|
internal_do_not_use_render: ({ isFormControl: p }) => /* @__PURE__ */ w($, { children: [
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
180
|
M,
|
|
181
181
|
{
|
|
182
|
-
...
|
|
183
|
-
ref:
|
|
184
|
-
__scopeCheckbox:
|
|
182
|
+
...r,
|
|
183
|
+
ref: i,
|
|
184
|
+
__scopeCheckbox: c
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
p && /* @__PURE__ */
|
|
187
|
+
p && /* @__PURE__ */ a(
|
|
188
188
|
L,
|
|
189
189
|
{
|
|
190
|
-
__scopeCheckbox:
|
|
190
|
+
__scopeCheckbox: c
|
|
191
191
|
}
|
|
192
192
|
)
|
|
193
193
|
] })
|
|
@@ -195,21 +195,21 @@ var U = l.forwardRef(
|
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
|
-
U.displayName =
|
|
199
|
-
var A = "CheckboxIndicator", D =
|
|
200
|
-
(o,
|
|
201
|
-
const { __scopeCheckbox:
|
|
202
|
-
return /* @__PURE__ */
|
|
198
|
+
U.displayName = y;
|
|
199
|
+
var A = "CheckboxIndicator", D = u.forwardRef(
|
|
200
|
+
(o, i) => {
|
|
201
|
+
const { __scopeCheckbox: c, forceMount: d, ...t } = o, e = N(A, c);
|
|
202
|
+
return /* @__PURE__ */ a(
|
|
203
203
|
V,
|
|
204
204
|
{
|
|
205
|
-
present:
|
|
206
|
-
children: /* @__PURE__ */
|
|
205
|
+
present: d || x(e.checked) || e.checked === !0,
|
|
206
|
+
children: /* @__PURE__ */ a(
|
|
207
207
|
E.span,
|
|
208
208
|
{
|
|
209
209
|
"data-state": O(e.checked),
|
|
210
210
|
"data-disabled": e.disabled ? "" : void 0,
|
|
211
211
|
...t,
|
|
212
|
-
ref:
|
|
212
|
+
ref: i,
|
|
213
213
|
style: { pointerEvents: "none", ...o.style }
|
|
214
214
|
}
|
|
215
215
|
)
|
|
@@ -218,50 +218,50 @@ var A = "CheckboxIndicator", D = l.forwardRef(
|
|
|
218
218
|
}
|
|
219
219
|
);
|
|
220
220
|
D.displayName = A;
|
|
221
|
-
var F = "CheckboxBubbleInput", L =
|
|
222
|
-
({ __scopeCheckbox: o, ...
|
|
221
|
+
var F = "CheckboxBubbleInput", L = u.forwardRef(
|
|
222
|
+
({ __scopeCheckbox: o, ...i }, c) => {
|
|
223
223
|
const {
|
|
224
|
-
control:
|
|
224
|
+
control: d,
|
|
225
225
|
hasConsumerStoppedPropagationRef: t,
|
|
226
226
|
checked: e,
|
|
227
227
|
defaultChecked: f,
|
|
228
228
|
required: _,
|
|
229
|
-
disabled:
|
|
230
|
-
name:
|
|
231
|
-
value:
|
|
232
|
-
form:
|
|
229
|
+
disabled: m,
|
|
230
|
+
name: h,
|
|
231
|
+
value: l,
|
|
232
|
+
form: r,
|
|
233
233
|
bubbleInput: p,
|
|
234
|
-
setBubbleInput:
|
|
235
|
-
} = N(F, o),
|
|
236
|
-
|
|
234
|
+
setBubbleInput: v
|
|
235
|
+
} = N(F, o), k = B(c, v), b = Q(e), I = J(d);
|
|
236
|
+
u.useEffect(() => {
|
|
237
237
|
const s = p;
|
|
238
238
|
if (!s) return;
|
|
239
|
-
const
|
|
240
|
-
|
|
239
|
+
const R = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(
|
|
240
|
+
R,
|
|
241
241
|
"checked"
|
|
242
242
|
).set, j = !t.current;
|
|
243
|
-
if (
|
|
243
|
+
if (b !== e && S) {
|
|
244
244
|
const H = new Event("click", { bubbles: j });
|
|
245
|
-
s.indeterminate =
|
|
245
|
+
s.indeterminate = x(e), S.call(s, x(e) ? !1 : e), s.dispatchEvent(H);
|
|
246
246
|
}
|
|
247
|
-
}, [p,
|
|
248
|
-
const
|
|
249
|
-
return /* @__PURE__ */
|
|
247
|
+
}, [p, b, e, t]);
|
|
248
|
+
const n = u.useRef(x(e) ? !1 : e);
|
|
249
|
+
return /* @__PURE__ */ a(
|
|
250
250
|
E.input,
|
|
251
251
|
{
|
|
252
252
|
type: "checkbox",
|
|
253
253
|
"aria-hidden": !0,
|
|
254
|
-
defaultChecked: f ??
|
|
254
|
+
defaultChecked: f ?? n.current,
|
|
255
255
|
required: _,
|
|
256
|
-
disabled:
|
|
257
|
-
name:
|
|
258
|
-
value:
|
|
259
|
-
form:
|
|
260
|
-
...
|
|
256
|
+
disabled: m,
|
|
257
|
+
name: h,
|
|
258
|
+
value: l,
|
|
259
|
+
form: r,
|
|
260
|
+
...i,
|
|
261
261
|
tabIndex: -1,
|
|
262
|
-
ref:
|
|
262
|
+
ref: k,
|
|
263
263
|
style: {
|
|
264
|
-
...
|
|
264
|
+
...i.style,
|
|
265
265
|
...I,
|
|
266
266
|
position: "absolute",
|
|
267
267
|
pointerEvents: "none",
|
|
@@ -280,13 +280,13 @@ L.displayName = F;
|
|
|
280
280
|
function re(o) {
|
|
281
281
|
return typeof o == "function";
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function x(o) {
|
|
284
284
|
return o === "indeterminate";
|
|
285
285
|
}
|
|
286
286
|
function O(o) {
|
|
287
|
-
return
|
|
287
|
+
return x(o) ? "indeterminate" : o ? "checked" : "unchecked";
|
|
288
288
|
}
|
|
289
|
-
const ce = "cfxui__Checkbox__rootUnset__cbb57", ne = "cfxui__Checkbox__root__865aa", ie = "cfxui__Checkbox__square__029aa", se = "cfxui__Checkbox__indicator__2afc0", ae = "cfxui__Checkbox__checked__b4081", de = "cfxui__Checkbox__radioIcon__719e7", me = "cfxui__Checkbox__tickIcon__a7f19",
|
|
289
|
+
const ce = "cfxui__Checkbox__rootUnset__cbb57", ne = "cfxui__Checkbox__root__865aa", ie = "cfxui__Checkbox__square__029aa", se = "cfxui__Checkbox__indicator__2afc0", ae = "cfxui__Checkbox__checked__b4081", de = "cfxui__Checkbox__radioIcon__719e7", me = "cfxui__Checkbox__tickIcon__a7f19", C = {
|
|
290
290
|
rootUnset: ce,
|
|
291
291
|
root: ne,
|
|
292
292
|
square: ie,
|
|
@@ -300,41 +300,51 @@ const ce = "cfxui__Checkbox__rootUnset__cbb57", ne = "cfxui__Checkbox__root__865
|
|
|
300
300
|
};
|
|
301
301
|
function pe(o) {
|
|
302
302
|
const {
|
|
303
|
-
id:
|
|
304
|
-
size:
|
|
305
|
-
rootClassName:
|
|
303
|
+
id: i,
|
|
304
|
+
size: c = "normal",
|
|
305
|
+
rootClassName: d,
|
|
306
306
|
indicatorClassName: t,
|
|
307
307
|
colorToken: e,
|
|
308
308
|
color: f,
|
|
309
309
|
opacity: _,
|
|
310
|
-
luminance:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
310
|
+
luminance: m,
|
|
311
|
+
checked: h,
|
|
312
|
+
name: l,
|
|
313
|
+
iconIndicator: r = z,
|
|
314
|
+
...p
|
|
315
|
+
} = o, v = g(
|
|
316
|
+
C.root,
|
|
317
|
+
C.rootUnset,
|
|
318
|
+
C[`size-${c}`],
|
|
319
|
+
d
|
|
320
|
+
), k = Z(o), b = g(
|
|
321
|
+
C.checked,
|
|
322
|
+
r === Y && C.tickIcon,
|
|
323
|
+
r === z && C.radioIcon
|
|
322
324
|
);
|
|
323
325
|
return /* @__PURE__ */ w(
|
|
324
326
|
U,
|
|
325
327
|
{
|
|
326
|
-
...
|
|
327
|
-
id:
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
...p,
|
|
329
|
+
id: i,
|
|
330
|
+
checked: h,
|
|
331
|
+
style: { color: k },
|
|
332
|
+
className: v,
|
|
330
333
|
children: [
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
|
|
334
|
+
l && /* @__PURE__ */ a(
|
|
335
|
+
"input",
|
|
336
|
+
{
|
|
337
|
+
type: "hidden",
|
|
338
|
+
name: l
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
/* @__PURE__ */ a(W, { className: C.square }),
|
|
342
|
+
/* @__PURE__ */ a(D, { className: g(C.indicator, t), children: /* @__PURE__ */ a(r, { className: b }) })
|
|
333
343
|
]
|
|
334
344
|
}
|
|
335
345
|
);
|
|
336
346
|
}
|
|
337
|
-
const
|
|
347
|
+
const bo = G.memo(pe);
|
|
338
348
|
export {
|
|
339
|
-
|
|
349
|
+
bo as default
|
|
340
350
|
};
|
|
@@ -12,9 +12,10 @@ export interface DropdownSelectProps<T = string> {
|
|
|
12
12
|
placeholder?: React.ReactNode;
|
|
13
13
|
size?: ResponsiveValueType<InputSize>;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
15
16
|
fullWidth?: boolean;
|
|
16
17
|
onlight?: boolean;
|
|
17
|
-
|
|
18
|
+
name?: string;
|
|
18
19
|
}
|
|
19
20
|
export declare function DropdownSelect(props: DropdownSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export default DropdownSelect;
|
|
@@ -1,75 +1,84 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { g as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { clsx as
|
|
6
|
-
import { Icon as
|
|
1
|
+
import { jsxs as f, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { g as W, R as N, T as R, D as v } from "../../DropdownContent-BertjH0y.js";
|
|
3
|
+
import _, { useRef as b, useState as z, useEffect as I } from "react";
|
|
4
|
+
import T from "../Flex/Flex.js";
|
|
5
|
+
import { clsx as j } from "../../utils/clsx.js";
|
|
6
|
+
import { Icon as y } from "../Icon/Icon.js";
|
|
7
7
|
import { mergeRefs as E } from "../../utils/mergeRefs.js";
|
|
8
|
-
const M = "cfxui__DropdownSelect__icon__d05b8", O = "cfxui__DropdownSelect__trigger__c03df", k = "cfxui__DropdownSelect__onlight__f0191",
|
|
8
|
+
const M = "cfxui__DropdownSelect__icon__d05b8", O = "cfxui__DropdownSelect__trigger__c03df", k = "cfxui__DropdownSelect__onlight__f0191", A = "cfxui__DropdownSelect__fullWidth__dce56", B = "cfxui__DropdownSelect__placeholder__e0d89", e = {
|
|
9
9
|
icon: M,
|
|
10
10
|
trigger: O,
|
|
11
11
|
onlight: k,
|
|
12
|
-
fullWidth:
|
|
13
|
-
placeholder:
|
|
14
|
-
},
|
|
12
|
+
fullWidth: A,
|
|
13
|
+
placeholder: B
|
|
14
|
+
}, K = {
|
|
15
15
|
small: "xxsmall",
|
|
16
16
|
normal: "xsmall",
|
|
17
17
|
large: "normal"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function L(g) {
|
|
20
20
|
const {
|
|
21
|
-
options:
|
|
22
|
-
value:
|
|
21
|
+
options: r,
|
|
22
|
+
value: t,
|
|
23
23
|
onChange: c,
|
|
24
24
|
size: i = "normal",
|
|
25
25
|
fullWidth: o = !1,
|
|
26
|
-
onlight:
|
|
27
|
-
disabled:
|
|
26
|
+
onlight: m = !1,
|
|
27
|
+
disabled: p,
|
|
28
28
|
placeholder: u = "Select...",
|
|
29
|
-
ref:
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
ref: h,
|
|
30
|
+
name: a
|
|
31
|
+
} = g, n = b(null), [x, S] = z(void 0), w = W(i, "trigger"), C = j(
|
|
32
|
+
w,
|
|
32
33
|
e.trigger,
|
|
33
34
|
{
|
|
34
|
-
[e.placeholder]: !
|
|
35
|
+
[e.placeholder]: !t,
|
|
35
36
|
[e.fullWidth]: o,
|
|
36
|
-
[e.onlight]:
|
|
37
|
+
[e.onlight]: m
|
|
37
38
|
}
|
|
38
|
-
),
|
|
39
|
-
c(
|
|
40
|
-
}, [c]),
|
|
41
|
-
() =>
|
|
42
|
-
[
|
|
39
|
+
), D = _.useCallback((s) => {
|
|
40
|
+
c(s);
|
|
41
|
+
}, [c]), d = _.useMemo(
|
|
42
|
+
() => r.find((s) => s.value === t),
|
|
43
|
+
[r, t]
|
|
43
44
|
);
|
|
44
|
-
return
|
|
45
|
-
o &&
|
|
46
|
-
}, [o]), /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
45
|
+
return I(() => {
|
|
46
|
+
o && n.current && S(n.current.offsetWidth);
|
|
47
|
+
}, [o]), /* @__PURE__ */ f(N, { children: [
|
|
48
|
+
a && /* @__PURE__ */ l(
|
|
49
|
+
"input",
|
|
49
50
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children: /* @__PURE__ */ d(I, { gap: "small", centered: !0, spaceBetween: !0, children: [
|
|
54
|
-
a !== void 0 ? a.label : u,
|
|
55
|
-
/* @__PURE__ */ s(j, { className: e.icon, name: "DownChevron" })
|
|
56
|
-
] })
|
|
51
|
+
type: "hidden",
|
|
52
|
+
name: a,
|
|
53
|
+
value: t
|
|
57
54
|
}
|
|
58
55
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ l(
|
|
60
57
|
R,
|
|
61
58
|
{
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
ref: E(h, n),
|
|
60
|
+
className: C,
|
|
61
|
+
disabled: p,
|
|
62
|
+
children: /* @__PURE__ */ f(T, { gap: "small", centered: !0, spaceBetween: !0, children: [
|
|
63
|
+
d !== void 0 ? d.label : u,
|
|
64
|
+
/* @__PURE__ */ l(y, { className: e.icon, name: "DownChevron" })
|
|
65
|
+
] })
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ l(
|
|
69
|
+
v,
|
|
70
|
+
{
|
|
71
|
+
triggerWidth: x,
|
|
72
|
+
options: r,
|
|
64
73
|
size: i,
|
|
65
74
|
fullWidth: o,
|
|
66
|
-
onSelect:
|
|
75
|
+
onSelect: D
|
|
67
76
|
}
|
|
68
77
|
)
|
|
69
78
|
] });
|
|
70
79
|
}
|
|
71
80
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
L as DropdownSelect,
|
|
82
|
+
K as ICON_SIZE_MAP,
|
|
83
|
+
L as default
|
|
75
84
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import r from "react";
|
|
3
3
|
import t from "../Flex/Flex.js";
|
|
4
|
-
import { Text as
|
|
4
|
+
import { Text as o } from "../Text/Text.js";
|
|
5
5
|
import "../../utils/ui/ui.js";
|
|
6
|
-
import { DropdownSelect as
|
|
7
|
-
const
|
|
6
|
+
import { DropdownSelect as a } from "./DropdownSelect.js";
|
|
7
|
+
const n = [
|
|
8
8
|
{
|
|
9
9
|
value: "value_all",
|
|
10
10
|
label: "all"
|
|
@@ -19,26 +19,27 @@ const c = [
|
|
|
19
19
|
}
|
|
20
20
|
];
|
|
21
21
|
function d() {
|
|
22
|
-
const [
|
|
22
|
+
const [c, i] = r.useState(void 0), [u, s] = r.useState(void 0);
|
|
23
23
|
return /* @__PURE__ */ l(t, { gap: "large", vertical: !0, pb: 20, children: [
|
|
24
24
|
/* @__PURE__ */ l(t, { gap: "normal", vertical: !0, children: [
|
|
25
|
-
/* @__PURE__ */ e(
|
|
25
|
+
/* @__PURE__ */ e(o, { children: "Default Select Input" }),
|
|
26
26
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
27
|
-
|
|
27
|
+
a,
|
|
28
28
|
{
|
|
29
|
-
options:
|
|
30
|
-
onChange:
|
|
31
|
-
value:
|
|
29
|
+
options: n,
|
|
30
|
+
onChange: i,
|
|
31
|
+
value: c,
|
|
32
|
+
name: "DropdownSelect"
|
|
32
33
|
}
|
|
33
34
|
) })
|
|
34
35
|
] }),
|
|
35
36
|
/* @__PURE__ */ l(t, { gap: "normal", vertical: !0, children: [
|
|
36
|
-
/* @__PURE__ */ e(
|
|
37
|
+
/* @__PURE__ */ e(o, { children: "Full Width Select Input" }),
|
|
37
38
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
38
|
-
|
|
39
|
+
a,
|
|
39
40
|
{
|
|
40
41
|
size: "large",
|
|
41
|
-
options:
|
|
42
|
+
options: n,
|
|
42
43
|
fullWidth: !0,
|
|
43
44
|
value: u,
|
|
44
45
|
onChange: s
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { IconName } from '../Icon';
|
|
3
3
|
import { ResponsiveValueType } from '../../utils/ui';
|
|
4
|
+
import { InputSize, InputTheme } from './Input.types';
|
|
4
5
|
|
|
5
|
-
export type InputSize = 'small' | 'normal' | 'large';
|
|
6
|
-
export type InputTheme = 'default' | 'onlight';
|
|
7
6
|
type InputTypeSpecificProps = {
|
|
8
7
|
type?: 'text' | 'password' | 'search';
|
|
9
8
|
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
10
|
} | {
|
|
11
11
|
type: 'number';
|
|
12
12
|
min?: number | string;
|
|
13
13
|
max?: number | string;
|
|
14
14
|
step?: number | string;
|
|
15
15
|
value?: number | string;
|
|
16
|
+
defaultValue?: number | string;
|
|
16
17
|
};
|
|
17
18
|
export type InputProps = InputTypeSpecificProps & {
|
|
18
19
|
name?: string;
|