@cfx-dev/ui-components 5.0.7 → 5.0.8
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.
|
@@ -114,9 +114,9 @@ var q = "Checkbox", [ce, yt] = W(q), [ne, F] = ce(q);
|
|
|
114
114
|
function se(o) {
|
|
115
115
|
const {
|
|
116
116
|
__scopeCheckbox: a,
|
|
117
|
-
checked:
|
|
117
|
+
checked: c,
|
|
118
118
|
children: p,
|
|
119
|
-
defaultChecked:
|
|
119
|
+
defaultChecked: r,
|
|
120
120
|
disabled: e,
|
|
121
121
|
form: _,
|
|
122
122
|
name: h,
|
|
@@ -125,41 +125,41 @@ function se(o) {
|
|
|
125
125
|
value: x = "on",
|
|
126
126
|
// @ts-expect-error
|
|
127
127
|
internal_do_not_use_render: u
|
|
128
|
-
} = o, [
|
|
129
|
-
prop:
|
|
130
|
-
defaultProp:
|
|
128
|
+
} = o, [n, y] = Y({
|
|
129
|
+
prop: c,
|
|
130
|
+
defaultProp: r ?? !1,
|
|
131
131
|
onChange: d,
|
|
132
132
|
caller: q
|
|
133
|
-
}), [l, k] = f.useState(null), [C,
|
|
133
|
+
}), [l, k] = f.useState(null), [C, i] = f.useState(null), t = f.useRef(!1), g = l ? !!_ || !!l.closest("form") : (
|
|
134
134
|
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
135
135
|
!0
|
|
136
|
-
),
|
|
137
|
-
checked:
|
|
136
|
+
), I = {
|
|
137
|
+
checked: n,
|
|
138
138
|
disabled: e,
|
|
139
|
-
setChecked:
|
|
139
|
+
setChecked: y,
|
|
140
140
|
control: l,
|
|
141
141
|
setControl: k,
|
|
142
142
|
name: h,
|
|
143
143
|
form: _,
|
|
144
144
|
value: x,
|
|
145
|
-
hasConsumerStoppedPropagationRef:
|
|
145
|
+
hasConsumerStoppedPropagationRef: t,
|
|
146
146
|
required: b,
|
|
147
|
-
defaultChecked:
|
|
148
|
-
isFormControl:
|
|
147
|
+
defaultChecked: v(r) ? !1 : r,
|
|
148
|
+
isFormControl: g,
|
|
149
149
|
bubbleInput: C,
|
|
150
|
-
setBubbleInput:
|
|
150
|
+
setBubbleInput: i
|
|
151
151
|
};
|
|
152
152
|
return /* @__PURE__ */ m(
|
|
153
153
|
ne,
|
|
154
154
|
{
|
|
155
155
|
scope: a,
|
|
156
|
-
...
|
|
157
|
-
children: ae(u) ? u(
|
|
156
|
+
...I,
|
|
157
|
+
children: ae(u) ? u(I) : p
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
var O = "CheckboxTrigger", D = f.forwardRef(
|
|
162
|
-
({ __scopeCheckbox: o, onKeyDown: a, onClick:
|
|
162
|
+
({ __scopeCheckbox: o, onKeyDown: a, onClick: c, ...p }, r) => {
|
|
163
163
|
const {
|
|
164
164
|
control: e,
|
|
165
165
|
value: _,
|
|
@@ -168,22 +168,22 @@ var O = "CheckboxTrigger", D = f.forwardRef(
|
|
|
168
168
|
required: b,
|
|
169
169
|
setControl: x,
|
|
170
170
|
setChecked: u,
|
|
171
|
-
hasConsumerStoppedPropagationRef:
|
|
172
|
-
isFormControl:
|
|
171
|
+
hasConsumerStoppedPropagationRef: n,
|
|
172
|
+
isFormControl: y,
|
|
173
173
|
bubbleInput: l
|
|
174
|
-
} = F(O, o), k = A(
|
|
174
|
+
} = F(O, o), k = A(r, x), C = f.useRef(d);
|
|
175
175
|
return f.useEffect(() => {
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
return
|
|
176
|
+
const i = e == null ? void 0 : e.form;
|
|
177
|
+
if (i) {
|
|
178
|
+
const t = () => u(C.current);
|
|
179
|
+
return i.addEventListener("reset", t), () => i.removeEventListener("reset", t);
|
|
180
180
|
}
|
|
181
181
|
}, [e, u]), /* @__PURE__ */ m(
|
|
182
182
|
w.button,
|
|
183
183
|
{
|
|
184
184
|
type: "button",
|
|
185
185
|
role: "checkbox",
|
|
186
|
-
"aria-checked":
|
|
186
|
+
"aria-checked": v(d) ? "mixed" : d,
|
|
187
187
|
"aria-required": b,
|
|
188
188
|
"data-state": K(d),
|
|
189
189
|
"data-disabled": h ? "" : void 0,
|
|
@@ -191,11 +191,11 @@ var O = "CheckboxTrigger", D = f.forwardRef(
|
|
|
191
191
|
value: _,
|
|
192
192
|
...p,
|
|
193
193
|
ref: k,
|
|
194
|
-
onKeyDown: T(a, (
|
|
195
|
-
|
|
194
|
+
onKeyDown: T(a, (i) => {
|
|
195
|
+
i.key === "Enter" && i.preventDefault();
|
|
196
196
|
}),
|
|
197
|
-
onClick: T(
|
|
198
|
-
u((
|
|
197
|
+
onClick: T(c, (i) => {
|
|
198
|
+
u((t) => v(t) ? !0 : !t), l && y && (n.current = i.isPropagationStopped(), n.current || i.stopPropagation());
|
|
199
199
|
})
|
|
200
200
|
}
|
|
201
201
|
);
|
|
@@ -205,9 +205,9 @@ D.displayName = O;
|
|
|
205
205
|
var L = f.forwardRef(
|
|
206
206
|
(o, a) => {
|
|
207
207
|
const {
|
|
208
|
-
__scopeCheckbox:
|
|
208
|
+
__scopeCheckbox: c,
|
|
209
209
|
name: p,
|
|
210
|
-
checked:
|
|
210
|
+
checked: r,
|
|
211
211
|
defaultChecked: e,
|
|
212
212
|
required: _,
|
|
213
213
|
disabled: h,
|
|
@@ -219,8 +219,8 @@ var L = f.forwardRef(
|
|
|
219
219
|
return /* @__PURE__ */ m(
|
|
220
220
|
se,
|
|
221
221
|
{
|
|
222
|
-
__scopeCheckbox:
|
|
223
|
-
checked:
|
|
222
|
+
__scopeCheckbox: c,
|
|
223
|
+
checked: r,
|
|
224
224
|
defaultChecked: e,
|
|
225
225
|
disabled: h,
|
|
226
226
|
required: _,
|
|
@@ -228,19 +228,19 @@ var L = f.forwardRef(
|
|
|
228
228
|
name: p,
|
|
229
229
|
form: x,
|
|
230
230
|
value: d,
|
|
231
|
-
internal_do_not_use_render: ({ isFormControl:
|
|
231
|
+
internal_do_not_use_render: ({ isFormControl: n }) => /* @__PURE__ */ U(V, { children: [
|
|
232
232
|
/* @__PURE__ */ m(
|
|
233
233
|
D,
|
|
234
234
|
{
|
|
235
235
|
...u,
|
|
236
236
|
ref: a,
|
|
237
|
-
__scopeCheckbox:
|
|
237
|
+
__scopeCheckbox: c
|
|
238
238
|
}
|
|
239
239
|
),
|
|
240
|
-
|
|
240
|
+
n && /* @__PURE__ */ m(
|
|
241
241
|
G,
|
|
242
242
|
{
|
|
243
|
-
__scopeCheckbox:
|
|
243
|
+
__scopeCheckbox: c
|
|
244
244
|
}
|
|
245
245
|
)
|
|
246
246
|
] })
|
|
@@ -251,17 +251,17 @@ var L = f.forwardRef(
|
|
|
251
251
|
L.displayName = q;
|
|
252
252
|
var j = "CheckboxIndicator", H = f.forwardRef(
|
|
253
253
|
(o, a) => {
|
|
254
|
-
const { __scopeCheckbox:
|
|
254
|
+
const { __scopeCheckbox: c, forceMount: p, ...r } = o, e = F(j, c);
|
|
255
255
|
return /* @__PURE__ */ m(
|
|
256
256
|
oe,
|
|
257
257
|
{
|
|
258
|
-
present: p ||
|
|
258
|
+
present: p || v(e.checked) || e.checked === !0,
|
|
259
259
|
children: /* @__PURE__ */ m(
|
|
260
260
|
w.span,
|
|
261
261
|
{
|
|
262
262
|
"data-state": K(e.checked),
|
|
263
263
|
"data-disabled": e.disabled ? "" : void 0,
|
|
264
|
-
...
|
|
264
|
+
...r,
|
|
265
265
|
ref: a,
|
|
266
266
|
style: { pointerEvents: "none", ...o.style }
|
|
267
267
|
}
|
|
@@ -272,10 +272,10 @@ var j = "CheckboxIndicator", H = f.forwardRef(
|
|
|
272
272
|
);
|
|
273
273
|
H.displayName = j;
|
|
274
274
|
var $ = "CheckboxBubbleInput", G = f.forwardRef(
|
|
275
|
-
({ __scopeCheckbox: o, ...a },
|
|
275
|
+
({ __scopeCheckbox: o, ...a }, c) => {
|
|
276
276
|
const {
|
|
277
277
|
control: p,
|
|
278
|
-
hasConsumerStoppedPropagationRef:
|
|
278
|
+
hasConsumerStoppedPropagationRef: r,
|
|
279
279
|
checked: e,
|
|
280
280
|
defaultChecked: _,
|
|
281
281
|
required: h,
|
|
@@ -283,28 +283,28 @@ var $ = "CheckboxBubbleInput", G = f.forwardRef(
|
|
|
283
283
|
name: b,
|
|
284
284
|
value: x,
|
|
285
285
|
form: u,
|
|
286
|
-
bubbleInput:
|
|
287
|
-
setBubbleInput:
|
|
288
|
-
} = F($, o), l = A(
|
|
286
|
+
bubbleInput: n,
|
|
287
|
+
setBubbleInput: y
|
|
288
|
+
} = F($, o), l = A(c, y), k = ee(e), C = Z(p);
|
|
289
289
|
f.useEffect(() => {
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
const
|
|
293
|
-
|
|
290
|
+
const t = n;
|
|
291
|
+
if (!t) return;
|
|
292
|
+
const g = window.HTMLInputElement.prototype, N = Object.getOwnPropertyDescriptor(
|
|
293
|
+
g,
|
|
294
294
|
"checked"
|
|
295
|
-
).set, S = !
|
|
296
|
-
if (k !== e &&
|
|
295
|
+
).set, S = !r.current;
|
|
296
|
+
if (k !== e && N) {
|
|
297
297
|
const z = new Event("click", { bubbles: S });
|
|
298
|
-
|
|
298
|
+
t.indeterminate = v(e), N.call(t, v(e) ? !1 : e), t.dispatchEvent(z);
|
|
299
299
|
}
|
|
300
|
-
}, [
|
|
301
|
-
const
|
|
300
|
+
}, [n, k, e, r]);
|
|
301
|
+
const i = f.useRef(v(e) ? !1 : e);
|
|
302
302
|
return /* @__PURE__ */ m(
|
|
303
303
|
w.input,
|
|
304
304
|
{
|
|
305
305
|
type: "checkbox",
|
|
306
306
|
"aria-hidden": !0,
|
|
307
|
-
defaultChecked: _ ??
|
|
307
|
+
defaultChecked: _ ?? i.current,
|
|
308
308
|
required: h,
|
|
309
309
|
disabled: d,
|
|
310
310
|
name: b,
|
|
@@ -333,11 +333,11 @@ G.displayName = $;
|
|
|
333
333
|
function ae(o) {
|
|
334
334
|
return typeof o == "function";
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function v(o) {
|
|
337
337
|
return o === "indeterminate";
|
|
338
338
|
}
|
|
339
339
|
function K(o) {
|
|
340
|
-
return
|
|
340
|
+
return v(o) ? "indeterminate" : o ? "checked" : "unchecked";
|
|
341
341
|
}
|
|
342
342
|
const me = "cfxui__Checkbox__rootUnset__cbb57", pe = "cfxui__Checkbox__root__865aa", de = "cfxui__Checkbox__secondary__95e8e", ue = "cfxui__Checkbox__isChecked__e5d94", le = "cfxui__Checkbox__icon__f9f6b", fe = "cfxui__Checkbox__square__029aa", _e = "cfxui__Checkbox__indicator__2afc0", he = "cfxui__Checkbox__squareFilledIcon__7d9b7", Ce = "cfxui__Checkbox__tickIcon__a7f19", s = {
|
|
343
343
|
rootUnset: me,
|
|
@@ -356,9 +356,9 @@ const me = "cfxui__Checkbox__rootUnset__cbb57", pe = "cfxui__Checkbox__root__865
|
|
|
356
356
|
function ke(o) {
|
|
357
357
|
const {
|
|
358
358
|
id: a,
|
|
359
|
-
size:
|
|
359
|
+
size: c = "medium",
|
|
360
360
|
rootClassName: p,
|
|
361
|
-
indicatorClassName:
|
|
361
|
+
indicatorClassName: r,
|
|
362
362
|
iconClassName: e,
|
|
363
363
|
checkedClassName: _,
|
|
364
364
|
squareClassName: h,
|
|
@@ -366,33 +366,33 @@ function ke(o) {
|
|
|
366
366
|
color: b,
|
|
367
367
|
opacity: x,
|
|
368
368
|
luminance: u,
|
|
369
|
-
checked:
|
|
370
|
-
iconSquare:
|
|
369
|
+
checked: n,
|
|
370
|
+
iconSquare: y = te,
|
|
371
371
|
iconIndicator: l = M,
|
|
372
372
|
name: k,
|
|
373
373
|
theme: C = "primary",
|
|
374
|
-
onClick:
|
|
375
|
-
onCheckedChange:
|
|
376
|
-
...
|
|
377
|
-
} = o, [
|
|
374
|
+
onClick: i,
|
|
375
|
+
onCheckedChange: t,
|
|
376
|
+
...g
|
|
377
|
+
} = o, [I, N] = R.useState(n);
|
|
378
378
|
R.useEffect(() => {
|
|
379
|
-
|
|
380
|
-
}, [
|
|
379
|
+
N(n);
|
|
380
|
+
}, [n]);
|
|
381
381
|
const S = R.useCallback(() => {
|
|
382
|
-
|
|
382
|
+
N((E) => !E);
|
|
383
383
|
}, []), z = R.useCallback((E) => {
|
|
384
|
-
|
|
385
|
-
}, [
|
|
384
|
+
N(E), t && t(E);
|
|
385
|
+
}, [t]), X = ie(o), B = P(
|
|
386
386
|
s.isChecked,
|
|
387
387
|
_
|
|
388
388
|
), J = P(
|
|
389
389
|
s.root,
|
|
390
390
|
s.rootUnset,
|
|
391
|
-
s[`size-${
|
|
391
|
+
s[`size-${c}`],
|
|
392
392
|
s[C],
|
|
393
393
|
p,
|
|
394
394
|
{
|
|
395
|
-
[B]:
|
|
395
|
+
[B]: I
|
|
396
396
|
}
|
|
397
397
|
), Q = P(
|
|
398
398
|
s.icon,
|
|
@@ -406,9 +406,9 @@ function ke(o) {
|
|
|
406
406
|
return /* @__PURE__ */ U(
|
|
407
407
|
L,
|
|
408
408
|
{
|
|
409
|
-
...
|
|
409
|
+
...g,
|
|
410
410
|
id: a,
|
|
411
|
-
checked:
|
|
411
|
+
checked: I,
|
|
412
412
|
style: { color: X },
|
|
413
413
|
className: J,
|
|
414
414
|
onClick: S,
|
|
@@ -419,23 +419,23 @@ function ke(o) {
|
|
|
419
419
|
{
|
|
420
420
|
type: "hidden",
|
|
421
421
|
name: k,
|
|
422
|
-
value:
|
|
422
|
+
value: I ? "on" : ""
|
|
423
423
|
}
|
|
424
424
|
),
|
|
425
425
|
/* @__PURE__ */ m(
|
|
426
|
-
|
|
426
|
+
y,
|
|
427
427
|
{
|
|
428
428
|
className: P(
|
|
429
429
|
s.square,
|
|
430
430
|
s[C],
|
|
431
431
|
{
|
|
432
|
-
[B]:
|
|
432
|
+
[B]: I
|
|
433
433
|
},
|
|
434
434
|
h
|
|
435
435
|
)
|
|
436
436
|
}
|
|
437
437
|
),
|
|
438
|
-
/* @__PURE__ */ m(H, { className: P(s.indicator, s[C],
|
|
438
|
+
/* @__PURE__ */ m(H, { className: P(s.indicator, s[C], r), children: /* @__PURE__ */ m(l, { className: Q }) })
|
|
439
439
|
]
|
|
440
440
|
}
|
|
441
441
|
);
|