@eifi1/ui-kit 0.5.1 → 0.6.0
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/README.md +50 -1
- package/dist/components/amount-input.d.ts +7 -0
- package/dist/components/autocomplete.d.ts +101 -0
- package/dist/components/autocomplete.js +260 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/calculator.d.ts +7 -0
- package/dist/components/chip.d.ts +3 -2
- package/dist/components/chip.js +14 -1
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +100 -0
- package/dist/components/choice-card.js +170 -0
- package/dist/components/choice-card.js.map +1 -0
- package/dist/components/combobox-core.d.ts +76 -6
- package/dist/components/combobox-core.js +119 -49
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +12 -2
- package/dist/components/combobox.js +42 -17
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +91 -0
- package/dist/components/danger-confirm.js +181 -0
- package/dist/components/danger-confirm.js.map +1 -0
- package/dist/components/dialog-frame.d.ts +84 -0
- package/dist/components/dialog-frame.js +86 -0
- package/dist/components/dialog-frame.js.map +1 -0
- package/dist/components/disclosure.d.ts +108 -0
- package/dist/components/disclosure.js +127 -0
- package/dist/components/disclosure.js.map +1 -0
- package/dist/components/entity-combobox.d.ts +17 -3
- package/dist/components/entity-combobox.js +25 -5
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/file-button.d.ts +161 -0
- package/dist/components/file-button.js +225 -0
- package/dist/components/file-button.js.map +1 -0
- package/dist/components/file-dropzone.d.ts +72 -23
- package/dist/components/file-dropzone.js +219 -94
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/icon-picker.d.ts +72 -0
- package/dist/components/icon-picker.js +104 -0
- package/dist/components/icon-picker.js.map +1 -0
- package/dist/components/mini-calendar.d.ts +3 -0
- package/dist/components/mini-calendar.js +4 -3
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +8 -1
- package/dist/components/modal.js +4 -2
- package/dist/components/modal.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +16 -3
- package/dist/components/multi-entity-combobox.js +25 -5
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/number-field.d.ts +41 -1
- package/dist/components/number-field.js +42 -10
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +35 -2
- package/dist/components/number-input.js +35 -4
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +7 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.js +29 -7
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/signature-pad.d.ts +43 -1
- package/dist/components/signature-pad.js +74 -2
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +69 -0
- package/dist/components/swatch-picker.js +75 -0
- package/dist/components/swatch-picker.js.map +1 -0
- package/dist/components/tile-radio.d.ts +50 -0
- package/dist/components/tile-radio.js +140 -0
- package/dist/components/tile-radio.js.map +1 -0
- package/dist/components/toggle-group.d.ts +27 -5
- package/dist/components/toggle-group.js +22 -15
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/ui.d.ts +150 -12
- package/dist/components/ui.js +196 -22
- package/dist/components/ui.js.map +1 -1
- package/dist/i18n/defaults.d.ts +7 -0
- package/dist/i18n/defaults.js +13 -2
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +38 -5
- package/dist/i18n/kit-labels.js +12 -4
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/index.d.ts +16 -7
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/table-text.d.ts +127 -0
- package/dist/lib/table-text.js +82 -0
- package/dist/lib/table-text.js.map +1 -0
- package/dist/rhf/form.d.ts +79 -0
- package/dist/rhf/form.js +143 -0
- package/dist/rhf/form.js.map +1 -0
- package/dist/rhf.d.ts +4 -0
- package/dist/rhf.js +3 -0
- package/dist/rhf.js.map +1 -0
- package/dist/shell/app-shell.js +3 -1
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/table-text.d.ts +1 -0
- package/dist/table-text.js +3 -0
- package/dist/table-text.js.map +1 -0
- package/package.json +14 -1
- package/src/components/autocomplete.tsx +425 -0
- package/src/components/chip.tsx +24 -2
- package/src/components/choice-card.tsx +305 -0
- package/src/components/combobox-core.tsx +228 -58
- package/src/components/combobox.tsx +58 -21
- package/src/components/danger-confirm.tsx +286 -0
- package/src/components/dialog-frame.tsx +179 -0
- package/src/components/disclosure.tsx +259 -0
- package/src/components/entity-combobox.tsx +41 -6
- package/src/components/file-button.tsx +431 -0
- package/src/components/file-dropzone.tsx +323 -117
- package/src/components/icon-picker.tsx +181 -0
- package/src/components/mini-calendar.tsx +7 -3
- package/src/components/modal.tsx +10 -2
- package/src/components/multi-entity-combobox.tsx +40 -6
- package/src/components/number-field.tsx +86 -10
- package/src/components/number-input.tsx +79 -2
- package/src/components/search-field.tsx +49 -6
- package/src/components/signature-pad.tsx +112 -0
- package/src/components/swatch-picker.tsx +141 -0
- package/src/components/tile-radio.tsx +228 -0
- package/src/components/toggle-group.tsx +54 -18
- package/src/components/ui.tsx +400 -24
- package/src/i18n/defaults.ts +12 -1
- package/src/i18n/kit-labels.tsx +45 -5
- package/src/index.ts +19 -0
- package/src/lib/table-text.ts +265 -0
- package/src/rhf/form.tsx +300 -0
- package/src/rhf.ts +9 -0
- package/src/shell/app-shell.tsx +3 -1
- package/src/table-text.ts +8 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useId, useRef } from "react";
|
|
2
|
+
import type { ChangeEvent, ComponentType, InputHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { Check, Minus } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
import { assignRef, hasMessage, mergeDescribedBy } from "./choice-parts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A checkbox or a radio, presented as a bordered card: a title, a line of description,
|
|
9
|
+
* an optional icon — and the whole card is the hit area.
|
|
10
|
+
*
|
|
11
|
+
* Kastlan built this twice by hand: the "manage roles" dialog wraps a `Checkbox` in a
|
|
12
|
+
* bordered `<label>` per role, and the lease wizard's "set up recurring rent" option is
|
|
13
|
+
* a `Checkbox` with `className="rounded-md border p-3"`. Neither had a focus ring on
|
|
14
|
+
* the card or a checked look beyond the 16px box, and the role picker's border stayed
|
|
15
|
+
* grey whether the role was on or off.
|
|
16
|
+
*
|
|
17
|
+
* Still a native `<input>` underneath, for the reasons {@link Checkbox} gives: it
|
|
18
|
+
* submits with its form, answers to `required`, and a radio set sharing a `name` gets
|
|
19
|
+
* the browser's own arrow-key behaviour — which already flips in a right-to-left page.
|
|
20
|
+
* The card is a `<label>` wrapped round it, so a click anywhere on the card lands on
|
|
21
|
+
* the input; the input is NAMED by the title alone and DESCRIBED by the description,
|
|
22
|
+
* so a screen reader does not read the whole card as its name.
|
|
23
|
+
*
|
|
24
|
+
* Checked is said three ways, none of them colour alone: the box's tick (or the
|
|
25
|
+
* radio's dot), a heavier border, and the brand-tinted surface.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export type ChoiceCardType = "checkbox" | "radio";
|
|
29
|
+
|
|
30
|
+
export interface ChoiceCardProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "title"> {
|
|
31
|
+
/** "checkbox" (default) for an on/off option or one of several; "radio" for one of
|
|
32
|
+
* a set — give every card of the set the same `name`, or use {@link ChoiceCardGroup}. */
|
|
33
|
+
type?: ChoiceCardType;
|
|
34
|
+
/** The option's name — the input's accessible name. */
|
|
35
|
+
title: ReactNode;
|
|
36
|
+
/** A line or two under the title. Attached with `aria-describedby`. */
|
|
37
|
+
description?: ReactNode;
|
|
38
|
+
/** A Lucide icon (or any component taking a `className`), shown at the card's start. */
|
|
39
|
+
icon?: ComponentType<{ className?: string; "aria-hidden"?: boolean }>;
|
|
40
|
+
/** Checkbox only: "some but not all". See {@link CheckboxProps.indeterminate}. */
|
|
41
|
+
indeterminate?: boolean;
|
|
42
|
+
/** Paints the card and sets `aria-invalid` together. */
|
|
43
|
+
invalid?: boolean;
|
|
44
|
+
/** What is wrong, in the caller's words. Rendered in the card and attached with
|
|
45
|
+
* `aria-describedby`; implies `invalid`. */
|
|
46
|
+
error?: ReactNode;
|
|
47
|
+
/** The checked state as a boolean. Fires alongside `onChange`, never instead of it. */
|
|
48
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
49
|
+
/** Classes for the `<input>`. `className` styles the card. */
|
|
50
|
+
inputClassName?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// The card. `has-[:checked]` and `has-[:focus-visible]` read the INPUT's state, so an
|
|
54
|
+
// uncontrolled card (`defaultChecked`, a plain form) looks right with no React state.
|
|
55
|
+
const CARD =
|
|
56
|
+
"flex cursor-pointer items-start gap-3 rounded-lg border border-[var(--border)] bg-[var(--bg-surface)] p-3 shadow-sm transition-colors " +
|
|
57
|
+
"hover:border-[var(--border-strong)] hover:bg-[var(--bg-hover)] " +
|
|
58
|
+
"has-[:checked]:border-[var(--brand)] has-[:checked]:bg-[var(--brand-bg)] has-[:checked]:ring-1 has-[:checked]:ring-[var(--brand)] " +
|
|
59
|
+
// The focus mark is the CARD's, not the 16px box's: the card is what was clicked and
|
|
60
|
+
// what the eye is on. An OUTLINE rather than a ring, because the checked state already
|
|
61
|
+
// spends the ring — two `ring-*` widths on one element are decided by stylesheet
|
|
62
|
+
// order, and the loser would be the focus mark. Offset, so the two never merge.
|
|
63
|
+
"has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-[var(--brand)] " +
|
|
64
|
+
// Read from the input too, so a card disabled by its `<fieldset>` fades as well.
|
|
65
|
+
"has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60";
|
|
66
|
+
|
|
67
|
+
// No hover offer on a card that cannot be changed.
|
|
68
|
+
const CARD_DISABLED = "hover:border-[var(--border)] hover:bg-[var(--bg-surface)]";
|
|
69
|
+
|
|
70
|
+
const CARD_INVALID =
|
|
71
|
+
"border-[var(--danger-border)] ring-1 ring-[var(--danger-border)] has-[:checked]:border-[var(--danger-border)] has-[:checked]:ring-[var(--danger-border)]";
|
|
72
|
+
|
|
73
|
+
const BOX =
|
|
74
|
+
"peer size-4 shrink-0 appearance-none border border-[var(--border-strong)] bg-[var(--bg-surface)] transition-colors " +
|
|
75
|
+
"checked:border-[var(--brand)] focus:outline-none disabled:cursor-not-allowed";
|
|
76
|
+
const CHECKBOX = "rounded-[4px] checked:bg-[var(--brand)]";
|
|
77
|
+
// A radio's dot is its BORDER: a 5px brand border round a surface-coloured 4px
|
|
78
|
+
// centre. No glyph to lay over it, and it scales with the box.
|
|
79
|
+
const RADIO = "rounded-full checked:border-[5px]";
|
|
80
|
+
|
|
81
|
+
export const ChoiceCard = forwardRef<HTMLInputElement, ChoiceCardProps>(function ChoiceCard(
|
|
82
|
+
{
|
|
83
|
+
type = "checkbox",
|
|
84
|
+
title,
|
|
85
|
+
description,
|
|
86
|
+
icon: Icon,
|
|
87
|
+
indeterminate = false,
|
|
88
|
+
invalid,
|
|
89
|
+
error,
|
|
90
|
+
onCheckedChange,
|
|
91
|
+
onChange,
|
|
92
|
+
className,
|
|
93
|
+
inputClassName,
|
|
94
|
+
id,
|
|
95
|
+
disabled,
|
|
96
|
+
...rest
|
|
97
|
+
},
|
|
98
|
+
ref,
|
|
99
|
+
) {
|
|
100
|
+
const generated = useId();
|
|
101
|
+
const inputId = id ?? generated;
|
|
102
|
+
const titleId = `${inputId}-title`;
|
|
103
|
+
const descriptionId = `${inputId}-description`;
|
|
104
|
+
const errorId = `${inputId}-error`;
|
|
105
|
+
const showDescription = hasMessage(description);
|
|
106
|
+
const showError = hasMessage(error);
|
|
107
|
+
const isInvalid = Boolean(invalid) || showError;
|
|
108
|
+
const mixed = type === "checkbox" && indeterminate;
|
|
109
|
+
|
|
110
|
+
const local = useRef<HTMLInputElement | null>(null);
|
|
111
|
+
const setRef = useCallback(
|
|
112
|
+
(node: HTMLInputElement | null) => {
|
|
113
|
+
local.current = node;
|
|
114
|
+
assignRef(ref, node);
|
|
115
|
+
},
|
|
116
|
+
[ref],
|
|
117
|
+
);
|
|
118
|
+
// After every render, as Checkbox does: a click clears the DOM property.
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (local.current) local.current.indeterminate = mixed;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<label
|
|
125
|
+
htmlFor={inputId}
|
|
126
|
+
className={cn(CARD, disabled && CARD_DISABLED, isInvalid && CARD_INVALID, className)}
|
|
127
|
+
>
|
|
128
|
+
{/* A 20px cell, so the box centres on the title's first line (text-sm). */}
|
|
129
|
+
<span className="relative flex h-5 shrink-0 items-center">
|
|
130
|
+
<input
|
|
131
|
+
ref={setRef}
|
|
132
|
+
id={inputId}
|
|
133
|
+
disabled={disabled}
|
|
134
|
+
{...rest}
|
|
135
|
+
type={type}
|
|
136
|
+
aria-labelledby={rest["aria-labelledby"] ?? titleId}
|
|
137
|
+
aria-invalid={isInvalid || rest["aria-invalid"] || undefined}
|
|
138
|
+
aria-describedby={mergeDescribedBy(
|
|
139
|
+
rest["aria-describedby"],
|
|
140
|
+
showDescription && descriptionId,
|
|
141
|
+
showError && errorId,
|
|
142
|
+
)}
|
|
143
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
144
|
+
onChange?.(e);
|
|
145
|
+
onCheckedChange?.(e.target.checked);
|
|
146
|
+
}}
|
|
147
|
+
className={cn(
|
|
148
|
+
BOX,
|
|
149
|
+
type === "radio" ? RADIO : CHECKBOX,
|
|
150
|
+
mixed && "border-[var(--brand)] bg-[var(--brand)]",
|
|
151
|
+
inputClassName,
|
|
152
|
+
)}
|
|
153
|
+
/>
|
|
154
|
+
{type === "checkbox" &&
|
|
155
|
+
(mixed ? (
|
|
156
|
+
<Minus
|
|
157
|
+
aria-hidden
|
|
158
|
+
strokeWidth={3}
|
|
159
|
+
className="pointer-events-none absolute inset-0 m-auto size-3 text-[var(--brand-contrast)]"
|
|
160
|
+
/>
|
|
161
|
+
) : (
|
|
162
|
+
<Check
|
|
163
|
+
aria-hidden
|
|
164
|
+
strokeWidth={3}
|
|
165
|
+
className="pointer-events-none invisible absolute inset-0 m-auto size-3 text-[var(--brand-contrast)] peer-checked:visible"
|
|
166
|
+
/>
|
|
167
|
+
))}
|
|
168
|
+
</span>
|
|
169
|
+
{Icon && <Icon aria-hidden className="mt-0.5 size-4 shrink-0 text-[var(--text-secondary)]" />}
|
|
170
|
+
<span className="min-w-0 flex-1">
|
|
171
|
+
<span
|
|
172
|
+
id={titleId}
|
|
173
|
+
// `select-none`: a double-click to toggle twice would otherwise select the words.
|
|
174
|
+
className="block select-none text-sm font-medium leading-5 text-[var(--text-primary)]"
|
|
175
|
+
>
|
|
176
|
+
{title}
|
|
177
|
+
</span>
|
|
178
|
+
{showDescription && (
|
|
179
|
+
<span id={descriptionId} className="mt-0.5 block text-xs text-[var(--text-muted)]">
|
|
180
|
+
{description}
|
|
181
|
+
</span>
|
|
182
|
+
)}
|
|
183
|
+
{showError && (
|
|
184
|
+
<span id={errorId} className="mt-1 block text-[11px] leading-tight text-[var(--danger)]">
|
|
185
|
+
{error}
|
|
186
|
+
</span>
|
|
187
|
+
)}
|
|
188
|
+
</span>
|
|
189
|
+
</label>
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
ChoiceCard.displayName = "ChoiceCard";
|
|
193
|
+
|
|
194
|
+
/* ── ChoiceCardGroup ─────────────────────────────────────────────────────── */
|
|
195
|
+
|
|
196
|
+
export interface ChoiceCardOption<T extends string> {
|
|
197
|
+
value: T;
|
|
198
|
+
title: ReactNode;
|
|
199
|
+
description?: ReactNode;
|
|
200
|
+
icon?: ChoiceCardProps["icon"];
|
|
201
|
+
disabled?: boolean;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface ChoiceCardGroupBaseProps<T extends string> {
|
|
205
|
+
options: ChoiceCardOption<T>[];
|
|
206
|
+
/** The question the cards answer. Rendered as the fieldset's `<legend>`, which is
|
|
207
|
+
* what names the group. Without one, pass `aria-label`. */
|
|
208
|
+
legend?: ReactNode;
|
|
209
|
+
"aria-label"?: string;
|
|
210
|
+
/** Shared by every input — what a plain form submits under. Generated if omitted. */
|
|
211
|
+
name?: string;
|
|
212
|
+
/** Classes for the card grid. Default: one column, two from `sm` up. */
|
|
213
|
+
className?: string;
|
|
214
|
+
/** Classes for every card. */
|
|
215
|
+
cardClassName?: string;
|
|
216
|
+
disabled?: boolean;
|
|
217
|
+
/** What is wrong with the answer as a whole. Rendered under the cards and attached
|
|
218
|
+
* to the fieldset. */
|
|
219
|
+
error?: ReactNode;
|
|
220
|
+
/** Radio mode only: marks the first input `required`, which is how a radio set is. */
|
|
221
|
+
required?: boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** One of the set: radios. `value` is `null` while nothing is chosen. */
|
|
225
|
+
export interface ChoiceCardSingleProps<T extends string> extends ChoiceCardGroupBaseProps<T> {
|
|
226
|
+
multiple?: false;
|
|
227
|
+
value: T | null;
|
|
228
|
+
onChange: (value: T) => void;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Any of the set: checkboxes. */
|
|
232
|
+
export interface ChoiceCardMultipleProps<T extends string> extends ChoiceCardGroupBaseProps<T> {
|
|
233
|
+
multiple: true;
|
|
234
|
+
value: T[];
|
|
235
|
+
onChange: (value: T[]) => void;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type ChoiceCardGroupProps<T extends string> =
|
|
239
|
+
| ChoiceCardSingleProps<T>
|
|
240
|
+
| ChoiceCardMultipleProps<T>;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* A set of {@link ChoiceCard}s answering one question, in a `<fieldset>`.
|
|
244
|
+
*
|
|
245
|
+
* `multiple` picks the input: radios (one of the set, the browser's arrow keys
|
|
246
|
+
* between them) or checkboxes (any of the set, Tab between them). The value is kept
|
|
247
|
+
* in the order of `options`, not the order the boxes were ticked, so a list saved
|
|
248
|
+
* from it does not depend on the order someone clicked in.
|
|
249
|
+
*/
|
|
250
|
+
export function ChoiceCardGroup<T extends string>(props: ChoiceCardGroupProps<T>) {
|
|
251
|
+
const { options, legend, name, className, cardClassName, disabled, error, required } = props;
|
|
252
|
+
const generated = useId();
|
|
253
|
+
const groupName = name ?? generated;
|
|
254
|
+
const errorId = `${generated}-error`;
|
|
255
|
+
const showError = hasMessage(error);
|
|
256
|
+
|
|
257
|
+
const isChecked = (v: T) => (props.multiple ? props.value.includes(v) : props.value === v);
|
|
258
|
+
const toggle = (v: T, on: boolean) => {
|
|
259
|
+
if (props.multiple) {
|
|
260
|
+
const next = new Set(props.value);
|
|
261
|
+
if (on) next.add(v);
|
|
262
|
+
else next.delete(v);
|
|
263
|
+
props.onChange(options.map((o) => o.value).filter((x) => next.has(x)));
|
|
264
|
+
} else if (on) {
|
|
265
|
+
props.onChange(v);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<fieldset
|
|
271
|
+
aria-label={props["aria-label"]}
|
|
272
|
+
aria-describedby={showError ? errorId : undefined}
|
|
273
|
+
disabled={disabled}
|
|
274
|
+
className="min-w-0"
|
|
275
|
+
>
|
|
276
|
+
{legend !== undefined && (
|
|
277
|
+
<legend className="mb-2 text-sm font-medium text-[var(--text-primary)]">{legend}</legend>
|
|
278
|
+
)}
|
|
279
|
+
<div className={cn("grid gap-2 sm:grid-cols-2", className)}>
|
|
280
|
+
{options.map((o, i) => (
|
|
281
|
+
<ChoiceCard
|
|
282
|
+
key={o.value}
|
|
283
|
+
type={props.multiple ? "checkbox" : "radio"}
|
|
284
|
+
name={groupName}
|
|
285
|
+
value={o.value}
|
|
286
|
+
title={o.title}
|
|
287
|
+
description={o.description}
|
|
288
|
+
icon={o.icon}
|
|
289
|
+
disabled={o.disabled}
|
|
290
|
+
invalid={showError}
|
|
291
|
+
required={!props.multiple && required && i === 0 ? true : undefined}
|
|
292
|
+
checked={isChecked(o.value)}
|
|
293
|
+
onCheckedChange={(on) => toggle(o.value, on)}
|
|
294
|
+
className={cardClassName}
|
|
295
|
+
/>
|
|
296
|
+
))}
|
|
297
|
+
</div>
|
|
298
|
+
{showError && (
|
|
299
|
+
<p id={errorId} className="mt-1 text-[11px] leading-tight text-[var(--danger)]">
|
|
300
|
+
{error}
|
|
301
|
+
</p>
|
|
302
|
+
)}
|
|
303
|
+
</fieldset>
|
|
304
|
+
);
|
|
305
|
+
}
|