@k8o/arte-odyssey 0.0.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/LICENSE +21 -0
- package/dist/components/accordion/accordion-button.d.ts +2 -0
- package/dist/components/accordion/accordion-button.js +40 -0
- package/dist/components/accordion/accordion-item.d.ts +4 -0
- package/dist/components/accordion/accordion-item.js +11 -0
- package/dist/components/accordion/accordion-panel.d.ts +2 -0
- package/dist/components/accordion/accordion-panel.js +21 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordion.js +17 -0
- package/dist/components/accordion/accordion.stories.js +89 -0
- package/dist/components/accordion/context.d.ts +10 -0
- package/dist/components/accordion/context.js +38 -0
- package/dist/components/accordion/index.d.ts +4 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/alert/alert.d.ts +8 -0
- package/dist/components/alert/alert.js +46 -0
- package/dist/components/alert/alert.stories.js +51 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/anchor/anchor.d.ts +14 -0
- package/dist/components/anchor/anchor.js +31 -0
- package/dist/components/anchor/anchor.stories.js +23 -0
- package/dist/components/anchor/index.d.ts +1 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/baseline-status/baseline-status.d.ts +16 -0
- package/dist/components/baseline-status/baseline-status.js +39 -0
- package/dist/components/baseline-status/baseline-status.stories.js +15 -0
- package/dist/components/baseline-status/index.d.ts +1 -0
- package/dist/components/baseline-status/index.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +18 -0
- package/dist/components/breadcrumb/breadcrumb.js +36 -0
- package/dist/components/breadcrumb/breadcrumb.stories.js +40 -0
- package/dist/components/breadcrumb/index.d.ts +1 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.js +55 -0
- package/dist/components/button/button.stories.js +96 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/card.d.ts +3 -0
- package/dist/components/card/card.js +26 -0
- package/dist/components/card/card.stories.js +38 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +2 -0
- package/dist/components/card/interactive-card.d.ts +3 -0
- package/dist/components/card/interactive-card.js +34 -0
- package/dist/components/card/type.d.ts +6 -0
- package/dist/components/card/type.js +0 -0
- package/dist/components/code/code.d.ts +4 -0
- package/dist/components/code/code.js +38 -0
- package/dist/components/code/code.stories.js +60 -0
- package/dist/components/code/index.d.ts +1 -0
- package/dist/components/code/index.js +4 -0
- package/dist/components/dialog/dialog.d.ts +17 -0
- package/dist/components/dialog/dialog.js +85 -0
- package/dist/components/dialog/dialog.stories.js +98 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/drawer/drawer.d.ts +6 -0
- package/dist/components/drawer/drawer.js +56 -0
- package/dist/components/drawer/drawer.stories.js +25 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +130 -0
- package/dist/components/dropdown-menu/dropdown-menu.stories.js +111 -0
- package/dist/components/dropdown-menu/hooks.d.ts +23 -0
- package/dist/components/dropdown-menu/hooks.js +56 -0
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/error-boundary/index.d.ts +1 -0
- package/dist/components/error-boundary/index.js +4 -0
- package/dist/components/form/autocomplete/autocomplete.d.ts +14 -0
- package/dist/components/form/autocomplete/autocomplete.js +225 -0
- package/dist/components/form/autocomplete/autocomplete.stories.js +59 -0
- package/dist/components/form/autocomplete/index.d.ts +1 -0
- package/dist/components/form/autocomplete/index.js +1 -0
- package/dist/components/form/checkbox/checkbox.d.ts +8 -0
- package/dist/components/form/checkbox/checkbox.js +40 -0
- package/dist/components/form/checkbox/checkbox.stories.js +27 -0
- package/dist/components/form/checkbox/index.d.ts +1 -0
- package/dist/components/form/checkbox/index.js +1 -0
- package/dist/components/form/form-control/form-control.d.ts +20 -0
- package/dist/components/form/form-control/form-control.js +53 -0
- package/dist/components/form/form-control/form-control.stories.js +94 -0
- package/dist/components/form/form-control/index.d.ts +1 -0
- package/dist/components/form/form-control/index.js +1 -0
- package/dist/components/form/number-field/index.d.ts +1 -0
- package/dist/components/form/number-field/index.js +1 -0
- package/dist/components/form/number-field/number-field.d.ts +17 -0
- package/dist/components/form/number-field/number-field.js +150 -0
- package/dist/components/form/number-field/number-field.stories.js +106 -0
- package/dist/components/form/radio/index.d.ts +1 -0
- package/dist/components/form/radio/index.js +1 -0
- package/dist/components/form/radio/radio.d.ts +11 -0
- package/dist/components/form/radio/radio.js +51 -0
- package/dist/components/form/radio/radio.stories.js +55 -0
- package/dist/components/form/range-field/index.d.ts +1 -0
- package/dist/components/form/range-field/index.js +4 -0
- package/dist/components/form/range-field/range-field.d.ts +17 -0
- package/dist/components/form/range-field/range-field.js +54 -0
- package/dist/components/form/range-field/range-field.stories.js +162 -0
- package/dist/components/form/select/index.d.ts +1 -0
- package/dist/components/form/select/index.js +1 -0
- package/dist/components/form/select/select.d.ts +14 -0
- package/dist/components/form/select/select.js +39 -0
- package/dist/components/form/select/select.stories.js +58 -0
- package/dist/components/form/text-field/index.d.ts +1 -0
- package/dist/components/form/text-field/index.js +1 -0
- package/dist/components/form/text-field/text-field.d.ts +15 -0
- package/dist/components/form/text-field/text-field.js +40 -0
- package/dist/components/form/text-field/text-field.stories.js +61 -0
- package/dist/components/form/textarea/index.d.ts +1 -0
- package/dist/components/form/textarea/index.js +1 -0
- package/dist/components/form/textarea/textarea.d.ts +18 -0
- package/dist/components/form/textarea/textarea.js +56 -0
- package/dist/components/form/textarea/textarea.stories.js +92 -0
- package/dist/components/heading/heading.d.ts +8 -0
- package/dist/components/heading/heading.js +77 -0
- package/dist/components/heading/heading.stories.js +52 -0
- package/dist/components/heading/index.d.ts +1 -0
- package/dist/components/heading/index.js +1 -0
- package/dist/components/icon-button/icon-button.d.ts +8 -0
- package/dist/components/icon-button/icon-button.js +38 -0
- package/dist/components/icon-button/icon-button.stories.js +54 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/icon-link/icon-link.d.ts +17 -0
- package/dist/components/icon-link/icon-link.js +37 -0
- package/dist/components/icon-link/icon-link.stories.js +40 -0
- package/dist/components/icon-link/index.d.ts +1 -0
- package/dist/components/icon-link/index.js +1 -0
- package/dist/components/icons/arte-odyssey.d.ts +3 -0
- package/dist/components/icons/arte-odyssey.js +463 -0
- package/dist/components/icons/base.d.ts +9 -0
- package/dist/components/icons/base.js +13 -0
- package/dist/components/icons/github-mark.d.ts +3 -0
- package/dist/components/icons/github-mark.js +33 -0
- package/dist/components/icons/icons.stories.js +276 -0
- package/dist/components/icons/index.d.ts +7 -0
- package/dist/components/icons/index.js +7 -0
- package/dist/components/icons/logo.d.ts +6 -0
- package/dist/components/icons/logo.js +50 -0
- package/dist/components/icons/lucide.d.ts +50 -0
- package/dist/components/icons/lucide.js +569 -0
- package/dist/components/icons/qiita.d.ts +3 -0
- package/dist/components/icons/qiita.js +48 -0
- package/dist/components/icons/twitter.d.ts +3 -0
- package/dist/components/icons/twitter.js +34 -0
- package/dist/components/icons/zenn.d.ts +6 -0
- package/dist/components/icons/zenn.js +41 -0
- package/dist/components/index.d.ts +37 -0
- package/dist/components/index.js +37 -0
- package/dist/components/link-button/index.d.ts +1 -0
- package/dist/components/link-button/index.js +1 -0
- package/dist/components/link-button/link-button.d.ts +19 -0
- package/dist/components/link-button/link-button.js +46 -0
- package/dist/components/link-button/link-button.stories.js +51 -0
- package/dist/components/list-box/hooks.d.ts +37 -0
- package/dist/components/list-box/hooks.js +70 -0
- package/dist/components/list-box/index.d.ts +1 -0
- package/dist/components/list-box/index.js +1 -0
- package/dist/components/list-box/list-box.d.ts +22 -0
- package/dist/components/list-box/list-box.js +145 -0
- package/dist/components/list-box/list-box.stories.js +69 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/modal/modal.d.ts +8 -0
- package/dist/components/modal/modal.js +118 -0
- package/dist/components/modal/modal.stories.js +22 -0
- package/dist/components/popover/hooks.d.ts +65 -0
- package/dist/components/popover/hooks.js +187 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.d.ts +18 -0
- package/dist/components/popover/popover.js +141 -0
- package/dist/components/popover/popover.stories.js +45 -0
- package/dist/components/progress/index.d.ts +1 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +7 -0
- package/dist/components/progress/progress.js +21 -0
- package/dist/components/progress/progress.stories.js +16 -0
- package/dist/components/providers/component-provider.d.ts +2 -0
- package/dist/components/providers/component-provider.js +9 -0
- package/dist/components/providers/index.d.ts +2 -0
- package/dist/components/providers/index.js +2 -0
- package/dist/components/providers/portal-root.d.ts +5 -0
- package/dist/components/providers/portal-root.js +17 -0
- package/dist/components/scroll-linked/index.d.ts +1 -0
- package/dist/components/scroll-linked/index.js +1 -0
- package/dist/components/scroll-linked/scroll-linked.d.ts +2 -0
- package/dist/components/scroll-linked/scroll-linked.js +21 -0
- package/dist/components/scroll-linked/scroll-linked.stories.js +18 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +20 -0
- package/dist/components/separator/separator.stories.js +27 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/tabs.d.ts +16 -0
- package/dist/components/tabs/tabs.js +145 -0
- package/dist/components/tabs/tabs.stories.js +49 -0
- package/dist/components/text-tag/index.d.ts +1 -0
- package/dist/components/text-tag/index.js +1 -0
- package/dist/components/text-tag/text-tag.d.ts +5 -0
- package/dist/components/text-tag/text-tag.js +23 -0
- package/dist/components/text-tag/text-tag.stories.js +30 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +5 -0
- package/dist/components/toast/provider.d.ts +11 -0
- package/dist/components/toast/provider.js +125 -0
- package/dist/components/toast/toast.d.ts +9 -0
- package/dist/components/toast/toast.js +19 -0
- package/dist/components/toast/toast.stories.js +45 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.d.ts +13 -0
- package/dist/components/tooltip/tooltip.js +60 -0
- package/dist/components/tooltip/tooltip.stories.js +40 -0
- package/dist/helpers/cn.d.ts +2 -0
- package/dist/helpers/cn.js +8 -0
- package/dist/helpers/color/find-all-colors.d.ts +12 -0
- package/dist/helpers/color/find-all-colors.js +210 -0
- package/dist/helpers/is-internal-route.d.ts +1 -0
- package/dist/helpers/is-internal-route.js +12 -0
- package/dist/helpers/number/between.d.ts +1 -0
- package/dist/helpers/number/between.js +19 -0
- package/dist/helpers/number/cast.d.ts +1 -0
- package/dist/helpers/number/cast.js +41 -0
- package/dist/helpers/number/commalize.d.ts +1 -0
- package/dist/helpers/number/commalize.js +22 -0
- package/dist/helpers/number/index.d.ts +4 -0
- package/dist/helpers/number/index.js +10 -0
- package/dist/helpers/number/to-precision.d.ts +1 -0
- package/dist/helpers/number/to-precision.js +17 -0
- package/dist/helpers/uuid-v4.d.ts +1 -0
- package/dist/helpers/uuid-v4.js +32 -0
- package/dist/hooks/click-away/index.d.ts +2 -0
- package/dist/hooks/click-away/index.js +24 -0
- package/dist/hooks/click-away/index.test.js +31 -0
- package/dist/hooks/client/index.d.ts +1 -0
- package/dist/hooks/client/index.js +12 -0
- package/dist/hooks/clipboard/index.d.ts +4 -0
- package/dist/hooks/clipboard/index.js +17 -0
- package/dist/hooks/clipboard/index.test.js +35 -0
- package/dist/hooks/hash/index.d.ts +1 -0
- package/dist/hooks/hash/index.js +28 -0
- package/dist/hooks/hash/index.test.js +46 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/interval/index.d.ts +1 -0
- package/dist/hooks/interval/index.js +17 -0
- package/dist/hooks/interval/index.test.js +32 -0
- package/dist/hooks/local-storage/index.d.ts +1 -0
- package/dist/hooks/local-storage/index.js +48 -0
- package/dist/hooks/local-storage/index.test.js +82 -0
- package/dist/hooks/scroll-direction/index.d.ts +6 -0
- package/dist/hooks/scroll-direction/index.js +40 -0
- package/dist/hooks/scroll-direction/index.test.js +174 -0
- package/dist/hooks/step/index.d.ts +13 -0
- package/dist/hooks/step/index.js +39 -0
- package/dist/hooks/step/index.test.js +85 -0
- package/dist/hooks/timeout/index.d.ts +1 -0
- package/dist/hooks/timeout/index.js +17 -0
- package/dist/hooks/timeout/index.test.js +31 -0
- package/dist/hooks/window-size/index.d.ts +6 -0
- package/dist/hooks/window-size/index.js +22 -0
- package/dist/hooks/window-size/index.test.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/package.json +6 -0
- package/dist/styles/index.css +394 -0
- package/dist/types/variables.d.ts +6 -0
- package/dist/types/variables.js +0 -0
- package/package.json +110 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export * from './accordion';
|
|
2
|
+
export * from './alert';
|
|
3
|
+
export * from './anchor';
|
|
4
|
+
export * from './baseline-status';
|
|
5
|
+
export * from './breadcrumb';
|
|
6
|
+
export * from './button';
|
|
7
|
+
export * from './card';
|
|
8
|
+
export * from './code';
|
|
9
|
+
export * from './dialog';
|
|
10
|
+
export * from './drawer';
|
|
11
|
+
export * from './dropdown-menu';
|
|
12
|
+
export * from './error-boundary';
|
|
13
|
+
export * from './form/autocomplete';
|
|
14
|
+
export * from './form/checkbox';
|
|
15
|
+
export * from './form/form-control';
|
|
16
|
+
export * from './form/number-field';
|
|
17
|
+
export * from './form/radio';
|
|
18
|
+
export * from './form/range-field';
|
|
19
|
+
export * from './form/select';
|
|
20
|
+
export * from './form/text-field';
|
|
21
|
+
export * from './form/textarea';
|
|
22
|
+
export * from './heading';
|
|
23
|
+
export * from './icon-button';
|
|
24
|
+
export * from './icon-link';
|
|
25
|
+
export * from './icons';
|
|
26
|
+
export * from './link-button';
|
|
27
|
+
export * from './list-box';
|
|
28
|
+
export * from './modal';
|
|
29
|
+
export * from './popover';
|
|
30
|
+
export * from './progress';
|
|
31
|
+
export * from './providers';
|
|
32
|
+
export * from './scroll-linked';
|
|
33
|
+
export * from './separator';
|
|
34
|
+
export * from './tabs';
|
|
35
|
+
export * from './text-tag';
|
|
36
|
+
export * from './toast';
|
|
37
|
+
export * from './tooltip';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export * from "./accordion";
|
|
2
|
+
export * from "./alert";
|
|
3
|
+
export * from "./anchor";
|
|
4
|
+
export * from "./baseline-status";
|
|
5
|
+
export * from "./breadcrumb";
|
|
6
|
+
export * from "./button";
|
|
7
|
+
export * from "./card";
|
|
8
|
+
export * from "./code";
|
|
9
|
+
export * from "./dialog";
|
|
10
|
+
export * from "./drawer";
|
|
11
|
+
export * from "./dropdown-menu";
|
|
12
|
+
export * from "./error-boundary";
|
|
13
|
+
export * from "./form/autocomplete";
|
|
14
|
+
export * from "./form/checkbox";
|
|
15
|
+
export * from "./form/form-control";
|
|
16
|
+
export * from "./form/number-field";
|
|
17
|
+
export * from "./form/radio";
|
|
18
|
+
export * from "./form/range-field";
|
|
19
|
+
export * from "./form/select";
|
|
20
|
+
export * from "./form/text-field";
|
|
21
|
+
export * from "./form/textarea";
|
|
22
|
+
export * from "./heading";
|
|
23
|
+
export * from "./icon-button";
|
|
24
|
+
export * from "./icon-link";
|
|
25
|
+
export * from "./icons";
|
|
26
|
+
export * from "./link-button";
|
|
27
|
+
export * from "./list-box";
|
|
28
|
+
export * from "./modal";
|
|
29
|
+
export * from "./popover";
|
|
30
|
+
export * from "./progress";
|
|
31
|
+
export * from "./providers";
|
|
32
|
+
export * from "./scroll-linked";
|
|
33
|
+
export * from "./separator";
|
|
34
|
+
export * from "./tabs";
|
|
35
|
+
export * from "./text-tag";
|
|
36
|
+
export * from "./toast";
|
|
37
|
+
export * from "./tooltip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './link-button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./link-button";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
export declare const LinkButton: FC<{
|
|
3
|
+
variant?: 'contained' | 'outlined' | 'skeleton';
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
href: string;
|
|
6
|
+
startIcon?: ReactNode;
|
|
7
|
+
endIcon?: ReactNode;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
openInNewTab?: boolean;
|
|
10
|
+
children: string;
|
|
11
|
+
renderAnchor?: (props: {
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
href: string;
|
|
14
|
+
className: string;
|
|
15
|
+
target?: string;
|
|
16
|
+
rel?: string;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}) => ReactNode;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./../../helpers/cn";
|
|
3
|
+
import { isInternalRoute } from "./../../helpers/is-internal-route";
|
|
4
|
+
const LinkButton = ({
|
|
5
|
+
children,
|
|
6
|
+
size = "md",
|
|
7
|
+
variant = "contained",
|
|
8
|
+
href,
|
|
9
|
+
startIcon,
|
|
10
|
+
endIcon,
|
|
11
|
+
active = false,
|
|
12
|
+
openInNewTab = false,
|
|
13
|
+
renderAnchor = ({ children: children2, ...props }) => /* @__PURE__ */ jsx("a", { ...props, children: children2 })
|
|
14
|
+
}) => {
|
|
15
|
+
const type = isInternalRoute(href) && !openInNewTab ? "internal" : "external";
|
|
16
|
+
const props = type === "internal" ? {} : { target: "_blank", rel: "noopener noreferrer" };
|
|
17
|
+
const className = cn(
|
|
18
|
+
"rounded-lg text-center font-bold",
|
|
19
|
+
{
|
|
20
|
+
"bg-primary-bg text-fg hover:bg-primary-bg/90 active:bg-primary-bg/80": variant === "contained",
|
|
21
|
+
"border-primary-border bg-bg-base text-primary-fg hover:bg-bg-subtle active:bg-bg-emphasize border-2": variant === "outlined",
|
|
22
|
+
"bg-transparent text-fg-mute hover:text-fg-base active:text-fg-base": variant === "skeleton"
|
|
23
|
+
},
|
|
24
|
+
"focus-visible:border-transparent focus-visible:ring-border-info focus-visible:ring-2 focus-visible:outline-hidden",
|
|
25
|
+
size === "sm" && "px-3 py-1 text-sm",
|
|
26
|
+
size === "md" && "text-md px-4 py-2",
|
|
27
|
+
size === "lg" && "px-6 py-3 text-lg",
|
|
28
|
+
Boolean(startIcon ?? endIcon) && "flex items-center gap-2",
|
|
29
|
+
Boolean(endIcon) && "justify-between",
|
|
30
|
+
active && "text-fg-info hover:text-fg-info active:text-fg-info"
|
|
31
|
+
);
|
|
32
|
+
return renderAnchor({
|
|
33
|
+
href,
|
|
34
|
+
className,
|
|
35
|
+
"aria-label": children,
|
|
36
|
+
...props,
|
|
37
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
startIcon,
|
|
39
|
+
children,
|
|
40
|
+
endIcon
|
|
41
|
+
] })
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
LinkButton
|
|
46
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CopyIcon } from "../icons";
|
|
3
|
+
import { LinkButton } from "./link-button";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "components/link-button",
|
|
6
|
+
component: LinkButton,
|
|
7
|
+
args: {
|
|
8
|
+
href: "",
|
|
9
|
+
children: "\u30DC\u30BF\u30F3"
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var link_button_stories_default = meta;
|
|
13
|
+
const Large = {
|
|
14
|
+
args: {
|
|
15
|
+
size: "lg"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const Medium = {
|
|
19
|
+
args: {
|
|
20
|
+
size: "md"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const Small = {
|
|
24
|
+
args: {
|
|
25
|
+
size: "sm"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const Outline = {
|
|
29
|
+
args: {
|
|
30
|
+
variant: "outlined"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const StartIcon = {
|
|
34
|
+
args: {
|
|
35
|
+
startIcon: /* @__PURE__ */ jsx(CopyIcon, {})
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const EndIcon = {
|
|
39
|
+
args: {
|
|
40
|
+
endIcon: /* @__PURE__ */ jsx(CopyIcon, {})
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
EndIcon,
|
|
45
|
+
Large,
|
|
46
|
+
Medium,
|
|
47
|
+
Outline,
|
|
48
|
+
Small,
|
|
49
|
+
StartIcon,
|
|
50
|
+
link_button_stories_default as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type HTMLProps, type RefObject } from 'react';
|
|
2
|
+
export type Option = {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
type MenuContext = {
|
|
7
|
+
options: Option[];
|
|
8
|
+
activeIndex: number | null;
|
|
9
|
+
selectedIndex: number | null;
|
|
10
|
+
handleSelect: (index: number) => void;
|
|
11
|
+
itemElementsRef: RefObject<(HTMLElement | null)[]>;
|
|
12
|
+
getTriggerProps: (userProps?: HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
13
|
+
getContentProps: (userProps?: HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
14
|
+
getItemProps: (userProps?: Omit<HTMLProps<HTMLElement>, 'selected' | 'active'>) => Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
declare const MenuContext: React.Context<MenuContext | null>;
|
|
17
|
+
export declare const MenuContextProvider: React.Context<MenuContext | null>;
|
|
18
|
+
export declare const useMenuContent: () => {
|
|
19
|
+
options: Option[];
|
|
20
|
+
selectedIndex: number | null;
|
|
21
|
+
contentProps: Record<string, unknown>;
|
|
22
|
+
itemElementsRef: RefObject<(HTMLElement | null)[]>;
|
|
23
|
+
};
|
|
24
|
+
export declare const useMenuItem: (index: number) => {
|
|
25
|
+
selected: boolean;
|
|
26
|
+
props: {
|
|
27
|
+
ref: (node: HTMLElement | null) => void;
|
|
28
|
+
'aria-selected': boolean;
|
|
29
|
+
role: string;
|
|
30
|
+
tabIndex: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const useMenuTrigger: () => {
|
|
34
|
+
label: string;
|
|
35
|
+
getTriggerProps: (userProps?: HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useListItem } from "@floating-ui/react";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
use,
|
|
6
|
+
useMemo
|
|
7
|
+
} from "react";
|
|
8
|
+
import { useOpenContext } from "../popover/hooks";
|
|
9
|
+
const MenuContext = createContext(null);
|
|
10
|
+
const MenuContextProvider = MenuContext;
|
|
11
|
+
const useMenuContext = () => {
|
|
12
|
+
const menu = use(MenuContext);
|
|
13
|
+
if (!menu) {
|
|
14
|
+
throw new Error("useMenuContext must be used within a DropdownMenu.Root");
|
|
15
|
+
}
|
|
16
|
+
return menu;
|
|
17
|
+
};
|
|
18
|
+
const useMenuContent = () => {
|
|
19
|
+
const menu = useMenuContext();
|
|
20
|
+
return useMemo(
|
|
21
|
+
() => ({
|
|
22
|
+
options: menu.options,
|
|
23
|
+
selectedIndex: menu.selectedIndex,
|
|
24
|
+
contentProps: menu.getContentProps(),
|
|
25
|
+
itemElementsRef: menu.itemElementsRef
|
|
26
|
+
}),
|
|
27
|
+
[menu]
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
const useMenuItem = (index) => {
|
|
31
|
+
const menu = useMenuContext();
|
|
32
|
+
const { onClose } = useOpenContext();
|
|
33
|
+
const item = useListItem();
|
|
34
|
+
return useMemo(
|
|
35
|
+
() => ({
|
|
36
|
+
selected: menu.selectedIndex === index,
|
|
37
|
+
props: {
|
|
38
|
+
ref: item.ref,
|
|
39
|
+
"aria-selected": menu.selectedIndex === index,
|
|
40
|
+
role: "option",
|
|
41
|
+
tabIndex: menu.activeIndex === item.index ? 0 : -1,
|
|
42
|
+
...menu.getItemProps({
|
|
43
|
+
onClick: () => {
|
|
44
|
+
menu.handleSelect(index);
|
|
45
|
+
onClose();
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
[index, item.index, item.ref, menu, onClose]
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
const useMenuTrigger = () => {
|
|
54
|
+
const menu = useMenuContext();
|
|
55
|
+
const defaultLabel = "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044";
|
|
56
|
+
const label = menu.selectedIndex !== null ? menu.options[menu.selectedIndex]?.label ?? defaultLabel : defaultLabel;
|
|
57
|
+
return useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
label,
|
|
60
|
+
getTriggerProps: menu.getTriggerProps
|
|
61
|
+
}),
|
|
62
|
+
[label, menu.getTriggerProps]
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
MenuContextProvider,
|
|
67
|
+
useMenuContent,
|
|
68
|
+
useMenuItem,
|
|
69
|
+
useMenuTrigger
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './list-box';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./list-box";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Placement } from '@floating-ui/react';
|
|
2
|
+
import { type ComponentProps, type FC, type PropsWithChildren, type ReactElement } from 'react';
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
import { type Option } from './hooks';
|
|
5
|
+
export declare const ListBox: {
|
|
6
|
+
Root: FC<PropsWithChildren<{
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
options: Option[];
|
|
9
|
+
value: Option["key"] | undefined;
|
|
10
|
+
onSelect: (key: Option["key"]) => void;
|
|
11
|
+
}>>;
|
|
12
|
+
Content: FC<{
|
|
13
|
+
helpContent?: ReactElement;
|
|
14
|
+
}>;
|
|
15
|
+
Trigger: FC<{
|
|
16
|
+
size?: ComponentProps<typeof Button>["size"];
|
|
17
|
+
}>;
|
|
18
|
+
TriggerIcon: FC<{
|
|
19
|
+
size?: ComponentProps<typeof Button>["size"];
|
|
20
|
+
icon: ReactElement;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
FloatingList,
|
|
5
|
+
useInteractions,
|
|
6
|
+
useListNavigation
|
|
7
|
+
} from "@floating-ui/react";
|
|
8
|
+
import {
|
|
9
|
+
useRef,
|
|
10
|
+
useState
|
|
11
|
+
} from "react";
|
|
12
|
+
import { cn } from "./../../helpers/cn";
|
|
13
|
+
import { Button } from "../button";
|
|
14
|
+
import { IconButton } from "../icon-button";
|
|
15
|
+
import { CheckIcon, ChevronIcon } from "../icons";
|
|
16
|
+
import { Popover } from "../popover";
|
|
17
|
+
import { useFloatingUIContext } from "../popover/hooks";
|
|
18
|
+
import {
|
|
19
|
+
MenuContextProvider,
|
|
20
|
+
useMenuContent,
|
|
21
|
+
useMenuItem,
|
|
22
|
+
useMenuTrigger
|
|
23
|
+
} from "./hooks";
|
|
24
|
+
const Root = ({ children, placement = "bottom", options, value, onSelect }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(Popover.Root, { flipDisabled: true, placement, type: "listbox", children: /* @__PURE__ */ jsx(MenuProvider, { onSelect, options, value, children }) });
|
|
26
|
+
};
|
|
27
|
+
const MenuProvider = ({ children, options, onSelect, value }) => {
|
|
28
|
+
const selectedIndex = options.findIndex((option) => option.key === value);
|
|
29
|
+
const [activeIndex, setActiveIndex] = useState(null);
|
|
30
|
+
const itemElementsRef = useRef([]);
|
|
31
|
+
const context = useFloatingUIContext();
|
|
32
|
+
const listNavigation = useListNavigation(context, {
|
|
33
|
+
listRef: itemElementsRef,
|
|
34
|
+
activeIndex,
|
|
35
|
+
selectedIndex,
|
|
36
|
+
onNavigate: setActiveIndex,
|
|
37
|
+
loop: true
|
|
38
|
+
});
|
|
39
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(
|
|
40
|
+
[listNavigation]
|
|
41
|
+
);
|
|
42
|
+
const handleSelect = (index) => {
|
|
43
|
+
const key = options[index]?.key;
|
|
44
|
+
if (key) {
|
|
45
|
+
onSelect(key);
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
MenuContextProvider,
|
|
51
|
+
{
|
|
52
|
+
value: {
|
|
53
|
+
options,
|
|
54
|
+
activeIndex,
|
|
55
|
+
selectedIndex,
|
|
56
|
+
handleSelect,
|
|
57
|
+
itemElementsRef,
|
|
58
|
+
getTriggerProps: getReferenceProps,
|
|
59
|
+
getContentProps: getFloatingProps,
|
|
60
|
+
getItemProps
|
|
61
|
+
},
|
|
62
|
+
children
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
const Content = ({ helpContent }) => {
|
|
67
|
+
const { options, contentProps, itemElementsRef } = useMenuContent();
|
|
68
|
+
return /* @__PURE__ */ jsx(FloatingList, { elementsRef: itemElementsRef, children: /* @__PURE__ */ jsx(
|
|
69
|
+
Popover.Content,
|
|
70
|
+
{
|
|
71
|
+
renderItem: (props) => /* @__PURE__ */ jsxs(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
...props,
|
|
75
|
+
...contentProps,
|
|
76
|
+
className: "flex max-h-48 min-w-40 flex-col overflow-y-auto rounded-lg border border-border-mute bg-bg-base py-2 shadow-xl",
|
|
77
|
+
children: [
|
|
78
|
+
helpContent,
|
|
79
|
+
options.map(({ key, label }, idx) => /* @__PURE__ */ jsx(Item, { index: idx, label }, key))
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
) });
|
|
85
|
+
};
|
|
86
|
+
const Item = ({ label, index }) => {
|
|
87
|
+
const { props, selected } = useMenuItem(index);
|
|
88
|
+
return /* @__PURE__ */ jsxs(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
className: cn(
|
|
92
|
+
"group w-full px-2 py-1 text-left",
|
|
93
|
+
"hover:bg-primary-bg",
|
|
94
|
+
"focus-visible:border-transparent focus-visible:bg-primary-bg focus-visible:outline-hidden",
|
|
95
|
+
!selected && "pl-9",
|
|
96
|
+
selected && "inline-flex items-center gap-1"
|
|
97
|
+
),
|
|
98
|
+
...props,
|
|
99
|
+
children: [
|
|
100
|
+
selected && /* @__PURE__ */ jsx("span", { className: "text-fg-success group-hover:text-fg-base group-focus-visible:text-fg-base", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
101
|
+
label
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
const Trigger = ({ size = "md" }) => {
|
|
107
|
+
const { label, getTriggerProps } = useMenuTrigger();
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
Popover.Trigger,
|
|
110
|
+
{
|
|
111
|
+
renderItem: (props) => /* @__PURE__ */ jsx(
|
|
112
|
+
Button,
|
|
113
|
+
{
|
|
114
|
+
"aria-label": label,
|
|
115
|
+
color: "gray",
|
|
116
|
+
endIcon: /* @__PURE__ */ jsx(ChevronIcon, { direction: "down" }),
|
|
117
|
+
fullWidth: true,
|
|
118
|
+
size,
|
|
119
|
+
type: "button",
|
|
120
|
+
variant: "contained",
|
|
121
|
+
...getTriggerProps(props),
|
|
122
|
+
children: label
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
const TriggerIcon = ({ size = "md", icon }) => {
|
|
129
|
+
const { label, getTriggerProps } = useMenuTrigger();
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
Popover.Trigger,
|
|
132
|
+
{
|
|
133
|
+
renderItem: (props) => /* @__PURE__ */ jsx(IconButton, { label, size, ...getTriggerProps(props), children: icon })
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
const ListBox = {
|
|
138
|
+
Root,
|
|
139
|
+
Content,
|
|
140
|
+
Trigger,
|
|
141
|
+
TriggerIcon
|
|
142
|
+
};
|
|
143
|
+
export {
|
|
144
|
+
ListBox
|
|
145
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ListBox } from "./list-box";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "components/list-box",
|
|
6
|
+
component: ListBox.Root,
|
|
7
|
+
parameters: {
|
|
8
|
+
a11y: {
|
|
9
|
+
options: {
|
|
10
|
+
rules: {
|
|
11
|
+
// https://github.com/floating-ui/floating-ui/pull/2298#issuecomment-1518101512
|
|
12
|
+
"aria-hidden-focus": { enabled: false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var list_box_stories_default = meta;
|
|
19
|
+
const OPTIONS = [
|
|
20
|
+
{ key: "1", label: "apple" },
|
|
21
|
+
{ key: "2", label: "banana" },
|
|
22
|
+
{ key: "3", label: "cherry" },
|
|
23
|
+
{ key: "4", label: "date" },
|
|
24
|
+
{ key: "5", label: "elderberry" },
|
|
25
|
+
{ key: "6", label: "fig" },
|
|
26
|
+
{ key: "7", label: "grape" },
|
|
27
|
+
{ key: "8", label: "honeydew" },
|
|
28
|
+
{ key: "9", label: "kiwi" },
|
|
29
|
+
{ key: "10", label: "lemon" },
|
|
30
|
+
{ key: "11", label: "mango" },
|
|
31
|
+
{ key: "12", label: "nectarine" },
|
|
32
|
+
{ key: "13", label: "orange" },
|
|
33
|
+
{ key: "14", label: "pear" },
|
|
34
|
+
{ key: "15", label: "quince" },
|
|
35
|
+
{ key: "16", label: "raspberry" },
|
|
36
|
+
{ key: "17", label: "strawberry" },
|
|
37
|
+
{ key: "18", label: "tangerine" },
|
|
38
|
+
{ key: "19", label: "watermelon" }
|
|
39
|
+
];
|
|
40
|
+
const Default = {
|
|
41
|
+
render: () => {
|
|
42
|
+
const [selected, setSelected] = useState();
|
|
43
|
+
return /* @__PURE__ */ jsx("div", { className: "w-56", children: /* @__PURE__ */ jsxs(
|
|
44
|
+
ListBox.Root,
|
|
45
|
+
{
|
|
46
|
+
onSelect: (key) => {
|
|
47
|
+
setSelected(key);
|
|
48
|
+
},
|
|
49
|
+
options: OPTIONS,
|
|
50
|
+
value: selected,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx(ListBox.Trigger, {}),
|
|
53
|
+
/* @__PURE__ */ jsx(ListBox.Content, {})
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
) });
|
|
57
|
+
},
|
|
58
|
+
play: async ({ canvas, userEvent }) => {
|
|
59
|
+
const trigger = canvas.getByRole("combobox", {
|
|
60
|
+
name: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
61
|
+
});
|
|
62
|
+
trigger.focus();
|
|
63
|
+
await userEvent.keyboard("{Enter}");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
Default,
|
|
68
|
+
list_box_stories_default as default
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./modal";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FC, type PropsWithChildren, type RefObject } from 'react';
|
|
2
|
+
export declare const Modal: FC<PropsWithChildren<{
|
|
3
|
+
ref?: RefObject<HTMLDialogElement | null>;
|
|
4
|
+
type?: 'center' | 'bottom' | 'right';
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}>>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as motion from "motion/react-client";
|
|
3
|
+
import {
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
9
|
+
import { cn } from "./../../helpers/cn";
|
|
10
|
+
import { ToastProvider } from "../toast";
|
|
11
|
+
const centerVariants = {
|
|
12
|
+
open: {
|
|
13
|
+
opacity: 1,
|
|
14
|
+
scale: 1,
|
|
15
|
+
transition: {
|
|
16
|
+
duration: 0.2,
|
|
17
|
+
ease: [0.4, 0, 0.2, 1]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
closed: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
scale: 0.9,
|
|
23
|
+
transition: {
|
|
24
|
+
duration: 0.2,
|
|
25
|
+
ease: [0.4, 0, 0.2, 1]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const bottomVariants = {
|
|
30
|
+
open: {
|
|
31
|
+
opacity: 1,
|
|
32
|
+
y: 0,
|
|
33
|
+
transition: {
|
|
34
|
+
duration: 0.2,
|
|
35
|
+
ease: [0.4, 0, 0.2, 1]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
closed: {
|
|
39
|
+
opacity: 0,
|
|
40
|
+
y: "100%",
|
|
41
|
+
transition: {
|
|
42
|
+
duration: 0.2,
|
|
43
|
+
ease: [0.4, 0, 0.2, 1]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const rightVariants = {
|
|
48
|
+
open: {
|
|
49
|
+
opacity: 1,
|
|
50
|
+
x: 0,
|
|
51
|
+
transition: {
|
|
52
|
+
duration: 0.3,
|
|
53
|
+
ease: [0.4, 0, 0.2, 1]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
closed: {
|
|
57
|
+
opacity: 0,
|
|
58
|
+
x: "100%",
|
|
59
|
+
transition: {
|
|
60
|
+
duration: 0.3,
|
|
61
|
+
ease: [0.4, 0, 0.2, 1]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const Modal = ({ ref, type = "center", defaultOpen, isOpen, onClose, children }) => {
|
|
66
|
+
const dialogRef = useRef(null);
|
|
67
|
+
const [dialogOpen, setDialogOpen] = useState(defaultOpen ?? false);
|
|
68
|
+
const realDialogOpen = isOpen === true || isOpen === false ? isOpen : dialogOpen;
|
|
69
|
+
const realOnClose = useCallback(() => {
|
|
70
|
+
onClose?.();
|
|
71
|
+
if (isOpen === void 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
setDialogOpen(false);
|
|
75
|
+
}, [isOpen, onClose]);
|
|
76
|
+
const realRef = ref ?? dialogRef;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (realDialogOpen === realRef.current?.open) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (realDialogOpen) {
|
|
82
|
+
realRef.current?.showModal();
|
|
83
|
+
} else {
|
|
84
|
+
realRef.current?.close();
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
realDialogOpen,
|
|
88
|
+
realRef.current?.close,
|
|
89
|
+
realRef.current?.open,
|
|
90
|
+
realRef.current?.showModal
|
|
91
|
+
]);
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
motion.dialog,
|
|
94
|
+
{
|
|
95
|
+
animate: realDialogOpen ? "open" : "closed",
|
|
96
|
+
className: cn(
|
|
97
|
+
"border-border-mute bg-bg-base shadow-xl backdrop:bg-back-drop",
|
|
98
|
+
type === "center" && "m-auto max-h-lg w-5/6 max-w-2xl rounded-lg dark:border",
|
|
99
|
+
type === "bottom" && "mt-auto w-screen max-w-screen rounded-t-lg dark:border-t",
|
|
100
|
+
type === "right" && "ml-auto min-h-svh w-screen max-w-sm rounded-l-lg dark:border-l"
|
|
101
|
+
),
|
|
102
|
+
exit: "closed",
|
|
103
|
+
initial: "closed",
|
|
104
|
+
onClick: (e) => {
|
|
105
|
+
if (e.target === e.currentTarget) {
|
|
106
|
+
realRef.current?.close();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
onClose: realOnClose,
|
|
110
|
+
ref: realRef,
|
|
111
|
+
variants: type === "center" ? centerVariants : type === "bottom" ? bottomVariants : rightVariants,
|
|
112
|
+
children: /* @__PURE__ */ jsx(ToastProvider, { portalRef: realRef, position: "absolute", children })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
Modal
|
|
118
|
+
};
|