@api7/ui-components 0.5.0 → 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 +46 -1
- package/dist/components/alert/alert.d.ts +0 -2
- package/dist/components/alert/alert.js +1 -2
- package/dist/components/avatar/avatar.d.ts +0 -2
- package/dist/components/avatar/avatar.js +1 -2
- package/dist/components/badge/badge.d.ts +0 -2
- package/dist/components/badge/badge.js +1 -2
- package/dist/components/button/button.d.ts +0 -2
- package/dist/components/button/button.js +1 -2
- package/dist/components/calendar/calendar.d.ts +0 -2
- package/dist/components/calendar/calendar.js +1 -2
- package/dist/components/checkbox/checkbox.d.ts +0 -2
- package/dist/components/checkbox/checkbox.js +1 -2
- package/dist/components/combobox/combobox.d.ts +0 -2
- package/dist/components/combobox/combobox.js +1 -2
- package/dist/components/data-table/data-table.d.ts +0 -2
- package/dist/components/data-table/data-table.js +1 -2
- package/dist/components/data-table/filter-header.d.ts +1 -3
- package/dist/components/data-table/filter-header.js +1 -2
- package/dist/components/data-table/sort-header.js +1 -2
- package/dist/components/date-picker/date-picker.d.ts +0 -2
- package/dist/components/date-picker/date-picker.js +1 -2
- package/dist/components/description-list/description-list.d.ts +0 -2
- package/dist/components/description-list/description-list.js +1 -2
- package/dist/components/dialog/dialog.d.ts +0 -2
- package/dist/components/dialog/dialog.js +1 -2
- package/dist/components/drawer/drawer.d.ts +0 -2
- package/dist/components/drawer/drawer.js +1 -2
- package/dist/components/empty/empty.d.ts +0 -2
- package/dist/components/empty/empty.js +1 -2
- package/dist/components/field/field.d.ts +0 -2
- package/dist/components/field/field.js +1 -2
- package/dist/components/field/labeled-field.d.ts +33 -0
- package/dist/components/field/labeled-field.js +67 -0
- package/dist/components/form/choice-fields.d.ts +1 -3
- package/dist/components/form/choice-fields.js +1 -2
- package/dist/components/form/date-fields.d.ts +0 -2
- package/dist/components/form/date-fields.js +1 -2
- package/dist/components/form/errors.d.ts +1 -3
- package/dist/components/form/errors.js +1 -2
- package/dist/components/form/form-context.d.ts +1 -3
- package/dist/components/form/form-context.js +1 -2
- package/dist/components/form/form-item.d.ts +6 -17
- package/dist/components/form/form-item.js +9 -58
- package/dist/components/form/form.d.ts +1 -3
- package/dist/components/form/form.js +1 -2
- package/dist/components/form/lazy-field-components.js +1 -2
- package/dist/components/form/submit-button.d.ts +1 -3
- package/dist/components/form/submit-button.js +1 -2
- package/dist/components/form/text-field.d.ts +1 -3
- package/dist/components/form/text-field.js +1 -2
- package/dist/components/form/toggle-fields.d.ts +1 -3
- package/dist/components/form/toggle-fields.js +30 -46
- package/dist/components/input/input.d.ts +0 -2
- package/dist/components/input/input.js +1 -2
- package/dist/components/input-group/input-group.d.ts +0 -2
- package/dist/components/input-group/input-group.js +1 -2
- package/dist/components/menu/menu.d.ts +14 -4
- package/dist/components/menu/menu.js +34 -24
- package/dist/components/number-field/number-field.d.ts +0 -2
- package/dist/components/number-field/number-field.js +1 -2
- package/dist/components/pagination/pagination.d.ts +1 -3
- package/dist/components/pagination/pagination.js +1 -2
- package/dist/components/popover/popover.d.ts +3 -3
- package/dist/components/popover/popover.js +9 -3
- package/dist/components/progress/progress.d.ts +0 -2
- package/dist/components/progress/progress.js +1 -2
- package/dist/components/radio-group/radio-group.d.ts +0 -2
- package/dist/components/radio-group/radio-group.js +1 -2
- package/dist/components/select/select.d.ts +0 -2
- package/dist/components/select/select.js +1 -2
- package/dist/components/separator/separator.d.ts +0 -2
- package/dist/components/separator/separator.js +1 -2
- package/dist/components/sidebar/sidebar.d.ts +0 -2
- package/dist/components/sidebar/sidebar.js +2 -3
- package/dist/components/skeleton/skeleton.d.ts +0 -2
- package/dist/components/skeleton/skeleton.js +1 -2
- package/dist/components/spinner/spinner.d.ts +0 -2
- package/dist/components/spinner/spinner.js +1 -2
- package/dist/components/switch/switch.d.ts +0 -2
- package/dist/components/switch/switch.js +1 -2
- package/dist/components/table/table.d.ts +0 -2
- package/dist/components/table/table.js +1 -2
- package/dist/components/tabs/tabs.d.ts +0 -2
- package/dist/components/tabs/tabs.js +1 -2
- package/dist/components/textarea/textarea.d.ts +0 -2
- package/dist/components/textarea/textarea.js +1 -2
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +1 -2
- package/dist/components/tooltip/tooltip.d.ts +0 -2
- package/dist/components/tooltip/tooltip.js +1 -2
- package/dist/config/config-provider.d.ts +1 -3
- package/dist/config/config-provider.js +1 -2
- package/dist/config/messages.d.ts +1 -3
- package/dist/config/messages.js +1 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/lib/cn.js +1 -2
- package/dist/lib/control.js +1 -2
- package/dist/lib/popup.js +1 -2
- package/dist/tokens/contrast.d.ts +1 -3
- package/dist/tokens/contrast.js +1 -2
- package/dist/tokens/palette.d.ts +0 -2
- package/dist/tokens/palette.js +1 -2
- package/dist/tokens/scale.js +1 -2
- package/dist/tokens/semantic.d.ts +0 -2
- package/dist/tokens/semantic.js +0 -1
- package/dist/tokens/types.d.ts +1 -3
- package/dist/tokens/types.js +1 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ Add the optional ones only if you import those entry points.
|
|
|
94
94
|
| Import | Contents |
|
|
95
95
|
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
96
96
|
| `@api7/ui-components` | Components, `toast` and `Toaster`, `ConfigProvider`, `useLocale` and `useMessages`, and in CSS the theme for the Tailwind CSS of the application |
|
|
97
|
-
| `@api7/ui-components/form` | Form
|
|
97
|
+
| `@api7/ui-components/form` | Form fields built on TanStack Form. Their form row, `LabeledField`, is in the main entry and works with any form library |
|
|
98
98
|
| `@api7/ui-components/data-table` | The data table built on TanStack Table |
|
|
99
99
|
| `@api7/ui-components/tokens` | Design token data (`palette`, `themes`, `FAMILIES`, `STEPS` and the contrast helpers) for documentation pages |
|
|
100
100
|
|
|
@@ -213,6 +213,35 @@ export function NameForm({ onSave }: { onSave: (name: string) => void }) {
|
|
|
213
213
|
|
|
214
214
|
Validators are the ones of TanStack Form, so a function or a Standard Schema such as a zod schema both work. A string returned by a validator is shown under the field.
|
|
215
215
|
|
|
216
|
+
### With another form library
|
|
217
|
+
|
|
218
|
+
The form row that these fields draw is `LabeledField` from the main entry, and it does not depend on TanStack Form. It takes the label, `labelTooltip`, `optional`, `description` and `layout` like the fields above, and the state of the field as props: `name`, `invalid`, `touched`, `dirty` and `errors`, a list of messages shown while `invalid` is true. The control inside it gets its id, `aria-invalid` and `aria-describedby` from the field, so it is wired the same way as in a TanStack form. `group` renders a fieldset with the label as its legend, for a group of controls such as radio buttons.
|
|
219
|
+
|
|
220
|
+
With react-hook-form, read the state with `useController` and pass it in:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
import { Input, LabeledField } from '@api7/ui-components';
|
|
224
|
+
import { useController } from 'react-hook-form';
|
|
225
|
+
|
|
226
|
+
export function NameField() {
|
|
227
|
+
const { field, fieldState } = useController({ name: 'name', rules: { required: 'Name is required' } });
|
|
228
|
+
return (
|
|
229
|
+
<LabeledField
|
|
230
|
+
label="Name"
|
|
231
|
+
name={field.name}
|
|
232
|
+
invalid={fieldState.invalid}
|
|
233
|
+
touched={fieldState.isTouched}
|
|
234
|
+
dirty={fieldState.isDirty}
|
|
235
|
+
errors={fieldState.error?.message ? [fieldState.error.message] : []}
|
|
236
|
+
>
|
|
237
|
+
<Input ref={field.ref} value={field.value} onValueChange={field.onChange} onBlur={field.onBlur} />
|
|
238
|
+
</LabeledField>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`invalid` decides when the error shows. The fields of `/form` show it once the field is touched, and react-hook-form sets `fieldState.invalid` after its own validation mode runs, on submit by default.
|
|
244
|
+
|
|
216
245
|
## Joining a field and a button
|
|
217
246
|
|
|
218
247
|
`InputGroup` joins an `Input` with a `Button` or an `InputGroupAddon` into one control. The group draws no border, ring or state of its own. Each part keeps its own border, hover, focus, invalid and disabled styling, and they touch with one divider between them, so the field and the button read as one. Only the outer corners of the group are round. An `Input` and a `Button` that stand alone are not changed.
|
|
@@ -350,3 +379,19 @@ To change a color, redeclare the variable after the import, on the same selector
|
|
|
350
379
|
```
|
|
351
380
|
|
|
352
381
|
An `@theme` block with the same variable changes only the value of a page root that has no `data-theme` attribute. A `data-theme` region, including `<html data-theme="…">`, keeps the library value, because the library rules are not in a layer and Tailwind emits `@theme` values in the theme layer. Use `@theme` only for values that do not change with the theme, such as `--font-sans`.
|
|
382
|
+
|
|
383
|
+
## Popover arrows
|
|
384
|
+
|
|
385
|
+
`PopoverContent` has no arrow by default. Add `PopoverArrow` inside it for a pointer that follows the trigger when viewport collision handling shifts or flips the popup. The arrow uses the popover background token and accepts the Base UI arrow props, including `className` and `style` for appearance overrides.
|
|
386
|
+
|
|
387
|
+
```tsx
|
|
388
|
+
import { Popover, PopoverArrow, PopoverContent, PopoverTrigger } from '@api7/ui-components';
|
|
389
|
+
|
|
390
|
+
<Popover>
|
|
391
|
+
<PopoverTrigger>View ID</PopoverTrigger>
|
|
392
|
+
<PopoverContent align="center" sideOffset={12}>
|
|
393
|
+
<PopoverArrow />
|
|
394
|
+
ID: service-production
|
|
395
|
+
</PopoverContent>
|
|
396
|
+
</Popover>;
|
|
397
|
+
```
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
//#region src/components/alert/alert.d.ts
|
|
4
3
|
declare const alertVariants: (props?: ({
|
|
5
4
|
variant?: "destructive" | "success" | "warning" | "info" | null | undefined;
|
|
6
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -12,5 +11,4 @@ export type AlertDescriptionProps = ComponentProps<'div'>;
|
|
|
12
11
|
declare function Alert({ variant, icon, className, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
13
12
|
declare function AlertTitle({ className, ...props }: AlertTitleProps): import("react").JSX.Element;
|
|
14
13
|
declare function AlertDescription({ className, ...props }: AlertDescriptionProps): import("react").JSX.Element;
|
|
15
|
-
//#endregion
|
|
16
14
|
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
@@ -2,7 +2,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { CircleAlert, CircleCheck, Info, TriangleAlert } from "lucide-react";
|
|
5
|
-
|
|
5
|
+
// src/components/alert/alert.tsx
|
|
6
6
|
const alertVariants = cva("relative flex w-full gap-2 rounded-sm px-3 py-2 text-sm text-foreground [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
7
7
|
variants: { variant: {
|
|
8
8
|
info: "bg-info-subtle [&>svg]:text-info",
|
|
@@ -46,5 +46,4 @@ function AlertDescription({ className, ...props }) {
|
|
|
46
46
|
"data-slot": "alert-description"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
//#region src/components/avatar/avatar.d.ts
|
|
3
2
|
declare const SIZES: {
|
|
4
3
|
readonly sm: {
|
|
5
4
|
readonly px: 24;
|
|
@@ -29,5 +28,4 @@ export type AvatarProps = Omit<ComponentProps<'span'>, 'children'> & {
|
|
|
29
28
|
alt?: string;
|
|
30
29
|
};
|
|
31
30
|
declare function Avatar({ src, name, size, alt, className, style, ...props }: AvatarProps): import("react").JSX.Element;
|
|
32
|
-
//#endregion
|
|
33
31
|
export { Avatar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/avatar/avatar.tsx
|
|
5
5
|
const SIZES = {
|
|
6
6
|
sm: {
|
|
7
7
|
px: 24,
|
|
@@ -59,5 +59,4 @@ function Avatar({ src, name, size = "md", alt = "", className, style, ...props }
|
|
|
59
59
|
})
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { Avatar };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
//#region src/components/badge/badge.d.ts
|
|
4
3
|
declare const badgeVariants: (props?: ({
|
|
5
4
|
color?: "gray" | "slate" | "blue" | "green" | "red" | "yellow" | "orange" | "cyan" | "indigo" | "purple" | "pink" | null | undefined;
|
|
6
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -10,5 +9,4 @@ export type BadgeProps = Omit<ComponentProps<'span'>, 'color'> & {
|
|
|
10
9
|
dot?: boolean;
|
|
11
10
|
};
|
|
12
11
|
declare function Badge({ color, dot, className, children, ...props }: BadgeProps): import("react").JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
12
|
export { Badge, badgeVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
-
|
|
4
|
+
// src/components/badge/badge.tsx
|
|
5
5
|
const badgeVariants = cva("inline-flex min-h-5 max-w-[500px] items-center gap-1.5 rounded-full px-2 text-xs font-medium", {
|
|
6
6
|
variants: { color: {
|
|
7
7
|
gray: "bg-(--badge-gray-bg) text-(color:--badge-gray-fg)",
|
|
@@ -34,5 +34,4 @@ function Badge({ color = "gray", dot = false, className, children, ...props }) {
|
|
|
34
34
|
})]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
//#endregion
|
|
38
37
|
export { Badge, badgeVariants };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
2
|
import { Button } from "@base-ui/react/button";
|
|
3
|
-
//#region src/components/button/button.d.ts
|
|
4
3
|
declare const buttonVariants: (props?: ({
|
|
5
4
|
variant?: "primary" | "secondary" | "destructive" | "link" | "outline" | "ghost" | null | undefined;
|
|
6
5
|
size?: "sm" | "md" | "lg" | "icon" | null | undefined;
|
|
@@ -17,5 +16,4 @@ export interface ButtonProps extends Omit<Button.Props, 'className'>, VariantPro
|
|
|
17
16
|
loadingLabel?: string;
|
|
18
17
|
}
|
|
19
18
|
declare function Button$1({ className, variant, size, loading, loadingLabel, disabled, focusableWhenDisabled, children, ...props }: ButtonProps): import("react").JSX.Element;
|
|
20
|
-
//#endregion
|
|
21
19
|
export { Button$1 as Button, buttonVariants };
|
|
@@ -5,7 +5,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { LoaderCircle } from "lucide-react";
|
|
7
7
|
import { Button } from "@base-ui/react/button";
|
|
8
|
-
|
|
8
|
+
// src/components/button/button.tsx
|
|
9
9
|
const buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-md border border-transparent text-sm font-medium whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", {
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
@@ -58,5 +58,4 @@ function Button$1({ className, variant, size, loading = false, loadingLabel, dis
|
|
|
58
58
|
]
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { Button$1 as Button, buttonVariants };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { DayPicker } from "react-day-picker";
|
|
3
|
-
//#region src/components/calendar/calendar.d.ts
|
|
4
3
|
export type CalendarProps = ComponentProps<typeof DayPicker>;
|
|
5
4
|
/**
|
|
6
5
|
* Wraps react-day-picker's DayPicker with this library's visual conventions. Locale falls back to
|
|
@@ -15,5 +14,4 @@ export type CalendarProps = ComponentProps<typeof DayPicker>;
|
|
|
15
14
|
* var(--color-primary); }` in the app's CSS.
|
|
16
15
|
*/
|
|
17
16
|
declare function Calendar({ className, classNames, locale, navLayout, components, ...props }: CalendarProps): import("react").JSX.Element;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { Calendar };
|
|
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
|
|
8
8
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
9
9
|
import { enUS, zhCN } from "react-day-picker/locale";
|
|
10
|
-
|
|
10
|
+
// src/components/calendar/calendar.tsx
|
|
11
11
|
/** Merges a consumer's `classNames` prop with ours key by key. Consumer classes are appended to the
|
|
12
12
|
* key's own classes (the cell's fixed size, range-band fillers and state looks), which they cannot
|
|
13
13
|
* replace: only `` utilities take part in `cn`'s conflict resolution. */
|
|
@@ -159,5 +159,4 @@ function CalendarDayButton({ className, day, modifiers, ref: forwardedRef, ...pr
|
|
|
159
159
|
className: cn("absolute inset-0 m-auto flex size-6 items-center justify-center rounded-sm text-sm outline-none hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring/40", className)
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
//#endregion
|
|
163
162
|
export { Calendar };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Checkbox } from "@base-ui/react/checkbox";
|
|
2
|
-
//#region src/components/checkbox/checkbox.d.ts
|
|
3
2
|
export type CheckboxProps = Omit<Checkbox.Root.Props, 'className'> & {
|
|
4
3
|
className?: string;
|
|
5
4
|
};
|
|
6
5
|
declare function Checkbox$1({ className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { Checkbox$1 as Checkbox };
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
5
5
|
import { Checkbox } from "@base-ui/react/checkbox";
|
|
6
|
-
|
|
6
|
+
// src/components/checkbox/checkbox.tsx
|
|
7
7
|
function Checkbox$1({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
9
9
|
"data-base-ui-swipe-ignore": true,
|
|
@@ -20,5 +20,4 @@ function Checkbox$1({ className, ...props }) {
|
|
|
20
20
|
})
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { Checkbox$1 as Checkbox };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { Combobox } from "@base-ui/react/combobox";
|
|
3
|
-
//#region src/components/combobox/combobox.d.ts
|
|
4
3
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
};
|
|
@@ -44,5 +43,4 @@ export type ComboboxChipProps = WithClassName<Combobox.Chip.Props> & {
|
|
|
44
43
|
declare function ComboboxChip({ className, children, removeLabel, ...props }: ComboboxChipProps): import("react").JSX.Element;
|
|
45
44
|
export type ComboboxChipsInputProps = WithClassName<Combobox.Input.Props>;
|
|
46
45
|
declare function ComboboxChipsInput({ className, ...props }: ComboboxChipsInputProps): import("react").JSX.Element;
|
|
47
|
-
//#endregion
|
|
48
46
|
export { Combobox$1 as Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxValue };
|
|
@@ -6,7 +6,7 @@ import { controlFocus, controlFocusWithin, controlSurface } from "../../lib/cont
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
8
8
|
import { Combobox } from "@base-ui/react/combobox";
|
|
9
|
-
|
|
9
|
+
// src/components/combobox/combobox.tsx
|
|
10
10
|
function Combobox$1(props) {
|
|
11
11
|
return /* @__PURE__ */ jsx(Combobox.Root, { ...props });
|
|
12
12
|
}
|
|
@@ -138,5 +138,4 @@ function ComboboxChipsInput({ className, ...props }) {
|
|
|
138
138
|
"data-slot": "combobox-chips-input"
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { Combobox$1 as Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxValue };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DataTableColumnFilter } from "./filter-header.js";
|
|
2
2
|
import { ComponentProps, ReactNode } from "react";
|
|
3
3
|
import { ColumnDef, ColumnFiltersState, PaginationState, RowData, SortingState, TableFeatures } from "@tanstack/react-table";
|
|
4
|
-
//#region src/components/data-table/data-table.d.ts
|
|
5
4
|
declare const dataTableFeatures: {
|
|
6
5
|
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
7
6
|
columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
|
|
@@ -84,5 +83,4 @@ export interface DataTableProps<TData extends RowData> {
|
|
|
84
83
|
}
|
|
85
84
|
declare function DataTable<TData extends RowData>({ columns, data, getRowId, sorting, defaultSorting, onSortingChange, manualSorting, columnFilters, onColumnFiltersChange, manualFiltering, pagination, defaultPagination, onPaginationChange, manualPagination, rowCount, pageSizeOptions, hidePagination, paginationLabel, loading, empty, toolbar, className }: DataTableProps<TData>): import("react").JSX.Element;
|
|
86
85
|
declare function DataTableRowActions({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
87
|
-
//#endregion
|
|
88
86
|
export { DataTable, type DataTableColumnDef, type DataTableFeatures, DataTableRowActions, createDataTableColumnHelper, dataTableFeatures };
|
|
@@ -9,7 +9,7 @@ import { SortHeader } from "./sort-header.js";
|
|
|
9
9
|
import { useEffect, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { columnFilteringFeature, columnVisibilityFeature, constructFilterFn, createColumnHelper, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, flexRender, rowPaginationFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_basic, sortFn_datetime, sortFn_text, tableFeatures, useTable } from "@tanstack/react-table";
|
|
12
|
-
|
|
12
|
+
// src/components/data-table/data-table.tsx
|
|
13
13
|
const LOADING_ROW_COUNT = 4;
|
|
14
14
|
const filterFn_oneOf = constructFilterFn({
|
|
15
15
|
filter: (value, chosen) => chosen.includes(String(value)),
|
|
@@ -175,5 +175,4 @@ function DataTableRowActions({ className, ...props }) {
|
|
|
175
175
|
"data-slot": "data-table-row-actions"
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
//#endregion
|
|
179
178
|
export { DataTable, DataTableRowActions, createDataTableColumnHelper, dataTableFeatures };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "./data-table.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { RowData } from "@tanstack/react-table";
|
|
4
|
-
//#region src/components/data-table/filter-header.d.ts
|
|
5
4
|
export interface DataTableColumnFilterOption {
|
|
6
5
|
value: string;
|
|
7
6
|
label: ReactNode;
|
|
@@ -18,5 +17,4 @@ export interface DataTableColumnFilter {
|
|
|
18
17
|
* checked: the last checked value cannot be unchecked, and Reset checks the default again.
|
|
19
18
|
*/
|
|
20
19
|
defaultValue?: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
20
|
+
}
|
|
@@ -4,7 +4,7 @@ import { Button } from "../button/button.js";
|
|
|
4
4
|
import { Menu, MenuCheckboxItem, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from "../menu/menu.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Funnel } from "lucide-react";
|
|
7
|
-
|
|
7
|
+
// src/components/data-table/filter-header.tsx
|
|
8
8
|
function FilterHeader({ column, filter }) {
|
|
9
9
|
const messages = useMessages();
|
|
10
10
|
const filterValue = column.getFilterValue();
|
|
@@ -51,5 +51,4 @@ function FilterHeader({ column, filter }) {
|
|
|
51
51
|
]
|
|
52
52
|
})] });
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { FilterHeader };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react";
|
|
5
|
-
|
|
5
|
+
// src/components/data-table/sort-header.tsx
|
|
6
6
|
function SortHeader({ column, children }) {
|
|
7
7
|
const sorted = column.getIsSorted();
|
|
8
8
|
const Icon = sorted === "asc" ? ArrowUp : sorted === "desc" ? ArrowDown : ChevronsUpDown;
|
|
@@ -13,5 +13,4 @@ function SortHeader({ column, children }) {
|
|
|
13
13
|
children: [children, /* @__PURE__ */ jsx(Icon, { className: "size-3.5" })]
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { SortHeader };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CalendarProps } from "../calendar/calendar.js";
|
|
2
2
|
import { FocusEventHandler } from "react";
|
|
3
3
|
import { DateRange, DateRange as DateRange$1 } from "react-day-picker";
|
|
4
|
-
//#region src/components/date-picker/date-picker.d.ts
|
|
5
4
|
export interface DatePickerProps {
|
|
6
5
|
/** Controlled value. Passing the `value` key at all makes the picker controlled, so `value={undefined}` clears it. */
|
|
7
6
|
value?: Date;
|
|
@@ -51,5 +50,4 @@ export interface DateRangePickerProps {
|
|
|
51
50
|
}
|
|
52
51
|
/** Popover trigger + two-month range Calendar, with optional preset ranges listed beside the calendar. */
|
|
53
52
|
declare function DateRangePicker(props: DateRangePickerProps): import("react").JSX.Element;
|
|
54
|
-
//#endregion
|
|
55
53
|
export { DatePicker, type DateRange$1 as DateRange, DateRangePicker };
|
|
@@ -8,7 +8,7 @@ import { useCallback, useState } from "react";
|
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { CalendarIcon } from "lucide-react";
|
|
10
10
|
import { Field } from "@base-ui/react/field";
|
|
11
|
-
|
|
11
|
+
// src/components/date-picker/date-picker.tsx
|
|
12
12
|
function pad(value) {
|
|
13
13
|
return String(value).padStart(2, "0");
|
|
14
14
|
}
|
|
@@ -232,5 +232,4 @@ function DateRangePicker(props) {
|
|
|
232
232
|
})]
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
//#endregion
|
|
236
235
|
export { DatePicker, DateRangePicker };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
//#region src/components/description-list/description-list.d.ts
|
|
4
3
|
declare const descriptionListVariants: (props?: ({
|
|
5
4
|
variant?: "default" | "outline" | null | undefined;
|
|
6
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -22,5 +21,4 @@ declare function DescriptionList({ className, variant, columns, style, ...props
|
|
|
22
21
|
declare function DescriptionListItem({ className, colSpan, style, ...props }: DescriptionListItemProps): import("react").JSX.Element;
|
|
23
22
|
declare function DescriptionListLabel({ className, ...props }: DescriptionListLabelProps): import("react").JSX.Element;
|
|
24
23
|
declare function DescriptionListValue({ className, ...props }: DescriptionListValueProps): import("react").JSX.Element;
|
|
25
|
-
//#endregion
|
|
26
24
|
export { DescriptionList, DescriptionListItem, DescriptionListLabel, DescriptionListValue, descriptionListVariants };
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
|
-
|
|
6
|
+
// src/components/description-list/description-list.tsx
|
|
7
7
|
const descriptionListVariants = cva("grid w-full grid-cols-[repeat(var(--description-list-columns,1),var(--description-list-label-width,160px)_minmax(0,1fr))] text-sm leading-5", {
|
|
8
8
|
variants: { variant: {
|
|
9
9
|
default: "",
|
|
@@ -85,5 +85,4 @@ function DescriptionListValue({ className, ...props }) {
|
|
|
85
85
|
"data-slot": "description-list-value"
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
//#endregion
|
|
89
88
|
export { DescriptionList, DescriptionListItem, DescriptionListLabel, DescriptionListValue, descriptionListVariants };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { Dialog } from "@base-ui/react/dialog";
|
|
3
|
-
//#region src/components/dialog/dialog.d.ts
|
|
4
3
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
};
|
|
@@ -26,5 +25,4 @@ export type DialogFooterProps = ComponentProps<'div'>;
|
|
|
26
25
|
declare function DialogFooter({ className, ...props }: DialogFooterProps): import("react").JSX.Element;
|
|
27
26
|
export type DialogCloseProps = WithClassName<Dialog.Close.Props>;
|
|
28
27
|
declare function DialogClose({ className, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
29
|
-
//#endregion
|
|
30
28
|
export { Dialog$1 as Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
|
|
@@ -6,7 +6,7 @@ import { createContext, useContext } from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { XIcon } from "lucide-react";
|
|
8
8
|
import { Dialog } from "@base-ui/react/dialog";
|
|
9
|
-
|
|
9
|
+
// src/components/dialog/dialog.tsx
|
|
10
10
|
const DialogModalContext = createContext(true);
|
|
11
11
|
function Dialog$1({ modal = true, ...props }) {
|
|
12
12
|
return /* @__PURE__ */ jsx(DialogModalContext.Provider, {
|
|
@@ -92,5 +92,4 @@ function DialogClose({ className, ...props }) {
|
|
|
92
92
|
"data-slot": "dialog-close"
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
//#endregion
|
|
96
95
|
export { Dialog$1 as Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { Drawer } from "@base-ui/react/drawer";
|
|
3
|
-
//#region src/components/drawer/drawer.d.ts
|
|
4
3
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
};
|
|
@@ -26,5 +25,4 @@ export type DrawerFooterProps = ComponentProps<'div'>;
|
|
|
26
25
|
declare function DrawerFooter({ className, ...props }: DrawerFooterProps): import("react").JSX.Element;
|
|
27
26
|
export type DrawerCloseProps = WithClassName<Drawer.Close.Props>;
|
|
28
27
|
declare function DrawerClose({ className, ...props }: DrawerCloseProps): import("react").JSX.Element;
|
|
29
|
-
//#endregion
|
|
30
28
|
export { Drawer$1 as Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger };
|
|
@@ -6,7 +6,7 @@ import { createContext, useContext } from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { XIcon } from "lucide-react";
|
|
8
8
|
import { Drawer } from "@base-ui/react/drawer";
|
|
9
|
-
|
|
9
|
+
// src/components/drawer/drawer.tsx
|
|
10
10
|
const DrawerModalContext = createContext(true);
|
|
11
11
|
function Drawer$1({ swipeDirection = "right", modal = true, ...props }) {
|
|
12
12
|
return /* @__PURE__ */ jsx(DrawerModalContext.Provider, {
|
|
@@ -98,5 +98,4 @@ function DrawerClose({ className, ...props }) {
|
|
|
98
98
|
"data-slot": "drawer-close"
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
//#endregion
|
|
102
101
|
export { Drawer$1 as Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
//#region src/components/empty/empty.d.ts
|
|
4
3
|
declare const emptyMediaVariants: (props?: ({
|
|
5
4
|
variant?: "default" | "icon" | null | undefined;
|
|
6
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -16,5 +15,4 @@ declare function EmptyMedia({ variant, className, ...props }: EmptyMediaProps):
|
|
|
16
15
|
declare function EmptyTitle({ className, ...props }: EmptyTitleProps): import("react").JSX.Element;
|
|
17
16
|
declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): import("react").JSX.Element;
|
|
18
17
|
declare function EmptyContent({ className, ...props }: EmptyContentProps): import("react").JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
18
|
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
-
|
|
4
|
+
// src/components/empty/empty.tsx
|
|
5
5
|
const emptyVariants = cva("flex w-full min-w-0 flex-col items-center justify-center gap-3 rounded-sm border-[3px] border-dashed border-border px-4 py-4 text-center");
|
|
6
6
|
const emptyMediaVariants = cva("flex shrink-0 items-center justify-center", {
|
|
7
7
|
variants: { variant: {
|
|
@@ -53,5 +53,4 @@ function EmptyContent({ className, ...props }) {
|
|
|
53
53
|
"data-slot": "empty-content"
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Field } from "@base-ui/react/field";
|
|
2
2
|
import { Fieldset } from "@base-ui/react/fieldset";
|
|
3
|
-
//#region src/components/field/field.d.ts
|
|
4
3
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
};
|
|
@@ -16,5 +15,4 @@ declare function FieldDescription({ className, ...props }: FieldDescriptionProps
|
|
|
16
15
|
declare function FieldError({ className, ...props }: FieldErrorProps): import("react").JSX.Element;
|
|
17
16
|
declare function Fieldset$1({ className, ...props }: FieldsetProps): import("react").JSX.Element;
|
|
18
17
|
declare function FieldsetLegend({ className, ...props }: FieldsetLegendProps): import("react").JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
18
|
export { Field$1 as Field, FieldDescription, FieldError, FieldLabel, Fieldset$1 as Fieldset, FieldsetLegend };
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Field } from "@base-ui/react/field";
|
|
5
5
|
import { Fieldset } from "@base-ui/react/fieldset";
|
|
6
|
-
|
|
6
|
+
// src/components/field/field.tsx
|
|
7
7
|
function Field$1({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Field.Root, {
|
|
9
9
|
className: cn("flex flex-col gap-1.5", className),
|
|
@@ -46,5 +46,4 @@ function FieldsetLegend({ className, ...props }) {
|
|
|
46
46
|
"data-slot": "fieldset-legend"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { Field$1 as Field, FieldDescription, FieldError, FieldLabel, Fieldset$1 as Fieldset, FieldsetLegend };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type LabeledFieldLayout = 'stacked' | 'inline-end' | 'inline-start';
|
|
3
|
+
export interface LabeledFieldProps {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
/** Info icon next to the label that shows this content in a tooltip. */
|
|
7
|
+
labelTooltip?: ReactNode;
|
|
8
|
+
/** Appends the "Optional" marker to the label. */
|
|
9
|
+
optional?: boolean;
|
|
10
|
+
optionalLabel?: string;
|
|
11
|
+
moreInfoLabel?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
layout?: LabeledFieldLayout;
|
|
14
|
+
/**
|
|
15
|
+
* Renders a fieldset whose legend is the label, for a group of controls such as radio
|
|
16
|
+
* buttons. Only the stacked layout applies to a group.
|
|
17
|
+
*/
|
|
18
|
+
group?: boolean;
|
|
19
|
+
/** Name of the field, given to the control inside it. */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Marks the field and its control invalid and shows the errors. */
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
touched?: boolean;
|
|
24
|
+
dirty?: boolean;
|
|
25
|
+
/** Messages shown under the field while it is invalid. */
|
|
26
|
+
errors?: readonly string[];
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A form row: label, optional marker, label tooltip, control, description and errors. It
|
|
31
|
+
* takes the field state as props, so any form library or plain React state can drive it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function LabeledField({ label, description, labelTooltip, optional, optionalLabel, moreInfoLabel, className, layout, group, name, invalid, touched, dirty, errors, children }: LabeledFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMessages } from "../../config/config-provider.js";
|
|
3
|
+
import { Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend } from "./field.js";
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { InfoIcon } from "lucide-react";
|
|
7
|
+
// src/components/field/labeled-field.tsx
|
|
8
|
+
/** Appended inside a label so the accessible name reads "Name Optional". */
|
|
9
|
+
function OptionalMarker({ label }) {
|
|
10
|
+
const messages = useMessages();
|
|
11
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
12
|
+
className: "font-medium text-muted-foreground",
|
|
13
|
+
children: [" ", label ?? messages.form.optional]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** Info icon button next to a label; kept outside the label so clicking it does not focus the control. */
|
|
17
|
+
function LabelTooltip({ content, label }) {
|
|
18
|
+
const messages = useMessages();
|
|
19
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
20
|
+
render: /* @__PURE__ */ jsx("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
"aria-label": label ?? messages.form.moreInfo,
|
|
23
|
+
className: "inline-flex text-muted-foreground"
|
|
24
|
+
}),
|
|
25
|
+
children: /* @__PURE__ */ jsx(InfoIcon, { className: "size-3.5" })
|
|
26
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: content })] });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A form row: label, optional marker, label tooltip, control, description and errors. It
|
|
30
|
+
* takes the field state as props, so any form library or plain React state can drive it.
|
|
31
|
+
*/
|
|
32
|
+
function LabeledField({ label, description, labelTooltip, optional, optionalLabel, moreInfoLabel, className, layout = "stacked", group = false, name, invalid = false, touched, dirty, errors = [], children }) {
|
|
33
|
+
const labelRow = label && /* @__PURE__ */ jsxs("div", {
|
|
34
|
+
className: "flex items-center gap-1",
|
|
35
|
+
children: [/* @__PURE__ */ jsxs(group ? FieldsetLegend : FieldLabel, { children: [label, optional && /* @__PURE__ */ jsx(OptionalMarker, { label: optionalLabel })] }), labelTooltip && /* @__PURE__ */ jsx(LabelTooltip, {
|
|
36
|
+
content: labelTooltip,
|
|
37
|
+
label: moreInfoLabel
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
let body;
|
|
41
|
+
if (group) body = /* @__PURE__ */ jsxs(Fieldset, { children: [labelRow, children] });
|
|
42
|
+
else if (layout === "stacked") body = /* @__PURE__ */ jsxs(Fragment, { children: [labelRow, children] });
|
|
43
|
+
else body = /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "flex flex-row items-center gap-2.5",
|
|
45
|
+
children: layout === "inline-end" ? /* @__PURE__ */ jsxs(Fragment, { children: [labelRow, children] }) : /* @__PURE__ */ jsxs(Fragment, { children: [children, labelRow] })
|
|
46
|
+
});
|
|
47
|
+
return /* @__PURE__ */ jsxs(Field, {
|
|
48
|
+
name,
|
|
49
|
+
invalid,
|
|
50
|
+
touched,
|
|
51
|
+
dirty,
|
|
52
|
+
className,
|
|
53
|
+
"data-slot": "form-item",
|
|
54
|
+
children: [
|
|
55
|
+
body,
|
|
56
|
+
description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
|
|
57
|
+
invalid && errors.length > 0 && /* @__PURE__ */ jsx(FieldError, {
|
|
58
|
+
match: true,
|
|
59
|
+
children: errors.map((message) => /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "block",
|
|
61
|
+
children: message
|
|
62
|
+
}, message))
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export { LabeledField };
|