@dloizides/ui-forms 1.8.0 → 1.9.1
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/CHANGELOG.md +55 -0
- package/dist/index.d.mts +176 -4
- package/dist/index.d.ts +176 -4
- package/dist/index.js +205 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +203 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -36,6 +36,40 @@ function resolveFieldMarker(required, optional) {
|
|
|
36
36
|
if (optional) return "optional";
|
|
37
37
|
return "none";
|
|
38
38
|
}
|
|
39
|
+
var FIELD_STACK_MARGIN_BOTTOM = 16;
|
|
40
|
+
var FIELD_STACK_LABEL_MARGIN_BOTTOM = 4;
|
|
41
|
+
var FIELD_STACK_CHILD_MARGIN_TOP = 4;
|
|
42
|
+
var FIELD_CONTRACT_GAP = 6;
|
|
43
|
+
var fieldSpacingStyles = StyleSheet.create({
|
|
44
|
+
stackContainer: { marginBottom: FIELD_STACK_MARGIN_BOTTOM },
|
|
45
|
+
stackLabel: { marginBottom: FIELD_STACK_LABEL_MARGIN_BOTTOM },
|
|
46
|
+
stackChild: { marginTop: FIELD_STACK_CHILD_MARGIN_TOP },
|
|
47
|
+
/**
|
|
48
|
+
* The gap model sets NO margins — not even zeroed ones. An explicit `marginBottom: 0` here would
|
|
49
|
+
* defeat a caller who legitimately wants to push one field down via `containerStyle`, because
|
|
50
|
+
* `containerStyle` composes AFTER this and a zero is indistinguishable from "unset" to a reader.
|
|
51
|
+
*/
|
|
52
|
+
gapContainer: { gap: FIELD_CONTRACT_GAP },
|
|
53
|
+
none: {}
|
|
54
|
+
});
|
|
55
|
+
function resolveFieldSpacing(explicit, insideGrid) {
|
|
56
|
+
if (explicit !== void 0) return explicit;
|
|
57
|
+
return insideGrid ? "gap" : "stack";
|
|
58
|
+
}
|
|
59
|
+
function fieldSpacingStyleSet(spacing) {
|
|
60
|
+
if (spacing === "gap") {
|
|
61
|
+
return {
|
|
62
|
+
container: fieldSpacingStyles.gapContainer,
|
|
63
|
+
label: fieldSpacingStyles.none,
|
|
64
|
+
child: fieldSpacingStyles.none
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
container: fieldSpacingStyles.stackContainer,
|
|
69
|
+
label: fieldSpacingStyles.stackLabel,
|
|
70
|
+
child: fieldSpacingStyles.stackChild
|
|
71
|
+
};
|
|
72
|
+
}
|
|
39
73
|
var FIELD_FONT_SIZE = 13;
|
|
40
74
|
var FIELD_FONT_WEIGHT = "600";
|
|
41
75
|
var CONTROL_FONT_SIZE = 11;
|
|
@@ -56,27 +90,25 @@ var labelVariantStyles = StyleSheet.create({
|
|
|
56
90
|
function resolveLabelVariantStyle(variant) {
|
|
57
91
|
return variant === "control" ? labelVariantStyles.control : labelVariantStyles.field;
|
|
58
92
|
}
|
|
59
|
-
var
|
|
60
|
-
var
|
|
93
|
+
var FormGridContext = React.createContext(null);
|
|
94
|
+
var GapOwnedContext = React.createContext(false);
|
|
95
|
+
var FormGridProvider = FormGridContext.Provider;
|
|
96
|
+
var GapOwnedProvider = GapOwnedContext.Provider;
|
|
97
|
+
function useFormGridMetrics() {
|
|
98
|
+
return React.useContext(FormGridContext);
|
|
99
|
+
}
|
|
100
|
+
function useIsGapOwned() {
|
|
101
|
+
return React.useContext(GapOwnedContext);
|
|
102
|
+
}
|
|
61
103
|
var ERROR_FONT_SIZE = 12;
|
|
62
|
-
var ERROR_MARGIN_TOP = 4;
|
|
63
104
|
var HINT_FONT_SIZE = 12;
|
|
64
|
-
var HINT_MARGIN_TOP = 4;
|
|
65
105
|
var OPTIONAL_MARK_FONT_WEIGHT = "400";
|
|
66
106
|
var styles = StyleSheet.create({
|
|
67
|
-
container: {
|
|
68
|
-
marginBottom: CONTAINER_MARGIN_BOTTOM
|
|
69
|
-
},
|
|
70
|
-
label: {
|
|
71
|
-
marginBottom: LABEL_MARGIN_BOTTOM
|
|
72
|
-
},
|
|
73
107
|
hintText: {
|
|
74
|
-
fontSize: HINT_FONT_SIZE
|
|
75
|
-
marginTop: HINT_MARGIN_TOP
|
|
108
|
+
fontSize: HINT_FONT_SIZE
|
|
76
109
|
},
|
|
77
110
|
errorText: {
|
|
78
|
-
fontSize: ERROR_FONT_SIZE
|
|
79
|
-
marginTop: ERROR_MARGIN_TOP
|
|
111
|
+
fontSize: ERROR_FONT_SIZE
|
|
80
112
|
},
|
|
81
113
|
optionalMark: {
|
|
82
114
|
fontWeight: OPTIONAL_MARK_FONT_WEIGHT
|
|
@@ -112,9 +144,12 @@ var Field = ({
|
|
|
112
144
|
labelVariant,
|
|
113
145
|
labelStyle,
|
|
114
146
|
containerStyle,
|
|
147
|
+
spacing,
|
|
115
148
|
testID
|
|
116
149
|
}) => {
|
|
117
150
|
const { theme } = useUi();
|
|
151
|
+
const gapOwned = useIsGapOwned();
|
|
152
|
+
const spacingStyles = fieldSpacingStyleSet(resolveFieldSpacing(spacing, gapOwned));
|
|
118
153
|
const { colors, semantic } = theme;
|
|
119
154
|
const errorColor = semantic.error["500"];
|
|
120
155
|
const hasError = hasFieldError(error);
|
|
@@ -136,7 +171,7 @@ var Field = ({
|
|
|
136
171
|
);
|
|
137
172
|
const describedById = joinDescribedBy(hasHint ? hintId : void 0, hasError ? errorId : void 0);
|
|
138
173
|
const control = typeof children === "function" ? children({ describedById, hasError }) : children;
|
|
139
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
174
|
+
return /* @__PURE__ */ jsxs(View, { style: [spacingStyles.container, containerStyle], testID, children: [
|
|
140
175
|
hasLabel ? /* @__PURE__ */ jsx(
|
|
141
176
|
FieldLabel,
|
|
142
177
|
{
|
|
@@ -145,16 +180,107 @@ var Field = ({
|
|
|
145
180
|
optionalLabel,
|
|
146
181
|
optionalMarkStyle: [styles.optionalMark, themeStyles.optionalMark],
|
|
147
182
|
requiredMarkStyle: themeStyles.requiredMark,
|
|
148
|
-
style: [
|
|
183
|
+
style: [spacingStyles.label, resolveLabelVariantStyle(labelVariant), themeStyles.label, labelStyle]
|
|
149
184
|
}
|
|
150
185
|
) : null,
|
|
151
186
|
control,
|
|
152
|
-
hasHint ? /* @__PURE__ */ jsx(Text, { nativeID: hintId, style: [styles.hintText, themeStyles.hintText], children: hint }) : null,
|
|
153
|
-
hasError ? /* @__PURE__ */ jsx(Text, { nativeID: errorId, role: "alert", style: [styles.errorText, themeStyles.errorText], children: error }) : null
|
|
187
|
+
hasHint ? /* @__PURE__ */ jsx(Text, { nativeID: hintId, style: [styles.hintText, spacingStyles.child, themeStyles.hintText], children: hint }) : null,
|
|
188
|
+
hasError ? /* @__PURE__ */ jsx(Text, { nativeID: errorId, role: "alert", style: [styles.errorText, spacingStyles.child, themeStyles.errorText], children: error }) : null
|
|
154
189
|
] });
|
|
155
190
|
};
|
|
156
|
-
var
|
|
191
|
+
var FORM_GRID_DEFAULT_GAP = 12;
|
|
192
|
+
var FORM_GRID_DEFAULT_MIN_WIDTH = 220;
|
|
193
|
+
var FORM_GRID_DEFAULT_BASIS = 260;
|
|
157
194
|
var styles2 = StyleSheet.create({
|
|
195
|
+
grid: {
|
|
196
|
+
flexDirection: "row",
|
|
197
|
+
flexWrap: "wrap"
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
var FormGrid = ({
|
|
201
|
+
children,
|
|
202
|
+
gap = FORM_GRID_DEFAULT_GAP,
|
|
203
|
+
minWidth = FORM_GRID_DEFAULT_MIN_WIDTH,
|
|
204
|
+
basis = FORM_GRID_DEFAULT_BASIS,
|
|
205
|
+
style,
|
|
206
|
+
testID
|
|
207
|
+
}) => {
|
|
208
|
+
const metrics = React.useMemo(() => ({ minWidth, basis }), [minWidth, basis]);
|
|
209
|
+
return /* @__PURE__ */ jsx(FormGridProvider, { value: metrics, children: /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsx(View, { style: [styles2.grid, { gap }, style], testID, children }) }) });
|
|
210
|
+
};
|
|
211
|
+
var GROW = 1;
|
|
212
|
+
var NO_GROW = 0;
|
|
213
|
+
var FormCell = ({
|
|
214
|
+
children,
|
|
215
|
+
minWidth,
|
|
216
|
+
basis,
|
|
217
|
+
grow = true,
|
|
218
|
+
style,
|
|
219
|
+
testID
|
|
220
|
+
}) => {
|
|
221
|
+
const metrics = useFormGridMetrics();
|
|
222
|
+
const resolvedMinWidth = minWidth ?? metrics?.minWidth ?? FORM_GRID_DEFAULT_MIN_WIDTH;
|
|
223
|
+
const resolvedBasis = basis ?? metrics?.basis ?? FORM_GRID_DEFAULT_BASIS;
|
|
224
|
+
const cellStyle = {
|
|
225
|
+
minWidth: resolvedMinWidth,
|
|
226
|
+
flexBasis: resolvedBasis,
|
|
227
|
+
flexGrow: grow ? GROW : NO_GROW
|
|
228
|
+
};
|
|
229
|
+
return /* @__PURE__ */ jsx(View, { style: [cellStyle, style], testID, children });
|
|
230
|
+
};
|
|
231
|
+
var SECTION_GAP = 10;
|
|
232
|
+
var DESCRIPTION_FONT_SIZE = 12;
|
|
233
|
+
var styles3 = StyleSheet.create({
|
|
234
|
+
section: {
|
|
235
|
+
gap: SECTION_GAP
|
|
236
|
+
},
|
|
237
|
+
description: {
|
|
238
|
+
fontSize: DESCRIPTION_FONT_SIZE
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
var sectionSeq = 0;
|
|
242
|
+
function useSectionLegendId() {
|
|
243
|
+
const [id] = React.useState(() => {
|
|
244
|
+
sectionSeq += 1;
|
|
245
|
+
return `form-section-legend-${String(sectionSeq)}`;
|
|
246
|
+
});
|
|
247
|
+
return id;
|
|
248
|
+
}
|
|
249
|
+
var FormSection = ({
|
|
250
|
+
title,
|
|
251
|
+
description,
|
|
252
|
+
children,
|
|
253
|
+
labelVariant,
|
|
254
|
+
titleStyle,
|
|
255
|
+
style,
|
|
256
|
+
testID
|
|
257
|
+
}) => {
|
|
258
|
+
const { theme } = useUi();
|
|
259
|
+
const { colors } = theme;
|
|
260
|
+
const legendId = useSectionLegendId();
|
|
261
|
+
const hasTitle = typeof title === "string" && title !== "";
|
|
262
|
+
const hasDescription = typeof description === "string" && description !== "";
|
|
263
|
+
const a11y = { "aria-labelledby": hasTitle ? legendId : void 0 };
|
|
264
|
+
return (
|
|
265
|
+
// The section spaces its children with `gap`, so it owns their vertical rhythm exactly as a
|
|
266
|
+
// `FormGrid` owns a row's — without this a `Field` placed directly in a section would stack its
|
|
267
|
+
// 16px margin on the section's gap and recreate the F3 bug one level up.
|
|
268
|
+
/* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsxs(View, { role: "group", style: [styles3.section, style], testID, ...a11y, children: [
|
|
269
|
+
hasTitle ? /* @__PURE__ */ jsx(
|
|
270
|
+
Text,
|
|
271
|
+
{
|
|
272
|
+
nativeID: legendId,
|
|
273
|
+
style: [resolveLabelVariantStyle(labelVariant), { color: colors.text }, titleStyle],
|
|
274
|
+
children: title
|
|
275
|
+
}
|
|
276
|
+
) : null,
|
|
277
|
+
hasDescription ? /* @__PURE__ */ jsx(Text, { style: [styles3.description, { color: colors.textSecondary }], children: description }) : null,
|
|
278
|
+
children
|
|
279
|
+
] }) })
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
var ACTIONS_GAP = 12;
|
|
283
|
+
var styles4 = StyleSheet.create({
|
|
158
284
|
container: {
|
|
159
285
|
flexDirection: "row",
|
|
160
286
|
justifyContent: "flex-end",
|
|
@@ -174,7 +300,7 @@ var FormActions = ({
|
|
|
174
300
|
saveTestID = "save-button",
|
|
175
301
|
cancelTestID = "cancel-button",
|
|
176
302
|
testID
|
|
177
|
-
}) => /* @__PURE__ */ jsxs(View, { style: [
|
|
303
|
+
}) => /* @__PURE__ */ jsxs(View, { style: [styles4.container, containerStyle], testID, children: [
|
|
178
304
|
typeof onCancel === "function" ? /* @__PURE__ */ jsx(
|
|
179
305
|
Button,
|
|
180
306
|
{
|
|
@@ -297,6 +423,16 @@ function useThemedInput(options = {}) {
|
|
|
297
423
|
};
|
|
298
424
|
}
|
|
299
425
|
var IS_WEB2 = Platform.OS === "web";
|
|
426
|
+
function webFieldA11y({ describedById, hasError = false, required = false }) {
|
|
427
|
+
if (!IS_WEB2) {
|
|
428
|
+
return {};
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
"aria-invalid": hasError ? true : void 0,
|
|
432
|
+
"aria-describedby": describedById,
|
|
433
|
+
"aria-required": required ? true : void 0
|
|
434
|
+
};
|
|
435
|
+
}
|
|
300
436
|
var ThemedTextInput = React.forwardRef(function ThemedTextInput2({ hasError = false, describedById, requiredField = false, onFocus, onBlur, style, placeholderTextColor, ...rest }, ref) {
|
|
301
437
|
const {
|
|
302
438
|
style: themedStyle,
|
|
@@ -304,11 +440,7 @@ var ThemedTextInput = React.forwardRef(function ThemedTextInput2({ hasError = fa
|
|
|
304
440
|
focusBind,
|
|
305
441
|
hoverBind
|
|
306
442
|
} = useThemedInput({ hasError, onFocus, onBlur });
|
|
307
|
-
const webA11y =
|
|
308
|
-
"aria-invalid": hasError ? true : void 0,
|
|
309
|
-
"aria-describedby": describedById,
|
|
310
|
-
"aria-required": requiredField ? true : void 0
|
|
311
|
-
} : {};
|
|
443
|
+
const webA11y = webFieldA11y({ describedById, hasError, required: requiredField });
|
|
312
444
|
return /* @__PURE__ */ jsx(
|
|
313
445
|
TextInput,
|
|
314
446
|
{
|
|
@@ -327,7 +459,7 @@ var INPUT_PADDING_V = 10;
|
|
|
327
459
|
var INPUT_PADDING_H = 12;
|
|
328
460
|
var INPUT_BORDER_RADIUS = 8;
|
|
329
461
|
var INPUT_BORDER_WIDTH = 1;
|
|
330
|
-
var
|
|
462
|
+
var styles5 = StyleSheet.create({
|
|
331
463
|
input: {
|
|
332
464
|
paddingVertical: INPUT_PADDING_V,
|
|
333
465
|
paddingHorizontal: INPUT_PADDING_H,
|
|
@@ -349,7 +481,7 @@ var FormField = ({
|
|
|
349
481
|
describedById,
|
|
350
482
|
hasError,
|
|
351
483
|
requiredField: required,
|
|
352
|
-
style:
|
|
484
|
+
style: styles5.input,
|
|
353
485
|
testID: "form-field-input",
|
|
354
486
|
...textInputProps
|
|
355
487
|
}
|
|
@@ -387,18 +519,22 @@ function withAlpha2(hex, alpha) {
|
|
|
387
519
|
const isValid = !Number.isNaN(r) && !Number.isNaN(g) && !Number.isNaN(b);
|
|
388
520
|
return isValid ? `rgba(${r}, ${g}, ${b}, ${alpha})` : hex;
|
|
389
521
|
}
|
|
390
|
-
var
|
|
522
|
+
var styles6 = StyleSheet.create({
|
|
391
523
|
chipContainer: {
|
|
392
524
|
flexDirection: "row",
|
|
393
525
|
flexWrap: "wrap",
|
|
394
|
-
//
|
|
395
|
-
//
|
|
396
|
-
//
|
|
397
|
-
marginBottom: -
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
526
|
+
// `gap`, NOT per-chip margins plus a compensating negative container margin.
|
|
527
|
+
//
|
|
528
|
+
// The old form was `chipWrapper { marginRight: 8, marginBottom: 8 }` with
|
|
529
|
+
// `chipContainer { marginBottom: -8 }`. Its comment blamed `Field`'s 16px container margin —
|
|
530
|
+
// that was WRONG, and worth recording: F3 was briefed on the belief that the -8 compensated for
|
|
531
|
+
// `Field` and had to move in lockstep with it. It did not. -8 cancelled the CHIP's own gutter
|
|
532
|
+
// hanging off the last row, identically whether `Field` contributed 16, 0, or anything else.
|
|
533
|
+
//
|
|
534
|
+
// The pair is still the wrong tool: it holds only while the two constants agree, and it leaves
|
|
535
|
+
// a real negative margin any measuring parent inherits. `gap` produces the byte-identical box
|
|
536
|
+
// and is correct under BOTH of `Field`'s spacing models, not just the one it was tuned against.
|
|
537
|
+
gap: CHIP_GUTTER
|
|
402
538
|
},
|
|
403
539
|
chip: {
|
|
404
540
|
paddingHorizontal: 12,
|
|
@@ -450,12 +586,11 @@ function OutlineChip({
|
|
|
450
586
|
"aria-pressed": ariaPressed,
|
|
451
587
|
disabled,
|
|
452
588
|
hitSlop: CHIP_HIT_SLOP,
|
|
453
|
-
style: styles4.chipWrapper,
|
|
454
589
|
testID,
|
|
455
590
|
onHoverIn: () => setHovered(true),
|
|
456
591
|
onHoverOut: () => setHovered(false),
|
|
457
592
|
onPress,
|
|
458
|
-
children: /* @__PURE__ */ jsx(View, { style: [
|
|
593
|
+
children: /* @__PURE__ */ jsx(View, { style: [styles6.chipOutline, { borderColor, backgroundColor }], children: /* @__PURE__ */ jsx(Text, { style: [styles6.chipText, styles6.chipTextOutline, { color: textColor }], children: option.label }) })
|
|
459
594
|
}
|
|
460
595
|
);
|
|
461
596
|
}
|
|
@@ -481,18 +616,12 @@ function SolidChip({
|
|
|
481
616
|
"aria-pressed": ariaPressed,
|
|
482
617
|
disabled,
|
|
483
618
|
hitSlop: CHIP_HIT_SLOP,
|
|
484
|
-
style: styles4.chipWrapper,
|
|
485
619
|
testID,
|
|
486
620
|
onPress,
|
|
487
|
-
children: /* @__PURE__ */ jsx(View, { style: [
|
|
621
|
+
children: /* @__PURE__ */ jsx(View, { style: [styles6.chip, { borderColor: colors.border, backgroundColor }], children: /* @__PURE__ */ jsx(Text, { style: [styles6.chipText, { color: textColor }], children: option.label }) })
|
|
488
622
|
}
|
|
489
623
|
);
|
|
490
624
|
}
|
|
491
|
-
var IS_WEB3 = Platform.OS === "web";
|
|
492
|
-
function groupA11yProps(describedById, hasError) {
|
|
493
|
-
if (!IS_WEB3) return {};
|
|
494
|
-
return { "aria-invalid": hasError ? true : void 0, "aria-describedby": describedById };
|
|
495
|
-
}
|
|
496
625
|
var ChipSelector = ({
|
|
497
626
|
label,
|
|
498
627
|
options,
|
|
@@ -502,6 +631,7 @@ var ChipSelector = ({
|
|
|
502
631
|
disabled = false,
|
|
503
632
|
variant = "solid",
|
|
504
633
|
containerStyle,
|
|
634
|
+
spacing,
|
|
505
635
|
required = false,
|
|
506
636
|
error,
|
|
507
637
|
testID,
|
|
@@ -544,10 +674,21 @@ var ChipSelector = ({
|
|
|
544
674
|
const key = String(option.value);
|
|
545
675
|
return variant === "outline" ? /* @__PURE__ */ jsx(OutlineChip, { ...chipProps }, key) : /* @__PURE__ */ jsx(SolidChip, { ...chipProps }, key);
|
|
546
676
|
}
|
|
547
|
-
return /* @__PURE__ */ jsx(
|
|
677
|
+
return /* @__PURE__ */ jsx(
|
|
678
|
+
Field,
|
|
679
|
+
{
|
|
680
|
+
containerStyle,
|
|
681
|
+
error,
|
|
682
|
+
label,
|
|
683
|
+
required,
|
|
684
|
+
spacing,
|
|
685
|
+
testID,
|
|
686
|
+
children: ({ describedById, hasError }) => /* @__PURE__ */ jsx(View, { style: styles6.chipContainer, ...webFieldA11y({ describedById, hasError }), children: options.map(renderChip) })
|
|
687
|
+
}
|
|
688
|
+
);
|
|
548
689
|
};
|
|
549
|
-
var
|
|
550
|
-
var
|
|
690
|
+
var DESCRIPTION_FONT_SIZE2 = 12;
|
|
691
|
+
var styles7 = StyleSheet.create({
|
|
551
692
|
container: {
|
|
552
693
|
flexDirection: "row",
|
|
553
694
|
justifyContent: "space-between",
|
|
@@ -561,7 +702,7 @@ var styles5 = StyleSheet.create({
|
|
|
561
702
|
fontWeight: "600"
|
|
562
703
|
},
|
|
563
704
|
description: {
|
|
564
|
-
fontSize:
|
|
705
|
+
fontSize: DESCRIPTION_FONT_SIZE2,
|
|
565
706
|
marginTop: 2
|
|
566
707
|
}
|
|
567
708
|
});
|
|
@@ -587,13 +728,13 @@ var FormSwitch = ({
|
|
|
587
728
|
View,
|
|
588
729
|
{
|
|
589
730
|
style: [
|
|
590
|
-
|
|
731
|
+
styles7.container,
|
|
591
732
|
containerStyle
|
|
592
733
|
],
|
|
593
734
|
children: [
|
|
594
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
595
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
596
|
-
hasDescription ? /* @__PURE__ */ jsx(Text, { style: [
|
|
735
|
+
/* @__PURE__ */ jsxs(View, { style: styles7.textColumn, children: [
|
|
736
|
+
/* @__PURE__ */ jsx(Text, { style: [styles7.label, themeStyles.label], children: label }),
|
|
737
|
+
hasDescription ? /* @__PURE__ */ jsx(Text, { style: [styles7.description, themeStyles.description], children: description }) : null
|
|
597
738
|
] }),
|
|
598
739
|
/* @__PURE__ */ jsx(
|
|
599
740
|
Switch,
|
|
@@ -618,7 +759,7 @@ var BOX_SIZE = 20;
|
|
|
618
759
|
var BOX_RADIUS = 5;
|
|
619
760
|
var CHECK_FONT_SIZE = 14;
|
|
620
761
|
var DISABLED_OPACITY = 0.5;
|
|
621
|
-
var
|
|
762
|
+
var styles8 = StyleSheet.create({
|
|
622
763
|
container: {
|
|
623
764
|
flexDirection: "row",
|
|
624
765
|
alignItems: "flex-start",
|
|
@@ -700,14 +841,14 @@ var FormCheckbox = ({
|
|
|
700
841
|
disabled,
|
|
701
842
|
onPress: toggle,
|
|
702
843
|
role: "checkbox",
|
|
703
|
-
style: [
|
|
844
|
+
style: [styles8.container, containerStyle, disabled ? { opacity: DISABLED_OPACITY } : null],
|
|
704
845
|
testID,
|
|
705
846
|
...keyboardProps,
|
|
706
847
|
children: [
|
|
707
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
708
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
709
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
710
|
-
hasHint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
848
|
+
/* @__PURE__ */ jsx(View, { style: [styles8.box, value ? themeStyles.boxOn : themeStyles.boxOff], children: value ? /* @__PURE__ */ jsx(Text, { style: [styles8.check, { color: colors.surface }], accessibilityElementsHidden: true, children: "\u2713" }) : null }),
|
|
849
|
+
/* @__PURE__ */ jsxs(View, { style: styles8.textColumn, children: [
|
|
850
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.label, themeStyles.label], children: label }),
|
|
851
|
+
hasHint ? /* @__PURE__ */ jsx(Text, { style: [styles8.hint, themeStyles.hint], children: hintText }) : null
|
|
711
852
|
] })
|
|
712
853
|
]
|
|
713
854
|
}
|
|
@@ -788,13 +929,13 @@ var controlStyles = StyleSheet.create({
|
|
|
788
929
|
optionText: { fontSize: OPTION_FONT },
|
|
789
930
|
error: { fontSize: ERROR_FONT, marginTop: ERROR_GAP }
|
|
790
931
|
});
|
|
791
|
-
var
|
|
932
|
+
var IS_WEB3 = typeof document !== "undefined";
|
|
792
933
|
var ESCAPE_KEY = "Escape";
|
|
793
934
|
var ACTIVE_WEIGHT = "700";
|
|
794
935
|
var IDLE_WEIGHT = "400";
|
|
795
936
|
function useDismiss(anchorRef, menuRef, onDismiss) {
|
|
796
937
|
useEffect(() => {
|
|
797
|
-
if (!
|
|
938
|
+
if (!IS_WEB3) return void 0;
|
|
798
939
|
const onMouseDown = (event) => {
|
|
799
940
|
const anchorNode = anchorRef.current;
|
|
800
941
|
const menuNode = menuRef.current;
|
|
@@ -1113,6 +1254,6 @@ function DateRangeControl({
|
|
|
1113
1254
|
] });
|
|
1114
1255
|
}
|
|
1115
1256
|
|
|
1116
|
-
export { AnchoredMenu, ChipSelector, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCheckbox, FormField, FormSwitch, SelectControl, ThemedTextInput, TypeaheadControl, controlStyles, isUnmatched, suggestOptions, useThemedInput };
|
|
1257
|
+
export { AnchoredMenu, ChipSelector, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormSwitch, SelectControl, ThemedTextInput, TypeaheadControl, controlStyles, isUnmatched, suggestOptions, useThemedInput };
|
|
1117
1258
|
//# sourceMappingURL=index.mjs.map
|
|
1118
1259
|
//# sourceMappingURL=index.mjs.map
|