@agentero/design-system 0.27.1 → 0.29.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/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/merge-props.d.ts +42 -0
- package/lib/merge-props.js +24 -0
- package/mcp/manifests/components.html +1258 -71
- package/mcp/manifests/components.json +1033 -9
- package/package.json +22 -1
- package/src/alert/alert.js +28 -28
- package/src/avatar/avatar.js +22 -22
- package/src/avatar-group/avatar-group.js +6 -6
- package/src/button/button.js +7 -7
- package/src/data-table/data-table.js +36 -36
- package/src/field/context.d.ts +70 -0
- package/src/field/context.js +6 -0
- package/src/field/field.d.ts +216 -0
- package/src/field/field.js +132 -0
- package/src/field/icons.d.ts +9 -0
- package/src/field/icons.js +14 -0
- package/src/field/index.d.ts +30 -0
- package/src/field/index.js +13 -0
- package/src/field-text/field-text.d.ts +28 -0
- package/src/field-text/field-text.js +26 -0
- package/src/field-text/index.d.ts +2 -0
- package/src/field-text/index.js +2 -0
- package/src/form/form.d.ts +60 -0
- package/src/form/form.js +16 -0
- package/src/form/index.d.ts +7 -0
- package/src/form/index.js +5 -0
- package/src/form-text/form-text.d.ts +136 -0
- package/src/form-text/form-text.js +40 -0
- package/src/form-text/index.d.ts +2 -0
- package/src/form-text/index.js +2 -0
- package/src/input/context.d.ts +17 -0
- package/src/input/context.js +10 -0
- package/src/input/index.d.ts +1 -0
- package/src/input/index.js +3 -2
- package/src/input/input.d.ts +7 -7
- package/src/input/input.js +16 -11
- package/src/label/context.d.ts +13 -0
- package/src/label/context.js +7 -0
- package/src/label/index.d.ts +1 -0
- package/src/label/index.js +3 -2
- package/src/label/label.d.ts +6 -1
- package/src/label/label.js +19 -17
- package/src/modal/modal.js +23 -23
- package/src/progress/progress.js +9 -9
- package/src/switch/switch.js +7 -7
- package/src/table/table.js +28 -28
- package/src/tabs/tabs.js +26 -26
- package/src/tag/tag.js +7 -7
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Control, FieldPathByValue, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
3
|
+
import { FieldLabelProps } from '../field';
|
|
4
|
+
import { FieldTextProps } from '../field-text';
|
|
5
|
+
import { InputProps } from '../input';
|
|
6
|
+
/**
|
|
7
|
+
* Props `FormText` forwards to its `Input`. The field owns `id` (pass
|
|
8
|
+
* `controlId` on `FormText` to choose it) and react-hook-form owns `name`,
|
|
9
|
+
* `value` and `defaultValue` (set it in `useForm`'s `defaultValues`).
|
|
10
|
+
*
|
|
11
|
+
* The state is the field's as well: `disabled`, `required` and `readOnly` are
|
|
12
|
+
* props of `FormText` itself and `aria-invalid` follows its validation state.
|
|
13
|
+
* An `Input` takes its own props over the ones its context hands it, so
|
|
14
|
+
* setting them here would move the control without the label and the root
|
|
15
|
+
* following. `aria-describedby` stays open: its ids join the ones the field
|
|
16
|
+
* wires rather than replacing them.
|
|
17
|
+
*/
|
|
18
|
+
export type FormTextInputProps = Omit<InputProps, 'id' | 'name' | 'value' | 'defaultValue' | 'ref' | 'disabled' | 'required' | 'readOnly' | 'aria-invalid'>;
|
|
19
|
+
/**
|
|
20
|
+
* The paths of a form's values a `FormText` can bind to: those holding a
|
|
21
|
+
* string, `null` and `undefined` included, since an input stores a string and
|
|
22
|
+
* an empty form often starts from either. A path to a number, a boolean or an
|
|
23
|
+
* object is rejected at compile time; it belongs to the `Form<X>` of that
|
|
24
|
+
* value type. Untyped forms (`FieldValues`) accept any path.
|
|
25
|
+
*/
|
|
26
|
+
export type FormTextPath<TFieldValues extends FieldValues> = FieldPathByValue<TFieldValues, string | null | undefined>;
|
|
27
|
+
export type FormTextProps<TFieldValues extends FieldValues = FieldValues, TName extends FormTextPath<TFieldValues> = FormTextPath<TFieldValues>, TTransformedValues = TFieldValues> = Omit<FieldTextProps, 'invalid' | 'children'> & {
|
|
28
|
+
/**
|
|
29
|
+
* Path of the value in the form, nested paths included (`'agency.npn'`).
|
|
30
|
+
* Type it against the form's values with the generic
|
|
31
|
+
* (`<FormText<Values> name="agency.npn" />`) or by passing `control`: the
|
|
32
|
+
* path must then exist and hold a string (`FormTextPath`).
|
|
33
|
+
*/
|
|
34
|
+
name: TName;
|
|
35
|
+
/**
|
|
36
|
+
* The form's `control`, from `useForm()`. Defaults to the one the
|
|
37
|
+
* surrounding `Form.Root` provides; pass it explicitly to get `name`
|
|
38
|
+
* inference without writing the generic, or when the field renders outside
|
|
39
|
+
* a `Form.Root`. A `control` whose resolver transforms the values is
|
|
40
|
+
* accepted as is.
|
|
41
|
+
*/
|
|
42
|
+
control?: Control<TFieldValues, any, TTransformedValues>;
|
|
43
|
+
/**
|
|
44
|
+
* react-hook-form validation rules for this field (`required`, `pattern`,
|
|
45
|
+
* `validate`…), same as `register`'s. They only validate: `rules.required`
|
|
46
|
+
* does not mark the field `required` — that is a separate, visible decision.
|
|
47
|
+
*/
|
|
48
|
+
rules?: UseControllerProps<TFieldValues, TName>['rules'];
|
|
49
|
+
/**
|
|
50
|
+
* Drops the value from the form when the field unmounts, react-hook-form's
|
|
51
|
+
* `shouldUnregister`. Defaults to `false`: a field revealed by another one
|
|
52
|
+
* keeps its value while hidden.
|
|
53
|
+
*/
|
|
54
|
+
shouldUnregister?: boolean;
|
|
55
|
+
/** The caption, rendered as the field's label. Text in almost every case. */
|
|
56
|
+
label: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Helper text shown under the control and announced through its
|
|
59
|
+
* `aria-describedby`. Use it for guidance the user needs before typing; put
|
|
60
|
+
* details worth a click in `tooltip` instead.
|
|
61
|
+
*/
|
|
62
|
+
description?: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Content of an info tooltip rendered beside the label, for details that
|
|
65
|
+
* would clutter the description. The trigger is a sibling of the label, so
|
|
66
|
+
* the field's accessible name stays the label text.
|
|
67
|
+
*/
|
|
68
|
+
tooltip?: FieldLabelProps['tooltip'];
|
|
69
|
+
/** Preferred side of the tooltip. Defaults to `'top'`. */
|
|
70
|
+
tooltipSide?: FieldLabelProps['tooltipSide'];
|
|
71
|
+
/**
|
|
72
|
+
* Appends a muted " (optional)" to the label. The forms mark optional fields
|
|
73
|
+
* rather than required ones; ignored when `required` is set.
|
|
74
|
+
*/
|
|
75
|
+
optional?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Marks the field required: an asterisk on the label and the native
|
|
78
|
+
* `required` attribute on the input, which assistive technology announces.
|
|
79
|
+
* It does not validate — pair it with `rules.required` or a resolver — and it
|
|
80
|
+
* never triggers the browser bubble, since `Form.Root` renders `noValidate`.
|
|
81
|
+
*/
|
|
82
|
+
required?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Disables the input and marks the field. Unlike react-hook-form's own
|
|
85
|
+
* `disabled` option, the value stays in the submitted data: disabling a
|
|
86
|
+
* field is a presentation decision, not a change to the form's values.
|
|
87
|
+
*/
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Everything else the `Input` should receive: `type`, `placeholder`,
|
|
91
|
+
* `maxLength`, `autoComplete`, `size`, `className`… Handlers such as
|
|
92
|
+
* `onChange` and `onBlur` run after react-hook-form's, which are already
|
|
93
|
+
* wired.
|
|
94
|
+
*/
|
|
95
|
+
inputProps?: FormTextInputProps;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* A complete text field bound to one react-hook-form value: label, `Input`,
|
|
99
|
+
* helper text and validation error, laid out in the standard order and wired
|
|
100
|
+
* through `useController`. It renders inside a `Form.Root`, which provides the
|
|
101
|
+
* form, and needs only a `name`, which on a typed form must point at a string
|
|
102
|
+
* (`FormTextPath`). The `required`, `invalid` and error states
|
|
103
|
+
* reach the label, the input's `aria-*` attributes and the message with no
|
|
104
|
+
* ids written by hand.
|
|
105
|
+
*
|
|
106
|
+
* Use it for the common case: a labelled single-line input in a form. When
|
|
107
|
+
* the layout is different — an input with addons, another control, a
|
|
108
|
+
* message rendered elsewhere — compose the primitives yourself:
|
|
109
|
+
* `useController` with [FieldText](?path=/docs/components-fieldtext--docs),
|
|
110
|
+
* `Label`, `Input`, `Field.Description` and `Field.Error`. `FormText` adds no
|
|
111
|
+
* behaviour of its own over that composition.
|
|
112
|
+
*
|
|
113
|
+
* Errors come from `useController`'s per-field state, never from
|
|
114
|
+
* `formState.errors`, so the message stays fresh under the React Compiler.
|
|
115
|
+
* With `criteriaMode: 'all'` on the form the error carries every rule that
|
|
116
|
+
* failed and `Field.Error` lists them all. An error on an array or object path
|
|
117
|
+
* (`error.root`) is not this field's: render a `Field.Error` for it where the
|
|
118
|
+
* group lives.
|
|
119
|
+
*
|
|
120
|
+
* @summary Label, Input, description and error bound to one react-hook-form field
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <FormText
|
|
124
|
+
* name="taxId"
|
|
125
|
+
* label="Tax ID"
|
|
126
|
+
* tooltip="The EIN the IRS issued to the agency."
|
|
127
|
+
* description="Nine digits, with or without the dash."
|
|
128
|
+
* required
|
|
129
|
+
* rules={{ required: 'Enter the tax ID.', pattern: { value: /^\d{2}-?\d{7}$/, message: 'Nine digits.' } }}
|
|
130
|
+
* inputProps={{ inputMode: 'numeric', autoComplete: 'off' }}
|
|
131
|
+
* />
|
|
132
|
+
*/
|
|
133
|
+
export declare const FormText: {
|
|
134
|
+
<TFieldValues extends FieldValues = FieldValues, TName extends FormTextPath<TFieldValues> = FormTextPath<TFieldValues>, TTransformedValues = TFieldValues>({ name, control, rules, shouldUnregister, disabled, label, description, tooltip, tooltipSide, optional, inputProps, ...root }: FormTextProps<TFieldValues, TName, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
|
|
135
|
+
displayName: string;
|
|
136
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeProps as e } from "../../lib/merge-props.js";
|
|
3
|
+
import { Field as t } from "../field/index.js";
|
|
4
|
+
import { Input as n } from "../input/input.js";
|
|
5
|
+
import { FieldText as r } from "../field-text/field-text.js";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import { useController as o } from "react-hook-form";
|
|
8
|
+
//#region src/form-text/form-text.tsx
|
|
9
|
+
var s = ({ name: s, control: c, rules: l, shouldUnregister: u, disabled: d, label: f, description: p, tooltip: m, tooltipSide: h, optional: g, inputProps: _, ...v }) => {
|
|
10
|
+
let { field: y, fieldState: b } = o({
|
|
11
|
+
name: s,
|
|
12
|
+
control: c,
|
|
13
|
+
rules: l,
|
|
14
|
+
shouldUnregister: u
|
|
15
|
+
}), x = {
|
|
16
|
+
name: y.name,
|
|
17
|
+
value: y.value ?? "",
|
|
18
|
+
onChange: y.onChange,
|
|
19
|
+
onBlur: y.onBlur,
|
|
20
|
+
ref: y.ref
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ a(r, {
|
|
23
|
+
invalid: b.invalid,
|
|
24
|
+
disabled: d || y.disabled,
|
|
25
|
+
...v,
|
|
26
|
+
children: [/* @__PURE__ */ i(t.Label, {
|
|
27
|
+
tooltip: m,
|
|
28
|
+
tooltipSide: h,
|
|
29
|
+
optional: g,
|
|
30
|
+
children: f
|
|
31
|
+
}), /* @__PURE__ */ a(t.Content, { children: [
|
|
32
|
+
/* @__PURE__ */ i(n, { ...e(x, _ ?? {}) }),
|
|
33
|
+
p && /* @__PURE__ */ i(t.Description, { children: p }),
|
|
34
|
+
/* @__PURE__ */ i(t.Error, { errors: b.error ? [b.error] : void 0 })
|
|
35
|
+
] })]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
s.displayName = "FormText";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { s as FormText };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InputProps } from './input';
|
|
2
|
+
/**
|
|
3
|
+
* Props a container hands to every `Input` rendered inside it: the wiring
|
|
4
|
+
* (`id`, `aria-describedby`, `aria-invalid`, `required`, `disabled`,
|
|
5
|
+
* `readOnly`) and, from a form adapter, `name`, `value`, `onChange`, `onBlur`
|
|
6
|
+
* and `ref`. An `Input` with no provider above it reads `null` and uses only
|
|
7
|
+
* its own props.
|
|
8
|
+
*/
|
|
9
|
+
export declare const InputContext: import('react').Context<Partial<InputProps> | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Merges the surrounding `InputContext`, if any, under the input's own props.
|
|
12
|
+
* Own props win; handlers present on both sides are chained and
|
|
13
|
+
* `aria-describedby` ids are concatenated. In development it warns when the
|
|
14
|
+
* input carries an `id` that differs from the one the container provides,
|
|
15
|
+
* since the label would then point elsewhere.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useInputContext: (props: InputProps) => InputProps;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMergeProps as e } from "../../lib/merge-props.js";
|
|
3
|
+
import { createContext as t, use as n } from "react";
|
|
4
|
+
//#region src/input/context.ts
|
|
5
|
+
var r = t(null), i = (t) => {
|
|
6
|
+
let i = n(r);
|
|
7
|
+
return process.env.NODE_ENV !== "production" && i?.id && t.id && i.id !== t.id && console.warn(`Input: its id "${t.id}" differs from the one its field provides ("${i.id}"), so the label and messages point elsewhere. Set \`controlId\` on the container instead.`), e(i, t);
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as InputContext, i as useInputContext };
|
package/src/input/index.d.ts
CHANGED
package/src/input/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { InputContext as e, useInputContext as t } from "./context.js";
|
|
2
|
+
import { Input as n, inputRecipe as r } from "./input.js";
|
|
3
|
+
export { n as Input, e as InputContext, r as inputRecipe, t as useInputContext };
|
package/src/input/input.d.ts
CHANGED
|
@@ -82,18 +82,18 @@ export type InputProps = Omit<ComponentPropsWithRef<'input'>, 'size'> & {
|
|
|
82
82
|
* [Label](?path=/docs/components-label--docs) so the control has an accessible
|
|
83
83
|
* name.
|
|
84
84
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* There is no `status` prop — mark the control `aria-invalid` and the
|
|
85
|
+
* When a container provides `InputContext`, the input takes its wiring (`id`,
|
|
86
|
+
* `aria-describedby`, `aria-invalid`, `required`, `disabled`, `readOnly`) from
|
|
87
|
+
* it with nothing passed by hand; `FieldText` is one such container. Standalone it
|
|
88
|
+
* renders exactly the props it is given, and its own props always win over the
|
|
89
|
+
* context. There is no `status` prop — mark the control `aria-invalid` and the
|
|
90
90
|
* destructive border follows.
|
|
91
91
|
*
|
|
92
92
|
* Do not use Input for multi-line text; that is TextArea's job. It also has no
|
|
93
93
|
* slots for leading or trailing addons — an input with a currency prefix or a
|
|
94
94
|
* unit suffix belongs in an input group, not here.
|
|
95
95
|
*
|
|
96
|
-
* @summary Base single-line text control
|
|
96
|
+
* @summary Base single-line text control that takes its wiring from InputContext
|
|
97
97
|
*
|
|
98
98
|
* @example
|
|
99
99
|
* <Label htmlFor="email">Email</Label>
|
|
@@ -104,6 +104,6 @@ export type InputProps = Omit<ComponentPropsWithRef<'input'>, 'size'> & {
|
|
|
104
104
|
* <span id="email-error">Enter a valid email address.</span>
|
|
105
105
|
*/
|
|
106
106
|
export declare const Input: {
|
|
107
|
-
(
|
|
107
|
+
(props: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
108
108
|
displayName: string;
|
|
109
109
|
};
|
package/src/input/input.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn as e } from "../../lib/utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { useInputContext as t } from "./context.js";
|
|
4
|
+
import { tv as n } from "tailwind-variants";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
6
|
//#region src/input/input.tsx
|
|
5
|
-
var
|
|
7
|
+
var i = n({
|
|
6
8
|
base: [
|
|
7
9
|
"box-border w-full min-w-0 appearance-none rounded-md px-4 shadow-sm",
|
|
8
10
|
"border border-solid border-border-input-default bg-bg-input-normal text-text-input-normal",
|
|
@@ -24,12 +26,15 @@ var r = t({
|
|
|
24
26
|
lg: "h-12 rounded-lg text-base"
|
|
25
27
|
} },
|
|
26
28
|
defaultVariants: { size: "md" }
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
|
|
29
|
+
}), a = (n) => {
|
|
30
|
+
let { className: a, size: o, ...s } = t(n);
|
|
31
|
+
return /* @__PURE__ */ r("input", {
|
|
32
|
+
"data-slot": "input",
|
|
33
|
+
"data-size": o,
|
|
34
|
+
className: e(i({ size: o }), a),
|
|
35
|
+
...s
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
a.displayName = "Input";
|
|
34
39
|
//#endregion
|
|
35
|
-
export {
|
|
40
|
+
export { a as Input, i as inputRecipe };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LabelProps } from './label';
|
|
2
|
+
/**
|
|
3
|
+
* Props a container hands to every `Label` rendered inside it, typically
|
|
4
|
+
* `htmlFor` (the control's id) and `required`. A `Label` with no provider above
|
|
5
|
+
* it reads `null` and uses only its own props.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LabelContext: import('react').Context<Partial<LabelProps> | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Merges the surrounding `LabelContext`, if any, under the label's own props.
|
|
10
|
+
* Own props win, so an explicit `htmlFor` or `required={false}` overrides
|
|
11
|
+
* whatever the container provides.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useLabelContext: (props: LabelProps) => LabelProps;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMergeProps as e } from "../../lib/merge-props.js";
|
|
3
|
+
import { createContext as t, use as n } from "react";
|
|
4
|
+
//#region src/label/context.ts
|
|
5
|
+
var r = t(null), i = (t) => e(n(r), t);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { r as LabelContext, i as useLabelContext };
|
package/src/label/index.d.ts
CHANGED
package/src/label/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LabelContext as e, useLabelContext as t } from "./context.js";
|
|
2
|
+
import { Label as n, labelRecipe as r } from "./label.js";
|
|
3
|
+
export { n as Label, e as LabelContext, r as labelRecipe, t as useLabelContext };
|
package/src/label/label.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ export type LabelProps = ComponentPropsWithRef<typeof LabelPrimitive.Root> & Lab
|
|
|
49
49
|
* button) inside a `<label>` gives that element the label's accessible name and
|
|
50
50
|
* makes a click focus the control — render it as a sibling instead.
|
|
51
51
|
*
|
|
52
|
+
* When a container provides `LabelContext`, the label takes `htmlFor` and
|
|
53
|
+
* `required` from it and associates itself with the control without an explicit
|
|
54
|
+
* `htmlFor`; `Field.Root` is one such container. Standalone it behaves as a
|
|
55
|
+
* plain label. Its own props always win over the context.
|
|
56
|
+
*
|
|
52
57
|
* @summary Accessible caption for a form control
|
|
53
58
|
*
|
|
54
59
|
* @example
|
|
@@ -56,6 +61,6 @@ export type LabelProps = ComponentPropsWithRef<typeof LabelPrimitive.Root> & Lab
|
|
|
56
61
|
* <Input id="phone" type="tel" />
|
|
57
62
|
*/
|
|
58
63
|
export declare const Label: {
|
|
59
|
-
(
|
|
64
|
+
(props: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
60
65
|
displayName: string;
|
|
61
66
|
};
|
package/src/label/label.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn as e } from "../../lib/utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { useLabelContext as t } from "./context.js";
|
|
4
|
+
import { tv as n } from "tailwind-variants";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import * as a from "@radix-ui/react-label";
|
|
5
7
|
//#region src/label/label.tsx
|
|
6
|
-
var
|
|
8
|
+
var o = n({
|
|
7
9
|
slots: {
|
|
8
10
|
root: "flex flex-wrap gap-1 py-0.25 text-sm font-semibold text-text-input-normal",
|
|
9
11
|
text: "align-middle",
|
|
10
|
-
required: "
|
|
12
|
+
required: "align-middle text-text-input-destructive"
|
|
11
13
|
},
|
|
12
14
|
variants: { optional: { true: { text: "after:font-normal after:text-text-input-placeholder after:content-[\"_(optional)\"]" } } },
|
|
13
15
|
defaultVariants: { optional: !1 }
|
|
14
|
-
}),
|
|
15
|
-
let u =
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
}), s = (n) => {
|
|
17
|
+
let { className: s, children: c, optional: l = !1, required: u = !1, ...d } = t(n), f = o({ optional: l && !u });
|
|
18
|
+
return /* @__PURE__ */ i(a.Root, {
|
|
17
19
|
"data-slot": "label",
|
|
18
|
-
className: e(
|
|
19
|
-
...
|
|
20
|
-
children: [/* @__PURE__ */
|
|
21
|
-
className:
|
|
22
|
-
children:
|
|
23
|
-
}),
|
|
20
|
+
className: e(f.root(), s),
|
|
21
|
+
...d,
|
|
22
|
+
children: [/* @__PURE__ */ r("span", {
|
|
23
|
+
className: f.text(),
|
|
24
|
+
children: c
|
|
25
|
+
}), u && /* @__PURE__ */ r("span", {
|
|
24
26
|
"aria-hidden": !0,
|
|
25
|
-
className:
|
|
27
|
+
className: f.required(),
|
|
26
28
|
children: "*"
|
|
27
29
|
})]
|
|
28
30
|
});
|
|
29
31
|
};
|
|
30
|
-
|
|
32
|
+
s.displayName = "Label";
|
|
31
33
|
//#endregion
|
|
32
|
-
export {
|
|
34
|
+
export { s as Label, o as labelRecipe };
|
package/src/modal/modal.js
CHANGED
|
@@ -3,21 +3,21 @@ import { cn as e } from "../../lib/utils.js";
|
|
|
3
3
|
import { Button as t } from "../button/button.js";
|
|
4
4
|
import { IconClose as n } from "./icons.js";
|
|
5
5
|
import { tv as r } from "tailwind-variants";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { createContext as i, useContext as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
8
|
import * as c from "@radix-ui/react-dialog";
|
|
9
9
|
//#region src/modal/modal.tsx
|
|
10
|
-
var l = (e) => /* @__PURE__ */
|
|
10
|
+
var l = (e) => /* @__PURE__ */ o(c.Root, {
|
|
11
11
|
"data-slot": "modal-root",
|
|
12
12
|
...e
|
|
13
13
|
});
|
|
14
14
|
l.displayName = "Modal.Root";
|
|
15
|
-
var u = (e) => /* @__PURE__ */
|
|
15
|
+
var u = (e) => /* @__PURE__ */ o(c.Trigger, {
|
|
16
16
|
"data-slot": "modal-trigger",
|
|
17
17
|
...e
|
|
18
18
|
});
|
|
19
19
|
u.displayName = "Modal.Trigger";
|
|
20
|
-
var d =
|
|
20
|
+
var d = i("dialog"), f = r({
|
|
21
21
|
slots: {
|
|
22
22
|
overlay: [
|
|
23
23
|
"fixed inset-0 z-(--z-index-top-layer) bg-overlay-dark-300",
|
|
@@ -41,70 +41,70 @@ var d = o("dialog"), f = r({
|
|
|
41
41
|
lg: { content: "max-w-[45rem]" }
|
|
42
42
|
} },
|
|
43
43
|
defaultVariants: { size: "md" }
|
|
44
|
-
}), p = f(), m = ({ className: t, size: n, variant: r = "dialog", children:
|
|
44
|
+
}), p = f(), m = ({ className: t, size: n, variant: r = "dialog", children: i, onEscapeKeyDown: a, onPointerDownOutside: l, ...u }) => {
|
|
45
45
|
let p = f({ size: n }), m = r === "alert";
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ o(d.Provider, {
|
|
47
47
|
value: r,
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ s(c.Portal, { children: [/* @__PURE__ */ o(c.Overlay, {
|
|
49
49
|
"data-slot": "modal-overlay",
|
|
50
50
|
className: p.overlay()
|
|
51
|
-
}), /* @__PURE__ */
|
|
51
|
+
}), /* @__PURE__ */ o(c.Content, {
|
|
52
52
|
"data-slot": "modal-content",
|
|
53
53
|
role: m ? "alertdialog" : "dialog",
|
|
54
54
|
className: e(p.content(), t),
|
|
55
55
|
onEscapeKeyDown: (e) => {
|
|
56
|
-
|
|
56
|
+
a?.(e), m && e.preventDefault();
|
|
57
57
|
},
|
|
58
58
|
onPointerDownOutside: (e) => {
|
|
59
59
|
l?.(e), m && e.preventDefault();
|
|
60
60
|
},
|
|
61
61
|
...u,
|
|
62
|
-
children:
|
|
62
|
+
children: i
|
|
63
63
|
})] })
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
m.displayName = "Modal.Content";
|
|
67
|
-
var h = ({ className: e, children: r, ...
|
|
68
|
-
let l =
|
|
69
|
-
return /* @__PURE__ */
|
|
67
|
+
var h = ({ className: e, children: r, ...i }) => {
|
|
68
|
+
let l = a(d);
|
|
69
|
+
return /* @__PURE__ */ s("div", {
|
|
70
70
|
"data-slot": "modal-title",
|
|
71
71
|
className: p.title({ className: e }),
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
...
|
|
72
|
+
children: [/* @__PURE__ */ o(c.Title, {
|
|
73
|
+
...i,
|
|
74
74
|
children: r
|
|
75
|
-
}), l === "dialog" && /* @__PURE__ */
|
|
75
|
+
}), l === "dialog" && /* @__PURE__ */ o(c.Close, {
|
|
76
76
|
asChild: !0,
|
|
77
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ o(t, {
|
|
78
78
|
variant: "ghost",
|
|
79
79
|
size: "sm",
|
|
80
80
|
"aria-label": "Close",
|
|
81
81
|
className: "shrink-0",
|
|
82
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ o(n, {})
|
|
83
83
|
})
|
|
84
84
|
})]
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
h.displayName = "Modal.Title";
|
|
88
|
-
var g = ({ className: e, ...t }) => /* @__PURE__ */
|
|
88
|
+
var g = ({ className: e, ...t }) => /* @__PURE__ */ o(c.Description, {
|
|
89
89
|
"data-slot": "modal-description",
|
|
90
90
|
className: p.description({ className: e }),
|
|
91
91
|
...t
|
|
92
92
|
});
|
|
93
93
|
g.displayName = "Modal.Description";
|
|
94
|
-
var _ = ({ className: e, ...t }) => /* @__PURE__ */
|
|
94
|
+
var _ = ({ className: e, ...t }) => /* @__PURE__ */ o("div", {
|
|
95
95
|
"data-slot": "modal-body",
|
|
96
96
|
tabIndex: 0,
|
|
97
97
|
className: p.body({ className: e }),
|
|
98
98
|
...t
|
|
99
99
|
});
|
|
100
100
|
_.displayName = "Modal.Body";
|
|
101
|
-
var v = ({ className: e, ...t }) => /* @__PURE__ */
|
|
101
|
+
var v = ({ className: e, ...t }) => /* @__PURE__ */ o("div", {
|
|
102
102
|
"data-slot": "modal-footer",
|
|
103
103
|
className: p.footer({ className: e }),
|
|
104
104
|
...t
|
|
105
105
|
});
|
|
106
106
|
v.displayName = "Modal.Footer";
|
|
107
|
-
var y = (e) => /* @__PURE__ */
|
|
107
|
+
var y = (e) => /* @__PURE__ */ o(c.Close, {
|
|
108
108
|
"data-slot": "modal-close",
|
|
109
109
|
...e
|
|
110
110
|
});
|
package/src/progress/progress.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { tv as e } from "tailwind-variants";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useId as t } from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
import * as i from "@radix-ui/react-progress";
|
|
6
6
|
//#region src/progress/progress.tsx
|
|
7
7
|
var a = e({ slots: {
|
|
@@ -12,28 +12,28 @@ var a = e({ slots: {
|
|
|
12
12
|
label: "text-sm text-text-default-base-primary",
|
|
13
13
|
value: "text-base text-text-default-base-primary"
|
|
14
14
|
} }), o = ({ percentage: e, label: o, "aria-label": s, className: c }) => {
|
|
15
|
-
let l =
|
|
16
|
-
return /* @__PURE__ */
|
|
15
|
+
let l = t(), u = a(), d = Math.min(100, Math.max(0, e));
|
|
16
|
+
return /* @__PURE__ */ r("div", {
|
|
17
17
|
"data-slot": "progress",
|
|
18
18
|
className: u.root(),
|
|
19
|
-
children: [o && /* @__PURE__ */
|
|
19
|
+
children: [o && /* @__PURE__ */ r("div", {
|
|
20
20
|
"data-slot": "progress-label",
|
|
21
21
|
className: u.labelRow(),
|
|
22
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ n("span", {
|
|
23
23
|
id: l,
|
|
24
24
|
className: u.label(),
|
|
25
25
|
children: o
|
|
26
|
-
}), /* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ r("span", {
|
|
27
27
|
className: u.value(),
|
|
28
28
|
children: [d, "%"]
|
|
29
29
|
})]
|
|
30
|
-
}), /* @__PURE__ */
|
|
30
|
+
}), /* @__PURE__ */ n(i.Root, {
|
|
31
31
|
"data-slot": "progress-track",
|
|
32
32
|
value: d,
|
|
33
33
|
"aria-labelledby": o ? l : void 0,
|
|
34
34
|
"aria-label": o ? void 0 : s ?? "Progress",
|
|
35
35
|
className: u.track({ className: c }),
|
|
36
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ n(i.Indicator, {
|
|
37
37
|
"data-slot": "progress-indicator",
|
|
38
38
|
className: u.indicator(),
|
|
39
39
|
style: { transform: `translateX(-${100 - d}%)` }
|
package/src/switch/switch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
3
|
import { tv as t } from "tailwind-variants";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useId as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
6
|
import * as a from "@radix-ui/react-switch";
|
|
7
7
|
//#region src/switch/switch.tsx
|
|
8
8
|
var o = t({
|
|
@@ -32,24 +32,24 @@ var o = t({
|
|
|
32
32
|
},
|
|
33
33
|
defaultVariants: { size: "md" }
|
|
34
34
|
}), s = ({ className: t, size: s, reverse: c, label: l, id: u, ref: d, ...f }) => {
|
|
35
|
-
let p =
|
|
35
|
+
let p = n(), m = u ?? (l ? p : void 0), h = o({
|
|
36
36
|
size: s,
|
|
37
37
|
reverse: c
|
|
38
|
-
}), g = /* @__PURE__ */
|
|
38
|
+
}), g = /* @__PURE__ */ r(a.Root, {
|
|
39
39
|
ref: d,
|
|
40
40
|
id: m,
|
|
41
41
|
"data-slot": "switch",
|
|
42
42
|
className: e(h.root(), t),
|
|
43
43
|
...f,
|
|
44
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ r(a.Thumb, {
|
|
45
45
|
"data-slot": "switch-thumb",
|
|
46
46
|
className: h.thumb()
|
|
47
47
|
})
|
|
48
48
|
});
|
|
49
|
-
return l ? /* @__PURE__ */
|
|
49
|
+
return l ? /* @__PURE__ */ i("span", {
|
|
50
50
|
"data-slot": "switch-wrapper",
|
|
51
51
|
className: h.wrapper(),
|
|
52
|
-
children: [g, /* @__PURE__ */
|
|
52
|
+
children: [g, /* @__PURE__ */ r("label", {
|
|
53
53
|
htmlFor: m,
|
|
54
54
|
"data-slot": "switch-label",
|
|
55
55
|
className: h.label(),
|