@lucasromero/matrix-ui 0.7.2 → 0.8.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 +24 -0
- package/LICENSE +21 -0
- package/README.md +93 -61
- package/dist/components/Accordion/Accordion.d.ts +5 -0
- package/dist/components/Accordion/Accordion.js +40 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.module.js +10 -0
- package/dist/components/Alert/Alert.d.ts +11 -0
- package/dist/components/Alert/Alert.js +66 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.module.js +15 -0
- package/dist/components/Avatar/Avatar.d.ts +6 -0
- package/dist/components/Avatar/Avatar.js +36 -0
- package/dist/components/Avatar/helpers/getInitials.d.ts +1 -0
- package/dist/components/Avatar/helpers/getInitials.js +6 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.module.js +9 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +7 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +35 -0
- package/dist/components/AvatarGroup/index.d.ts +1 -0
- package/dist/components/AvatarGroup/index.module.js +9 -0
- package/dist/components/Badge/Badge.d.ts +5 -3
- package/dist/components/Badge/Badge.js +21 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.module.js +10 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +41 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.module.js +11 -0
- package/dist/components/Button/Button.d.ts +6 -3
- package/dist/components/Button/Button.js +27 -0
- package/dist/components/Button/ButtonLink.d.ts +6 -0
- package/dist/components/Button/ButtonLink.js +16 -0
- package/dist/components/Button/buttonClassName.d.ts +2 -0
- package/dist/components/Button/buttonClassName.js +11 -0
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.module.js +13 -0
- package/dist/components/Card/Card.d.ts +3 -3
- package/dist/components/Card/Card.js +10 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.module.js +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +21 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.module.js +7 -0
- package/dist/components/Chip/Chip.d.ts +7 -0
- package/dist/components/Chip/Chip.js +34 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/Chip/index.module.js +10 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +8 -0
- package/dist/components/CodeBlock/CodeBlock.js +47 -0
- package/dist/components/CodeBlock/index.d.ts +1 -0
- package/dist/components/CodeBlock/index.module.js +9 -0
- package/dist/components/Combobox/Combobox.d.ts +11 -0
- package/dist/components/Combobox/Combobox.js +123 -0
- package/dist/components/Combobox/index.d.ts +1 -0
- package/dist/components/Combobox/index.module.js +12 -0
- package/dist/components/Container/Container.d.ts +5 -0
- package/dist/components/Container/Container.js +15 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Container/index.module.js +21 -0
- package/dist/components/DateInput/DateInput.d.ts +4 -0
- package/dist/components/DateInput/DateInput.js +54 -0
- package/dist/components/DateInput/index.d.ts +1 -0
- package/dist/components/DateInput/index.module.js +7 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +5 -0
- package/dist/components/DescriptionList/DescriptionList.js +26 -0
- package/dist/components/DescriptionList/index.d.ts +1 -0
- package/dist/components/DescriptionList/index.module.js +10 -0
- package/dist/components/Dialog/Dialog.d.ts +14 -0
- package/dist/components/Dialog/Dialog.js +73 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.module.js +16 -0
- package/dist/components/Divider/Divider.d.ts +5 -0
- package/dist/components/Divider/Divider.js +18 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.module.js +19 -0
- package/dist/components/Drawer/Drawer.d.ts +3 -0
- package/dist/components/Drawer/Drawer.js +73 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.module.js +17 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +95 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/DropdownMenu/index.module.js +11 -0
- package/dist/components/EmptyState/EmptyState.d.ts +8 -0
- package/dist/components/EmptyState/EmptyState.js +39 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.module.js +10 -0
- package/dist/components/FileUpload/FileUpload.d.ts +7 -0
- package/dist/components/FileUpload/FileUpload.js +116 -0
- package/dist/components/FileUpload/helpers/formatFileSize.d.ts +1 -0
- package/dist/components/FileUpload/helpers/formatFileSize.js +12 -0
- package/dist/components/FileUpload/helpers/matchesAccept.d.ts +1 -0
- package/dist/components/FileUpload/helpers/matchesAccept.js +7 -0
- package/dist/components/FileUpload/index.d.ts +1 -0
- package/dist/components/FileUpload/index.module.js +16 -0
- package/dist/components/FormField/FormField.d.ts +11 -0
- package/dist/components/FormField/FormField.js +35 -0
- package/dist/components/FormField/index.d.ts +1 -0
- package/dist/components/FormField/index.module.js +8 -0
- package/dist/components/Heading/Heading.d.ts +4 -0
- package/dist/components/Heading/Heading.js +14 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.module.js +9 -0
- package/dist/components/Inline/Inline.d.ts +7 -0
- package/dist/components/Inline/Inline.js +17 -0
- package/dist/components/Inline/index.d.ts +1 -0
- package/dist/components/Inline/index.module.js +27 -0
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +11 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.module.js +3 -0
- package/dist/components/Link/Link.d.ts +3 -3
- package/dist/components/Link/Link.js +11 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/Link/index.module.js +3 -0
- package/dist/components/Navigation/Navigation.d.ts +14 -0
- package/dist/components/Navigation/Navigation.js +75 -0
- package/dist/components/Navigation/NavigationMenu.d.ts +6 -0
- package/dist/components/Navigation/NavigationMenu.js +48 -0
- package/dist/components/Navigation/index.d.ts +2 -0
- package/dist/components/Navigation/index.module.js +20 -0
- package/dist/components/NumberInput/NumberInput.d.ts +10 -0
- package/dist/components/NumberInput/NumberInput.js +80 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.module.js +7 -0
- package/dist/components/OtpInput/OtpInput.d.ts +8 -0
- package/dist/components/OtpInput/OtpInput.js +47 -0
- package/dist/components/OtpInput/index.d.ts +1 -0
- package/dist/components/OtpInput/index.module.js +9 -0
- package/dist/components/PageHeader/PageHeader.d.ts +8 -0
- package/dist/components/PageHeader/PageHeader.js +39 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/PageHeader/index.module.js +8 -0
- package/dist/components/Pagination/Pagination.d.ts +14 -0
- package/dist/components/Pagination/Pagination.js +81 -0
- package/dist/components/Pagination/helpers/getPaginationItems.d.ts +1 -0
- package/dist/components/Pagination/helpers/getPaginationItems.js +22 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.module.js +11 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.js +42 -0
- package/dist/components/PasswordInput/index.d.ts +1 -0
- package/dist/components/PasswordInput/index.module.js +7 -0
- package/dist/components/Phone/Phone.d.ts +7 -0
- package/dist/components/Phone/Phone.js +19 -0
- package/dist/components/Phone/helpers/formatPhoneNumber.d.ts +14 -0
- package/dist/components/Phone/helpers/formatPhoneNumber.js +15 -0
- package/dist/components/Phone/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +11 -0
- package/dist/components/Popover/Popover.js +51 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.module.js +7 -0
- package/dist/components/Progress/Progress.d.ts +10 -0
- package/dist/components/Progress/Progress.js +74 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.module.js +21 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.js +21 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.module.js +7 -0
- package/dist/components/RelatedLinks/RelatedLinks.d.ts +6 -0
- package/dist/components/RelatedLinks/RelatedLinks.js +39 -0
- package/dist/components/RelatedLinks/index.d.ts +1 -0
- package/dist/components/RelatedLinks/index.module.js +11 -0
- package/dist/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.js +28 -0
- package/dist/components/SearchInput/index.d.ts +1 -0
- package/dist/components/SearchInput/index.module.js +8 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +31 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.module.js +8 -0
- package/dist/components/SideNav/SideNav.d.ts +6 -0
- package/dist/components/SideNav/SideNav.js +38 -0
- package/dist/components/SideNav/index.d.ts +1 -0
- package/dist/components/SideNav/index.module.js +10 -0
- package/dist/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.js +39 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.module.js +11 -0
- package/dist/components/Slider/Slider.d.ts +10 -0
- package/dist/components/Slider/Slider.js +37 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.module.js +7 -0
- package/dist/components/Spinner/Spinner.d.ts +4 -0
- package/dist/components/Spinner/Spinner.js +24 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.module.js +10 -0
- package/dist/components/Stack/Stack.d.ts +5 -0
- package/dist/components/Stack/Stack.js +15 -0
- package/dist/components/Stack/index.d.ts +1 -0
- package/dist/components/Stack/index.module.js +21 -0
- package/dist/components/Stepper/Stepper.d.ts +6 -0
- package/dist/components/Stepper/Stepper.js +50 -0
- package/dist/components/Stepper/index.d.ts +1 -0
- package/dist/components/Stepper/index.module.js +15 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +22 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.module.js +7 -0
- package/dist/components/Table/Table.d.ts +3 -0
- package/dist/components/Table/Table.js +34 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.module.js +9 -0
- package/dist/components/Tabs/Tabs.d.ts +8 -0
- package/dist/components/Tabs/Tabs.js +63 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.module.js +9 -0
- package/dist/components/Text/Text.d.ts +3 -3
- package/dist/components/Text/Text.js +15 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/Text/index.module.js +10 -0
- package/dist/components/TextTag/TextTag.d.ts +5 -0
- package/dist/components/TextTag/TextTag.js +19 -0
- package/dist/components/TextTag/index.d.ts +1 -0
- package/dist/components/TextTag/index.module.js +7 -0
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Textarea/Textarea.js +11 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Textarea/index.module.js +3 -0
- package/dist/components/TimeInput/TimeInput.d.ts +4 -0
- package/dist/components/TimeInput/TimeInput.js +54 -0
- package/dist/components/TimeInput/index.d.ts +1 -0
- package/dist/components/TimeInput/index.module.js +7 -0
- package/dist/components/Toast/Toast.d.ts +4 -0
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.module.js +8 -0
- package/dist/components/Toggle/Toggle.d.ts +4 -0
- package/dist/components/Toggle/Toggle.js +20 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Toggle/index.module.js +7 -0
- package/dist/components/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.js +48 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.module.js +7 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +3 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +15 -0
- package/dist/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/components/VisuallyHidden/index.module.js +6 -0
- package/dist/hooks/useAnchoredPosition.d.ts +6 -0
- package/dist/hooks/useAnchoredPosition.js +40 -0
- package/dist/hooks/useDisclosure.d.ts +2 -0
- package/dist/hooks/useDisclosure.js +23 -0
- package/dist/hooks/useDismiss.d.ts +3 -0
- package/dist/hooks/useDismiss.js +22 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -0
- package/dist/hooks/useMediaQuery.js +12 -0
- package/dist/hooks/useModalDialog.d.ts +9 -0
- package/dist/hooks/useModalDialog.js +54 -0
- package/dist/hooks/useOpenState.d.ts +1 -0
- package/dist/hooks/useOpenState.js +14 -0
- package/dist/index.d.ts +117 -3
- package/dist/index.js +62 -0
- package/dist/styles.css +2 -0
- package/dist/types/accordionType.d.ts +19 -0
- package/dist/types/alertType.d.ts +30 -0
- package/dist/types/avatarGroupType.d.ts +20 -0
- package/dist/types/avatarType.d.ts +15 -0
- package/dist/types/badgeType.d.ts +11 -8
- package/dist/types/breadcrumbsType.d.ts +23 -0
- package/dist/types/buttonLinkType.d.ts +19 -0
- package/dist/types/buttonType.d.ts +27 -9
- package/dist/types/cardType.d.ts +9 -43
- package/dist/types/checkboxType.d.ts +9 -0
- package/dist/types/chipType.d.ts +18 -0
- package/dist/types/codeBlockType.d.ts +19 -0
- package/dist/types/comboboxType.d.ts +27 -0
- package/dist/types/containerType.d.ts +11 -0
- package/dist/types/dateInputType.d.ts +7 -0
- package/dist/types/descriptionListType.d.ts +20 -0
- package/dist/types/dialogType.d.ts +38 -0
- package/dist/types/dividerType.d.ts +14 -0
- package/dist/types/drawerType.d.ts +7 -0
- package/dist/types/dropdownMenuType.d.ts +36 -0
- package/dist/types/emptyStateType.d.ts +16 -0
- package/dist/types/fileUploadType.d.ts +13 -0
- package/dist/types/formFieldType.d.ts +26 -0
- package/dist/types/headingType.d.ts +12 -0
- package/dist/types/index.d.ts +61 -11
- package/dist/types/inlineType.d.ts +17 -0
- package/dist/types/inputType.d.ts +8 -0
- package/dist/types/linkType.d.ts +8 -9
- package/dist/types/navigationMenuType.d.ts +14 -0
- package/dist/types/navigationType.d.ts +42 -0
- package/dist/types/numberInputType.d.ts +19 -0
- package/dist/types/otpInputType.d.ts +16 -0
- package/dist/types/pageHeaderType.d.ts +19 -0
- package/dist/types/paginationType.d.ts +37 -0
- package/dist/types/passwordInputType.d.ts +5 -0
- package/dist/types/phoneType.d.ts +19 -0
- package/dist/types/popoverType.d.ts +31 -0
- package/dist/types/progressType.d.ts +21 -0
- package/dist/types/radioType.d.ts +9 -0
- package/dist/types/relatedLinksType.d.ts +25 -0
- package/dist/types/searchInputType.d.ts +6 -0
- package/dist/types/selectType.d.ts +8 -0
- package/dist/types/sideNavType.d.ts +35 -0
- package/dist/types/skeletonType.d.ts +12 -0
- package/dist/types/sliderType.d.ts +19 -0
- package/dist/types/spaceType.d.ts +2 -0
- package/dist/types/spinnerType.d.ts +12 -0
- package/dist/types/stackType.d.ts +15 -0
- package/dist/types/stepperType.d.ts +27 -0
- package/dist/types/switchType.d.ts +9 -0
- package/dist/types/tableType.d.ts +26 -0
- package/dist/types/tabsType.d.ts +30 -0
- package/dist/types/textTagType.d.ts +9 -0
- package/dist/types/textType.d.ts +5 -15
- package/dist/types/textareaType.d.ts +8 -0
- package/dist/types/timeInputType.d.ts +7 -0
- package/dist/types/toastType.d.ts +7 -0
- package/dist/types/toggleType.d.ts +7 -0
- package/dist/types/tooltipType.d.ts +22 -0
- package/dist/types/useDisclosureType.d.ts +30 -0
- package/dist/types/useMediaQueryType.d.ts +4 -0
- package/dist/types/visuallyHiddenType.d.ts +5 -0
- package/package.json +54 -75
- package/dist/components/CardRow/CardRow.d.ts +0 -3
- package/dist/components/IconDropdown/IconDropdown.d.ts +0 -3
- package/dist/components/Image/Image.d.ts +0 -3
- package/dist/components/Navbar/Navbar.d.ts +0 -3
- package/dist/components/Rating/Rating.d.ts +0 -3
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +0 -3
- package/dist/components/index.d.ts +0 -11
- package/dist/favicon.svg +0 -1
- package/dist/fonts/Inter-400.woff2 +0 -11
- package/dist/fonts/Inter-500.woff2 +0 -11
- package/dist/fonts/Inter-600.woff2 +0 -11
- package/dist/fonts/Inter-700.woff2 +0 -11
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useBreakpoint.d.ts +0 -7
- package/dist/icons.svg +0 -24
- package/dist/matrix-ui.es.js +0 -680
- package/dist/matrix-ui.umd.js +0 -2
- package/dist/types/cardRowType.d.ts +0 -34
- package/dist/types/iconDropdownType.d.ts +0 -16
- package/dist/types/imageType.d.ts +0 -11
- package/dist/types/navbarType.d.ts +0 -27
- package/dist/types/ratingType.d.ts +0 -3
- package/dist/types/selectDropdownType.d.ts +0 -15
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useModalDialog as e } from "../../hooks/useModalDialog.js";
|
|
3
|
+
import { Button as t } from "../Button/Button.js";
|
|
4
|
+
import { Heading as n } from "../Heading/Heading.js";
|
|
5
|
+
import { Text as r } from "../Text/Text.js";
|
|
6
|
+
import i from "./index.module.js";
|
|
7
|
+
import { X as a } from "lucide-react";
|
|
8
|
+
import { forwardRef as o, useId as s, useImperativeHandle as c } from "react";
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
// src/components/Dialog/Dialog.tsx
|
|
11
|
+
var d = o(({ open: o, onClose: d, title: f, titleLevel: p = 2, description: m, children: h, footer: g, size: _ = "medium", closeLabel: v = "Close", hideCloseButton: y = !1, closeOnBackdropClick: b = !0, initialFocusRef: x, className: S, onPointerDown: C, onClick: w, ...T }, E) => {
|
|
12
|
+
let D = s(), O = s(), { dialogRef: k, backdropHandlers: A } = e(o, d, b, x);
|
|
13
|
+
return c(E, () => k.current), /* @__PURE__ */ l("dialog", {
|
|
14
|
+
...T,
|
|
15
|
+
ref: k,
|
|
16
|
+
"aria-labelledby": D,
|
|
17
|
+
"aria-describedby": m ? O : void 0,
|
|
18
|
+
className: [
|
|
19
|
+
i.dialog,
|
|
20
|
+
i[_],
|
|
21
|
+
S
|
|
22
|
+
].filter(Boolean).join(" "),
|
|
23
|
+
onPointerDown: (e) => {
|
|
24
|
+
C?.(e), A.onPointerDown(e);
|
|
25
|
+
},
|
|
26
|
+
onClick: (e) => {
|
|
27
|
+
w?.(e), A.onClick(e);
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */ u("div", {
|
|
30
|
+
className: i.panel,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ u("div", {
|
|
33
|
+
className: i.header,
|
|
34
|
+
children: [/* @__PURE__ */ l(n, {
|
|
35
|
+
id: D,
|
|
36
|
+
level: p,
|
|
37
|
+
size: "small",
|
|
38
|
+
className: i.title,
|
|
39
|
+
children: f
|
|
40
|
+
}), !y && /* @__PURE__ */ l(t, {
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "small",
|
|
43
|
+
iconOnly: !0,
|
|
44
|
+
"aria-label": v,
|
|
45
|
+
className: i.close,
|
|
46
|
+
onClick: () => d("close-button"),
|
|
47
|
+
children: /* @__PURE__ */ l(a, {
|
|
48
|
+
size: 16,
|
|
49
|
+
strokeWidth: 1.75,
|
|
50
|
+
"aria-hidden": "true"
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
m && /* @__PURE__ */ l(r, {
|
|
55
|
+
id: O,
|
|
56
|
+
variant: "muted",
|
|
57
|
+
className: i.description,
|
|
58
|
+
children: m
|
|
59
|
+
}),
|
|
60
|
+
h != null && /* @__PURE__ */ l("div", {
|
|
61
|
+
className: i.body,
|
|
62
|
+
children: h
|
|
63
|
+
}),
|
|
64
|
+
g != null && /* @__PURE__ */ l("div", {
|
|
65
|
+
className: i.footer,
|
|
66
|
+
children: g
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
d.displayName = "Dialog";
|
|
73
|
+
export { d as Dialog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dialog } from "./Dialog.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/components/Dialog/index.module.scss
|
|
2
|
+
var e = "matrix-dialog-dialog", t = "matrix-dialog-small", n = "matrix-dialog-large", r = "matrix-dialog-panel", i = "matrix-dialog-header", a = "matrix-dialog-title", o = "matrix-dialog-close", s = "matrix-dialog-description", c = "matrix-dialog-body", l = "matrix-dialog-footer", u = {
|
|
3
|
+
dialog: e,
|
|
4
|
+
"dialog-enter": "matrix-dialog-dialog-enter",
|
|
5
|
+
"backdrop-enter": "matrix-dialog-backdrop-enter",
|
|
6
|
+
small: t,
|
|
7
|
+
large: n,
|
|
8
|
+
panel: r,
|
|
9
|
+
header: i,
|
|
10
|
+
title: a,
|
|
11
|
+
close: o,
|
|
12
|
+
description: s,
|
|
13
|
+
body: c,
|
|
14
|
+
footer: l
|
|
15
|
+
};
|
|
16
|
+
export { c as body, o as close, u as default, s as description, e as dialog, l as footer, i as header, n as large, r as panel, t as small, a as title };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLHRElement>, "children"> & {
|
|
2
|
+
orientation?: import("../../index.js").DividerOrientation;
|
|
3
|
+
spacing?: import("../../index.js").SpaceToken;
|
|
4
|
+
decorative?: boolean;
|
|
5
|
+
} & import("react").RefAttributes<HTMLHRElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import e from "./index.module.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/components/Divider/Divider.tsx
|
|
5
|
+
var r = t(({ orientation: t = "horizontal", spacing: r = 4, decorative: i = !1, className: a, ...o }, s) => /* @__PURE__ */ n("hr", {
|
|
6
|
+
...o,
|
|
7
|
+
ref: s,
|
|
8
|
+
"aria-orientation": t === "vertical" && !i ? "vertical" : void 0,
|
|
9
|
+
"aria-hidden": i ? !0 : o["aria-hidden"],
|
|
10
|
+
className: [
|
|
11
|
+
e.divider,
|
|
12
|
+
e[t],
|
|
13
|
+
e[`spacing${r}`],
|
|
14
|
+
a
|
|
15
|
+
].filter(Boolean).join(" ")
|
|
16
|
+
}));
|
|
17
|
+
r.displayName = "Divider";
|
|
18
|
+
export { r as Divider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Divider } from "./Divider.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/components/Divider/index.module.scss
|
|
2
|
+
var e = "matrix-divider-divider", t = "matrix-divider-horizontal", n = "matrix-divider-vertical", r = "matrix-divider-spacing0", i = "matrix-divider-spacing1", a = "matrix-divider-spacing2", o = "matrix-divider-spacing3", s = "matrix-divider-spacing4", c = "matrix-divider-spacing5", l = "matrix-divider-spacing6", u = "matrix-divider-spacing8", d = "matrix-divider-spacing10", f = "matrix-divider-spacing12", p = "matrix-divider-spacing16", m = "matrix-divider-spacing20", h = {
|
|
3
|
+
divider: e,
|
|
4
|
+
horizontal: t,
|
|
5
|
+
vertical: n,
|
|
6
|
+
spacing0: r,
|
|
7
|
+
spacing1: i,
|
|
8
|
+
spacing2: a,
|
|
9
|
+
spacing3: o,
|
|
10
|
+
spacing4: s,
|
|
11
|
+
spacing5: c,
|
|
12
|
+
spacing6: l,
|
|
13
|
+
spacing8: u,
|
|
14
|
+
spacing10: d,
|
|
15
|
+
spacing12: f,
|
|
16
|
+
spacing16: p,
|
|
17
|
+
spacing20: m
|
|
18
|
+
};
|
|
19
|
+
export { h as default, e as divider, t as horizontal, r as spacing0, i as spacing1, d as spacing10, f as spacing12, p as spacing16, a as spacing2, m as spacing20, o as spacing3, s as spacing4, c as spacing5, l as spacing6, u as spacing8, n as vertical };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useModalDialog as e } from "../../hooks/useModalDialog.js";
|
|
3
|
+
import { Button as t } from "../Button/Button.js";
|
|
4
|
+
import { Heading as n } from "../Heading/Heading.js";
|
|
5
|
+
import { Text as r } from "../Text/Text.js";
|
|
6
|
+
import i from "./index.module.js";
|
|
7
|
+
import { X as a } from "lucide-react";
|
|
8
|
+
import { forwardRef as o, useId as s, useImperativeHandle as c } from "react";
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
// src/components/Drawer/Drawer.tsx
|
|
11
|
+
var d = o(({ open: o, onClose: d, title: f, titleLevel: p = 2, description: m, children: h, footer: g, side: _ = "end", closeLabel: v = "Close", hideCloseButton: y = !1, closeOnBackdropClick: b = !0, initialFocusRef: x, className: S, onPointerDown: C, onClick: w, ...T }, E) => {
|
|
12
|
+
let D = s(), O = s(), { dialogRef: k, backdropHandlers: A } = e(o, d, b, x);
|
|
13
|
+
return c(E, () => k.current), /* @__PURE__ */ l("dialog", {
|
|
14
|
+
...T,
|
|
15
|
+
ref: k,
|
|
16
|
+
"aria-labelledby": D,
|
|
17
|
+
"aria-describedby": m ? O : void 0,
|
|
18
|
+
className: [
|
|
19
|
+
i.drawer,
|
|
20
|
+
i[_],
|
|
21
|
+
S
|
|
22
|
+
].filter(Boolean).join(" "),
|
|
23
|
+
onPointerDown: (e) => {
|
|
24
|
+
C?.(e), A.onPointerDown(e);
|
|
25
|
+
},
|
|
26
|
+
onClick: (e) => {
|
|
27
|
+
w?.(e), A.onClick(e);
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */ u("div", {
|
|
30
|
+
className: i.panel,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ u("div", {
|
|
33
|
+
className: i.header,
|
|
34
|
+
children: [/* @__PURE__ */ l(n, {
|
|
35
|
+
id: D,
|
|
36
|
+
level: p,
|
|
37
|
+
size: "small",
|
|
38
|
+
className: i.title,
|
|
39
|
+
children: f
|
|
40
|
+
}), !y && /* @__PURE__ */ l(t, {
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "small",
|
|
43
|
+
iconOnly: !0,
|
|
44
|
+
"aria-label": v,
|
|
45
|
+
className: i.close,
|
|
46
|
+
onClick: () => d("close-button"),
|
|
47
|
+
children: /* @__PURE__ */ l(a, {
|
|
48
|
+
size: 16,
|
|
49
|
+
strokeWidth: 1.75,
|
|
50
|
+
"aria-hidden": "true"
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
m && /* @__PURE__ */ l(r, {
|
|
55
|
+
id: O,
|
|
56
|
+
variant: "muted",
|
|
57
|
+
className: i.description,
|
|
58
|
+
children: m
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ l("div", {
|
|
61
|
+
className: i.body,
|
|
62
|
+
children: h
|
|
63
|
+
}),
|
|
64
|
+
g != null && /* @__PURE__ */ l("div", {
|
|
65
|
+
className: i.footer,
|
|
66
|
+
children: g
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
d.displayName = "Drawer";
|
|
73
|
+
export { d as Drawer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer } from "./Drawer.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/components/Drawer/index.module.scss
|
|
2
|
+
var e = "matrix-drawer-drawer", t = "matrix-drawer-end", n = "matrix-drawer-start", r = "matrix-drawer-panel", i = "matrix-drawer-header", a = "matrix-drawer-title", o = "matrix-drawer-close", s = "matrix-drawer-description", c = "matrix-drawer-body", l = "matrix-drawer-footer", u = {
|
|
3
|
+
drawer: e,
|
|
4
|
+
"backdrop-enter": "matrix-drawer-backdrop-enter",
|
|
5
|
+
end: t,
|
|
6
|
+
"drawer-enter-end": "matrix-drawer-drawer-enter-end",
|
|
7
|
+
start: n,
|
|
8
|
+
"drawer-enter-start": "matrix-drawer-drawer-enter-start",
|
|
9
|
+
panel: r,
|
|
10
|
+
header: i,
|
|
11
|
+
title: a,
|
|
12
|
+
close: o,
|
|
13
|
+
description: s,
|
|
14
|
+
body: c,
|
|
15
|
+
footer: l
|
|
16
|
+
};
|
|
17
|
+
export { c as body, o as close, u as default, s as description, e as drawer, t as end, l as footer, i as header, r as panel, n as start, a as title };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PopoverTriggerProps } from "../../types/popoverType.js";
|
|
2
|
+
export declare const DropdownMenu: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "children" | "role"> & {
|
|
3
|
+
children: import("react").ReactElement<PopoverTriggerProps>;
|
|
4
|
+
items: import("../../index.js").DropdownMenuItem[];
|
|
5
|
+
label?: string;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
side?: import("../../index.js").PopoverSide;
|
|
10
|
+
align?: import("../../index.js").PopoverAlign;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { topLayerAttributes as e, useAnchoredPosition as t } from "../../hooks/useAnchoredPosition.js";
|
|
3
|
+
import { useDismiss as n } from "../../hooks/useDismiss.js";
|
|
4
|
+
import { useOpenState as r } from "../../hooks/useOpenState.js";
|
|
5
|
+
import i from "./index.module.js";
|
|
6
|
+
import { cloneElement as a, forwardRef as o, isValidElement as s, useCallback as c, useEffect as l, useId as u, useImperativeHandle as d, useRef as f, useState as p } from "react";
|
|
7
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
9
|
+
var g = o(({ children: o, items: g, label: _, open: v, defaultOpen: y = !1, onOpenChange: b, side: x = "bottom", align: S = "start", className: C, onKeyDown: w, ...T }, E) => {
|
|
10
|
+
let [D, O] = r(v, y, b), [k, A] = p(0), j = u(), M = u(), N = f(null), P = f(null), F = f(null), I = f([]), L = f(!1);
|
|
11
|
+
d(E, () => P.current), t(D, N, P, x, S, 4);
|
|
12
|
+
let R = c((e) => {
|
|
13
|
+
L.current = !1, O(!1), e && F.current?.focus();
|
|
14
|
+
}, [O]), z = c((e) => R(e === "escape"), [R]);
|
|
15
|
+
n(D, N, z), l(() => {
|
|
16
|
+
D && L.current && I.current[k]?.focus();
|
|
17
|
+
}, [D, k]);
|
|
18
|
+
let B = (e, t) => {
|
|
19
|
+
F.current = t, L.current = !0, A(Math.max(0, e)), O(!0);
|
|
20
|
+
}, V = s(o), H = V && o.props.id || M, U = V ? a(o, {
|
|
21
|
+
id: H,
|
|
22
|
+
"aria-haspopup": "menu",
|
|
23
|
+
"aria-expanded": D,
|
|
24
|
+
"aria-controls": D ? j : void 0,
|
|
25
|
+
onClick: (e) => {
|
|
26
|
+
o.props.onClick?.(e), e.defaultPrevented || (D ? R(!1) : B(0, e.currentTarget));
|
|
27
|
+
},
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
o.props.onKeyDown?.(e), e.defaultPrevented || (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), B(e.key === "ArrowDown" ? 0 : g.length - 1, e.currentTarget));
|
|
30
|
+
}
|
|
31
|
+
}) : o, W = (e) => {
|
|
32
|
+
let t = g[e];
|
|
33
|
+
t && !t.disabled && (R(!0), t.onSelect?.());
|
|
34
|
+
}, G = (e) => {
|
|
35
|
+
if (w?.(e), e.defaultPrevented || g.length === 0) return;
|
|
36
|
+
let t = g.length - 1, n = (t) => {
|
|
37
|
+
e.preventDefault(), L.current = !0, A(t);
|
|
38
|
+
};
|
|
39
|
+
switch (e.key) {
|
|
40
|
+
case "ArrowDown": return n(k >= t ? 0 : k + 1);
|
|
41
|
+
case "ArrowUp": return n(k <= 0 ? t : k - 1);
|
|
42
|
+
case "Home": return n(0);
|
|
43
|
+
case "End": return n(t);
|
|
44
|
+
case "Escape": return e.preventDefault(), e.stopPropagation(), R(!0);
|
|
45
|
+
case "Tab": return R(!1);
|
|
46
|
+
}
|
|
47
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
48
|
+
let t = e.key.toLowerCase(), r = [...g.keys()].map((e) => (k + 1 + e) % g.length).find((e) => g[e].label.toLowerCase().startsWith(t));
|
|
49
|
+
r !== void 0 && n(r);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ h("div", {
|
|
53
|
+
ref: N,
|
|
54
|
+
className: i.dropdownMenu,
|
|
55
|
+
onBlur: (e) => {
|
|
56
|
+
let t = e.relatedTarget;
|
|
57
|
+
D && t instanceof Node && !N.current?.contains(t) && R(!1);
|
|
58
|
+
},
|
|
59
|
+
children: [U, D && /* @__PURE__ */ m("div", {
|
|
60
|
+
...T,
|
|
61
|
+
ref: P,
|
|
62
|
+
id: j,
|
|
63
|
+
role: "menu",
|
|
64
|
+
"aria-label": _,
|
|
65
|
+
"aria-labelledby": _ ? void 0 : H,
|
|
66
|
+
...e,
|
|
67
|
+
className: [i.menu, C].filter(Boolean).join(" "),
|
|
68
|
+
onKeyDown: G,
|
|
69
|
+
children: g.map((e, t) => /* @__PURE__ */ h("button", {
|
|
70
|
+
ref: (e) => {
|
|
71
|
+
I.current[t] = e;
|
|
72
|
+
},
|
|
73
|
+
type: "button",
|
|
74
|
+
role: "menuitem",
|
|
75
|
+
tabIndex: t === k ? 0 : -1,
|
|
76
|
+
"aria-disabled": e.disabled || void 0,
|
|
77
|
+
className: [i.item, e.danger && i.danger].filter(Boolean).join(" "),
|
|
78
|
+
onClick: () => W(t),
|
|
79
|
+
onPointerMove: () => {
|
|
80
|
+
t !== k && (L.current = !0, A(t));
|
|
81
|
+
},
|
|
82
|
+
children: [e.icon != null && /* @__PURE__ */ m("span", {
|
|
83
|
+
className: i.icon,
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: e.icon
|
|
86
|
+
}), /* @__PURE__ */ m("span", {
|
|
87
|
+
className: i.label,
|
|
88
|
+
children: e.label
|
|
89
|
+
})]
|
|
90
|
+
}, `${t}-${e.label}`))
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
g.displayName = "DropdownMenu";
|
|
95
|
+
export { g as DropdownMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownMenu } from "./DropdownMenu.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/components/DropdownMenu/index.module.scss
|
|
2
|
+
var e = "matrix-dropdownmenu-dropdownMenu", t = "matrix-dropdownmenu-menu", n = "matrix-dropdownmenu-item", r = "matrix-dropdownmenu-danger", i = "matrix-dropdownmenu-icon", a = "matrix-dropdownmenu-label", o = {
|
|
3
|
+
dropdownMenu: e,
|
|
4
|
+
menu: t,
|
|
5
|
+
"floating-enter": "matrix-dropdownmenu-floating-enter",
|
|
6
|
+
item: n,
|
|
7
|
+
danger: r,
|
|
8
|
+
icon: i,
|
|
9
|
+
label: a
|
|
10
|
+
};
|
|
11
|
+
export { r as danger, o as default, e as dropdownMenu, i as icon, n as item, a as label, t as menu };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const EmptyState: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "children" | "title"> & {
|
|
2
|
+
title: import("react").ReactNode;
|
|
3
|
+
titleLevel?: import("../../index.js").HeadingLevel;
|
|
4
|
+
description?: import("react").ReactNode;
|
|
5
|
+
icon?: import("react").ReactNode;
|
|
6
|
+
actions?: import("react").ReactNode;
|
|
7
|
+
bordered?: boolean;
|
|
8
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Heading as e } from "../Heading/Heading.js";
|
|
2
|
+
import { Text as t } from "../Text/Text.js";
|
|
3
|
+
import n from "./index.module.js";
|
|
4
|
+
import { forwardRef as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
7
|
+
var o = r(({ title: r, titleLevel: o = 2, description: s, icon: c, actions: l, bordered: u = !1, className: d, ...f }, p) => /* @__PURE__ */ a("div", {
|
|
8
|
+
...f,
|
|
9
|
+
ref: p,
|
|
10
|
+
className: [
|
|
11
|
+
n.emptyState,
|
|
12
|
+
u && n.bordered,
|
|
13
|
+
d
|
|
14
|
+
].filter(Boolean).join(" "),
|
|
15
|
+
children: [
|
|
16
|
+
c != null && /* @__PURE__ */ i("span", {
|
|
17
|
+
className: n.icon,
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: c
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ i(e, {
|
|
22
|
+
level: o,
|
|
23
|
+
size: "small",
|
|
24
|
+
className: n.title,
|
|
25
|
+
children: r
|
|
26
|
+
}),
|
|
27
|
+
s != null && /* @__PURE__ */ i(t, {
|
|
28
|
+
variant: "muted",
|
|
29
|
+
className: n.description,
|
|
30
|
+
children: s
|
|
31
|
+
}),
|
|
32
|
+
l != null && /* @__PURE__ */ i("div", {
|
|
33
|
+
className: n.actions,
|
|
34
|
+
children: l
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}));
|
|
38
|
+
o.displayName = "EmptyState";
|
|
39
|
+
export { o as EmptyState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyState } from "./EmptyState.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/components/EmptyState/index.module.scss
|
|
2
|
+
var e = "matrix-emptystate-emptyState", t = "matrix-emptystate-bordered", n = "matrix-emptystate-icon", r = "matrix-emptystate-title", i = "matrix-emptystate-description", a = "matrix-emptystate-actions", o = {
|
|
3
|
+
emptyState: e,
|
|
4
|
+
bordered: t,
|
|
5
|
+
icon: n,
|
|
6
|
+
title: r,
|
|
7
|
+
description: i,
|
|
8
|
+
actions: a
|
|
9
|
+
};
|
|
10
|
+
export { a as actions, t as bordered, o as default, i as description, e as emptyState, n as icon, r as title };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const FileUpload: import("react").ForwardRefExoticComponent<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "children" | "defaultValue" | "type" | "value"> & {
|
|
2
|
+
onFilesChange?: (files: File[]) => void;
|
|
3
|
+
dropLabel?: string;
|
|
4
|
+
showFileList?: boolean;
|
|
5
|
+
fileListLabel?: string;
|
|
6
|
+
getRemoveLabel?: (file: File) => string;
|
|
7
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../Button/Button.js";
|
|
3
|
+
import { formatFileSize as t } from "./helpers/formatFileSize.js";
|
|
4
|
+
import { matchesAccept as n } from "./helpers/matchesAccept.js";
|
|
5
|
+
import r from "./index.module.js";
|
|
6
|
+
import { File as i, Upload as a, X as o } from "lucide-react";
|
|
7
|
+
import { forwardRef as s, useEffect as c, useImperativeHandle as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
// src/components/FileUpload/FileUpload.tsx
|
|
10
|
+
var m = s(({ onFilesChange: s, dropLabel: m = "Drag and drop files here, or choose them", showFileList: h = !0, fileListLabel: g = "Selected files", getRemoveLabel: _ = (e) => `Remove ${e.name}`, accept: v, multiple: y, disabled: b, className: x, onChange: S, ...C }, w) => {
|
|
11
|
+
let [T, E] = d([]), [D, O] = d(!1), k = u(null), A = u([]), j = u(null);
|
|
12
|
+
l(w, () => k.current), c(() => {
|
|
13
|
+
let e = j.current;
|
|
14
|
+
e !== null && (j.current = null, (A.current[Math.min(e, T.length - 1)] ?? k.current)?.focus());
|
|
15
|
+
}, [T]);
|
|
16
|
+
let M = (e) => {
|
|
17
|
+
E(e);
|
|
18
|
+
let t = k.current;
|
|
19
|
+
if (t && typeof DataTransfer == "function") try {
|
|
20
|
+
let n = new DataTransfer();
|
|
21
|
+
e.forEach((e) => n.items.add(e)), t.files = n.files;
|
|
22
|
+
} catch {
|
|
23
|
+
t.value = e.length === 0 ? "" : t.value;
|
|
24
|
+
}
|
|
25
|
+
s?.(e);
|
|
26
|
+
}, N = (e) => {
|
|
27
|
+
let t = e.filter((e) => n(e, v));
|
|
28
|
+
t.length !== 0 && M(y ? [...T, ...t] : t.slice(0, 1));
|
|
29
|
+
}, P = (e) => {
|
|
30
|
+
S?.(e), N(Array.from(e.target.files ?? []));
|
|
31
|
+
}, F = (e) => {
|
|
32
|
+
b || (e.preventDefault(), O(!0));
|
|
33
|
+
}, I = (e) => {
|
|
34
|
+
b || (e.preventDefault(), O(!1), N(Array.from(e.dataTransfer.files)));
|
|
35
|
+
}, L = (e) => {
|
|
36
|
+
j.current = e, M(T.filter((t, n) => n !== e));
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ p("div", {
|
|
39
|
+
className: r.fileUpload,
|
|
40
|
+
children: [/* @__PURE__ */ p("div", {
|
|
41
|
+
className: [
|
|
42
|
+
r.dropzone,
|
|
43
|
+
D && r.dragging,
|
|
44
|
+
b && r.disabled
|
|
45
|
+
].filter(Boolean).join(" "),
|
|
46
|
+
onDragEnter: F,
|
|
47
|
+
onDragOver: F,
|
|
48
|
+
onDragLeave: (e) => {
|
|
49
|
+
e.currentTarget.contains(e.relatedTarget) || O(!1);
|
|
50
|
+
},
|
|
51
|
+
onDrop: I,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ f(a, {
|
|
54
|
+
size: 20,
|
|
55
|
+
strokeWidth: 1.75,
|
|
56
|
+
className: r.icon,
|
|
57
|
+
"aria-hidden": "true"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ f("span", {
|
|
60
|
+
className: r.dropLabel,
|
|
61
|
+
children: m
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ f("input", {
|
|
64
|
+
...C,
|
|
65
|
+
ref: k,
|
|
66
|
+
type: "file",
|
|
67
|
+
accept: v,
|
|
68
|
+
multiple: y,
|
|
69
|
+
disabled: b,
|
|
70
|
+
className: [r.input, x].filter(Boolean).join(" "),
|
|
71
|
+
onChange: P
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}), h && T.length > 0 && /* @__PURE__ */ f("ul", {
|
|
75
|
+
className: r.list,
|
|
76
|
+
"aria-label": g,
|
|
77
|
+
children: T.map((n, a) => /* @__PURE__ */ p("li", {
|
|
78
|
+
className: r.file,
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ f(i, {
|
|
81
|
+
size: 16,
|
|
82
|
+
strokeWidth: 1.75,
|
|
83
|
+
className: r.fileIcon,
|
|
84
|
+
"aria-hidden": "true"
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ f("span", {
|
|
87
|
+
className: r.fileName,
|
|
88
|
+
children: n.name
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ f("span", {
|
|
91
|
+
className: r.fileSize,
|
|
92
|
+
children: t(n.size)
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ f(e, {
|
|
95
|
+
ref: (e) => {
|
|
96
|
+
A.current[a] = e;
|
|
97
|
+
},
|
|
98
|
+
variant: "ghost",
|
|
99
|
+
size: "small",
|
|
100
|
+
iconOnly: !0,
|
|
101
|
+
"aria-label": _(n),
|
|
102
|
+
disabled: b,
|
|
103
|
+
onClick: () => L(a),
|
|
104
|
+
children: /* @__PURE__ */ f(o, {
|
|
105
|
+
size: 14,
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}, `${a}-${n.name}-${n.size}`))
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
m.displayName = "FileUpload";
|
|
116
|
+
export { m as FileUpload };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatFileSize: (bytes: number) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/components/FileUpload/helpers/formatFileSize.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
if (e < 1024) return `${e} B`;
|
|
4
|
+
let t = [
|
|
5
|
+
"KB",
|
|
6
|
+
"MB",
|
|
7
|
+
"GB"
|
|
8
|
+
], n = e / 1024, r = 0;
|
|
9
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
10
|
+
return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${t[r]}`;
|
|
11
|
+
};
|
|
12
|
+
export { e as formatFileSize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const matchesAccept: (file: File, accept: string | undefined) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/components/FileUpload/helpers/matchesAccept.ts
|
|
2
|
+
var e = (e, t) => {
|
|
3
|
+
if (!t || t.trim() === "") return !0;
|
|
4
|
+
let n = e.name.toLowerCase(), r = e.type.toLowerCase();
|
|
5
|
+
return t.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean).some((e) => e.startsWith(".") ? n.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r === e);
|
|
6
|
+
};
|
|
7
|
+
export { e as matchesAccept };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileUpload } from "./FileUpload.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/components/FileUpload/index.module.scss
|
|
2
|
+
var e = "matrix-fileupload-fileUpload", t = "matrix-fileupload-dropzone", n = "matrix-fileupload-dragging", r = "matrix-fileupload-disabled", i = "matrix-fileupload-icon", a = "matrix-fileupload-dropLabel", o = "matrix-fileupload-input", s = "matrix-fileupload-list", c = "matrix-fileupload-file", l = "matrix-fileupload-fileIcon", u = "matrix-fileupload-fileName", d = "matrix-fileupload-fileSize", f = {
|
|
3
|
+
fileUpload: e,
|
|
4
|
+
dropzone: t,
|
|
5
|
+
dragging: n,
|
|
6
|
+
disabled: r,
|
|
7
|
+
icon: i,
|
|
8
|
+
dropLabel: a,
|
|
9
|
+
input: o,
|
|
10
|
+
list: s,
|
|
11
|
+
file: c,
|
|
12
|
+
fileIcon: l,
|
|
13
|
+
fileName: u,
|
|
14
|
+
fileSize: d
|
|
15
|
+
};
|
|
16
|
+
export { f as default, r as disabled, n as dragging, a as dropLabel, t as dropzone, c as file, l as fileIcon, u as fileName, d as fileSize, e as fileUpload, i as icon, o as input, s as list };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const FormField: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "children" | "id"> & {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
optional?: boolean;
|
|
5
|
+
optionalText?: string;
|
|
6
|
+
error?: string | null;
|
|
7
|
+
children: import("react").ReactNode;
|
|
8
|
+
labelClassName?: string;
|
|
9
|
+
optionalClassName?: string;
|
|
10
|
+
errorClassName?: string;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import e from "./index.module.js";
|
|
2
|
+
import { cloneElement as t, forwardRef as n, isValidElement as r } from "react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
// src/components/FormField/FormField.tsx
|
|
5
|
+
var o = n(({ id: n, label: o, optional: s = !1, optionalText: c = "(Optional)", error: l = null, children: u, className: d, labelClassName: f, optionalClassName: p, errorClassName: m, ...h }, g) => {
|
|
6
|
+
let _ = `${n}-error`, v = l && r(u) ? t(u, {
|
|
7
|
+
"aria-describedby": [u.props["aria-describedby"], _].filter(Boolean).join(" "),
|
|
8
|
+
"aria-invalid": u.props["aria-invalid"] ?? !0
|
|
9
|
+
}) : u;
|
|
10
|
+
return /* @__PURE__ */ a("div", {
|
|
11
|
+
...h,
|
|
12
|
+
ref: g,
|
|
13
|
+
className: [e.field, d].filter(Boolean).join(" "),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ a("label", {
|
|
16
|
+
htmlFor: n,
|
|
17
|
+
className: [e.label, f].filter(Boolean).join(" "),
|
|
18
|
+
children: [o, s && /* @__PURE__ */ a("span", {
|
|
19
|
+
className: [e.optional, p].filter(Boolean).join(" "),
|
|
20
|
+
children: [" ", c]
|
|
21
|
+
})]
|
|
22
|
+
}),
|
|
23
|
+
v,
|
|
24
|
+
l && /* @__PURE__ */ i("span", {
|
|
25
|
+
id: _,
|
|
26
|
+
className: [e.error, m].filter(Boolean).join(" "),
|
|
27
|
+
"aria-live": "polite",
|
|
28
|
+
"aria-atomic": "true",
|
|
29
|
+
children: l
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
o.displayName = "FormField";
|
|
35
|
+
export { o as FormField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormField } from "./FormField.js";
|