@vitinnczk/onyx-ui 0.0.0-stage → 0.2.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/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +330 -2
- package/dist/components/Accordion/Accordion.d.ts +42 -0
- package/dist/components/Accordion/Accordion.js +105 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.js +14 -0
- package/dist/components/Accordion/Accordion.module.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Alert/Alert.d.ts +26 -0
- package/dist/components/Alert/Alert.js +58 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Alert/Alert.module.js +19 -0
- package/dist/components/Alert/Alert.module.js.map +1 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.d.ts +16 -0
- package/dist/components/Avatar/Avatar.js +33 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/Avatar.module.js +15 -0
- package/dist/components/Avatar/Avatar.module.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Badge/Badge.d.ts +15 -0
- package/dist/components/Badge/Badge.js +17 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/Badge.module.js +18 -0
- package/dist/components/Badge/Badge.module.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +26 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +44 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.js +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.js.map +1 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +29 -0
- package/dist/components/Button/Button.js +40 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.js +18 -0
- package/dist/components/Button/Button.module.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +24 -0
- package/dist/components/Card/Card.js +34 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.module.js +17 -0
- package/dist/components/Card/Card.module.js.map +1 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.js +52 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.module.js +9 -0
- package/dist/components/Checkbox/Checkbox.module.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Divider/Divider.d.ts +18 -0
- package/dist/components/Divider/Divider.js +24 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/Divider.module.js +12 -0
- package/dist/components/Divider/Divider.module.js.map +1 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.d.ts +18 -0
- package/dist/components/Drawer/Drawer.js +27 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.module.js +17 -0
- package/dist/components/Drawer/Drawer.module.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +65 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +159 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.module.js +16 -0
- package/dist/components/DropdownMenu/DropdownMenu.module.js.map +1 -0
- package/dist/components/DropdownMenu/index.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.d.ts +20 -0
- package/dist/components/EmptyState/EmptyState.js +36 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.module.js +12 -0
- package/dist/components/EmptyState/EmptyState.module.js.map +1 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/FormField/FormField.d.ts +24 -0
- package/dist/components/FormField/FormField.js +49 -0
- package/dist/components/FormField/FormField.js.map +1 -0
- package/dist/components/FormField/FormField.module.js +10 -0
- package/dist/components/FormField/FormField.module.js.map +1 -0
- package/dist/components/FormField/formFieldContext.d.ts +24 -0
- package/dist/components/FormField/formFieldContext.js +18 -0
- package/dist/components/FormField/formFieldContext.js.map +1 -0
- package/dist/components/FormField/index.d.ts +2 -0
- package/dist/components/Heading/Heading.d.ts +14 -0
- package/dist/components/Heading/Heading.js +32 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Heading/Heading.module.js +14 -0
- package/dist/components/Heading/Heading.module.js.map +1 -0
- package/dist/components/Heading/index.d.ts +2 -0
- package/dist/components/Icon/Icon.d.ts +16 -0
- package/dist/components/Icon/Icon.js +28 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/Icon.module.js +13 -0
- package/dist/components/Icon/Icon.module.js.map +1 -0
- package/dist/components/Icon/icons.d.ts +17 -0
- package/dist/components/Icon/icons.js +47 -0
- package/dist/components/Icon/icons.js.map +1 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts +12 -0
- package/dist/components/IconButton/IconButton.js +25 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/IconButton.module.js +11 -0
- package/dist/components/IconButton/IconButton.module.js.map +1 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Input/Input.d.ts +18 -0
- package/dist/components/Input/Input.js +47 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/Input.module.js +5 -0
- package/dist/components/Input/Input.module.js.map +1 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Label/Label.d.ts +15 -0
- package/dist/components/Label/Label.js +22 -0
- package/dist/components/Label/Label.js.map +1 -0
- package/dist/components/Label/Label.module.js +10 -0
- package/dist/components/Label/Label.module.js.map +1 -0
- package/dist/components/Label/index.d.ts +2 -0
- package/dist/components/Link/Link.d.ts +23 -0
- package/dist/components/Link/Link.js +27 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/Link.module.js +11 -0
- package/dist/components/Link/Link.module.js.map +1 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Modal/DialogSurface.d.ts +39 -0
- package/dist/components/Modal/DialogSurface.js +69 -0
- package/dist/components/Modal/DialogSurface.js.map +1 -0
- package/dist/components/Modal/DialogSurface.module.js +16 -0
- package/dist/components/Modal/DialogSurface.module.js.map +1 -0
- package/dist/components/Modal/Modal.d.ts +34 -0
- package/dist/components/Modal/Modal.js +44 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/Modal.module.js +13 -0
- package/dist/components/Modal/Modal.module.js.map +1 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Pagination/Pagination.d.ts +46 -0
- package/dist/components/Pagination/Pagination.js +71 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/Pagination.module.js +13 -0
- package/dist/components/Pagination/Pagination.module.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Popover/Popover.d.ts +46 -0
- package/dist/components/Popover/Popover.js +89 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/Popover.module.js +12 -0
- package/dist/components/Popover/Popover.module.js.map +1 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Portal/Portal.d.ts +10 -0
- package/dist/components/Portal/Portal.js +13 -0
- package/dist/components/Portal/Portal.js.map +1 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Progress/Progress.d.ts +28 -0
- package/dist/components/Progress/Progress.js +42 -0
- package/dist/components/Progress/Progress.js.map +1 -0
- package/dist/components/Progress/Progress.module.js +18 -0
- package/dist/components/Progress/Progress.module.js.map +1 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +41 -0
- package/dist/components/RadioGroup/RadioGroup.js +112 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.module.js +16 -0
- package/dist/components/RadioGroup/RadioGroup.module.js.map +1 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +19 -0
- package/dist/components/Select/Select.js +44 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/Select.module.js +10 -0
- package/dist/components/Select/Select.module.js.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +22 -0
- package/dist/components/Skeleton/Skeleton.js +33 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.module.js +12 -0
- package/dist/components/Skeleton/Skeleton.module.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Slider/Slider.d.ts +38 -0
- package/dist/components/Slider/Slider.js +55 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/Slider.module.js +11 -0
- package/dist/components/Slider/Slider.module.js.map +1 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Spinner/Spinner.d.ts +22 -0
- package/dist/components/Spinner/Spinner.js +34 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/Spinner.module.js +17 -0
- package/dist/components/Spinner/Spinner.module.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +17 -0
- package/dist/components/Switch/Switch.js +48 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.module.js +9 -0
- package/dist/components/Switch/Switch.module.js.map +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Table/Table.d.ts +84 -0
- package/dist/components/Table/Table.js +105 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Table/Table.module.js +23 -0
- package/dist/components/Table/Table.module.js.map +1 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Tabs/Tabs.d.ts +41 -0
- package/dist/components/Tabs/Tabs.js +86 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/Tabs.module.js +14 -0
- package/dist/components/Tabs/Tabs.module.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +22 -0
- package/dist/components/Text/Text.js +37 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/Text.module.js +30 -0
- package/dist/components/Text/Text.module.js.map +1 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Textarea/Textarea.d.ts +17 -0
- package/dist/components/Textarea/Textarea.js +36 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/Textarea.module.js +11 -0
- package/dist/components/Textarea/Textarea.module.js.map +1 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +39 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +36 -0
- package/dist/components/ThemeProvider/ThemeProvider.js.map +1 -0
- package/dist/components/ThemeProvider/index.d.ts +2 -0
- package/dist/components/ThemeProvider/themeStore.d.ts +8 -0
- package/dist/components/ThemeProvider/themeStore.js +36 -0
- package/dist/components/ThemeProvider/themeStore.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +66 -0
- package/dist/components/Toast/Toast.js +166 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/Toast.module.js +27 -0
- package/dist/components/Toast/Toast.module.js.map +1 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +40 -0
- package/dist/components/Tooltip/Tooltip.js +63 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.js +8 -0
- package/dist/components/Tooltip/Tooltip.module.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +4 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +16 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js +5 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js.map +1 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/useClickOutside.d.ts +10 -0
- package/dist/hooks/useClickOutside.js +21 -0
- package/dist/hooks/useClickOutside.js.map +1 -0
- package/dist/hooks/useControllableState.d.ts +10 -0
- package/dist/hooks/useControllableState.js +16 -0
- package/dist/hooks/useControllableState.js.map +1 -0
- package/dist/hooks/useEscapeKey.d.ts +9 -0
- package/dist/hooks/useEscapeKey.js +21 -0
- package/dist/hooks/useEscapeKey.js.map +1 -0
- package/dist/hooks/useFocusTrap.d.ts +19 -0
- package/dist/hooks/useFocusTrap.js +42 -0
- package/dist/hooks/useFocusTrap.js.map +1 -0
- package/dist/hooks/useLatestRef.d.ts +1 -0
- package/dist/hooks/useLatestRef.js +12 -0
- package/dist/hooks/useLatestRef.js.map +1 -0
- package/dist/hooks/useScrollLock.d.ts +10 -0
- package/dist/hooks/useScrollLock.js +19 -0
- package/dist/hooks/useScrollLock.js.map +1 -0
- package/dist/hooks/useTimeout.d.ts +5 -0
- package/dist/hooks/useTimeout.js +16 -0
- package/dist/hooks/useTimeout.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +59 -0
- package/dist/styles/choice.module.js +15 -0
- package/dist/styles/choice.module.js.map +1 -0
- package/dist/styles/field.module.js +11 -0
- package/dist/styles/field.module.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/tokens/breakpoints.d.ts +12 -0
- package/dist/tokens/breakpoints.js +11 -0
- package/dist/tokens/breakpoints.js.map +1 -0
- package/dist/tokens/colors.d.ts +82 -0
- package/dist/tokens/colors.js +92 -0
- package/dist/tokens/colors.js.map +1 -0
- package/dist/tokens/focus.d.ts +4 -0
- package/dist/tokens/focus.js +8 -0
- package/dist/tokens/focus.js.map +1 -0
- package/dist/tokens/index.d.ts +22 -0
- package/dist/tokens/index.js +37 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/motion.d.ts +21 -0
- package/dist/tokens/motion.js +16 -0
- package/dist/tokens/motion.js.map +1 -0
- package/dist/tokens/radius.d.ts +9 -0
- package/dist/tokens/radius.js +13 -0
- package/dist/tokens/radius.js.map +1 -0
- package/dist/tokens/shadows.d.ts +12 -0
- package/dist/tokens/shadows.js +12 -0
- package/dist/tokens/shadows.js.map +1 -0
- package/dist/tokens/sizes.d.ts +22 -0
- package/dist/tokens/sizes.js +23 -0
- package/dist/tokens/sizes.js.map +1 -0
- package/dist/tokens/spacing.d.ts +19 -0
- package/dist/tokens/spacing.js +19 -0
- package/dist/tokens/spacing.js.map +1 -0
- package/dist/tokens/themes.d.ts +256 -0
- package/dist/tokens/themes.js +120 -0
- package/dist/tokens/themes.js.map +1 -0
- package/dist/tokens/typography.d.ts +37 -0
- package/dist/tokens/typography.js +35 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/tokens/z-index.d.ts +8 -0
- package/dist/tokens/z-index.js +11 -0
- package/dist/tokens/z-index.js.map +1 -0
- package/dist/utils/cn.d.ts +8 -0
- package/dist/utils/cn.js +14 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/floating.d.ts +20 -0
- package/dist/utils/floating.js +31 -0
- package/dist/utils/floating.js.map +1 -0
- package/dist/utils/getElementRef.d.ts +3 -0
- package/dist/utils/getElementRef.js +8 -0
- package/dist/utils/getElementRef.js.map +1 -0
- package/dist/utils/mergeRefs.d.ts +2 -0
- package/dist/utils/mergeRefs.js +9 -0
- package/dist/utils/mergeRefs.js.map +1 -0
- package/dist/utils/polymorphic.d.ts +13 -0
- package/dist/utils/refocusIfLost.d.ts +6 -0
- package/dist/utils/refocusIfLost.js +10 -0
- package/dist/utils/refocusIfLost.js.map +1 -0
- package/package.json +106 -4
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import { ErrorIcon as t } from "../Icon/icons.js";
|
|
4
|
+
import { VisuallyHidden as n } from "../VisuallyHidden/VisuallyHidden.js";
|
|
5
|
+
import { Label as r } from "../Label/Label.js";
|
|
6
|
+
import { FormFieldContext as i } from "./formFieldContext.js";
|
|
7
|
+
import a from "./FormField.module.js";
|
|
8
|
+
import { forwardRef as o, useId as s } from "react";
|
|
9
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
|
+
// src/components/FormField/FormField.tsx
|
|
11
|
+
var u = o(function({ label: o, helperText: u, error: d, required: f, disabled: p, hideLabel: m = !1, controlId: h, className: g, children: _, ...v }, y) {
|
|
12
|
+
let b = s(), x = h ?? b, S = `${x}-helper`, C = `${x}-error`, w = u != null, T = d != null && d !== !1, E = /* @__PURE__ */ c(r, {
|
|
13
|
+
htmlFor: x,
|
|
14
|
+
required: f,
|
|
15
|
+
disabled: p,
|
|
16
|
+
children: o
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ l("div", {
|
|
19
|
+
ref: y,
|
|
20
|
+
className: e(a.field, g),
|
|
21
|
+
...v,
|
|
22
|
+
children: [
|
|
23
|
+
m ? /* @__PURE__ */ c(n, { children: E }) : E,
|
|
24
|
+
/* @__PURE__ */ c(i.Provider, {
|
|
25
|
+
value: {
|
|
26
|
+
id: x,
|
|
27
|
+
describedBy: e(w && S, T && C) || void 0,
|
|
28
|
+
invalid: T,
|
|
29
|
+
disabled: p,
|
|
30
|
+
required: f
|
|
31
|
+
},
|
|
32
|
+
children: _
|
|
33
|
+
}),
|
|
34
|
+
w && /* @__PURE__ */ c("p", {
|
|
35
|
+
id: S,
|
|
36
|
+
className: a.helper,
|
|
37
|
+
children: u
|
|
38
|
+
}),
|
|
39
|
+
T && /* @__PURE__ */ l("p", {
|
|
40
|
+
id: C,
|
|
41
|
+
className: a.error,
|
|
42
|
+
children: [/* @__PURE__ */ c(t, { className: a.errorIcon }), d]
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
export { u as FormField };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.js","names":["styles","FormField_module_default","FormField","forwardRef","props","generatedId","useId","id","controlId","helperId","errorId","hasHelper","helperText","invalid","error","labelElement","Label","label","cn","className","hideLabel","VisuallyHidden","FormFieldContext","ErrorIcon"],"sources":["../../../src/components/FormField/FormField.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/utils/cn';\nimport { ErrorIcon } from '../Icon';\nimport { Label } from '../Label';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { FormFieldContext } from './formFieldContext';\nimport styles from './FormField.module.css';\n\nexport interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {\n /** Visible caption, rendered as the `<label>` of the control. */\n label: ReactNode;\n /** Hint shown below the control and linked with `aria-describedby`. */\n helperText?: ReactNode;\n /** Error message. Marks the control as invalid and is linked with `aria-describedby`. */\n error?: ReactNode;\n /** Marks the control as required and shows a marker next to the label. */\n required?: boolean;\n /** Disables the control. */\n disabled?: boolean;\n /** Keeps the label for assistive technology only. */\n hideLabel?: boolean;\n /** Id of the control. Generated when omitted. */\n controlId?: string;\n /** One `Input`, `Textarea`, `Select` or `Slider`, which picks up the field's id and state. */\n children: ReactNode;\n}\n\n/**\n * Wraps a form control with its label, helper text and error message, and wires them up with\n * `htmlFor`, `aria-describedby` and `aria-invalid`.\n */\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(function FormField(\n {\n label,\n helperText,\n error,\n required,\n disabled,\n hideLabel = false,\n controlId,\n className,\n children,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const id = controlId ?? generatedId;\n const helperId = `${id}-helper`;\n const errorId = `${id}-error`;\n const hasHelper = helperText !== undefined && helperText !== null;\n const invalid = error !== undefined && error !== null && error !== false;\n\n const labelElement = (\n <Label htmlFor={id} required={required} disabled={disabled}>\n {label}\n </Label>\n );\n\n return (\n <div ref={ref} className={cn(styles.field, className)} {...props}>\n {hideLabel ? <VisuallyHidden>{labelElement}</VisuallyHidden> : labelElement}\n <FormFieldContext.Provider\n value={{\n id,\n describedBy: cn(hasHelper && helperId, invalid && errorId) || undefined,\n invalid,\n disabled,\n required,\n }}\n >\n {children}\n </FormFieldContext.Provider>\n {hasHelper && (\n <p id={helperId} className={styles.helper}>\n {helperText}\n </p>\n )}\n {invalid && (\n <p id={errorId} className={styles.error}>\n <ErrorIcon className={styles.errorIcon} />\n {error}\n </p>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;AA+BA,IAAaE,IAAYC,EAA2C,SAClE,EACE,UACA,eACA,UACA,aACA,aACA,eAAY,IACZ,cACA,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAcC,EAAM,GACpBC,IAAKC,KAAaH,GAClBI,IAAW,GAAGF,EAAG,UACjBG,IAAU,GAAGH,EAAG,SAChBI,IAAYC,KAA2C,MACvDC,IAAUC,KAAiC,QAAQA,MAAU,IAE7DC,IACJ,kBAACC,GAAD;EAAO,SAAST;EAAc;EAAoB;EAC/C,UAAAU;CACI,CAAA;CAGT,OACE,kBAAC,OAAD;EAAU;EAAK,WAAWC,EAAGlB,EAAO,OAAOmB,CAAS;EAAG,GAAIf;EAA3D,UAAA;GACGgB,IAAY,kBAACC,GAAD,EAAA,UAAiBN,EAA6B,CAAA,IAAIA;GAC/D,kBAACO,EAAiB,UAAlB;IACE,OAAO;KACL;KACA,aAAaJ,EAAGP,KAAaF,GAAUI,KAAWH,CAAO,KAAK,KAAA;KAC9D;KACA;KACA;IACF;IAEC;GACwB,CAAA;GAC1BC,KACC,kBAAC,KAAD;IAAG,IAAIF;IAAU,WAAWT,EAAO;IAChC,UAAAY;GACA,CAAA;GAEJC,KACC,kBAAC,KAAD;IAAG,IAAIH;IAAS,WAAWV,EAAO;IAAlC,UAAA,CACE,kBAACuB,GAAD,EAAW,WAAWvB,EAAO,UAAY,CAAA,GACxCc,CACA;;EAEF;;AAET,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/components/FormField/FormField.module.css
|
|
2
|
+
var e = "onyx-field-NXQSy", t = "onyx-helper-JuBZ6", n = "onyx-error-4SHKr", r = "onyx-errorIcon-bd5lg", i = {
|
|
3
|
+
field: e,
|
|
4
|
+
helper: t,
|
|
5
|
+
error: n,
|
|
6
|
+
errorIcon: r
|
|
7
|
+
};
|
|
8
|
+
export { i as default, n as error, r as errorIcon, e as field, t as helper };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=FormField.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.module.js","names":["field","helper","error","errorIcon","FormField_module_default"],"sources":["../../../src/components/FormField/FormField.module.css"],"sourcesContent":[".field {\n display: grid;\n gap: var(--space-1);\n min-width: 0;\n}\n\n.helper,\n.error {\n margin: 0;\n font-size: var(--font-size-sm);\n line-height: var(--line-height-normal);\n}\n\n.helper {\n color: var(--color-text-muted);\n}\n\n.error {\n display: flex;\n gap: var(--space-1);\n align-items: center;\n color: var(--color-danger-text);\n}\n\n.errorIcon {\n flex-shrink: 0;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface FormFieldContextValue {
|
|
2
|
+
id: string;
|
|
3
|
+
describedBy: string | undefined;
|
|
4
|
+
invalid: boolean;
|
|
5
|
+
disabled: boolean | undefined;
|
|
6
|
+
required: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const FormFieldContext: import('react').Context<FormFieldContextValue | null>;
|
|
9
|
+
export interface FieldControlProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
'aria-describedby'?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Merges the props of a form control with the ones its enclosing `FormField` provides. */
|
|
17
|
+
export declare function useFieldControl({ id, disabled, required, invalid, 'aria-describedby': describedBy, }: FieldControlProps): {
|
|
18
|
+
id: string | undefined;
|
|
19
|
+
disabled: boolean | undefined;
|
|
20
|
+
required: boolean | undefined;
|
|
21
|
+
invalid: boolean;
|
|
22
|
+
'aria-invalid': true | undefined;
|
|
23
|
+
'aria-describedby': string | undefined;
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { createContext as t, useContext as n } from "react";
|
|
3
|
+
// src/components/FormField/formFieldContext.ts
|
|
4
|
+
var r = t(null);
|
|
5
|
+
function i({ id: t, disabled: i, required: a, invalid: o, "aria-describedby": s }) {
|
|
6
|
+
let c = n(r), l = o ?? c?.invalid ?? !1;
|
|
7
|
+
return {
|
|
8
|
+
id: t ?? c?.id,
|
|
9
|
+
disabled: i ?? c?.disabled,
|
|
10
|
+
required: a ?? c?.required,
|
|
11
|
+
invalid: l,
|
|
12
|
+
"aria-invalid": l || void 0,
|
|
13
|
+
"aria-describedby": e(c?.describedBy, s) || void 0
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { r as FormFieldContext, i as useFieldControl };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=formFieldContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFieldContext.js","names":["FormFieldContext","createContext","useFieldControl","describedBy","field","useContext","isInvalid","invalid","id","disabled","required","cn"],"sources":["../../../src/components/FormField/formFieldContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { cn } from '@/utils/cn';\n\nexport interface FormFieldContextValue {\n id: string;\n describedBy: string | undefined;\n invalid: boolean;\n disabled: boolean | undefined;\n required: boolean | undefined;\n}\n\nexport const FormFieldContext = createContext<FormFieldContextValue | null>(null);\n\nexport interface FieldControlProps {\n id?: string;\n disabled?: boolean;\n required?: boolean;\n invalid?: boolean;\n 'aria-describedby'?: string;\n}\n\n/** Merges the props of a form control with the ones its enclosing `FormField` provides. */\nexport function useFieldControl({\n id,\n disabled,\n required,\n invalid,\n 'aria-describedby': describedBy,\n}: FieldControlProps) {\n const field = useContext(FormFieldContext);\n const isInvalid = invalid ?? field?.invalid ?? false;\n\n return {\n id: id ?? field?.id,\n disabled: disabled ?? field?.disabled,\n required: required ?? field?.required,\n invalid: isInvalid,\n 'aria-invalid': isInvalid || undefined,\n 'aria-describedby': cn(field?.describedBy, describedBy) || undefined,\n };\n}\n"],"mappings":";;;AAWA,IAAaA,IAAmBC,EAA4C,IAAI;AAWhF,SAAgBC,EAAgB,EAC9B,OACA,aACA,aACA,YACA,oBAAoBC,KACA;CACpB,IAAMC,IAAQC,EAAWL,CAAgB,GACnCM,IAAYC,KAAWH,GAAO,WAAW;CAE/C,OAAO;EACL,IAAII,KAAMJ,GAAO;EACjB,UAAUK,KAAYL,GAAO;EAC7B,UAAUM,KAAYN,GAAO;EAC7B,SAASE;EACT,gBAAgBA,KAAa,KAAA;EAC7B,oBAAoBK,EAAGP,GAAO,aAAaD,CAAW,KAAK,KAAA;CAC7D;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export type HeadingSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
|
|
4
|
+
export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Rank in the document outline, rendered as `<h1>` to `<h6>`. Pick it from the structure of
|
|
7
|
+
* the page, then use `size` for the look.
|
|
8
|
+
* @default 2
|
|
9
|
+
*/
|
|
10
|
+
level?: HeadingLevel;
|
|
11
|
+
/** Visual size. Defaults to a size that matches `level`. */
|
|
12
|
+
size?: HeadingSize;
|
|
13
|
+
}
|
|
14
|
+
export declare const Heading: import('react').ForwardRefExoticComponent<HeadingProps & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import t from "./Heading.module.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Heading/Heading.tsx
|
|
7
|
+
var i = {
|
|
8
|
+
1: "3xl",
|
|
9
|
+
2: "2xl",
|
|
10
|
+
3: "xl",
|
|
11
|
+
4: "lg",
|
|
12
|
+
5: "md",
|
|
13
|
+
6: "sm"
|
|
14
|
+
}, a = {
|
|
15
|
+
sm: t.sm,
|
|
16
|
+
md: t.md,
|
|
17
|
+
lg: t.lg,
|
|
18
|
+
xl: t.xl,
|
|
19
|
+
"2xl": t.size2xl,
|
|
20
|
+
"3xl": t.size3xl,
|
|
21
|
+
"4xl": t.size4xl
|
|
22
|
+
}, o = n(function({ level: n = 2, size: o = i[n], className: s, ...c }, l) {
|
|
23
|
+
let u = `h${n}`;
|
|
24
|
+
return /* @__PURE__ */ r(u, {
|
|
25
|
+
ref: l,
|
|
26
|
+
className: e(t.heading, a[o], s),
|
|
27
|
+
...c
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
export { o as Heading };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=Heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.js","names":["styles","Heading_module_default","defaultSizes","sizeClasses","Heading","forwardRef","level","props","Component","cn","size","className"],"sources":["../../../src/components/Heading/Heading.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from 'react';\nimport { cn } from '@/utils/cn';\nimport styles from './Heading.module.css';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\nexport type HeadingSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';\n\nexport interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {\n /**\n * Rank in the document outline, rendered as `<h1>` to `<h6>`. Pick it from the structure of\n * the page, then use `size` for the look.\n * @default 2\n */\n level?: HeadingLevel;\n /** Visual size. Defaults to a size that matches `level`. */\n size?: HeadingSize;\n}\n\nconst defaultSizes: Record<HeadingLevel, HeadingSize> = {\n 1: '3xl',\n 2: '2xl',\n 3: 'xl',\n 4: 'lg',\n 5: 'md',\n 6: 'sm',\n};\n\nconst sizeClasses: Record<HeadingSize, string | undefined> = {\n sm: styles.sm,\n md: styles.md,\n lg: styles.lg,\n xl: styles.xl,\n '2xl': styles.size2xl,\n '3xl': styles.size3xl,\n '4xl': styles.size4xl,\n};\n\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { level = 2, size = defaultSizes[level], className, ...props },\n ref,\n) {\n const Component = `h${level}` as const;\n\n return (\n <Component ref={ref} className={cn(styles.heading, sizeClasses[size], className)} {...props} />\n );\n});\n"],"mappings":";;;;;;AAkBA,IAAME,IAAkD;CACtD,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL,GAEMC,IAAuD;CAC3D,IAAIH,EAAO;CACX,IAAIA,EAAO;CACX,IAAIA,EAAO;CACX,IAAIA,EAAO;CACX,OAAOA,EAAO;CACd,OAAOA,EAAO;CACd,OAAOA,EAAO;AAChB,GAEaI,IAAUC,EAA6C,SAClE,EAAE,WAAQ,GAAG,UAAOH,EAAaI,IAAQ,cAAW,GAAGC,KACvD,GACA;CACA,IAAMC,IAAY,IAAIF;CAEtB,OACE,kBAACE,GAAD;EAAgB;EAAK,WAAWC,EAAGT,EAAO,SAASG,EAAYO,IAAOC,CAAS;EAAG,GAAIJ;CAAQ,CAAA;AAElG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/components/Heading/Heading.module.css
|
|
2
|
+
var e = "onyx-heading-2pnHW", t = "onyx-sm-0p2sS", n = "onyx-md--B-e3", r = "onyx-lg-LZdYs", i = "onyx-xl-1WQmT", a = "onyx-size2xl-LnbpV", o = "onyx-size3xl-mYwix", s = "onyx-size4xl-holtr", c = {
|
|
3
|
+
heading: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
md: n,
|
|
6
|
+
lg: r,
|
|
7
|
+
xl: i,
|
|
8
|
+
size2Xl: a,
|
|
9
|
+
size3Xl: o,
|
|
10
|
+
size4Xl: s
|
|
11
|
+
};
|
|
12
|
+
export { c as default, e as heading, r as lg, n as md, a as size2Xl, o as size3Xl, s as size4Xl, t as sm, i as xl };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Heading.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.module.js","names":["heading","sm","md","lg","xl","size2Xl","size3Xl","size4Xl","Heading_module_default"],"sources":["../../../src/components/Heading/Heading.module.css"],"sourcesContent":[".heading {\n margin: 0;\n font-weight: var(--font-weight-semibold);\n line-height: var(--line-height-tight);\n color: var(--color-text);\n text-wrap: balance;\n}\n\n.sm {\n font-size: var(--font-size-sm);\n line-height: var(--line-height-normal);\n}\n\n.md {\n font-size: var(--font-size-md);\n line-height: var(--line-height-normal);\n}\n\n.lg {\n font-size: var(--font-size-lg);\n line-height: var(--line-height-snug);\n}\n\n.xl {\n font-size: var(--font-size-xl);\n line-height: var(--line-height-snug);\n}\n\n.size2xl {\n font-size: var(--font-size-2xl);\n}\n\n.size3xl {\n font-size: var(--font-size-3xl);\n letter-spacing: var(--letter-spacing-tight);\n}\n\n.size4xl {\n font-size: var(--font-size-4xl);\n font-weight: var(--font-weight-bold);\n letter-spacing: var(--letter-spacing-tight);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export type IconSize = 'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
|
|
4
|
+
/**
|
|
5
|
+
* Accessible name. Without it the icon is decorative and hidden from assistive technology,
|
|
6
|
+
* so the surrounding text or control must carry the meaning.
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* `inherit` follows the font size of the surrounding text.
|
|
11
|
+
* @default 'inherit'
|
|
12
|
+
*/
|
|
13
|
+
size?: IconSize;
|
|
14
|
+
}
|
|
15
|
+
/** Renders a 24×24 stroke icon. Pass the shapes as children, or use one of the built-in icons. */
|
|
16
|
+
export declare const Icon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import t from "./Icon.module.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Icon/Icon.tsx
|
|
7
|
+
var i = n(function({ label: n, size: i = "inherit", className: a, children: o, ...s }, c) {
|
|
8
|
+
return /* @__PURE__ */ r("svg", {
|
|
9
|
+
ref: c,
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeWidth: 2,
|
|
15
|
+
strokeLinecap: "round",
|
|
16
|
+
strokeLinejoin: "round",
|
|
17
|
+
focusable: "false",
|
|
18
|
+
role: n ? "img" : void 0,
|
|
19
|
+
"aria-label": n,
|
|
20
|
+
"aria-hidden": !n || void 0,
|
|
21
|
+
className: e(t.icon, t[i], a),
|
|
22
|
+
...s,
|
|
23
|
+
children: o
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export { i as Icon };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","names":["styles","Icon_module_default","Icon","forwardRef","props","label","cn","size","className"],"sources":["../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import { forwardRef, type SVGProps } from 'react';\nimport { cn } from '@/utils/cn';\nimport styles from './Icon.module.css';\n\nexport type IconSize = 'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {\n /**\n * Accessible name. Without it the icon is decorative and hidden from assistive technology,\n * so the surrounding text or control must carry the meaning.\n */\n label?: string;\n /**\n * `inherit` follows the font size of the surrounding text.\n * @default 'inherit'\n */\n size?: IconSize;\n}\n\n/** Renders a 24×24 stroke icon. Pass the shapes as children, or use one of the built-in icons. */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(function Icon(\n { label, size = 'inherit', className, children, ...props },\n ref,\n) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n focusable=\"false\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={cn(styles.icon, styles[size], className)}\n {...props}\n >\n {children}\n </svg>\n );\n});\n"],"mappings":";;;;;;AAoBA,IAAaE,IAAOC,EAAqC,SACvD,EAAE,UAAO,UAAO,WAAW,cAAW,aAAU,GAAGC,KACnD,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,OAAM;EACN,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAa;EACb,eAAc;EACd,gBAAe;EACf,WAAU;EACV,MAAMC,IAAQ,QAAQ,KAAA;EACtB,cAAYA;EACZ,eAAa,MAAQ,KAAA;EACrB,WAAWC,EAAGN,EAAO,MAAMA,EAAOO,IAAOC,CAAS;EAClD,GAAIJ;EAEH;CACE,CAAA;AAET,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/components/Icon/Icon.module.css
|
|
2
|
+
var e = "onyx-icon-szG-X", t = "onyx-inherit-k1qag", n = "onyx-xs-mghPd", r = "onyx-sm-sfJ0-", i = "onyx-md-nlSCK", a = "onyx-lg-56VkH", o = "onyx-xl-0lQu8", s = {
|
|
3
|
+
icon: e,
|
|
4
|
+
inherit: t,
|
|
5
|
+
xs: n,
|
|
6
|
+
sm: r,
|
|
7
|
+
md: i,
|
|
8
|
+
lg: a,
|
|
9
|
+
xl: o
|
|
10
|
+
};
|
|
11
|
+
export { s as default, e as icon, t as inherit, a as lg, i as md, r as sm, o as xl, n as xs };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=Icon.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.module.js","names":["icon","inherit","xs","sm","md","lg","xl","Icon_module_default"],"sources":["../../../src/components/Icon/Icon.module.css"],"sourcesContent":[".icon {\n display: inline-block;\n flex-shrink: 0;\n vertical-align: middle;\n}\n\n.inherit {\n width: 1em;\n height: 1em;\n}\n\n.xs {\n width: var(--size-icon-xs);\n height: var(--size-icon-xs);\n}\n\n.sm {\n width: var(--size-icon-sm);\n height: var(--size-icon-sm);\n}\n\n.md {\n width: var(--size-icon-md);\n height: var(--size-icon-md);\n}\n\n.lg {\n width: var(--size-icon-lg);\n height: var(--size-icon-lg);\n}\n\n.xl {\n width: var(--size-icon-xl);\n height: var(--size-icon-xl);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IconProps } from './Icon.js';
|
|
2
|
+
export declare const CheckIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
3
|
+
export declare const MinusIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
4
|
+
export declare const CloseIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
5
|
+
export declare const ChevronDownIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
6
|
+
export declare const ChevronUpIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
7
|
+
export declare const ChevronLeftIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
8
|
+
export declare const ChevronRightIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
9
|
+
export declare const ArrowUpIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
10
|
+
export declare const ArrowDownIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
11
|
+
export declare const ArrowUpDownIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
12
|
+
export declare const ExternalLinkIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
13
|
+
export declare const MoreHorizontalIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
14
|
+
export declare const InfoIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
15
|
+
export declare const SuccessIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
16
|
+
export declare const WarningIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
17
|
+
export declare const ErrorIcon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon as e } from "./Icon.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Icon/icons.tsx
|
|
6
|
+
function a(n, i) {
|
|
7
|
+
let a = t(function(t, n) {
|
|
8
|
+
return /* @__PURE__ */ r(e, {
|
|
9
|
+
ref: n,
|
|
10
|
+
...t,
|
|
11
|
+
children: i
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return a.displayName = n, a;
|
|
15
|
+
}
|
|
16
|
+
var o = a("CheckIcon", /* @__PURE__ */ r("path", { d: "M20 6 9 17l-5-5" })), s = a("MinusIcon", /* @__PURE__ */ r("path", { d: "M5 12h14" })), c = a("CloseIcon", /* @__PURE__ */ r("path", { d: "M18 6 6 18M6 6l12 12" })), l = a("ChevronDownIcon", /* @__PURE__ */ r("path", { d: "m6 9 6 6 6-6" })), u = a("ChevronUpIcon", /* @__PURE__ */ r("path", { d: "m18 15-6-6-6 6" })), d = a("ChevronLeftIcon", /* @__PURE__ */ r("path", { d: "m15 18-6-6 6-6" })), f = a("ChevronRightIcon", /* @__PURE__ */ r("path", { d: "m9 18 6-6-6-6" })), p = a("ArrowUpIcon", /* @__PURE__ */ r("path", { d: "M12 19V5M5 12l7-7 7 7" })), m = a("ArrowDownIcon", /* @__PURE__ */ r("path", { d: "M12 5v14M19 12l-7 7-7-7" })), h = a("ArrowUpDownIcon", /* @__PURE__ */ r("path", { d: "m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16" })), g = a("ExternalLinkIcon", /* @__PURE__ */ r("path", { d: "M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })), _ = a("MoreHorizontalIcon", /* @__PURE__ */ i(n, { children: [
|
|
17
|
+
/* @__PURE__ */ r("circle", {
|
|
18
|
+
cx: "5",
|
|
19
|
+
cy: "12",
|
|
20
|
+
r: "1"
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ r("circle", {
|
|
23
|
+
cx: "12",
|
|
24
|
+
cy: "12",
|
|
25
|
+
r: "1"
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ r("circle", {
|
|
28
|
+
cx: "19",
|
|
29
|
+
cy: "12",
|
|
30
|
+
r: "1"
|
|
31
|
+
})
|
|
32
|
+
] })), v = a("InfoIcon", /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("circle", {
|
|
33
|
+
cx: "12",
|
|
34
|
+
cy: "12",
|
|
35
|
+
r: "10"
|
|
36
|
+
}), /* @__PURE__ */ r("path", { d: "M12 16v-4M12 8h.01" })] })), y = a("SuccessIcon", /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("circle", {
|
|
37
|
+
cx: "12",
|
|
38
|
+
cy: "12",
|
|
39
|
+
r: "10"
|
|
40
|
+
}), /* @__PURE__ */ r("path", { d: "m9 12 2 2 4-4" })] })), b = a("WarningIcon", /* @__PURE__ */ r("path", { d: "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01" })), x = a("ErrorIcon", /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("circle", {
|
|
41
|
+
cx: "12",
|
|
42
|
+
cy: "12",
|
|
43
|
+
r: "10"
|
|
44
|
+
}), /* @__PURE__ */ r("path", { d: "M12 8v4M12 16h.01" })] }));
|
|
45
|
+
export { m as ArrowDownIcon, h as ArrowUpDownIcon, p as ArrowUpIcon, o as CheckIcon, l as ChevronDownIcon, d as ChevronLeftIcon, f as ChevronRightIcon, u as ChevronUpIcon, c as CloseIcon, x as ErrorIcon, g as ExternalLinkIcon, v as InfoIcon, s as MinusIcon, _ as MoreHorizontalIcon, y as SuccessIcon, b as WarningIcon };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","names":["_Fragment","createIcon","Component","forwardRef","Icon","props","shapes","displayName","CheckIcon","MinusIcon","CloseIcon","ChevronDownIcon","ChevronUpIcon","ChevronLeftIcon","ChevronRightIcon","ArrowUpIcon","ArrowDownIcon","ArrowUpDownIcon","ExternalLinkIcon","MoreHorizontalIcon","Fragment","InfoIcon","SuccessIcon","WarningIcon","ErrorIcon"],"sources":["../../../src/components/Icon/icons.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react';\nimport { Icon, type IconProps } from './Icon';\n\nfunction createIcon(displayName: string, shapes: ReactNode) {\n const Component = forwardRef<SVGSVGElement, IconProps>(function BuiltInIcon(props, ref) {\n return (\n <Icon ref={ref} {...props}>\n {shapes}\n </Icon>\n );\n });\n Component.displayName = displayName;\n return Component;\n}\n\nexport const CheckIcon = createIcon('CheckIcon', <path d=\"M20 6 9 17l-5-5\" />);\nexport const MinusIcon = createIcon('MinusIcon', <path d=\"M5 12h14\" />);\nexport const CloseIcon = createIcon('CloseIcon', <path d=\"M18 6 6 18M6 6l12 12\" />);\nexport const ChevronDownIcon = createIcon('ChevronDownIcon', <path d=\"m6 9 6 6 6-6\" />);\nexport const ChevronUpIcon = createIcon('ChevronUpIcon', <path d=\"m18 15-6-6-6 6\" />);\nexport const ChevronLeftIcon = createIcon('ChevronLeftIcon', <path d=\"m15 18-6-6 6-6\" />);\nexport const ChevronRightIcon = createIcon('ChevronRightIcon', <path d=\"m9 18 6-6-6-6\" />);\nexport const ArrowUpIcon = createIcon('ArrowUpIcon', <path d=\"M12 19V5M5 12l7-7 7 7\" />);\nexport const ArrowDownIcon = createIcon('ArrowDownIcon', <path d=\"M12 5v14M19 12l-7 7-7-7\" />);\nexport const ArrowUpDownIcon = createIcon(\n 'ArrowUpDownIcon',\n <path d=\"m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16\" />,\n);\nexport const ExternalLinkIcon = createIcon(\n 'ExternalLinkIcon',\n <path d=\"M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />,\n);\nexport const MoreHorizontalIcon = createIcon(\n 'MoreHorizontalIcon',\n <>\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n </>,\n);\nexport const InfoIcon = createIcon(\n 'InfoIcon',\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4M12 8h.01\" />\n </>,\n);\nexport const SuccessIcon = createIcon(\n 'SuccessIcon',\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </>,\n);\nexport const WarningIcon = createIcon(\n 'WarningIcon',\n <path d=\"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01\" />,\n);\nexport const ErrorIcon = createIcon(\n 'ErrorIcon',\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 8v4M12 16h.01\" />\n </>,\n);\n"],"mappings":";;;;;AAGA,SAASC,EAAW,GAAqB,GAAmB;CAC1D,IAAMC,IAAYC,EAAqC,SAAqB,GAAO,GAAK;EACtF,OACE,kBAACC,GAAD;GAAW;GAAK,GAAIC;GACjB,UAAAC;EACG,CAAA;CAEV,CAAC;CAED,OADA,EAAU,cAAcC,GACjBL;AACT;AAEA,IAAaM,IAAYP,EAAW,aAAa,kBAAC,QAAD,EAAM,GAAE,kBAAmB,CAAA,CAAC,GAChEQ,IAAYR,EAAW,aAAa,kBAAC,QAAD,EAAM,GAAE,WAAY,CAAA,CAAC,GACzDS,IAAYT,EAAW,aAAa,kBAAC,QAAD,EAAM,GAAE,uBAAwB,CAAA,CAAC,GACrEU,IAAkBV,EAAW,mBAAmB,kBAAC,QAAD,EAAM,GAAE,eAAgB,CAAA,CAAC,GACzEW,IAAgBX,EAAW,iBAAiB,kBAAC,QAAD,EAAM,GAAE,iBAAkB,CAAA,CAAC,GACvEY,IAAkBZ,EAAW,mBAAmB,kBAAC,QAAD,EAAM,GAAE,iBAAkB,CAAA,CAAC,GAC3Ea,IAAmBb,EAAW,oBAAoB,kBAAC,QAAD,EAAM,GAAE,gBAAiB,CAAA,CAAC,GAC5Ec,IAAcd,EAAW,eAAe,kBAAC,QAAD,EAAM,GAAE,wBAAyB,CAAA,CAAC,GAC1Ee,IAAgBf,EAAW,iBAAiB,kBAAC,QAAD,EAAM,GAAE,0BAA2B,CAAA,CAAC,GAChFgB,IAAkBhB,EAC7B,mBACA,kBAAC,QAAD,EAAM,GAAE,4CAA6C,CAAA,CACvD,GACaiB,IAAmBjB,EAC9B,oBACA,kBAAC,QAAD,EAAM,GAAE,+EAAgF,CAAA,CAC1F,GACakB,IAAqBlB,EAChC,sBACA,kBAAAD,GAAA,EAAA,UAAA;CACE,kBAAC,UAAD;EAAQ,IAAG;EAAI,IAAG;EAAK,GAAE;CAAK,CAAA;CAC9B,kBAAC,UAAD;EAAQ,IAAG;EAAK,IAAG;EAAK,GAAE;CAAK,CAAA;CAC/B,kBAAC,UAAD;EAAQ,IAAG;EAAK,IAAG;EAAK,GAAE;CAAK,CAAA;AAC/B,EAAA,CAAA,CACJ,GACaqB,IAAWpB,EACtB,YACA,kBAAAD,GAAA,EAAA,UAAA,CACE,kBAAC,UAAD;CAAQ,IAAG;CAAK,IAAG;CAAK,GAAE;AAAM,CAAA,GAChC,kBAAC,QAAD,EAAM,GAAE,qBAAsB,CAAA,CAC9B,EAAA,CAAA,CACJ,GACasB,IAAcrB,EACzB,eACA,kBAAAD,GAAA,EAAA,UAAA,CACE,kBAAC,UAAD;CAAQ,IAAG;CAAK,IAAG;CAAK,GAAE;AAAM,CAAA,GAChC,kBAAC,QAAD,EAAM,GAAE,gBAAiB,CAAA,CACzB,EAAA,CAAA,CACJ,GACauB,IAActB,EACzB,eACA,kBAAC,QAAD,EAAM,GAAE,4GAA6G,CAAA,CACvH,GACauB,IAAYvB,EACvB,aACA,kBAAAD,GAAA,EAAA,UAAA,CACE,kBAAC,UAAD;CAAQ,IAAG;CAAK,IAAG;CAAK,GAAE;AAAM,CAAA,GAChC,kBAAC,QAAD,EAAM,GAAE,oBAAqB,CAAA,CAC7B,EAAA,CAAA,CACJ"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Icon } from './Icon.js';
|
|
2
|
+
export type { IconProps, IconSize } from './Icon.js';
|
|
3
|
+
export { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, ErrorIcon, ExternalLinkIcon, InfoIcon, MinusIcon, MoreHorizontalIcon, SuccessIcon, WarningIcon, } from './icons.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/index.js';
|
|
3
|
+
export interface IconButtonProps extends Omit<ButtonProps, 'startIcon' | 'endIcon' | 'fullWidth' | 'children' | 'aria-label'> {
|
|
4
|
+
/** Accessible name. Required because the button has no visible text. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** The icon. It is hidden from assistive technology; `label` names the button. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** @default 'ghost' */
|
|
9
|
+
variant?: ButtonProps['variant'];
|
|
10
|
+
}
|
|
11
|
+
/** Square button that shows only an icon. */
|
|
12
|
+
export declare const IconButton: import('react').ForwardRefExoticComponent<IconButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import { Button as t } from "../Button/Button.js";
|
|
4
|
+
import n from "./IconButton.module.js";
|
|
5
|
+
import { forwardRef as r } from "react";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
// src/components/IconButton/IconButton.tsx
|
|
8
|
+
var a = r(function({ label: r, variant: a = "ghost", size: o = "md", className: s, children: c, ...l }, u) {
|
|
9
|
+
return /* @__PURE__ */ i(t, {
|
|
10
|
+
ref: u,
|
|
11
|
+
variant: a,
|
|
12
|
+
size: o,
|
|
13
|
+
"aria-label": r,
|
|
14
|
+
className: e(n.iconButton, n[o], s),
|
|
15
|
+
...l,
|
|
16
|
+
children: /* @__PURE__ */ i("span", {
|
|
17
|
+
className: n.icon,
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: c
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
export { a as IconButton };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","names":["styles","IconButton_module_default","IconButton","forwardRef","props","Button","label","cn","size","className"],"sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react';\nimport { cn } from '@/utils/cn';\nimport { Button, type ButtonProps } from '../Button';\nimport styles from './IconButton.module.css';\n\nexport interface IconButtonProps extends Omit<\n ButtonProps,\n 'startIcon' | 'endIcon' | 'fullWidth' | 'children' | 'aria-label'\n> {\n /** Accessible name. Required because the button has no visible text. */\n label: string;\n /** The icon. It is hidden from assistive technology; `label` names the button. */\n children: ReactNode;\n /** @default 'ghost' */\n variant?: ButtonProps['variant'];\n}\n\n/** Square button that shows only an icon. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { label, variant = 'ghost', size = 'md', className, children, ...props },\n ref,\n) {\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n aria-label={label}\n className={cn(styles.iconButton, styles[size], className)}\n {...props}\n >\n <span className={styles.icon} aria-hidden=\"true\">\n {children}\n </span>\n </Button>\n );\n});\n"],"mappings":";;;;;;;AAkBA,IAAaE,IAAaC,EAA+C,SACvE,EAAE,UAAO,aAAU,SAAS,UAAO,MAAM,cAAW,aAAU,GAAGC,KACjE,GACA;CACA,OACE,kBAACC,GAAD;EACO;EACI;EACH;EACN,cAAYC;EACZ,WAAWC,EAAGP,EAAO,YAAYA,EAAOQ,IAAOC,CAAS;EACxD,GAAIL;EAEJ,UAAA,kBAAC,QAAD;GAAM,WAAWJ,EAAO;GAAM,eAAY;GACvC;EACG,CAAA;CACA,CAAA;AAEZ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/components/IconButton/IconButton.module.css
|
|
2
|
+
var e = "onyx-iconButton-JAF-a", t = "onyx-icon-2DDWy", n = "onyx-sm--tgrW", r = "onyx-md-Rq8Ph", i = "onyx-lg-n8cv7", a = {
|
|
3
|
+
iconButton: e,
|
|
4
|
+
icon: t,
|
|
5
|
+
sm: n,
|
|
6
|
+
md: r,
|
|
7
|
+
lg: i
|
|
8
|
+
};
|
|
9
|
+
export { a as default, t as icon, e as iconButton, i as lg, r as md, n as sm };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=IconButton.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.module.js","names":["iconButton","icon","sm","md","lg","IconButton_module_default"],"sources":["../../../src/components/IconButton/IconButton.module.css"],"sourcesContent":[".iconButton {\n padding-inline: 0;\n}\n\n.icon {\n display: inline-flex;\n}\n\n.sm {\n min-width: var(--size-control-sm);\n font-size: var(--size-icon-sm);\n}\n\n.md {\n min-width: var(--size-control-md);\n font-size: var(--size-icon-md);\n}\n\n.lg {\n min-width: var(--size-control-lg);\n font-size: var(--size-icon-lg);\n}\n\n@media (pointer: coarse) {\n .iconButton {\n min-width: var(--size-touch-target);\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type FieldSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
4
|
+
/** @default 'md' */
|
|
5
|
+
size?: FieldSize;
|
|
6
|
+
/** Marks the value as invalid. Inside a `FormField`, defaults to whether it has an error. */
|
|
7
|
+
invalid?: boolean;
|
|
8
|
+
/** Element shown before the text, such as an icon or a prefix. */
|
|
9
|
+
startAdornment?: ReactNode;
|
|
10
|
+
/** Element shown after the text, such as an icon, a unit or a button. */
|
|
11
|
+
endAdornment?: ReactNode;
|
|
12
|
+
/** Class of the outer box, which draws the border. Other props go to the `<input>`. */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Style of the outer box. */
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
/** Single-line text field. */
|
|
18
|
+
export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import { useFieldControl as t } from "../FormField/formFieldContext.js";
|
|
4
|
+
import n from "../../styles/field.module.js";
|
|
5
|
+
import r from "./Input.module.js";
|
|
6
|
+
import { forwardRef as i } from "react";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
// src/components/Input/Input.tsx
|
|
9
|
+
var s = i(function({ size: i = "md", invalid: s, startAdornment: c, endAdornment: l, className: u, style: d, type: f = "text", id: p, disabled: m, required: h, "aria-describedby": g, ..._ }, v) {
|
|
10
|
+
let y = t({
|
|
11
|
+
id: p,
|
|
12
|
+
disabled: m,
|
|
13
|
+
required: h,
|
|
14
|
+
invalid: s,
|
|
15
|
+
"aria-describedby": g
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ o("div", {
|
|
18
|
+
className: e(n.control, n[i], u),
|
|
19
|
+
style: d,
|
|
20
|
+
"data-invalid": y.invalid || void 0,
|
|
21
|
+
"data-disabled": y.disabled || void 0,
|
|
22
|
+
children: [
|
|
23
|
+
c && /* @__PURE__ */ a("span", {
|
|
24
|
+
className: n.adornment,
|
|
25
|
+
children: c
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ a("input", {
|
|
28
|
+
ref: v,
|
|
29
|
+
type: f,
|
|
30
|
+
id: y.id,
|
|
31
|
+
disabled: y.disabled,
|
|
32
|
+
required: y.required,
|
|
33
|
+
"aria-invalid": y["aria-invalid"],
|
|
34
|
+
"aria-describedby": y["aria-describedby"],
|
|
35
|
+
className: r.input,
|
|
36
|
+
..._
|
|
37
|
+
}),
|
|
38
|
+
l && /* @__PURE__ */ a("span", {
|
|
39
|
+
className: n.adornment,
|
|
40
|
+
children: l
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
export { s as Input };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","names":["field","styles","field_module_default","Input_module_default","Input","forwardRef","describedBy","props","control","useFieldControl","cn","size","className","startAdornment","endAdornment"],"sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/utils/cn';\nimport field from '@/styles/field.module.css';\nimport { useFieldControl } from '../FormField/formFieldContext';\nimport styles from './Input.module.css';\n\nexport type FieldSize = 'sm' | 'md' | 'lg';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /** @default 'md' */\n size?: FieldSize;\n /** Marks the value as invalid. Inside a `FormField`, defaults to whether it has an error. */\n invalid?: boolean;\n /** Element shown before the text, such as an icon or a prefix. */\n startAdornment?: ReactNode;\n /** Element shown after the text, such as an icon, a unit or a button. */\n endAdornment?: ReactNode;\n /** Class of the outer box, which draws the border. Other props go to the `<input>`. */\n className?: string;\n /** Style of the outer box. */\n style?: CSSProperties;\n}\n\n/** Single-line text field. */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n size = 'md',\n invalid,\n startAdornment,\n endAdornment,\n className,\n style,\n type = 'text',\n id,\n disabled,\n required,\n 'aria-describedby': describedBy,\n ...props\n },\n ref,\n) {\n const control = useFieldControl({\n id,\n disabled,\n required,\n invalid,\n 'aria-describedby': describedBy,\n });\n\n return (\n <div\n className={cn(field.control, field[size], className)}\n style={style}\n data-invalid={control.invalid || undefined}\n data-disabled={control.disabled || undefined}\n >\n {startAdornment && <span className={field.adornment}>{startAdornment}</span>}\n <input\n ref={ref}\n type={type}\n id={control.id}\n disabled={control.disabled}\n required={control.required}\n aria-invalid={control['aria-invalid']}\n aria-describedby={control['aria-describedby']}\n className={styles.input}\n {...props}\n />\n {endAdornment && <span className={field.adornment}>{endAdornment}</span>}\n </div>\n );\n});\n"],"mappings":";;;;;;;;AAwBA,IAAaI,IAAQC,EAAyC,SAC5D,EACE,UAAO,MACP,YACA,mBACA,iBACA,cACA,UACA,UAAO,QACP,OACA,aACA,aACA,oBAAoBC,GACpB,GAAGC,KAEL,GACA;CACA,IAAMC,IAAUC,EAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoBH;CACtB,CAAC;CAED,OACE,kBAAC,OAAD;EACE,WAAWI,EAAGV,EAAM,SAASA,EAAMW,IAAOC,CAAS;EAC5C;EACP,gBAAcJ,EAAQ,WAAW,KAAA;EACjC,iBAAeA,EAAQ,YAAY,KAAA;EAJrC,UAAA;GAMGK,KAAkB,kBAAC,QAAD;IAAM,WAAWb,EAAM;IAAY,UAAAa;GAAqB,CAAA;GAC3E,kBAAC,SAAD;IACO;IACC;IACN,IAAIL,EAAQ;IACZ,UAAUA,EAAQ;IAClB,UAAUA,EAAQ;IAClB,gBAAcA,EAAQ;IACtB,oBAAkBA,EAAQ;IAC1B,WAAWP,EAAO;IAClB,GAAIM;GACL,CAAA;GACAO,KAAgB,kBAAC,QAAD;IAAM,WAAWd,EAAM;IAAY,UAAAc;GAAmB,CAAA;EACpE;;AAET,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.module.js","names":["input","Input_module_default"],"sources":["../../../src/components/Input/Input.module.css"],"sourcesContent":[".input {\n flex: 1;\n align-self: stretch;\n min-width: 0;\n padding: 0;\n color: inherit;\n background: transparent;\n border: 0;\n outline: none;\n}\n\n.input:disabled {\n cursor: not-allowed;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LabelHTMLAttributes } from 'react';
|
|
2
|
+
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Shows a required marker. The marker is visual only: set `required` on the control too, so
|
|
5
|
+
* assistive technology announces it.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
required?: boolean;
|
|
9
|
+
/** @default false */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** @default 'md' */
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
}
|
|
14
|
+
/** Caption of a form control. Associate it with `htmlFor` or by wrapping the control. */
|
|
15
|
+
export declare const Label: import('react').ForwardRefExoticComponent<LabelProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import t from "./Label.module.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Label/Label.tsx
|
|
7
|
+
var a = n(function({ required: n = !1, disabled: a = !1, size: o = "md", className: s, children: c, ...l }, u) {
|
|
8
|
+
return /* @__PURE__ */ i("label", {
|
|
9
|
+
ref: u,
|
|
10
|
+
"data-disabled": a || void 0,
|
|
11
|
+
className: e(t.label, t[o], s),
|
|
12
|
+
...l,
|
|
13
|
+
children: [c, n && /* @__PURE__ */ r("span", {
|
|
14
|
+
className: t.required,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: "*"
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export { a as Label };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","names":["styles","Label_module_default","Label","forwardRef","props","disabled","cn","size","className","children","required"],"sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef, type LabelHTMLAttributes } from 'react';\nimport { cn } from '@/utils/cn';\nimport styles from './Label.module.css';\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /**\n * Shows a required marker. The marker is visual only: set `required` on the control too, so\n * assistive technology announces it.\n * @default false\n */\n required?: boolean;\n /** @default false */\n disabled?: boolean;\n /** @default 'md' */\n size?: 'sm' | 'md';\n}\n\n/** Caption of a form control. Associate it with `htmlFor` or by wrapping the control. */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(function Label(\n { required = false, disabled = false, size = 'md', className, children, ...props },\n ref,\n) {\n return (\n <label\n ref={ref}\n data-disabled={disabled || undefined}\n className={cn(styles.label, styles[size], className)}\n {...props}\n >\n {children}\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n );\n});\n"],"mappings":";;;;;;AAkBA,IAAaE,IAAQC,EAAyC,SAC5D,EAAE,cAAW,IAAO,cAAW,IAAO,UAAO,MAAM,cAAW,aAAU,GAAGC,KAC3E,GACA;CACA,OACE,kBAAC,SAAD;EACO;EACL,iBAAeC,KAAY,KAAA;EAC3B,WAAWC,EAAGN,EAAO,OAAOA,EAAOO,IAAOC,CAAS;EACnD,GAAIJ;EAJN,UAAA,CAMGK,GACAC,KACC,kBAAC,QAAD;GAAM,WAAWV,EAAO;GAAU,eAAY;GAAO,UAAA;EAE/C,CAAA,CAEH;;AAEX,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/components/Label/Label.module.css
|
|
2
|
+
var e = "onyx-label-RaRvM", t = "onyx-sm-65Zjw", n = "onyx-md-Ukw-y", r = "onyx-required-Ggrzc", i = {
|
|
3
|
+
label: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
md: n,
|
|
6
|
+
required: r
|
|
7
|
+
};
|
|
8
|
+
export { i as default, e as label, n as md, r as required, t as sm };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=Label.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.module.js","names":["label","sm","md","required","Label_module_default"],"sources":["../../../src/components/Label/Label.module.css"],"sourcesContent":[".label {\n display: inline-flex;\n gap: var(--space-1);\n align-items: baseline;\n font-weight: var(--font-weight-medium);\n line-height: var(--line-height-normal);\n color: var(--color-text);\n}\n\n.sm {\n font-size: var(--font-size-xs);\n}\n\n.md {\n font-size: var(--font-size-sm);\n}\n\n.label[data-disabled] {\n color: var(--color-text-disabled);\n}\n\n.required {\n color: var(--color-danger-text);\n}\n"],"mappings":""}
|