@jakubmazanec/ui 0.1.7-unstable.5350d526 → 0.2.0-next.1ccffc71
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/build/components/Card.d.ts +1 -1
- package/build/components/Card.js +3 -3
- package/build/components/Card.js.map +2 -2
- package/build/components/Checkbox.d.ts +1 -1
- package/build/components/Checkbox.js +3 -3
- package/build/components/Checkbox.js.map +2 -2
- package/build/components/Combobox.d.ts +1 -3
- package/build/components/Combobox.js +3 -3
- package/build/components/Combobox.js.map +2 -2
- package/build/components/ComboboxOption.d.ts +1 -1
- package/build/components/ComboboxOption.js +3 -3
- package/build/components/ComboboxOption.js.map +2 -2
- package/build/components/Container.d.ts +1 -1
- package/build/components/Container.js +3 -3
- package/build/components/Container.js.map +2 -2
- package/build/components/Description.d.ts +1 -1
- package/build/components/Description.js +3 -3
- package/build/components/Description.js.map +2 -2
- package/build/components/Dialog.d.ts +1 -1
- package/build/components/Dialog.js +3 -3
- package/build/components/Dialog.js.map +2 -2
- package/build/components/DialogPanel.d.ts +1 -1
- package/build/components/DialogPanel.js +3 -3
- package/build/components/DialogPanel.js.map +2 -2
- package/build/components/DialogTitle.js +2 -4
- package/build/components/DialogTitle.js.map +2 -2
- package/build/components/Error.d.ts +1 -1
- package/build/components/Error.js +3 -3
- package/build/components/Error.js.map +2 -2
- package/build/components/Field.d.ts +1 -1
- package/build/components/Field.js +3 -3
- package/build/components/Field.js.map +2 -2
- package/build/components/Fieldset.d.ts +1 -1
- package/build/components/Fieldset.js +3 -3
- package/build/components/Fieldset.js.map +2 -2
- package/build/components/Form.d.ts +1 -1
- package/build/components/Form.js +3 -3
- package/build/components/Form.js.map +2 -2
- package/build/components/Icon.d.ts +1 -1
- package/build/components/Icon.js +3 -3
- package/build/components/Icon.js.map +2 -2
- package/build/components/Input.d.ts +1 -1
- package/build/components/Input.js +3 -3
- package/build/components/Input.js.map +2 -2
- package/build/components/Label.d.ts +1 -1
- package/build/components/Label.js +3 -3
- package/build/components/Label.js.map +2 -2
- package/build/components/Legend.d.ts +1 -1
- package/build/components/Legend.js +3 -3
- package/build/components/Legend.js.map +2 -2
- package/build/components/Listbox.d.ts +1 -3
- package/build/components/Listbox.js +3 -3
- package/build/components/Listbox.js.map +2 -2
- package/build/components/ListboxOption.d.ts +1 -1
- package/build/components/ListboxOption.js +3 -3
- package/build/components/ListboxOption.js.map +2 -2
- package/build/components/Menu.d.ts +1 -3
- package/build/components/Menu.js +3 -3
- package/build/components/Menu.js.map +2 -2
- package/build/components/MenuButton.d.ts +1 -1
- package/build/components/MenuButton.js +3 -3
- package/build/components/MenuButton.js.map +2 -2
- package/build/components/MenuHeading.d.ts +1 -1
- package/build/components/MenuHeading.js +3 -3
- package/build/components/MenuHeading.js.map +2 -2
- package/build/components/MenuItem.d.ts +1 -1
- package/build/components/MenuItem.js +3 -3
- package/build/components/MenuItem.js.map +2 -2
- package/build/components/MenuItems.d.ts +1 -1
- package/build/components/MenuItems.js +3 -3
- package/build/components/MenuItems.js.map +2 -2
- package/build/components/MenuSection.d.ts +1 -1
- package/build/components/MenuSection.js +3 -3
- package/build/components/MenuSection.js.map +2 -2
- package/build/components/MenuSeparator.d.ts +1 -1
- package/build/components/MenuSeparator.js +3 -3
- package/build/components/MenuSeparator.js.map +2 -2
- package/build/components/Popover.d.ts +1 -1
- package/build/components/Popover.js +3 -3
- package/build/components/Popover.js.map +2 -2
- package/build/components/PopoverBackdrop.d.ts +1 -1
- package/build/components/PopoverBackdrop.js +3 -3
- package/build/components/PopoverBackdrop.js.map +2 -2
- package/build/components/PopoverButton.d.ts +1 -1
- package/build/components/PopoverButton.js +3 -3
- package/build/components/PopoverButton.js.map +2 -2
- package/build/components/PopoverGroup.d.ts +1 -1
- package/build/components/PopoverGroup.js +3 -3
- package/build/components/PopoverGroup.js.map +2 -2
- package/build/components/PopoverPanel.d.ts +1 -1
- package/build/components/PopoverPanel.js +3 -3
- package/build/components/PopoverPanel.js.map +2 -2
- package/build/components/Radio.d.ts +1 -1
- package/build/components/Radio.js +3 -3
- package/build/components/Radio.js.map +2 -2
- package/build/components/RadioGroup.d.ts +1 -1
- package/build/components/RadioGroup.js +3 -3
- package/build/components/RadioGroup.js.map +2 -2
- package/build/components/Table.d.ts +1 -1
- package/build/components/Table.js +3 -3
- package/build/components/Table.js.map +2 -2
- package/build/components/TableBody.d.ts +1 -1
- package/build/components/TableBody.js +3 -3
- package/build/components/TableBody.js.map +2 -2
- package/build/components/TableCaption.d.ts +1 -1
- package/build/components/TableCaption.js +3 -3
- package/build/components/TableCaption.js.map +2 -2
- package/build/components/TableCell.d.ts +1 -1
- package/build/components/TableCell.js +3 -3
- package/build/components/TableCell.js.map +2 -2
- package/build/components/TableFoot.d.ts +1 -1
- package/build/components/TableFoot.js +3 -3
- package/build/components/TableFoot.js.map +2 -2
- package/build/components/TableHead.d.ts +1 -1
- package/build/components/TableHead.js +3 -3
- package/build/components/TableHead.js.map +2 -2
- package/build/components/TableHeader.d.ts +1 -1
- package/build/components/TableHeader.js +3 -3
- package/build/components/TableHeader.js.map +2 -2
- package/build/components/TableRow.d.ts +1 -1
- package/build/components/TableRow.js +3 -3
- package/build/components/TableRow.js.map +2 -2
- package/build/components/Text.d.ts +1 -1
- package/build/components/Text.js +3 -3
- package/build/components/Text.js.map +2 -2
- package/build/components/Textarea.d.ts +1 -1
- package/build/components/Textarea.js +3 -3
- package/build/components/Textarea.js.map +2 -2
- package/package.json +13 -13
- package/source/components/Card.ts +3 -3
- package/source/components/Checkbox.tsx +3 -3
- package/source/components/Combobox.tsx +3 -3
- package/source/components/ComboboxOption.tsx +3 -3
- package/source/components/Container.ts +3 -3
- package/source/components/Description.tsx +3 -3
- package/source/components/Dialog.tsx +3 -3
- package/source/components/DialogPanel.tsx +3 -3
- package/source/components/DialogTitle.tsx +3 -6
- package/source/components/Error.tsx +3 -3
- package/source/components/Field.tsx +3 -3
- package/source/components/Fieldset.tsx +3 -3
- package/source/components/Form.tsx +3 -3
- package/source/components/Icon.tsx +3 -3
- package/source/components/Input.tsx +3 -3
- package/source/components/Label.tsx +3 -3
- package/source/components/Legend.tsx +3 -3
- package/source/components/Listbox.tsx +3 -3
- package/source/components/ListboxOption.tsx +3 -3
- package/source/components/Menu.tsx +3 -3
- package/source/components/MenuButton.tsx +3 -3
- package/source/components/MenuHeading.tsx +3 -3
- package/source/components/MenuItem.tsx +3 -3
- package/source/components/MenuItems.tsx +3 -3
- package/source/components/MenuSection.tsx +3 -3
- package/source/components/MenuSeparator.tsx +3 -3
- package/source/components/Popover.tsx +3 -3
- package/source/components/PopoverBackdrop.tsx +3 -3
- package/source/components/PopoverButton.tsx +3 -3
- package/source/components/PopoverGroup.tsx +3 -3
- package/source/components/PopoverPanel.tsx +3 -3
- package/source/components/Radio.tsx +3 -3
- package/source/components/RadioGroup.tsx +3 -3
- package/source/components/Table.ts +3 -3
- package/source/components/TableBody.ts +3 -3
- package/source/components/TableCaption.ts +3 -3
- package/source/components/TableCell.ts +3 -3
- package/source/components/TableFoot.ts +3 -3
- package/source/components/TableHead.ts +3 -3
- package/source/components/TableHeader.ts +3 -3
- package/source/components/TableRow.ts +3 -3
- package/source/components/Text.ts +3 -3
- package/source/components/Textarea.tsx +3 -3
|
@@ -10,6 +10,6 @@ export type CardProps<T extends ElementType> = ComponentProps<typeof useCardThem
|
|
|
10
10
|
as?: T | undefined;
|
|
11
11
|
className?: string;
|
|
12
12
|
}>;
|
|
13
|
-
export declare
|
|
13
|
+
export declare function Card<T extends ElementType = typeof CARD_ELEMENT>({ as: Component, className, ref, children, ...rest }: CardProps<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
14
14
|
export declare const cardTheme: ComponentTheme<typeof useCardTheme>;
|
|
15
15
|
export {};
|
package/build/components/Card.js
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
} from "../theme/internals.js";
|
|
8
8
|
export const useCardTheme = createComponentTheme("Card");
|
|
9
9
|
const CARD_ELEMENT = "button";
|
|
10
|
-
export
|
|
10
|
+
export function Card({
|
|
11
11
|
as: Component = CARD_ELEMENT,
|
|
12
12
|
className,
|
|
13
13
|
ref,
|
|
14
14
|
children,
|
|
15
15
|
...rest
|
|
16
|
-
})
|
|
16
|
+
}) {
|
|
17
17
|
let theme = useCardTheme();
|
|
18
18
|
let props = {
|
|
19
19
|
ref,
|
|
@@ -22,7 +22,7 @@ export const Card = ({
|
|
|
22
22
|
...rest
|
|
23
23
|
};
|
|
24
24
|
return createElement(Component, props, children);
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
export const cardTheme = {
|
|
27
27
|
className: "rounded-2 border border-neutral-100 p-4"
|
|
28
28
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Card.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ComponentPropsWithoutRef,\n createElement,\n type ElementType,\n type PropsWithChildren,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\n\nexport const useCardTheme = createComponentTheme('Card');\n\nconst CARD_ELEMENT = 'button';\n\nexport type CardProps<T extends ElementType> = ComponentProps<typeof useCardTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren<{\n as?: T | undefined;\n className?: string;\n }>;\n\nexport
|
|
5
|
-
"mappings": ";AAAA;AAAA,EAEE;AAAA,OAGK;AAEP;AAAA,EAGE;AAAA,OACK;AAGA,aAAM,eAAe,qBAAqB,MAAM;AAEvD,MAAM,eAAe;AAUd,
|
|
4
|
+
"sourcesContent": ["import {\n type ComponentPropsWithoutRef,\n createElement,\n type ElementType,\n type PropsWithChildren,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\n\nexport const useCardTheme = createComponentTheme('Card');\n\nconst CARD_ELEMENT = 'button';\n\nexport type CardProps<T extends ElementType> = ComponentProps<typeof useCardTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren<{\n as?: T | undefined;\n className?: string;\n }>;\n\nexport function Card<T extends ElementType = typeof CARD_ELEMENT>({\n as: Component = CARD_ELEMENT as T,\n className,\n ref,\n children,\n ...rest\n}: CardProps<T>) {\n let theme = useCardTheme();\n let props = {\n ref,\n className: theme(null, className),\n 'data-component': 'card',\n ...rest,\n };\n\n return createElement(Component, props, children);\n}\n\nexport const cardTheme: ComponentTheme<typeof useCardTheme> = {\n className: 'rounded-2 border border-neutral-100 p-4',\n};\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EAEE;AAAA,OAGK;AAEP;AAAA,EAGE;AAAA,OACK;AAGA,aAAM,eAAe,qBAAqB,MAAM;AAEvD,MAAM,eAAe;AAUd,gBAAS,KAAkD;AAAA,EAChE,IAAI,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiB;AACf,MAAI,QAAQ,aAAa;AACzB,MAAI,QAAQ;AAAA,IACV;AAAA,IACA,WAAW,MAAM,MAAM,SAAS;AAAA,IAChC,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL;AAEA,SAAO,cAAc,WAAW,OAAO,QAAQ;AACjD;AAEO,aAAM,YAAiD;AAAA,EAC5D,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,6 +25,6 @@ export type CheckboxProps<T extends ElementType> = ComponentProps<typeof useChec
|
|
|
25
25
|
className?: string;
|
|
26
26
|
onChange?: ((checked: boolean) => void) | undefined;
|
|
27
27
|
};
|
|
28
|
-
export declare
|
|
28
|
+
export declare function Checkbox<T extends ElementType = typeof CHECKBOX_ELEMENT>({ disabled, as, checked, indeterminate, autoFocus, name, className, onChange, ref, ...rest }: CheckboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export declare const checkboxTheme: ComponentTheme<typeof useCheckboxTheme>;
|
|
30
30
|
export {};
|
|
@@ -18,7 +18,7 @@ export const useCheckboxTheme = createComponentTheme("Checkbox", {
|
|
|
18
18
|
elements: ["root", "icon"]
|
|
19
19
|
});
|
|
20
20
|
const CHECKBOX_ELEMENT = "span";
|
|
21
|
-
export
|
|
21
|
+
export function Checkbox({
|
|
22
22
|
disabled = false,
|
|
23
23
|
as = CHECKBOX_ELEMENT,
|
|
24
24
|
checked,
|
|
@@ -29,7 +29,7 @@ export const Checkbox = ({
|
|
|
29
29
|
onChange,
|
|
30
30
|
ref,
|
|
31
31
|
...rest
|
|
32
|
-
})
|
|
32
|
+
}) {
|
|
33
33
|
let theme = useCheckboxTheme({ disabled });
|
|
34
34
|
let fieldName = useFieldName();
|
|
35
35
|
let field = useField();
|
|
@@ -64,7 +64,7 @@ export const Checkbox = ({
|
|
|
64
64
|
...rest
|
|
65
65
|
};
|
|
66
66
|
return /* @__PURE__ */ jsx(HeadlessCheckbox, { ...props, children: /* @__PURE__ */ jsx("span", { className: theme.icon(), children: /* @__PURE__ */ jsx(Icon, { name: "Check" }) }) });
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
export const checkboxTheme = {
|
|
69
69
|
classNames: {
|
|
70
70
|
root: "group/checkbox inline-block size-5 cursor-pointer",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Checkbox.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Checkbox as HeadlessCheckbox,\n type CheckboxProps as HeadlessCheckboxProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, useCallback} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\nimport {useFormId} from './internals.js';\nimport {useField} from './useField.js';\nimport {useFieldName} from './useFieldName.js';\n\nexport const useCheckboxTheme = createComponentTheme('Checkbox', {\n variants: {\n disabled: [true, false],\n },\n elements: ['root', 'icon'],\n});\n\nconst CHECKBOX_ELEMENT = 'span';\n\nexport type CheckboxProps<T extends ElementType> = ComponentProps<typeof useCheckboxTheme> &\n ComponentRef<T> &\n Omit<ComponentPropsWithoutRef<T>, 'onChange'> & {\n as?: T | undefined;\n checked?: boolean | undefined;\n indeterminate?: boolean | undefined;\n autoFocus?: boolean | undefined;\n name?: string;\n className?: string;\n onChange?: ((checked: boolean) => void) | undefined;\n };\n\nexport
|
|
5
|
-
"mappings": ";AA4EU;AA5EV;AAAA,EACE,YAAY;AAAA,OAEP;AACP,SAAyD,mBAAkB;AAE3E;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,YAAW;AACnB,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AACvB,SAAQ,oBAAmB;AAEpB,aAAM,mBAAmB,qBAAqB,YAAY;AAAA,EAC/D,UAAU;AAAA,IACR,UAAU,CAAC,MAAM,KAAK;AAAA,EACxB;AAAA,EACA,UAAU,CAAC,QAAQ,MAAM;AAC3B,CAAC;AAED,MAAM,mBAAmB;AAclB,
|
|
4
|
+
"sourcesContent": ["import {\n Checkbox as HeadlessCheckbox,\n type CheckboxProps as HeadlessCheckboxProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, useCallback} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\nimport {useFormId} from './internals.js';\nimport {useField} from './useField.js';\nimport {useFieldName} from './useFieldName.js';\n\nexport const useCheckboxTheme = createComponentTheme('Checkbox', {\n variants: {\n disabled: [true, false],\n },\n elements: ['root', 'icon'],\n});\n\nconst CHECKBOX_ELEMENT = 'span';\n\nexport type CheckboxProps<T extends ElementType> = ComponentProps<typeof useCheckboxTheme> &\n ComponentRef<T> &\n Omit<ComponentPropsWithoutRef<T>, 'onChange'> & {\n as?: T | undefined;\n checked?: boolean | undefined;\n indeterminate?: boolean | undefined;\n autoFocus?: boolean | undefined;\n name?: string;\n className?: string;\n onChange?: ((checked: boolean) => void) | undefined;\n };\n\nexport function Checkbox<T extends ElementType = typeof CHECKBOX_ELEMENT>({\n disabled = false,\n as = CHECKBOX_ELEMENT as T,\n checked,\n indeterminate,\n autoFocus,\n name,\n className,\n onChange,\n ref,\n ...rest\n}: CheckboxProps<T>) {\n let theme = useCheckboxTheme({disabled});\n let fieldName = useFieldName();\n let field = useField();\n let formId = useFormId();\n\n let handleChange = useCallback(() => {\n onChange?.(!checked);\n }, [checked, onChange]);\n\n if (field || fieldName) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessCheckboxProps<any> = {\n as,\n ref,\n form: formId,\n name: field?.name ?? fieldName,\n indeterminate,\n autoFocus,\n className: theme.root('relative', className),\n 'data-component': 'checkbox',\n ...rest,\n };\n\n return (\n <HeadlessCheckbox {...props}>\n <span className={theme.icon()}>\n <Icon name=\"Check\" />\n </span>\n </HeadlessCheckbox>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessCheckboxProps<any> = {\n as,\n ref,\n checked: Boolean(checked),\n name,\n indeterminate,\n autoFocus,\n className: theme.root('relative', className),\n 'data-component': 'checkbox',\n onChange: handleChange,\n ...rest,\n };\n\n return (\n <HeadlessCheckbox {...props}>\n <span className={theme.icon()}>\n <Icon name=\"Check\" />\n </span>\n </HeadlessCheckbox>\n );\n}\n\nexport const checkboxTheme: ComponentTheme<typeof useCheckboxTheme> = {\n classNames: {\n root: 'group/checkbox inline-block size-5 cursor-pointer',\n icon: 'flex justify-content justify-item size-5 *:rounded-2 *:bg-white *:border-2 *:border-neutral-100 *:hover:border-neutral-200 *:shadow-inner *:transition-colors *:text-transparent *:hover:text-neutral-100 group-data-[checked]/checkbox:*:bg-neutral-950 group-data-[checked]/checkbox:*:border-neutral-950 group-data-[checked]/checkbox:*:text-white',\n },\n variants: {\n disabled: {\n true: {\n root: 'cursor-not-allowed',\n icon: '*:hover:text-transparent *:border-neutral-50 *:hover:border-neutral-50 group-data-[checked]/checkbox:*:bg-neutral-100 group-data-[checked]/checkbox:*:border-neutral-100 group-data-[checked]/checkbox:*:text-white',\n },\n false: {\n root: '',\n icon: '',\n },\n },\n },\n};\n"],
|
|
5
|
+
"mappings": ";AA4EU;AA5EV;AAAA,EACE,YAAY;AAAA,OAEP;AACP,SAAyD,mBAAkB;AAE3E;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,YAAW;AACnB,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AACvB,SAAQ,oBAAmB;AAEpB,aAAM,mBAAmB,qBAAqB,YAAY;AAAA,EAC/D,UAAU;AAAA,IACR,UAAU,CAAC,MAAM,KAAK;AAAA,EACxB;AAAA,EACA,UAAU,CAAC,QAAQ,MAAM;AAC3B,CAAC;AAED,MAAM,mBAAmB;AAclB,gBAAS,SAA0D;AAAA,EACxE,WAAW;AAAA,EACX,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAqB;AACnB,MAAI,QAAQ,iBAAiB,EAAC,SAAQ,CAAC;AACvC,MAAI,YAAY,aAAa;AAC7B,MAAI,QAAQ,SAAS;AACrB,MAAI,SAAS,UAAU;AAEvB,MAAI,eAAe,YAAY,MAAM;AACnC,eAAW,CAAC,OAAO;AAAA,EACrB,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,MAAI,SAAS,WAAW;AAEtB,QAAIA,SAAoC;AAAA,MACtC;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,MAAM,OAAO,QAAQ;AAAA,MACrB;AAAA,MACA;AAAA,MACA,WAAW,MAAM,KAAK,YAAY,SAAS;AAAA,MAC3C,kBAAkB;AAAA,MAClB,GAAG;AAAA,IACL;AAEA,WACE,oBAAC,oBAAkB,GAAGA,QACpB,8BAAC,UAAK,WAAW,MAAM,KAAK,GAC1B,8BAAC,QAAK,MAAK,SAAQ,GACrB,GACF;AAAA,EAEJ;AAGA,MAAI,QAAoC;AAAA,IACtC;AAAA,IACA;AAAA,IACA,SAAS,QAAQ,OAAO;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,MAAM,KAAK,YAAY,SAAS;AAAA,IAC3C,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,GAAG;AAAA,EACL;AAEA,SACE,oBAAC,oBAAkB,GAAG,OACpB,8BAAC,UAAK,WAAW,MAAM,KAAK,GAC1B,8BAAC,QAAK,MAAK,SAAQ,GACrB,GACF;AAEJ;AAEO,aAAM,gBAAyD;AAAA,EACpE,YAAY;AAAA,IACV,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["props"]
|
|
7
7
|
}
|
|
@@ -53,8 +53,6 @@ export type ComboboxProps<T extends ElementType, V extends boolean | number | st
|
|
|
53
53
|
className?: string;
|
|
54
54
|
onChange?: (selectedValue: V | undefined) => void;
|
|
55
55
|
});
|
|
56
|
-
export declare
|
|
57
|
-
children?: import("react").ReactNode | undefined;
|
|
58
|
-
}>, V extends boolean | number | string = string>({ disabled, invalid, as, value, defaultValue, multiple, items, placeholder, immediate, virtual, customValue, name, className, onChange, ref, children, ...rest }: ComboboxProps<T, V>) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare function Combobox<T extends ElementType = typeof COMBOBOX_ELEMENT, V extends boolean | number | string = string>({ disabled, invalid, as, value, defaultValue, multiple, items, placeholder, immediate, virtual, customValue, name, className, onChange, ref, children, ...rest }: ComboboxProps<T, V>): import("react/jsx-runtime").JSX.Element;
|
|
59
57
|
export declare const comboboxTheme: ComponentTheme<typeof useComboboxTheme>;
|
|
60
58
|
export {};
|
|
@@ -26,7 +26,7 @@ export const useComboboxTheme = createComponentTheme("Combobox", {
|
|
|
26
26
|
elements: ["root", "input", "icon", "options"]
|
|
27
27
|
});
|
|
28
28
|
const COMBOBOX_ELEMENT = Fragment;
|
|
29
|
-
export
|
|
29
|
+
export function Combobox({
|
|
30
30
|
disabled = false,
|
|
31
31
|
invalid = false,
|
|
32
32
|
as = COMBOBOX_ELEMENT,
|
|
@@ -44,7 +44,7 @@ export const Combobox = ({
|
|
|
44
44
|
ref,
|
|
45
45
|
children,
|
|
46
46
|
...rest
|
|
47
|
-
})
|
|
47
|
+
}) {
|
|
48
48
|
let theme = useComboboxTheme({ disabled, invalid });
|
|
49
49
|
let formId = useFormId();
|
|
50
50
|
let field = useField();
|
|
@@ -135,7 +135,7 @@ export const Combobox = ({
|
|
|
135
135
|
filteredChildren
|
|
136
136
|
] }) : null
|
|
137
137
|
] });
|
|
138
|
-
}
|
|
138
|
+
}
|
|
139
139
|
export const comboboxTheme = {
|
|
140
140
|
classNames: {
|
|
141
141
|
root: "w-full min-w-32",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Combobox.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Combobox as HeadlessCombobox,\n ComboboxButton as HeadlessComboboxButton,\n ComboboxInput as HeadlessComboboxInput,\n ComboboxOptions as HeadlessComboboxOptions,\n type ComboboxProps as HeadlessComboboxProps,\n} from '@headlessui/react';\nimport {ChevronDownIcon} from '@heroicons/react/24/outline';\nimport {\n type ChangeEvent,\n Children,\n type ComponentPropsWithoutRef,\n type ElementType,\n Fragment,\n type PropsWithChildren,\n useCallback,\n useState,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {ComboboxOption} from './ComboboxOption.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\nimport {useFormId} from './internals.js';\nimport {useField} from './useField.js';\nimport {useFieldName} from './useFieldName.js';\n\nexport const useComboboxTheme = createComponentTheme('Combobox', {\n variants: {disabled: [true, false], invalid: [true, false]},\n elements: ['root', 'input', 'icon', 'options'],\n});\n\nconst COMBOBOX_ELEMENT = Fragment;\n\nexport type ComboboxItem<V> = {\n value: V;\n label: string;\n};\n\nexport type ComboboxProps<\n T extends ElementType,\n V extends boolean | number | string,\n> = ComponentProps<typeof useComboboxTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren &\n (\n | {\n as?: T | undefined;\n value?: V[] | undefined;\n defaultValue?: V[] | undefined;\n multiple: true;\n items?: Array<ComboboxItem<V>> | undefined;\n placeholder?: string;\n immediate?: boolean | undefined;\n virtual?: boolean | undefined;\n customValue?: boolean | undefined;\n name?: string | undefined;\n className?: string;\n onChange?: (selectedValue: V[] | undefined) => void;\n }\n | {\n as?: T | undefined;\n value?: V | undefined;\n defaultValue?: V | undefined;\n multiple?: false | undefined;\n items?: Array<ComboboxItem<V>> | undefined;\n placeholder?: string;\n immediate?: boolean | undefined;\n virtual?: boolean | undefined;\n customValue?: boolean | undefined;\n name?: string | undefined;\n className?: string;\n onChange?: (selectedValue: V | undefined) => void;\n }\n );\n\nexport
|
|
5
|
-
"mappings": ";AA4MM,SACE,KADF;AA5MN;AAAA,EACE,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,OAEd;AACP,SAAQ,uBAAsB;AAC9B;AAAA,EAEE;AAAA,EAGA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAGE;AAAA,OACK;AACP,SAAQ,sBAAqB;AAE7B,SAAQ,YAAW;AACnB,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AACvB,SAAQ,oBAAmB;AAEpB,aAAM,mBAAmB,qBAAqB,YAAY;AAAA,EAC/D,UAAU,EAAC,UAAU,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,KAAK,EAAC;AAAA,EAC1D,UAAU,CAAC,QAAQ,SAAS,QAAQ,SAAS;AAC/C,CAAC;AAED,MAAM,mBAAmB;AA6ClB,
|
|
4
|
+
"sourcesContent": ["import {\n Combobox as HeadlessCombobox,\n ComboboxButton as HeadlessComboboxButton,\n ComboboxInput as HeadlessComboboxInput,\n ComboboxOptions as HeadlessComboboxOptions,\n type ComboboxProps as HeadlessComboboxProps,\n} from '@headlessui/react';\nimport {ChevronDownIcon} from '@heroicons/react/24/outline';\nimport {\n type ChangeEvent,\n Children,\n type ComponentPropsWithoutRef,\n type ElementType,\n Fragment,\n type PropsWithChildren,\n useCallback,\n useState,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {ComboboxOption} from './ComboboxOption.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\nimport {useFormId} from './internals.js';\nimport {useField} from './useField.js';\nimport {useFieldName} from './useFieldName.js';\n\nexport const useComboboxTheme = createComponentTheme('Combobox', {\n variants: {disabled: [true, false], invalid: [true, false]},\n elements: ['root', 'input', 'icon', 'options'],\n});\n\nconst COMBOBOX_ELEMENT = Fragment;\n\nexport type ComboboxItem<V> = {\n value: V;\n label: string;\n};\n\nexport type ComboboxProps<\n T extends ElementType,\n V extends boolean | number | string,\n> = ComponentProps<typeof useComboboxTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren &\n (\n | {\n as?: T | undefined;\n value?: V[] | undefined;\n defaultValue?: V[] | undefined;\n multiple: true;\n items?: Array<ComboboxItem<V>> | undefined;\n placeholder?: string;\n immediate?: boolean | undefined;\n virtual?: boolean | undefined;\n customValue?: boolean | undefined;\n name?: string | undefined;\n className?: string;\n onChange?: (selectedValue: V[] | undefined) => void;\n }\n | {\n as?: T | undefined;\n value?: V | undefined;\n defaultValue?: V | undefined;\n multiple?: false | undefined;\n items?: Array<ComboboxItem<V>> | undefined;\n placeholder?: string;\n immediate?: boolean | undefined;\n virtual?: boolean | undefined;\n customValue?: boolean | undefined;\n name?: string | undefined;\n className?: string;\n onChange?: (selectedValue: V | undefined) => void;\n }\n );\n\nexport function Combobox<\n T extends ElementType = typeof COMBOBOX_ELEMENT,\n V extends boolean | number | string = string,\n>({\n disabled = false,\n invalid = false,\n as = COMBOBOX_ELEMENT as unknown as T,\n value,\n defaultValue,\n multiple,\n items,\n placeholder,\n immediate = true,\n virtual = false,\n customValue = false,\n name,\n className,\n onChange,\n ref,\n children,\n ...rest\n}: ComboboxProps<T, V>) {\n let theme = useComboboxTheme({disabled, invalid});\n let formId = useFormId();\n let field = useField();\n let fieldName = useFieldName();\n let [query, setQuery] = useState('');\n\n let handleChange = useCallback(\n (selectedValue: V | null) => {\n if (selectedValue) {\n onChange?.(selectedValue as V & V[]);\n }\n\n if (selectedValue === null) {\n onChange?.(undefined);\n }\n },\n [onChange],\n );\n\n let displayValue = useCallback(\n (option: string) => {\n if (items) {\n let selectedItem = items.find((item) => item.value === option);\n\n if (selectedItem) {\n return selectedItem.label;\n }\n }\n\n return option;\n },\n [items],\n );\n\n let handleQueryChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n setQuery(event.target.value);\n }, []);\n\n if (virtual && !items) {\n throw new Error('Combobox requires `items` prop in virtual scrolling mode!');\n }\n\n if (virtual && customValue) {\n throw new Error(\"Combobox doesn't support `customValue` prop in virtual scrolling mode!\");\n }\n\n if (items && children) {\n throw new Error('Combobox accepts only either `items` prop, or children!');\n }\n\n let filteredItems =\n query ?\n items?.filter((item) =>\n `${item.label as number | string}`\n .toLowerCase()\n .replaceAll(/\\s+/g, '')\n .includes(query.toLowerCase().replaceAll(/\\s+/g, '')),\n )\n : items;\n let filteredChildren =\n query ?\n Children.toArray(children).filter((child) => {\n if (\n typeof child === 'object' &&\n 'props' in child &&\n typeof child.props === 'object' &&\n typeof (child.props as {children?: unknown[] | string}).children === 'string' &&\n (child.props as {children: string}).children\n .toLowerCase()\n .replaceAll(/\\s+/g, '')\n .includes(query.toLowerCase().replaceAll(/\\s+/g, ''))\n ) {\n return true;\n }\n\n return false;\n })\n : children;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessComboboxProps<any, any, any> = {\n as,\n ref,\n name: field?.name ?? fieldName ?? name,\n value: value ?? undefined,\n defaultValue,\n multiple,\n disabled,\n immediate,\n form: formId,\n onChange: handleChange,\n ...rest,\n };\n\n if (virtual) {\n props.virtual = {\n options: filteredItems?.map((item) => item.value) ?? [],\n };\n }\n\n return (\n <HeadlessCombobox {...props}>\n <div className={theme.root('relative', className)} data-component=\"combobox\">\n <HeadlessComboboxInput\n className={theme.input(null, className)}\n displayValue={displayValue}\n size={1} // so the input default width without styling is small\n onChange={handleQueryChange}\n />\n <HeadlessComboboxButton className={theme.icon('absolute')}>\n <Icon>\n <ChevronDownIcon />\n </Icon>\n </HeadlessComboboxButton>\n </div>\n\n {virtual && filteredItems ?\n <HeadlessComboboxOptions anchor=\"bottom start\" className={theme.options()}>\n {({option}: {option: V}) => (\n <ComboboxOption value={option}>\n {items?.find((item) => item.value === option)?.label}\n </ComboboxOption>\n )}\n </HeadlessComboboxOptions>\n : null}\n\n {!virtual && filteredItems ?\n <HeadlessComboboxOptions anchor=\"bottom start\" className={theme.options()}>\n {customValue && query.length ?\n <ComboboxOption key={query} value={query}>\n {query}\n </ComboboxOption>\n : null}\n {filteredItems.map((item) => (\n <ComboboxOption key={String(item.value)} value={item.value}>\n {item.label}\n </ComboboxOption>\n ))}\n </HeadlessComboboxOptions>\n : null}\n\n {!filteredItems && Array.isArray(filteredChildren) ?\n <HeadlessComboboxOptions anchor=\"bottom start\" className={theme.options()}>\n {customValue && query.length ?\n <ComboboxOption value={query}>{query}</ComboboxOption>\n : null}\n {filteredChildren}\n </HeadlessComboboxOptions>\n : null}\n </HeadlessCombobox>\n );\n}\n\nexport const comboboxTheme: ComponentTheme<typeof useComboboxTheme> = {\n classNames: {\n root: 'w-full min-w-32',\n input:\n 'flex w-full items-center rounded-2 border-2 border-neutral-100 hover:border-neutral-200 bg-white px-2.5 h-9 pr-9 gap-x-2 transition-colors shadow-inner font-sans text-sm',\n icon: 'text-neutral-500 size-5 top-2 right-2 cursor-pointer',\n options:\n 'flex flex-col gap-y-1 shadow p-1 z-30 rounded-2 border-2 border-neutral-100 hover:border-neutral-200 bg-white text-left w-[var(--input-width)] [--anchor-gap:theme(spacing.1)] [--anchor-padding:theme(spacing.2)] [scrollbar-width:thin] empty:invisible transition-colors',\n },\n variants: {\n disabled: {\n true: {\n root: 'border-neutral-100 text-neutral-200 cursor-not-allowed',\n input: '',\n icon: 'text-neutral-200',\n options: 'border-neutral-100',\n },\n false: {\n root: '',\n input: '',\n icon: '',\n options: '',\n },\n },\n invalid: {\n true: {\n root: '',\n input: '',\n icon: '',\n options: '',\n },\n false: {\n root: '',\n input: '',\n icon: '',\n options: '',\n },\n },\n },\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,6 +21,6 @@ export type ComboboxOptionProps<T extends ElementType, V extends boolean | numbe
|
|
|
21
21
|
value: V;
|
|
22
22
|
className?: string;
|
|
23
23
|
};
|
|
24
|
-
export declare
|
|
24
|
+
export declare function ComboboxOption<T extends ElementType = typeof LISTBOX_OPTION_ELEMENT, V extends boolean | number | string = string>({ disabled, as, value, className, children, ref, ...rest }: ComboboxOptionProps<T, V>): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
export declare const comboboxOptionTheme: ComponentTheme<typeof useComboboxOptionTheme>;
|
|
26
26
|
export {};
|
|
@@ -12,7 +12,7 @@ export const useComboboxOptionTheme = createComponentTheme("ComboboxOption", {
|
|
|
12
12
|
elements: ["root", "icon"]
|
|
13
13
|
});
|
|
14
14
|
const LISTBOX_OPTION_ELEMENT = "div";
|
|
15
|
-
export
|
|
15
|
+
export function ComboboxOption({
|
|
16
16
|
disabled = false,
|
|
17
17
|
as = LISTBOX_OPTION_ELEMENT,
|
|
18
18
|
value,
|
|
@@ -20,7 +20,7 @@ export const ComboboxOption = ({
|
|
|
20
20
|
children,
|
|
21
21
|
ref,
|
|
22
22
|
...rest
|
|
23
|
-
})
|
|
23
|
+
}) {
|
|
24
24
|
let theme = useComboboxOptionTheme({ disabled });
|
|
25
25
|
let props = {
|
|
26
26
|
as,
|
|
@@ -35,7 +35,7 @@ export const ComboboxOption = ({
|
|
|
35
35
|
/* @__PURE__ */ jsx("span", { className: theme.icon("absolute"), children: /* @__PURE__ */ jsx(Icon, { name: "Check" }) }),
|
|
36
36
|
children
|
|
37
37
|
] });
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
export const comboboxOptionTheme = {
|
|
40
40
|
classNames: {
|
|
41
41
|
root: "relative group/option p-1 pr-6 rounded-1 hover:bg-neutral-50 data-[active]:bg-neutral-50 text-sm transition-colors",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/ComboboxOption.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n ComboboxOption as HeadlessComboboxOption,\n type ComboboxOptionProps as HeadlessComboboxOptionProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\n\nexport const useComboboxOptionTheme = createComponentTheme('ComboboxOption', {\n variants: {disabled: [true, false]},\n elements: ['root', 'icon'],\n});\n\nconst LISTBOX_OPTION_ELEMENT = 'div';\n\nexport type ComboboxOptionProps<\n T extends ElementType,\n V extends boolean | number | string,\n> = ComponentProps<typeof useComboboxOptionTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n value: V;\n className?: string;\n };\n\nexport
|
|
5
|
-
"mappings": ";AA2DI,SAEI,KAFJ;AA3DJ;AAAA,EACE,kBAAkB;AAAA,OAEb;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,YAAW;AAEZ,aAAM,yBAAyB,qBAAqB,kBAAkB;AAAA,EAC3E,UAAU,EAAC,UAAU,CAAC,MAAM,KAAK,EAAC;AAAA,EAClC,UAAU,CAAC,QAAQ,MAAM;AAC3B,CAAC;AAED,MAAM,yBAAyB;AAcxB,
|
|
4
|
+
"sourcesContent": ["import {\n ComboboxOption as HeadlessComboboxOption,\n type ComboboxOptionProps as HeadlessComboboxOptionProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {Icon} from './Icon.js';\n\nexport const useComboboxOptionTheme = createComponentTheme('ComboboxOption', {\n variants: {disabled: [true, false]},\n elements: ['root', 'icon'],\n});\n\nconst LISTBOX_OPTION_ELEMENT = 'div';\n\nexport type ComboboxOptionProps<\n T extends ElementType,\n V extends boolean | number | string,\n> = ComponentProps<typeof useComboboxOptionTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n value: V;\n className?: string;\n };\n\nexport function ComboboxOption<\n T extends ElementType = typeof LISTBOX_OPTION_ELEMENT,\n V extends boolean | number | string = string,\n>({\n disabled = false,\n as = LISTBOX_OPTION_ELEMENT as T,\n value,\n className,\n children,\n ref,\n ...rest\n}: ComboboxOptionProps<T, V>) {\n let theme = useComboboxOptionTheme({disabled});\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessComboboxOptionProps<any, any> = {\n as,\n ref,\n value,\n disabled,\n className: theme.root('cursor-pointer', className),\n 'data-component': 'combobox-option',\n ...rest,\n };\n\n return (\n <HeadlessComboboxOption {...props}>\n <span className={theme.icon('absolute')}>\n <Icon name=\"Check\" />\n </span>\n {children}\n </HeadlessComboboxOption>\n );\n}\n\nexport const comboboxOptionTheme: ComponentTheme<typeof useComboboxOptionTheme> = {\n classNames: {\n root: 'relative group/option p-1 pr-6 rounded-1 hover:bg-neutral-50 data-[active]:bg-neutral-50 text-sm transition-colors',\n icon: 'hidden group-data-[selected]/option:block right-1 top-1 text-neutral-500',\n },\n variants: {\n disabled: {\n true: {\n root: 'text-neutral-200 cursor-not-allowed',\n icon: 'text-neutral-200',\n },\n false: {\n root: '',\n icon: '',\n },\n },\n },\n};\n"],
|
|
5
|
+
"mappings": ";AA2DI,SAEI,KAFJ;AA3DJ;AAAA,EACE,kBAAkB;AAAA,OAEb;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,YAAW;AAEZ,aAAM,yBAAyB,qBAAqB,kBAAkB;AAAA,EAC3E,UAAU,EAAC,UAAU,CAAC,MAAM,KAAK,EAAC;AAAA,EAClC,UAAU,CAAC,QAAQ,MAAM;AAC3B,CAAC;AAED,MAAM,yBAAyB;AAcxB,gBAAS,eAGd;AAAA,EACA,WAAW;AAAA,EACX,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA8B;AAC5B,MAAI,QAAQ,uBAAuB,EAAC,SAAQ,CAAC;AAG7C,MAAI,QAA+C;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,MAAM,KAAK,kBAAkB,SAAS;AAAA,IACjD,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL;AAEA,SACE,qBAAC,0BAAwB,GAAG,OAC1B;AAAA,wBAAC,UAAK,WAAW,MAAM,KAAK,UAAU,GACpC,8BAAC,QAAK,MAAK,SAAQ,GACrB;AAAA,IACC;AAAA,KACH;AAEJ;AAEO,aAAM,sBAAqE;AAAA,EAChF,YAAY;AAAA,IACV,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,6 +22,6 @@ export type ContainerProps<T extends ElementType> = ComponentProps<typeof useCon
|
|
|
22
22
|
as?: T | undefined;
|
|
23
23
|
className?: string;
|
|
24
24
|
};
|
|
25
|
-
export declare
|
|
25
|
+
export declare function Container<T extends ElementType = typeof TEXT_ELEMENT>({ spacing, direction, justify, align, as: Component, className, ref, children, ...rest }: ContainerProps<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
26
26
|
export declare const containerTheme: ComponentTheme<typeof useContainerTheme>;
|
|
27
27
|
export {};
|
|
@@ -14,7 +14,7 @@ export const useContainerTheme = createComponentTheme("Container", {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
const TEXT_ELEMENT = "div";
|
|
17
|
-
export
|
|
17
|
+
export function Container({
|
|
18
18
|
spacing = "medium",
|
|
19
19
|
direction = "row",
|
|
20
20
|
justify = "normal",
|
|
@@ -24,7 +24,7 @@ export const Container = ({
|
|
|
24
24
|
ref,
|
|
25
25
|
children,
|
|
26
26
|
...rest
|
|
27
|
-
})
|
|
27
|
+
}) {
|
|
28
28
|
let theme = useContainerTheme({ spacing, direction, justify, align });
|
|
29
29
|
let props = {
|
|
30
30
|
ref,
|
|
@@ -33,7 +33,7 @@ export const Container = ({
|
|
|
33
33
|
...rest
|
|
34
34
|
};
|
|
35
35
|
return createElement(Component, props, children);
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
export const containerTheme = {
|
|
38
38
|
className: "flex",
|
|
39
39
|
variants: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Container.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ComponentPropsWithoutRef,\n createElement,\n type ElementType,\n type PropsWithChildren,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\n\nexport const useContainerTheme = createComponentTheme('Container', {\n variants: {\n spacing: ['extra-small', 'small', 'medium', 'large'],\n direction: ['row', 'column'],\n justify: ['normal', 'center', 'spaced'],\n align: ['normal', 'center'],\n },\n});\n\nconst TEXT_ELEMENT = 'div';\n\nexport type ContainerProps<T extends ElementType> = ComponentProps<typeof useContainerTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string;\n };\n\nexport
|
|
5
|
-
"mappings": ";AAAA;AAAA,EAEE;AAAA,OAGK;AAEP;AAAA,EAGE;AAAA,OACK;AAGA,aAAM,oBAAoB,qBAAqB,aAAa;AAAA,EACjE,UAAU;AAAA,IACR,SAAS,CAAC,eAAe,SAAS,UAAU,OAAO;AAAA,IACnD,WAAW,CAAC,OAAO,QAAQ;AAAA,IAC3B,SAAS,CAAC,UAAU,UAAU,QAAQ;AAAA,IACtC,OAAO,CAAC,UAAU,QAAQ;AAAA,EAC5B;AACF,CAAC;AAED,MAAM,eAAe;AAUd,
|
|
4
|
+
"sourcesContent": ["import {\n type ComponentPropsWithoutRef,\n createElement,\n type ElementType,\n type PropsWithChildren,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\n\nexport const useContainerTheme = createComponentTheme('Container', {\n variants: {\n spacing: ['extra-small', 'small', 'medium', 'large'],\n direction: ['row', 'column'],\n justify: ['normal', 'center', 'spaced'],\n align: ['normal', 'center'],\n },\n});\n\nconst TEXT_ELEMENT = 'div';\n\nexport type ContainerProps<T extends ElementType> = ComponentProps<typeof useContainerTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string;\n };\n\nexport function Container<T extends ElementType = typeof TEXT_ELEMENT>({\n spacing = 'medium',\n direction = 'row',\n justify = 'normal',\n align = 'normal',\n as: Component = TEXT_ELEMENT as T,\n className,\n ref,\n children,\n ...rest\n}: ContainerProps<T>) {\n let theme = useContainerTheme({spacing, direction, justify, align});\n let props = {\n ref,\n className: theme(null, className),\n 'data-component': 'container',\n ...rest,\n };\n\n return createElement(Component, props, children);\n}\n\nexport const containerTheme: ComponentTheme<typeof useContainerTheme> = {\n className: 'flex',\n variants: {\n spacing: {\n 'extra-small': 'gap-1',\n small: 'gap-2',\n medium: 'gap-4',\n large: 'gap-6',\n },\n direction: {\n row: '',\n column: 'flex-col',\n },\n justify: {\n normal: '',\n center: 'justify-center',\n spaced: 'justify-between',\n },\n align: {\n normal: '',\n center: 'items-center',\n },\n },\n};\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EAEE;AAAA,OAGK;AAEP;AAAA,EAGE;AAAA,OACK;AAGA,aAAM,oBAAoB,qBAAqB,aAAa;AAAA,EACjE,UAAU;AAAA,IACR,SAAS,CAAC,eAAe,SAAS,UAAU,OAAO;AAAA,IACnD,WAAW,CAAC,OAAO,QAAQ;AAAA,IAC3B,SAAS,CAAC,UAAU,UAAU,QAAQ;AAAA,IACtC,OAAO,CAAC,UAAU,QAAQ;AAAA,EAC5B;AACF,CAAC;AAED,MAAM,eAAe;AAUd,gBAAS,UAAuD;AAAA,EACrE,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,IAAI,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,MAAI,QAAQ,kBAAkB,EAAC,SAAS,WAAW,SAAS,MAAK,CAAC;AAClE,MAAI,QAAQ;AAAA,IACV;AAAA,IACA,WAAW,MAAM,MAAM,SAAS;AAAA,IAChC,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL;AAEA,SAAO,cAAc,WAAW,OAAO,QAAQ;AACjD;AAEO,aAAM,iBAA2D;AAAA,EACtE,WAAW;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,eAAe;AAAA,MACf,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,6 @@ export type DescriptionProps<T extends ElementType> = ComponentProps<typeof useD
|
|
|
10
10
|
as?: T | undefined;
|
|
11
11
|
className?: string | undefined;
|
|
12
12
|
};
|
|
13
|
-
export declare
|
|
13
|
+
export declare function Description<T extends ElementType = typeof DESCRIPTION_ELEMENT>({ as, className, ref, children, ...rest }: DescriptionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const descriptionTheme: ComponentTheme<typeof useDescriptionTheme>;
|
|
15
15
|
export {};
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
import { filterProps } from "./internals.js";
|
|
10
10
|
export const useDescriptionTheme = createComponentTheme("Description");
|
|
11
11
|
const DESCRIPTION_ELEMENT = "p";
|
|
12
|
-
export
|
|
12
|
+
export function Description({
|
|
13
13
|
as = DESCRIPTION_ELEMENT,
|
|
14
14
|
className,
|
|
15
15
|
ref,
|
|
16
16
|
children,
|
|
17
17
|
...rest
|
|
18
|
-
})
|
|
18
|
+
}) {
|
|
19
19
|
let theme = useDescriptionTheme();
|
|
20
20
|
let props = filterProps({
|
|
21
21
|
as,
|
|
@@ -25,7 +25,7 @@ export const Description = ({
|
|
|
25
25
|
...rest
|
|
26
26
|
});
|
|
27
27
|
return /* @__PURE__ */ jsx(HeadlessDescription, { ...props, children });
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
29
|
export const descriptionTheme = {
|
|
30
30
|
className: "font-sans text-sm"
|
|
31
31
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Description.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Description as HeadlessDescription,\n type DescriptionProps as HeadlessDescriptionProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDescriptionTheme = createComponentTheme('Description');\n\nconst DESCRIPTION_ELEMENT = 'p';\n\nexport type DescriptionProps<T extends ElementType> = ComponentProps<typeof useDescriptionTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string | undefined;\n };\n\nexport
|
|
5
|
-
"mappings": ";AA2CS;AA3CT;AAAA,EACE,eAAe;AAAA,OAEV;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,sBAAsB,qBAAqB,aAAa;AAErE,MAAM,sBAAsB;AAUrB,
|
|
4
|
+
"sourcesContent": ["import {\n Description as HeadlessDescription,\n type DescriptionProps as HeadlessDescriptionProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDescriptionTheme = createComponentTheme('Description');\n\nconst DESCRIPTION_ELEMENT = 'p';\n\nexport type DescriptionProps<T extends ElementType> = ComponentProps<typeof useDescriptionTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string | undefined;\n };\n\nexport function Description<T extends ElementType = typeof DESCRIPTION_ELEMENT>({\n as = DESCRIPTION_ELEMENT as T,\n className,\n ref,\n children,\n ...rest\n}: DescriptionProps<T>) {\n let theme = useDescriptionTheme();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessDescriptionProps<any> = filterProps({\n as,\n ref,\n className: theme(null, className),\n 'data-component': 'description',\n ...rest,\n });\n\n return <HeadlessDescription {...props}>{children}</HeadlessDescription>;\n}\n\nexport const descriptionTheme: ComponentTheme<typeof useDescriptionTheme> = {\n className: 'font-sans text-sm',\n};\n"],
|
|
5
|
+
"mappings": ";AA2CS;AA3CT;AAAA,EACE,eAAe;AAAA,OAEV;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,sBAAsB,qBAAqB,aAAa;AAErE,MAAM,sBAAsB;AAUrB,gBAAS,YAAgE;AAAA,EAC9E,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,MAAI,QAAQ,oBAAoB;AAEhC,MAAI,QAAuC,YAAY;AAAA,IACrD;AAAA,IACA;AAAA,IACA,WAAW,MAAM,MAAM,SAAS;AAAA,IAChC,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL,CAAC;AAED,SAAO,oBAAC,uBAAqB,GAAG,OAAQ,UAAS;AACnD;AAEO,aAAM,mBAA+D;AAAA,EAC1E,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -19,6 +19,6 @@ export type DialogProps<T extends ElementType> = ComponentProps<typeof useDialog
|
|
|
19
19
|
className?: string;
|
|
20
20
|
onClose?: () => void;
|
|
21
21
|
};
|
|
22
|
-
export declare
|
|
22
|
+
export declare function Dialog<T extends ElementType = typeof DIALOG_ELEMENT>({ as, open, static: isStatic, autoFocus, className, onClose, ref, children, ...rest }: DialogProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export declare const dialogTheme: ComponentTheme<typeof useDialogTheme>;
|
|
24
24
|
export {};
|
|
@@ -15,7 +15,7 @@ export const useDialogTheme = createComponentTheme("Dialog", {
|
|
|
15
15
|
elements: ["root", "backdrop"]
|
|
16
16
|
});
|
|
17
17
|
const DIALOG_ELEMENT = "div";
|
|
18
|
-
export
|
|
18
|
+
export function Dialog({
|
|
19
19
|
as = DIALOG_ELEMENT,
|
|
20
20
|
open,
|
|
21
21
|
static: isStatic,
|
|
@@ -25,7 +25,7 @@ export const Dialog = ({
|
|
|
25
25
|
ref,
|
|
26
26
|
children,
|
|
27
27
|
...rest
|
|
28
|
-
})
|
|
28
|
+
}) {
|
|
29
29
|
let theme = useDialogTheme();
|
|
30
30
|
let handleClose = useCallback(() => {
|
|
31
31
|
onClose?.();
|
|
@@ -44,7 +44,7 @@ export const Dialog = ({
|
|
|
44
44
|
/* @__PURE__ */ jsx(HeadlessDialogBackdrop, { transition: true, className: theme.backdrop("fixed inset-0") }),
|
|
45
45
|
/* @__PURE__ */ jsx("div", { className: theme.root("fixed inset-0", className), children })
|
|
46
46
|
] });
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
export const dialogTheme = {
|
|
49
49
|
classNames: {
|
|
50
50
|
root: "flex w-screen items-center justify-center p-4 z-30",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/Dialog.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Dialog as HeadlessDialog,\n DialogBackdrop as HeadlessDialogBackdrop,\n type DialogProps as HeadlessDialogProps,\n} from '@headlessui/react';\nimport {\n type ComponentPropsWithoutRef,\n type ElementType,\n type PropsWithChildren,\n useCallback,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDialogTheme = createComponentTheme('Dialog', {\n elements: ['root', 'backdrop'],\n});\n\nconst DIALOG_ELEMENT = 'div';\n\nexport type DialogProps<T extends ElementType> = ComponentProps<typeof useDialogTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n open: boolean;\n static?: boolean | undefined;\n autoFocus?: boolean | undefined;\n className?: string;\n onClose?: () => void;\n };\n\nexport
|
|
5
|
-
"mappings": ";AAoEI,SACE,KADF;AApEJ;AAAA,EACE,UAAU;AAAA,EACV,kBAAkB;AAAA,OAEb;AACP;AAAA,EAIE;AAAA,OACK;AAEP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,iBAAiB,qBAAqB,UAAU;AAAA,EAC3D,UAAU,CAAC,QAAQ,UAAU;AAC/B,CAAC;AAED,MAAM,iBAAiB;AAchB,
|
|
4
|
+
"sourcesContent": ["import {\n Dialog as HeadlessDialog,\n DialogBackdrop as HeadlessDialogBackdrop,\n type DialogProps as HeadlessDialogProps,\n} from '@headlessui/react';\nimport {\n type ComponentPropsWithoutRef,\n type ElementType,\n type PropsWithChildren,\n useCallback,\n} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDialogTheme = createComponentTheme('Dialog', {\n elements: ['root', 'backdrop'],\n});\n\nconst DIALOG_ELEMENT = 'div';\n\nexport type DialogProps<T extends ElementType> = ComponentProps<typeof useDialogTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n open: boolean;\n static?: boolean | undefined;\n autoFocus?: boolean | undefined;\n className?: string;\n onClose?: () => void;\n };\n\nexport function Dialog<T extends ElementType = typeof DIALOG_ELEMENT>({\n as = DIALOG_ELEMENT as T,\n open,\n static: isStatic,\n autoFocus,\n className,\n onClose,\n ref,\n children,\n ...rest\n}: DialogProps<T>) {\n let theme = useDialogTheme();\n\n let handleClose = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessDialogProps<any> = filterProps({\n as,\n ref,\n open,\n static: isStatic,\n transition: true,\n onClose: handleClose,\n 'data-component': 'dialog',\n ...rest,\n });\n\n return (\n <HeadlessDialog {...props}>\n <HeadlessDialogBackdrop transition className={theme.backdrop('fixed inset-0')} />\n <div className={theme.root('fixed inset-0', className)}>{children}</div>\n </HeadlessDialog>\n );\n}\n\nexport const dialogTheme: ComponentTheme<typeof useDialogTheme> = {\n classNames: {\n root: 'flex w-screen items-center justify-center p-4 z-30',\n backdrop: 'bg-black/30 z-30',\n },\n};\n"],
|
|
5
|
+
"mappings": ";AAoEI,SACE,KADF;AApEJ;AAAA,EACE,UAAU;AAAA,EACV,kBAAkB;AAAA,OAEb;AACP;AAAA,EAIE;AAAA,OACK;AAEP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,iBAAiB,qBAAqB,UAAU;AAAA,EAC3D,UAAU,CAAC,QAAQ,UAAU;AAC/B,CAAC;AAED,MAAM,iBAAiB;AAchB,gBAAS,OAAsD;AAAA,EACpE,KAAK;AAAA,EACL;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,MAAI,QAAQ,eAAe;AAE3B,MAAI,cAAc,YAAY,MAAM;AAClC,cAAU;AAAA,EACZ,GAAG,CAAC,OAAO,CAAC;AAGZ,MAAI,QAAkC,YAAY;AAAA,IAChD;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL,CAAC;AAED,SACE,qBAAC,kBAAgB,GAAG,OAClB;AAAA,wBAAC,0BAAuB,YAAU,MAAC,WAAW,MAAM,SAAS,eAAe,GAAG;AAAA,IAC/E,oBAAC,SAAI,WAAW,MAAM,KAAK,iBAAiB,SAAS,GAAI,UAAS;AAAA,KACpE;AAEJ;AAEO,aAAM,cAAqD;AAAA,EAChE,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,6 @@ export type DialogPanelProps<T extends ElementType> = ComponentProps<typeof useD
|
|
|
10
10
|
as?: T | undefined;
|
|
11
11
|
className?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare
|
|
13
|
+
export declare function DialogPanel<T extends ElementType = typeof DIALOG_PANEL_ELEMENT>({ as, className, ref, children, ...rest }: DialogPanelProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const dialogPanelTheme: ComponentTheme<typeof useDialogPanelTheme>;
|
|
15
15
|
export {};
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
import { filterProps } from "./internals.js";
|
|
10
10
|
export const useDialogPanelTheme = createComponentTheme("DialogPanel");
|
|
11
11
|
const DIALOG_PANEL_ELEMENT = "div";
|
|
12
|
-
export
|
|
12
|
+
export function DialogPanel({
|
|
13
13
|
as = DIALOG_PANEL_ELEMENT,
|
|
14
14
|
className,
|
|
15
15
|
ref,
|
|
16
16
|
children,
|
|
17
17
|
...rest
|
|
18
|
-
})
|
|
18
|
+
}) {
|
|
19
19
|
let theme = useDialogPanelTheme();
|
|
20
20
|
let props = filterProps({
|
|
21
21
|
as,
|
|
@@ -26,7 +26,7 @@ export const DialogPanel = ({
|
|
|
26
26
|
...rest
|
|
27
27
|
});
|
|
28
28
|
return /* @__PURE__ */ jsx(HeadlessDialogPanel, { ...props, children });
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
export const dialogPanelTheme = {
|
|
31
31
|
className: "shadow-1 relative flex w-full min-w-[300px] max-w-[900px] flex-col gap-y-6 rounded-4 bg-white p-6 max-h-[calc(100vh-3rem)] overflow-hidden overflow-y-auto"
|
|
32
32
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/DialogPanel.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n DialogPanel as HeadlessDialogPanel,\n type DialogPanelProps as HeadlessDialogPanelProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDialogPanelTheme = createComponentTheme('DialogPanel');\n\nconst DIALOG_PANEL_ELEMENT = 'div';\n\nexport type DialogPanelProps<T extends ElementType> = ComponentProps<typeof useDialogPanelTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string;\n };\n\nexport
|
|
5
|
-
"mappings": ";AA4CS;AA5CT;AAAA,EACE,eAAe;AAAA,OAEV;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,sBAAsB,qBAAqB,aAAa;AAErE,MAAM,uBAAuB;AAUtB,
|
|
4
|
+
"sourcesContent": ["import {\n DialogPanel as HeadlessDialogPanel,\n type DialogPanelProps as HeadlessDialogPanelProps,\n} from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDialogPanelTheme = createComponentTheme('DialogPanel');\n\nconst DIALOG_PANEL_ELEMENT = 'div';\n\nexport type DialogPanelProps<T extends ElementType> = ComponentProps<typeof useDialogPanelTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string;\n };\n\nexport function DialogPanel<T extends ElementType = typeof DIALOG_PANEL_ELEMENT>({\n as = DIALOG_PANEL_ELEMENT as T,\n className,\n ref,\n children,\n ...rest\n}: DialogPanelProps<T>) {\n let theme = useDialogPanelTheme();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: HeadlessDialogPanelProps<any> = filterProps({\n as,\n ref,\n className: theme(null, className),\n transition: true,\n 'data-component': 'dialog-panel',\n ...rest,\n });\n\n return <HeadlessDialogPanel {...props}>{children}</HeadlessDialogPanel>;\n}\n\nexport const dialogPanelTheme: ComponentTheme<typeof useDialogPanelTheme> = {\n className:\n 'shadow-1 relative flex w-full min-w-[300px] max-w-[900px] flex-col gap-y-6 rounded-4 bg-white p-6 max-h-[calc(100vh-3rem)] overflow-hidden overflow-y-auto',\n};\n"],
|
|
5
|
+
"mappings": ";AA4CS;AA5CT;AAAA,EACE,eAAe;AAAA,OAEV;AAGP;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,sBAAsB,qBAAqB,aAAa;AAErE,MAAM,uBAAuB;AAUtB,gBAAS,YAAiE;AAAA,EAC/E,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,MAAI,QAAQ,oBAAoB;AAEhC,MAAI,QAAuC,YAAY;AAAA,IACrD;AAAA,IACA;AAAA,IACA,WAAW,MAAM,MAAM,SAAS;AAAA,IAChC,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL,CAAC;AAED,SAAO,oBAAC,uBAAqB,GAAG,OAAQ,UAAS;AACnD;AAEO,aAAM,mBAA+D;AAAA,EAC1E,WACE;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
DialogTitle as HeadlessDialogTitle
|
|
5
|
-
} from "@headlessui/react";
|
|
3
|
+
import * as react from "@headlessui/react";
|
|
6
4
|
import {
|
|
7
5
|
createComponentTheme
|
|
8
6
|
} from "../theme/internals.js";
|
|
@@ -24,7 +22,7 @@ export const DialogTitle = ({
|
|
|
24
22
|
"data-component": "dialog-title",
|
|
25
23
|
...rest
|
|
26
24
|
});
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
25
|
+
return /* @__PURE__ */ jsx(react.DialogTitle, { ...props, children });
|
|
28
26
|
};
|
|
29
27
|
export const dialogTitleTheme = {
|
|
30
28
|
className: "text-xl font-bold"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/components/DialogTitle.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import * as react from '@headlessui/react';\nimport {type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren} from 'react';\n\nimport {\n type ComponentProps,\n type ComponentTheme,\n createComponentTheme,\n} from '../theme/internals.js';\nimport {type ComponentRef} from './ComponentRef.js';\nimport {filterProps} from './internals.js';\n\nexport const useDialogTitleTheme = createComponentTheme('DialogTitle');\n\nconst DIALOG_TITLE_ELEMENT = 'h2';\n\nexport type DialogTitleProps<T extends ElementType> = ComponentProps<typeof useDialogTitleTheme> &\n ComponentPropsWithoutRef<T> &\n ComponentRef<T> &\n PropsWithChildren & {\n as?: T | undefined;\n className?: string;\n };\n\nexport const DialogTitle = <T extends ElementType = typeof DIALOG_TITLE_ELEMENT>({\n as = DIALOG_TITLE_ELEMENT as T,\n className,\n ref,\n children,\n ...rest\n}: DialogTitleProps<T>) => {\n let theme = useDialogTitleTheme();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed\n let props: react.DialogTitleProps<any> = filterProps({\n as,\n ref,\n className: theme(null, className),\n 'data-component': 'dialog-title',\n ...rest,\n });\n\n return <react.DialogTitle {...props}>{children}</react.DialogTitle>;\n};\n\nexport const dialogTitleTheme: ComponentTheme<typeof useDialogTitleTheme> = {\n className: 'text-xl font-bold',\n};\n"],
|
|
5
|
+
"mappings": ";AAwCS;AAxCT,YAAY,WAAW;AAGvB;AAAA,EAGE;AAAA,OACK;AAEP,SAAQ,mBAAkB;AAEnB,aAAM,sBAAsB,qBAAqB,aAAa;AAErE,MAAM,uBAAuB;AAUtB,aAAM,cAAc,CAAsD;AAAA,EAC/E,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA2B;AACzB,MAAI,QAAQ,oBAAoB;AAEhC,MAAI,QAAqC,YAAY;AAAA,IACnD;AAAA,IACA;AAAA,IACA,WAAW,MAAM,MAAM,SAAS;AAAA,IAChC,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL,CAAC;AAED,SAAO,oBAAC,MAAM,aAAN,EAAmB,GAAG,OAAQ,UAAS;AACjD;AAEO,aAAM,mBAA+D;AAAA,EAC1E,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,6 @@ export type ErrorProps<T extends ElementType> = ComponentProps<typeof useErrorTh
|
|
|
10
10
|
as?: T | undefined;
|
|
11
11
|
className?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare
|
|
13
|
+
export declare function Error<T extends ElementType = typeof ERROR_ELEMENT>({ as: Component, className, ref, children, ...rest }: ErrorProps<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
14
14
|
export declare const errorTheme: ComponentTheme<typeof useErrorTheme>;
|
|
15
15
|
export {};
|
|
@@ -10,13 +10,13 @@ import { Text } from "./Text.js";
|
|
|
10
10
|
import { useField } from "./useField.js";
|
|
11
11
|
export const useErrorTheme = createComponentTheme("Error");
|
|
12
12
|
const ERROR_ELEMENT = "div";
|
|
13
|
-
export
|
|
13
|
+
export function Error({
|
|
14
14
|
as: Component = ERROR_ELEMENT,
|
|
15
15
|
className,
|
|
16
16
|
ref,
|
|
17
17
|
children,
|
|
18
18
|
...rest
|
|
19
|
-
})
|
|
19
|
+
}) {
|
|
20
20
|
let theme = useErrorTheme();
|
|
21
21
|
let field = useField();
|
|
22
22
|
let props = {
|
|
@@ -33,7 +33,7 @@ export const Error = ({
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
return createElement(Component, props, children);
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
export const errorTheme = {
|
|
38
38
|
className: "flex text-danger-500 empty:hidden"
|
|
39
39
|
};
|