@novi-ui/raster 0.1.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/README.md +129 -0
- package/dist/accordion/accordion.d.mts +31 -0
- package/dist/accordion/accordion.d.mts.map +1 -0
- package/dist/accordion/accordion.mjs +88 -0
- package/dist/accordion/accordion.mjs.map +1 -0
- package/dist/accordion/accordion.styles.d.mts +61 -0
- package/dist/accordion/accordion.styles.d.mts.map +1 -0
- package/dist/accordion/accordion.styles.mjs +78 -0
- package/dist/accordion/accordion.styles.mjs.map +1 -0
- package/dist/accordion/index.d.mts +3 -0
- package/dist/avatar/avatar.d.mts +19 -0
- package/dist/avatar/avatar.d.mts.map +1 -0
- package/dist/avatar/avatar.mjs +57 -0
- package/dist/avatar/avatar.mjs.map +1 -0
- package/dist/avatar/avatar.styles.d.mts +49 -0
- package/dist/avatar/avatar.styles.d.mts.map +1 -0
- package/dist/avatar/avatar.styles.mjs +45 -0
- package/dist/avatar/avatar.styles.mjs.map +1 -0
- package/dist/avatar/index.d.mts +3 -0
- package/dist/badge/badge.d.mts +15 -0
- package/dist/badge/badge.d.mts.map +1 -0
- package/dist/badge/badge.mjs +39 -0
- package/dist/badge/badge.mjs.map +1 -0
- package/dist/badge/badge.styles.d.mts +67 -0
- package/dist/badge/badge.styles.d.mts.map +1 -0
- package/dist/badge/badge.styles.mjs +99 -0
- package/dist/badge/badge.styles.mjs.map +1 -0
- package/dist/badge/index.d.mts +3 -0
- package/dist/breadcrumbs/breadcrumbs.d.mts +33 -0
- package/dist/breadcrumbs/breadcrumbs.d.mts.map +1 -0
- package/dist/breadcrumbs/breadcrumbs.mjs +79 -0
- package/dist/breadcrumbs/breadcrumbs.mjs.map +1 -0
- package/dist/breadcrumbs/breadcrumbs.styles.d.mts +46 -0
- package/dist/breadcrumbs/breadcrumbs.styles.d.mts.map +1 -0
- package/dist/breadcrumbs/breadcrumbs.styles.mjs +35 -0
- package/dist/breadcrumbs/breadcrumbs.styles.mjs.map +1 -0
- package/dist/breadcrumbs/index.d.mts +3 -0
- package/dist/button/button.d.mts +14 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +75 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/button.styles.d.mts +82 -0
- package/dist/button/button.styles.d.mts.map +1 -0
- package/dist/button/button.styles.mjs +118 -0
- package/dist/button/button.styles.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/card/card.d.mts +51 -0
- package/dist/card/card.d.mts.map +1 -0
- package/dist/card/card.mjs +96 -0
- package/dist/card/card.mjs.map +1 -0
- package/dist/card/card.styles.d.mts +70 -0
- package/dist/card/card.styles.d.mts.map +1 -0
- package/dist/card/card.styles.mjs +62 -0
- package/dist/card/card.styles.mjs.map +1 -0
- package/dist/card/index.d.mts +3 -0
- package/dist/checkbox/checkbox.d.mts +24 -0
- package/dist/checkbox/checkbox.d.mts.map +1 -0
- package/dist/checkbox/checkbox.mjs +124 -0
- package/dist/checkbox/checkbox.mjs.map +1 -0
- package/dist/checkbox/checkbox.styles.d.mts +111 -0
- package/dist/checkbox/checkbox.styles.d.mts.map +1 -0
- package/dist/checkbox/checkbox.styles.mjs +89 -0
- package/dist/checkbox/checkbox.styles.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +3 -0
- package/dist/index.d.mts +61 -0
- package/dist/index.mjs +42 -0
- package/dist/input/index.d.mts +3 -0
- package/dist/input/input.d.mts +20 -0
- package/dist/input/input.d.mts.map +1 -0
- package/dist/input/input.mjs +86 -0
- package/dist/input/input.mjs.map +1 -0
- package/dist/input/input.styles.d.mts +81 -0
- package/dist/input/input.styles.d.mts.map +1 -0
- package/dist/input/input.styles.mjs +83 -0
- package/dist/input/input.styles.mjs.map +1 -0
- package/dist/menu/index.d.mts +3 -0
- package/dist/menu/menu.d.mts +62 -0
- package/dist/menu/menu.d.mts.map +1 -0
- package/dist/menu/menu.mjs +115 -0
- package/dist/menu/menu.mjs.map +1 -0
- package/dist/menu/menu.styles.d.mts +90 -0
- package/dist/menu/menu.styles.d.mts.map +1 -0
- package/dist/menu/menu.styles.mjs +40 -0
- package/dist/menu/menu.styles.mjs.map +1 -0
- package/dist/modal/index.d.mts +3 -0
- package/dist/modal/modal.d.mts +47 -0
- package/dist/modal/modal.d.mts.map +1 -0
- package/dist/modal/modal.mjs +110 -0
- package/dist/modal/modal.mjs.map +1 -0
- package/dist/modal/modal.styles.d.mts +58 -0
- package/dist/modal/modal.styles.d.mts.map +1 -0
- package/dist/modal/modal.styles.mjs +69 -0
- package/dist/modal/modal.styles.mjs.map +1 -0
- package/dist/popover/index.d.mts +3 -0
- package/dist/popover/popover.d.mts +40 -0
- package/dist/popover/popover.d.mts.map +1 -0
- package/dist/popover/popover.mjs +86 -0
- package/dist/popover/popover.mjs.map +1 -0
- package/dist/popover/popover.styles.d.mts +81 -0
- package/dist/popover/popover.styles.d.mts.map +1 -0
- package/dist/popover/popover.styles.mjs +53 -0
- package/dist/popover/popover.styles.mjs.map +1 -0
- package/dist/progress/index.d.mts +3 -0
- package/dist/progress/progress.d.mts +14 -0
- package/dist/progress/progress.d.mts.map +1 -0
- package/dist/progress/progress.mjs +54 -0
- package/dist/progress/progress.mjs.map +1 -0
- package/dist/progress/progress.styles.d.mts +70 -0
- package/dist/progress/progress.styles.d.mts.map +1 -0
- package/dist/progress/progress.styles.mjs +54 -0
- package/dist/progress/progress.styles.mjs.map +1 -0
- package/dist/radio/index.d.mts +3 -0
- package/dist/radio/radio.d.mts +22 -0
- package/dist/radio/radio.d.mts.map +1 -0
- package/dist/radio/radio.mjs +95 -0
- package/dist/radio/radio.mjs.map +1 -0
- package/dist/radio/radio.styles.d.mts +111 -0
- package/dist/radio/radio.styles.d.mts.map +1 -0
- package/dist/radio/radio.styles.mjs +88 -0
- package/dist/radio/radio.styles.mjs.map +1 -0
- package/dist/raster.css +92 -0
- package/dist/raster.scoped.css +92 -0
- package/dist/select/index.d.mts +3 -0
- package/dist/select/select.d.mts +33 -0
- package/dist/select/select.d.mts.map +1 -0
- package/dist/select/select.mjs +114 -0
- package/dist/select/select.mjs.map +1 -0
- package/dist/select/select.styles.d.mts +82 -0
- package/dist/select/select.styles.d.mts.map +1 -0
- package/dist/select/select.styles.mjs +93 -0
- package/dist/select/select.styles.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +3 -0
- package/dist/skeleton/skeleton.d.mts +15 -0
- package/dist/skeleton/skeleton.d.mts.map +1 -0
- package/dist/skeleton/skeleton.mjs +26 -0
- package/dist/skeleton/skeleton.mjs.map +1 -0
- package/dist/skeleton/skeleton.styles.d.mts +31 -0
- package/dist/skeleton/skeleton.styles.d.mts.map +1 -0
- package/dist/skeleton/skeleton.styles.mjs +22 -0
- package/dist/skeleton/skeleton.styles.mjs.map +1 -0
- package/dist/spinner/index.d.mts +3 -0
- package/dist/spinner/spinner.d.mts +15 -0
- package/dist/spinner/spinner.d.mts.map +1 -0
- package/dist/spinner/spinner.mjs +55 -0
- package/dist/spinner/spinner.mjs.map +1 -0
- package/dist/spinner/spinner.styles.d.mts +46 -0
- package/dist/spinner/spinner.styles.d.mts.map +1 -0
- package/dist/spinner/spinner.styles.mjs +37 -0
- package/dist/spinner/spinner.styles.mjs.map +1 -0
- package/dist/styles/focus-ring.mjs +23 -0
- package/dist/styles/focus-ring.mjs.map +1 -0
- package/dist/switch/index.d.mts +3 -0
- package/dist/switch/switch.d.mts +17 -0
- package/dist/switch/switch.d.mts.map +1 -0
- package/dist/switch/switch.mjs +57 -0
- package/dist/switch/switch.mjs.map +1 -0
- package/dist/switch/switch.styles.d.mts +58 -0
- package/dist/switch/switch.styles.d.mts.map +1 -0
- package/dist/switch/switch.styles.mjs +80 -0
- package/dist/switch/switch.styles.mjs.map +1 -0
- package/dist/tabs/index.d.mts +3 -0
- package/dist/tabs/tabs.d.mts +55 -0
- package/dist/tabs/tabs.d.mts.map +1 -0
- package/dist/tabs/tabs.mjs +84 -0
- package/dist/tabs/tabs.mjs.map +1 -0
- package/dist/tabs/tabs.styles.d.mts +55 -0
- package/dist/tabs/tabs.styles.d.mts.map +1 -0
- package/dist/tabs/tabs.styles.mjs +73 -0
- package/dist/tabs/tabs.styles.mjs.map +1 -0
- package/dist/textarea/index.d.mts +3 -0
- package/dist/textarea/textarea.d.mts +15 -0
- package/dist/textarea/textarea.d.mts.map +1 -0
- package/dist/textarea/textarea.mjs +70 -0
- package/dist/textarea/textarea.mjs.map +1 -0
- package/dist/textarea/textarea.styles.d.mts +73 -0
- package/dist/textarea/textarea.styles.d.mts.map +1 -0
- package/dist/textarea/textarea.styles.mjs +81 -0
- package/dist/textarea/textarea.styles.mjs.map +1 -0
- package/dist/toast/index.d.mts +3 -0
- package/dist/toast/toast.d.mts +38 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +86 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/dist/toast/toast.styles.d.mts +61 -0
- package/dist/toast/toast.styles.d.mts.map +1 -0
- package/dist/toast/toast.styles.mjs +59 -0
- package/dist/toast/toast.styles.mjs.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { MenuProps } from "@novi-ui/core";
|
|
3
|
+
//#region src/menu/menu.d.ts
|
|
4
|
+
interface MenuItemProps {
|
|
5
|
+
/** 選ばれたときに `onAction` へ渡る値 */
|
|
6
|
+
id: string;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
/** 補足説明。項目名だけで足りないときに使う */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** キーボードショートカットの表示。桁が揃うよう等幅数字にしている */
|
|
11
|
+
shortcut?: ReactNode;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Menu の項目。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <MenuItem id="rename" shortcut="⌘R">名前を変更</MenuItem>
|
|
20
|
+
*/
|
|
21
|
+
declare function MenuItemComponent({ id, isDisabled, description, shortcut, children, className }: MenuItemProps): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Menu の区切り線。
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <MenuSeparator />
|
|
27
|
+
*/
|
|
28
|
+
declare function MenuSeparator({ className }: {
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Menu の見出し付きグループ。項目が多いときに種類でまとめる。
|
|
33
|
+
*
|
|
34
|
+
* 語彙に `section` / `sectionLabel` があるのに実装がなく、
|
|
35
|
+
* T-41 の slot 語彙レビューで漏れが判明したもの。
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <MenuSection title="ファイル">
|
|
39
|
+
* <MenuItem id="rename">名前を変更</MenuItem>
|
|
40
|
+
* </MenuSection>
|
|
41
|
+
*/
|
|
42
|
+
declare function MenuSection({ title, children, className }: {
|
|
43
|
+
title: ReactNode;
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
className?: string;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* トリガーから開く操作の一覧。矢印キーで移動、Escape で閉じる。
|
|
49
|
+
*
|
|
50
|
+
* 最初の子要素がトリガーになる。残りが項目として扱われる。
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* <Menu onAction={(key) => run(key)}>
|
|
54
|
+
* <Button>操作</Button>
|
|
55
|
+
* <MenuItem id="rename">名前を変更</MenuItem>
|
|
56
|
+
* <MenuItem id="delete">削除</MenuItem>
|
|
57
|
+
* </Menu>
|
|
58
|
+
*/
|
|
59
|
+
declare function Menu({ placement, offset, isOpen, defaultOpen, onOpenChange, onAction, disabledKeys, children, className, classNames, id }: MenuProps): import("react").JSX.Element;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Menu, MenuItemComponent, MenuItemProps, MenuSection, MenuSeparator };
|
|
62
|
+
//# sourceMappingURL=menu.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.mts","names":[],"sources":["../../src/menu/menu.tsx"],"mappings":";;;UAeiB;;EAEf;EACA;;EAEA,cAAc;;EAEd,WAAW;EACX,WAAW;EACX;;;;;;;;iBASc,oBACd,IACA,YACA,aACA,UACA,UACA,aACC,gCAAa,IAAA;;;;;;;iBAoCA,gBAAgB;EAAe;oBAAoB,IAAA;;;;;;;;;;;;iBAiBnD,cACd,OACA,UACA;EAEA,OAAO;EACP,WAAW;EACX;oBACD,IAAA;;;;;;;;;;;;;iBAyBe,OACd,WACA,QACA,QACA,aACA,cACA,UACA,cACA,UACA,WACA,YACA,MACC,4BAAS,IAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { menuStyles } from "./menu.styles.mjs";
|
|
3
|
+
import { Header, Menu, MenuItem, MenuSection, MenuTrigger, Popover, Separator } from "react-aria-components";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/menu/menu.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Menu の項目。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <MenuItem id="rename" shortcut="⌘R">名前を変更</MenuItem>
|
|
11
|
+
*/
|
|
12
|
+
function MenuItemComponent({ id, isDisabled, description, shortcut, children, className }) {
|
|
13
|
+
const s = menuStyles();
|
|
14
|
+
return /* @__PURE__ */ jsxs(MenuItem, {
|
|
15
|
+
id,
|
|
16
|
+
isDisabled,
|
|
17
|
+
textValue: typeof children === "string" ? children : void 0,
|
|
18
|
+
"data-slot": "item",
|
|
19
|
+
className: s.item({ class: className }),
|
|
20
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
21
|
+
className: "flex flex-col min-w-0",
|
|
22
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
23
|
+
"data-slot": "itemLabel",
|
|
24
|
+
className: s.itemLabel(),
|
|
25
|
+
children
|
|
26
|
+
}), description !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
27
|
+
"data-slot": "itemDescription",
|
|
28
|
+
className: s.itemDescription(),
|
|
29
|
+
children: description
|
|
30
|
+
})]
|
|
31
|
+
}), shortcut !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
32
|
+
"data-slot": "itemShortcut",
|
|
33
|
+
className: s.itemShortcut(),
|
|
34
|
+
children: shortcut
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Menu の区切り線。
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <MenuSeparator />
|
|
43
|
+
*/
|
|
44
|
+
function MenuSeparator({ className }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
46
|
+
"data-slot": "separator",
|
|
47
|
+
className: menuStyles().separator({ class: className })
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Menu の見出し付きグループ。項目が多いときに種類でまとめる。
|
|
52
|
+
*
|
|
53
|
+
* 語彙に `section` / `sectionLabel` があるのに実装がなく、
|
|
54
|
+
* T-41 の slot 語彙レビューで漏れが判明したもの。
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* <MenuSection title="ファイル">
|
|
58
|
+
* <MenuItem id="rename">名前を変更</MenuItem>
|
|
59
|
+
* </MenuSection>
|
|
60
|
+
*/
|
|
61
|
+
function MenuSection$1({ title, children, className }) {
|
|
62
|
+
const s = menuStyles();
|
|
63
|
+
return /* @__PURE__ */ jsxs(MenuSection, {
|
|
64
|
+
"data-slot": "section",
|
|
65
|
+
className: s.section({ class: className }),
|
|
66
|
+
children: [/* @__PURE__ */ jsx(Header, {
|
|
67
|
+
"data-slot": "sectionLabel",
|
|
68
|
+
className: s.sectionLabel(),
|
|
69
|
+
children: title
|
|
70
|
+
}), children]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* トリガーから開く操作の一覧。矢印キーで移動、Escape で閉じる。
|
|
75
|
+
*
|
|
76
|
+
* 最初の子要素がトリガーになる。残りが項目として扱われる。
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* <Menu onAction={(key) => run(key)}>
|
|
80
|
+
* <Button>操作</Button>
|
|
81
|
+
* <MenuItem id="rename">名前を変更</MenuItem>
|
|
82
|
+
* <MenuItem id="delete">削除</MenuItem>
|
|
83
|
+
* </Menu>
|
|
84
|
+
*/
|
|
85
|
+
function Menu$1({ placement = "bottom", offset = 4, isOpen, defaultOpen, onOpenChange, onAction, disabledKeys, children, className, classNames, id }) {
|
|
86
|
+
const s = menuStyles();
|
|
87
|
+
const [trigger, ...rest] = Array.isArray(children) ? children : [children];
|
|
88
|
+
return /* @__PURE__ */ jsxs(MenuTrigger, {
|
|
89
|
+
isOpen,
|
|
90
|
+
defaultOpen,
|
|
91
|
+
onOpenChange,
|
|
92
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
93
|
+
"data-slot": "trigger",
|
|
94
|
+
className: s.trigger({ class: classNames?.trigger }),
|
|
95
|
+
children: trigger
|
|
96
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
97
|
+
placement,
|
|
98
|
+
offset,
|
|
99
|
+
"data-slot": "popover",
|
|
100
|
+
className: s.popover({ class: [className, classNames?.popover] }),
|
|
101
|
+
children: /* @__PURE__ */ jsx(Menu, {
|
|
102
|
+
id,
|
|
103
|
+
"data-slot": "list",
|
|
104
|
+
className: s.list({ class: classNames?.list }),
|
|
105
|
+
onAction: (key) => onAction?.(String(key)),
|
|
106
|
+
disabledKeys,
|
|
107
|
+
children: rest
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { Menu$1 as Menu, MenuItemComponent, MenuSection$1 as MenuSection, MenuSeparator };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=menu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.mjs","names":["MenuSection","RACMenuSection","Menu","RACMenu"],"sources":["../../src/menu/menu.tsx"],"sourcesContent":["'use client'\n\nimport type { MenuProps } from '@novi-ui/core'\nimport type { ReactNode } from 'react'\nimport {\n Header,\n MenuItem,\n MenuTrigger,\n Popover,\n Menu as RACMenu,\n MenuSection as RACMenuSection,\n Separator,\n} from 'react-aria-components'\nimport { menuStyles } from './menu.styles'\n\nexport interface MenuItemProps {\n /** 選ばれたときに `onAction` へ渡る値 */\n id: string\n isDisabled?: boolean\n /** 補足説明。項目名だけで足りないときに使う */\n description?: ReactNode\n /** キーボードショートカットの表示。桁が揃うよう等幅数字にしている */\n shortcut?: ReactNode\n children?: ReactNode\n className?: string\n}\n\n/**\n * Menu の項目。\n *\n * @example\n * <MenuItem id=\"rename\" shortcut=\"⌘R\">名前を変更</MenuItem>\n */\nexport function MenuItemComponent({\n id,\n isDisabled,\n description,\n shortcut,\n children,\n className,\n}: MenuItemProps) {\n const s = menuStyles()\n\n return (\n <MenuItem\n id={id}\n isDisabled={isDisabled}\n textValue={typeof children === 'string' ? children : undefined}\n data-slot=\"item\"\n className={s.item({ class: className })}\n >\n <span className=\"flex flex-col min-w-0\">\n <span data-slot=\"itemLabel\" className={s.itemLabel()}>\n {children}\n </span>\n {description !== undefined && (\n <span data-slot=\"itemDescription\" className={s.itemDescription()}>\n {description}\n </span>\n )}\n </span>\n {shortcut !== undefined && (\n <span data-slot=\"itemShortcut\" className={s.itemShortcut()}>\n {shortcut}\n </span>\n )}\n </MenuItem>\n )\n}\n\n/**\n * Menu の区切り線。\n *\n * @example\n * <MenuSeparator />\n */\nexport function MenuSeparator({ className }: { className?: string }) {\n return (\n <Separator data-slot=\"separator\" className={menuStyles().separator({ class: className })} />\n )\n}\n\n/**\n * Menu の見出し付きグループ。項目が多いときに種類でまとめる。\n *\n * 語彙に `section` / `sectionLabel` があるのに実装がなく、\n * T-41 の slot 語彙レビューで漏れが判明したもの。\n *\n * @example\n * <MenuSection title=\"ファイル\">\n * <MenuItem id=\"rename\">名前を変更</MenuItem>\n * </MenuSection>\n */\nexport function MenuSection({\n title,\n children,\n className,\n}: {\n title: ReactNode\n children?: ReactNode\n className?: string\n}) {\n const s = menuStyles()\n\n return (\n <RACMenuSection data-slot=\"section\" className={s.section({ class: className })}>\n <Header data-slot=\"sectionLabel\" className={s.sectionLabel()}>\n {title}\n </Header>\n {children}\n </RACMenuSection>\n )\n}\n\n/**\n * トリガーから開く操作の一覧。矢印キーで移動、Escape で閉じる。\n *\n * 最初の子要素がトリガーになる。残りが項目として扱われる。\n *\n * @example\n * <Menu onAction={(key) => run(key)}>\n * <Button>操作</Button>\n * <MenuItem id=\"rename\">名前を変更</MenuItem>\n * <MenuItem id=\"delete\">削除</MenuItem>\n * </Menu>\n */\nexport function Menu({\n placement = 'bottom',\n offset = 4,\n isOpen,\n defaultOpen,\n onOpenChange,\n onAction,\n disabledKeys,\n children,\n className,\n classNames,\n id,\n}: MenuProps) {\n const s = menuStyles()\n const items = Array.isArray(children) ? children : [children]\n const [trigger, ...rest] = items\n\n return (\n <MenuTrigger isOpen={isOpen} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <span data-slot=\"trigger\" className={s.trigger({ class: classNames?.trigger })}>\n {trigger}\n </span>\n <Popover\n placement={placement}\n offset={offset}\n data-slot=\"popover\"\n className={s.popover({ class: [className, classNames?.popover] })}\n >\n {/* RAC の Popover は id を受け取らないため Menu 本体に付ける */}\n <RACMenu\n id={id}\n data-slot=\"list\"\n className={s.list({ class: classNames?.list })}\n onAction={(key) => onAction?.(String(key))}\n disabledKeys={disabledKeys}\n >\n {rest}\n </RACMenu>\n </Popover>\n </MenuTrigger>\n )\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAgB,kBAAkB,EAChC,IACA,YACA,aACA,UACA,UACA,aACgB;CAChB,MAAM,IAAI,WAAW;CAErB,OACE,qBAAC,UAAD;EACM;EACQ;EACZ,WAAW,OAAO,aAAa,WAAW,WAAW,KAAA;EACrD,aAAU;EACV,WAAW,EAAE,KAAK,EAAE,OAAO,UAAU,CAAC;EALxC,UAAA,CAOE,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,aAAU;IAAY,WAAW,EAAE,UAAU;IAChD;GACG,CAAA,GACL,gBAAgB,KAAA,KACf,oBAAC,QAAD;IAAM,aAAU;IAAkB,WAAW,EAAE,gBAAgB;IAC5D,UAAA;GACG,CAAA,CAEJ;EACL,CAAA,GAAA,aAAa,KAAA,KACZ,oBAAC,QAAD;GAAM,aAAU;GAAe,WAAW,EAAE,aAAa;GACtD,UAAA;EACG,CAAA,CAEA;;AAEd;;;;;;;AAQA,SAAgB,cAAc,EAAE,aAAqC;CACnE,OACE,oBAAC,WAAD;EAAW,aAAU;EAAY,WAAW,WAAW,CAAC,CAAC,UAAU,EAAE,OAAO,UAAU,CAAC;CAAI,CAAA;AAE/F;;;;;;;;;;;;AAaA,SAAgBA,cAAY,EAC1B,OACA,UACA,aAKC;CACD,MAAM,IAAI,WAAW;CAErB,OACE,qBAACC,aAAD;EAAgB,aAAU;EAAU,WAAW,EAAE,QAAQ,EAAE,OAAO,UAAU,CAAC;EAA7E,UAAA,CACE,oBAAC,QAAD;GAAQ,aAAU;GAAe,WAAW,EAAE,aAAa;GACxD,UAAA;EACK,CAAA,GACP,QACa;;AAEpB;;;;;;;;;;;;;AAcA,SAAgBC,OAAK,EACnB,YAAY,UACZ,SAAS,GACT,QACA,aACA,cACA,UACA,cACA,UACA,WACA,YACA,MACY;CACZ,MAAM,IAAI,WAAW;CAErB,MAAM,CAAC,SAAS,GAAG,QADL,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ;CAG5D,OACE,qBAAC,aAAD;EAAqB;EAAqB;EAA2B;EAArE,UAAA,CACE,oBAAC,QAAD;GAAM,aAAU;GAAU,WAAW,EAAE,QAAQ,EAAE,OAAO,YAAY,QAAQ,CAAC;GAC1E,UAAA;EACG,CAAA,GACN,oBAAC,SAAD;GACa;GACH;GACR,aAAU;GACV,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,YAAY,OAAO,EAAE,CAAC;GAGhE,UAAA,oBAACC,MAAD;IACM;IACJ,aAAU;IACV,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;IAC7C,WAAW,QAAQ,WAAW,OAAO,GAAG,CAAC;IAC3B;IAEb,UAAA;GACM,CAAA;EACF,CAAA,CACE;;AAEjB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region src/menu/menu.styles.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Menu のスタイル定義。
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const myMenu = tv({ extend: menuStyles, slots: { popover: 'min-w-56' } })
|
|
7
|
+
*/
|
|
8
|
+
declare const menuStyles: import("tailwind-variants").TVReturnType<{
|
|
9
|
+
[key: string]: {
|
|
10
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
11
|
+
item?: import("tailwind-variants").ClassValue;
|
|
12
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
13
|
+
list?: import("tailwind-variants").ClassValue;
|
|
14
|
+
popover?: import("tailwind-variants").ClassValue;
|
|
15
|
+
itemLabel?: import("tailwind-variants").ClassValue;
|
|
16
|
+
itemDescription?: import("tailwind-variants").ClassValue;
|
|
17
|
+
itemShortcut?: import("tailwind-variants").ClassValue;
|
|
18
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
19
|
+
section?: import("tailwind-variants").ClassValue;
|
|
20
|
+
sectionLabel?: import("tailwind-variants").ClassValue;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
[x: string]: {
|
|
25
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
26
|
+
item?: import("tailwind-variants").ClassValue;
|
|
27
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
28
|
+
list?: import("tailwind-variants").ClassValue;
|
|
29
|
+
popover?: import("tailwind-variants").ClassValue;
|
|
30
|
+
itemLabel?: import("tailwind-variants").ClassValue;
|
|
31
|
+
itemDescription?: import("tailwind-variants").ClassValue;
|
|
32
|
+
itemShortcut?: import("tailwind-variants").ClassValue;
|
|
33
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
34
|
+
section?: import("tailwind-variants").ClassValue;
|
|
35
|
+
sectionLabel?: import("tailwind-variants").ClassValue;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} | {}, {
|
|
39
|
+
trigger: string;
|
|
40
|
+
popover: string;
|
|
41
|
+
list: string;
|
|
42
|
+
item: string;
|
|
43
|
+
itemLabel: string;
|
|
44
|
+
itemDescription: string;
|
|
45
|
+
itemShortcut: string;
|
|
46
|
+
separator: string;
|
|
47
|
+
section: string;
|
|
48
|
+
sectionLabel: string;
|
|
49
|
+
}, undefined, {
|
|
50
|
+
[key: string]: {
|
|
51
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
52
|
+
item?: import("tailwind-variants").ClassValue;
|
|
53
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
54
|
+
list?: import("tailwind-variants").ClassValue;
|
|
55
|
+
popover?: import("tailwind-variants").ClassValue;
|
|
56
|
+
itemLabel?: import("tailwind-variants").ClassValue;
|
|
57
|
+
itemDescription?: import("tailwind-variants").ClassValue;
|
|
58
|
+
itemShortcut?: import("tailwind-variants").ClassValue;
|
|
59
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
60
|
+
section?: import("tailwind-variants").ClassValue;
|
|
61
|
+
sectionLabel?: import("tailwind-variants").ClassValue;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {}, {
|
|
65
|
+
trigger: string;
|
|
66
|
+
popover: string;
|
|
67
|
+
list: string;
|
|
68
|
+
item: string;
|
|
69
|
+
itemLabel: string;
|
|
70
|
+
itemDescription: string;
|
|
71
|
+
itemShortcut: string;
|
|
72
|
+
separator: string;
|
|
73
|
+
section: string;
|
|
74
|
+
sectionLabel: string;
|
|
75
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
76
|
+
trigger: string;
|
|
77
|
+
popover: string;
|
|
78
|
+
list: string;
|
|
79
|
+
item: string;
|
|
80
|
+
itemLabel: string;
|
|
81
|
+
itemDescription: string;
|
|
82
|
+
itemShortcut: string;
|
|
83
|
+
separator: string;
|
|
84
|
+
section: string;
|
|
85
|
+
sectionLabel: string;
|
|
86
|
+
}>>;
|
|
87
|
+
type MenuStyleProps = Parameters<typeof menuStyles>[0];
|
|
88
|
+
//#endregion
|
|
89
|
+
export { MenuStyleProps, menuStyles };
|
|
90
|
+
//# sourceMappingURL=menu.styles.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.styles.d.mts","names":[],"sources":["../../src/menu/menu.styles.ts"],"mappings":";;;;;;;cAwCa,wCAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEX,iBAAiB,kBAAkB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
//#region src/menu/menu.styles.ts
|
|
3
|
+
const slots = {
|
|
4
|
+
trigger: "outline-none",
|
|
5
|
+
popover: [
|
|
6
|
+
"text-[var(--novi-color-fg)]",
|
|
7
|
+
"min-w-40 outline-none",
|
|
8
|
+
"bg-[var(--novi-color-bg)]",
|
|
9
|
+
"border border-[var(--novi-color-border-strong)]",
|
|
10
|
+
"rounded-[var(--novi-radius-none)]",
|
|
11
|
+
"shadow-none",
|
|
12
|
+
"data-[entering]:motion-safe:animate-[novi-fade-in_120ms_ease-out]"
|
|
13
|
+
].join(" "),
|
|
14
|
+
list: "outline-none p-1 flex flex-col",
|
|
15
|
+
item: [
|
|
16
|
+
"flex items-center gap-3 justify-between",
|
|
17
|
+
"px-2 py-1.5 cursor-pointer outline-none",
|
|
18
|
+
"text-[var(--novi-color-fg)]",
|
|
19
|
+
"rounded-[var(--novi-radius-none)]",
|
|
20
|
+
"data-[focused]:bg-[var(--novi-color-subtle)]",
|
|
21
|
+
"data-[disabled]:opacity-40 data-[disabled]:cursor-default"
|
|
22
|
+
].join(" "),
|
|
23
|
+
itemLabel: "truncate",
|
|
24
|
+
itemDescription: "text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)]",
|
|
25
|
+
itemShortcut: "shrink-0 text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)] tabular-nums",
|
|
26
|
+
separator: "my-1 h-px bg-[var(--novi-color-border)]",
|
|
27
|
+
section: "flex flex-col",
|
|
28
|
+
sectionLabel: "px-2 pt-2 pb-1 text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)] tracking-wide"
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Menu のスタイル定義。
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const myMenu = tv({ extend: menuStyles, slots: { popover: 'min-w-56' } })
|
|
35
|
+
*/
|
|
36
|
+
const menuStyles = tv({ slots });
|
|
37
|
+
//#endregion
|
|
38
|
+
export { menuStyles };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=menu.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.styles.mjs","names":[],"sources":["../../src/menu/menu.styles.ts"],"sourcesContent":["import type { menuRequiredSlots, menuSlots, SlotMap } from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\n\nconst slots = {\n trigger: 'outline-none',\n popover: [\n 'text-[var(--novi-color-fg)]',\n 'min-w-40 outline-none',\n 'bg-[var(--novi-color-bg)]',\n 'border border-[var(--novi-color-border-strong)]',\n 'rounded-[var(--novi-radius-none)]',\n 'shadow-none',\n 'data-[entering]:motion-safe:animate-[novi-fade-in_120ms_ease-out]',\n ].join(' '),\n list: 'outline-none p-1 flex flex-col',\n item: [\n 'flex items-center gap-3 justify-between',\n 'px-2 py-1.5 cursor-pointer outline-none',\n 'text-[var(--novi-color-fg)]',\n 'rounded-[var(--novi-radius-none)]',\n 'data-[focused]:bg-[var(--novi-color-subtle)]',\n 'data-[disabled]:opacity-40 data-[disabled]:cursor-default',\n ].join(' '),\n itemLabel: 'truncate',\n itemDescription: 'text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)]',\n // ショートカットは桁を揃える。等幅数字にしないと縦の線が揃わない\n itemShortcut:\n 'shrink-0 text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)] tabular-nums',\n separator: 'my-1 h-px bg-[var(--novi-color-border)]',\n section: 'flex flex-col',\n sectionLabel:\n 'px-2 pt-2 pb-1 text-[length:var(--novi-text-xs)] text-[var(--novi-color-muted)] tracking-wide',\n} satisfies SlotMap<typeof menuSlots, (typeof menuRequiredSlots)[number]>\n\n/**\n * Menu のスタイル定義。\n *\n * @example\n * const myMenu = tv({ extend: menuStyles, slots: { popover: 'min-w-56' } })\n */\nexport const menuStyles = tv({ slots })\n\nexport type MenuStyleProps = Parameters<typeof menuStyles>[0]\n"],"mappings":";;AAGA,MAAM,QAAQ;CACZ,SAAS;CACT,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,MAAM;CACN,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,WAAW;CACX,iBAAiB;CAEjB,cACE;CACF,WAAW;CACX,SAAS;CACT,cACE;AACJ;;;;;;;AAQA,MAAa,aAAa,GAAG,EAAE,MAAM,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ModalProps } from "@novi-ui/core";
|
|
3
|
+
//#region src/modal/modal.d.ts
|
|
4
|
+
interface PartProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Modal の見出し。閉じるボタンと同じ行に並ぶ。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
13
|
+
*/
|
|
14
|
+
declare function ModalTitle({ children, className }: PartProps): import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Modal の本体。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
20
|
+
*/
|
|
21
|
+
declare function ModalBody({ children, className }: PartProps): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Modal の操作列。右揃えで並ぶ。
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <ModalFooter>
|
|
27
|
+
* <Button variant="outline">キャンセル</Button>
|
|
28
|
+
* <Button color="danger">削除</Button>
|
|
29
|
+
* </ModalFooter>
|
|
30
|
+
*/
|
|
31
|
+
declare function ModalFooter({ children, className }: PartProps): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* モーダルダイアログ。開いている間フォーカスは内側に閉じ込められ、Escape で閉じる。
|
|
34
|
+
*
|
|
35
|
+
* Raster では中央に置き、閉じるボタンをヘッダー右上に出す。
|
|
36
|
+
* 影を使わないため、階層は背景の暗転と 1px の境界線で作る。
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Modal isOpen={isOpen} onOpenChange={setIsOpen}>
|
|
40
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
41
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
42
|
+
* </Modal>
|
|
43
|
+
*/
|
|
44
|
+
declare function Modal({ size, radius, isOpen, defaultOpen, onOpenChange, isDismissable, isKeyboardDismissDisabled, children, className, classNames, id }: ModalProps): import("react").JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Modal, ModalBody, ModalFooter, ModalTitle };
|
|
47
|
+
//# sourceMappingURL=modal.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.mts","names":[],"sources":["../../src/modal/modal.tsx"],"mappings":";;;UAOU;EACR,WAAW;EACX;;;;;;;;iBASc,aAAa,UAAU,aAAa,4BAAS,IAAA;;;;;;;iBAsB7C,YAAY,UAAU,aAAa,4BAAS,IAAA;;;;;;;;;;iBAiB5C,cAAc,UAAU,aAAa,4BAAS,IAAA;;;;;;;;;;;;;iBAoB9C,QACd,MACA,QACA,QACA,aACA,cACA,eACA,2BACA,UACA,WACA,YACA,MACC,6BAAU,IAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { modalStyles } from "./modal.styles.mjs";
|
|
3
|
+
import { Button, Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/modal/modal.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Modal の見出し。閉じるボタンと同じ行に並ぶ。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
11
|
+
*/
|
|
12
|
+
function ModalTitle({ children, className }) {
|
|
13
|
+
const s = modalStyles();
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
"data-slot": "header",
|
|
16
|
+
className: s.header(),
|
|
17
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
18
|
+
slot: "title",
|
|
19
|
+
"data-slot": "title",
|
|
20
|
+
className: s.title({ class: className }),
|
|
21
|
+
children
|
|
22
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
23
|
+
slot: "close",
|
|
24
|
+
"data-slot": "closeButton",
|
|
25
|
+
className: s.closeButton(),
|
|
26
|
+
"aria-label": "閉じる",
|
|
27
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
28
|
+
viewBox: "0 0 16 16",
|
|
29
|
+
width: "1em",
|
|
30
|
+
height: "1em",
|
|
31
|
+
fill: "none",
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
34
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: "1.5"
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Modal の本体。
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
47
|
+
*/
|
|
48
|
+
function ModalBody({ children, className }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
"data-slot": "body",
|
|
51
|
+
className: modalStyles().body({ class: className }),
|
|
52
|
+
children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Modal の操作列。右揃えで並ぶ。
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* <ModalFooter>
|
|
60
|
+
* <Button variant="outline">キャンセル</Button>
|
|
61
|
+
* <Button color="danger">削除</Button>
|
|
62
|
+
* </ModalFooter>
|
|
63
|
+
*/
|
|
64
|
+
function ModalFooter({ children, className }) {
|
|
65
|
+
return /* @__PURE__ */ jsx("div", {
|
|
66
|
+
"data-slot": "footer",
|
|
67
|
+
className: modalStyles().footer({ class: className }),
|
|
68
|
+
children
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* モーダルダイアログ。開いている間フォーカスは内側に閉じ込められ、Escape で閉じる。
|
|
73
|
+
*
|
|
74
|
+
* Raster では中央に置き、閉じるボタンをヘッダー右上に出す。
|
|
75
|
+
* 影を使わないため、階層は背景の暗転と 1px の境界線で作る。
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* <Modal isOpen={isOpen} onOpenChange={setIsOpen}>
|
|
79
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
80
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
81
|
+
* </Modal>
|
|
82
|
+
*/
|
|
83
|
+
function Modal$1({ size, radius, isOpen, defaultOpen, onOpenChange, isDismissable = true, isKeyboardDismissDisabled, children, className, classNames, id }) {
|
|
84
|
+
const s = modalStyles({
|
|
85
|
+
size,
|
|
86
|
+
radius
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
89
|
+
isOpen,
|
|
90
|
+
defaultOpen,
|
|
91
|
+
onOpenChange,
|
|
92
|
+
isDismissable,
|
|
93
|
+
isKeyboardDismissDisabled,
|
|
94
|
+
"data-slot": "backdrop",
|
|
95
|
+
className: s.backdrop({ class: classNames?.backdrop }),
|
|
96
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
97
|
+
"data-slot": "panel",
|
|
98
|
+
className: s.panel({ class: [className, classNames?.panel] }),
|
|
99
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
100
|
+
id,
|
|
101
|
+
className: "outline-none",
|
|
102
|
+
children
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { Modal$1 as Modal, ModalBody, ModalFooter, ModalTitle };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=modal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.mjs","names":["Modal","RACModal"],"sources":["../../src/modal/modal.tsx"],"sourcesContent":["'use client'\n\nimport type { ModalProps } from '@novi-ui/core'\nimport type { ReactNode } from 'react'\nimport { Button, Dialog, Heading, ModalOverlay, Modal as RACModal } from 'react-aria-components'\nimport { modalStyles } from './modal.styles'\n\ninterface PartProps {\n children?: ReactNode\n className?: string\n}\n\n/**\n * Modal の見出し。閉じるボタンと同じ行に並ぶ。\n *\n * @example\n * <ModalTitle>削除しますか</ModalTitle>\n */\nexport function ModalTitle({ children, className }: PartProps) {\n const s = modalStyles()\n return (\n <div data-slot=\"header\" className={s.header()}>\n <Heading slot=\"title\" data-slot=\"title\" className={s.title({ class: className })}>\n {children}\n </Heading>\n <Button slot=\"close\" data-slot=\"closeButton\" className={s.closeButton()} aria-label=\"閉じる\">\n <svg viewBox=\"0 0 16 16\" width=\"1em\" height=\"1em\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4 4l8 8M12 4l-8 8\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </svg>\n </Button>\n </div>\n )\n}\n\n/**\n * Modal の本体。\n *\n * @example\n * <ModalBody>この操作は取り消せません。</ModalBody>\n */\nexport function ModalBody({ children, className }: PartProps) {\n return (\n <div data-slot=\"body\" className={modalStyles().body({ class: className })}>\n {children}\n </div>\n )\n}\n\n/**\n * Modal の操作列。右揃えで並ぶ。\n *\n * @example\n * <ModalFooter>\n * <Button variant=\"outline\">キャンセル</Button>\n * <Button color=\"danger\">削除</Button>\n * </ModalFooter>\n */\nexport function ModalFooter({ children, className }: PartProps) {\n return (\n <div data-slot=\"footer\" className={modalStyles().footer({ class: className })}>\n {children}\n </div>\n )\n}\n\n/**\n * モーダルダイアログ。開いている間フォーカスは内側に閉じ込められ、Escape で閉じる。\n *\n * Raster では中央に置き、閉じるボタンをヘッダー右上に出す。\n * 影を使わないため、階層は背景の暗転と 1px の境界線で作る。\n *\n * @example\n * <Modal isOpen={isOpen} onOpenChange={setIsOpen}>\n * <ModalTitle>削除しますか</ModalTitle>\n * <ModalBody>この操作は取り消せません。</ModalBody>\n * </Modal>\n */\nexport function Modal({\n size,\n radius,\n isOpen,\n defaultOpen,\n onOpenChange,\n isDismissable = true,\n isKeyboardDismissDisabled,\n children,\n className,\n classNames,\n id,\n}: ModalProps) {\n const s = modalStyles({ size, radius })\n\n return (\n <ModalOverlay\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n data-slot=\"backdrop\"\n className={s.backdrop({ class: classNames?.backdrop })}\n >\n <RACModal data-slot=\"panel\" className={s.panel({ class: [className, classNames?.panel] })}>\n {/* RAC の ModalOverlay / Modal は id を受け取らないため Dialog に付ける */}\n <Dialog id={id} className=\"outline-none\">\n {children}\n </Dialog>\n </RACModal>\n </ModalOverlay>\n )\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAgB,WAAW,EAAE,UAAU,aAAwB;CAC7D,MAAM,IAAI,YAAY;CACtB,OACE,qBAAC,OAAD;EAAK,aAAU;EAAS,WAAW,EAAE,OAAO;EAA5C,UAAA,CACE,oBAAC,SAAD;GAAS,MAAK;GAAQ,aAAU;GAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,UAAU,CAAC;GAC5E;EACM,CAAA,GACT,oBAAC,QAAD;GAAQ,MAAK;GAAQ,aAAU;GAAc,WAAW,EAAE,YAAY;GAAG,cAAW;GAClF,UAAA,oBAAC,OAAD;IAAK,SAAQ;IAAY,OAAM;IAAM,QAAO;IAAM,MAAK;IAAO,eAAY;IACxE,UAAA,oBAAC,QAAD;KAAM,GAAE;KAAqB,QAAO;KAAe,aAAY;IAAO,CAAA;GACnE,CAAA;EACC,CAAA,CACL;;AAET;;;;;;;AAQA,SAAgB,UAAU,EAAE,UAAU,aAAwB;CAC5D,OACE,oBAAC,OAAD;EAAK,aAAU;EAAO,WAAW,YAAY,CAAC,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC;EACrE;CACE,CAAA;AAET;;;;;;;;;;AAWA,SAAgB,YAAY,EAAE,UAAU,aAAwB;CAC9D,OACE,oBAAC,OAAD;EAAK,aAAU;EAAS,WAAW,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,UAAU,CAAC;EACzE;CACE,CAAA;AAET;;;;;;;;;;;;;AAcA,SAAgBA,QAAM,EACpB,MACA,QACA,QACA,aACA,cACA,gBAAgB,MAChB,2BACA,UACA,WACA,YACA,MACa;CACb,MAAM,IAAI,YAAY;EAAE;EAAM;CAAO,CAAC;CAEtC,OACE,oBAAC,cAAD;EACU;EACK;EACC;EACC;EACY;EAC3B,aAAU;EACV,WAAW,EAAE,SAAS,EAAE,OAAO,YAAY,SAAS,CAAC;EAErD,UAAA,oBAACC,OAAD;GAAU,aAAU;GAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,YAAY,KAAK,EAAE,CAAC;GAEtF,UAAA,oBAAC,QAAD;IAAY;IAAI,WAAU;IACvB;GACK,CAAA;EACA,CAAA;CACE,CAAA;AAElB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { VariantMap } from "@novi-ui/core";
|
|
2
|
+
//#region src/modal/modal.styles.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Modal のスタイル定義。
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const myModal = tv({ extend: modalStyles, slots: { panel: 'border-2' } })
|
|
8
|
+
*/
|
|
9
|
+
declare const modalStyles: import("tailwind-variants").TVReturnType<{
|
|
10
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
11
|
+
panel: string;
|
|
12
|
+
}>;
|
|
13
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
14
|
+
panel: string;
|
|
15
|
+
}>;
|
|
16
|
+
}, {
|
|
17
|
+
backdrop: string;
|
|
18
|
+
panel: string;
|
|
19
|
+
header: string;
|
|
20
|
+
title: string;
|
|
21
|
+
closeButton: string;
|
|
22
|
+
body: string;
|
|
23
|
+
footer: string;
|
|
24
|
+
}, undefined, {
|
|
25
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
26
|
+
panel: string;
|
|
27
|
+
}>;
|
|
28
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
29
|
+
panel: string;
|
|
30
|
+
}>;
|
|
31
|
+
}, {
|
|
32
|
+
backdrop: string;
|
|
33
|
+
panel: string;
|
|
34
|
+
header: string;
|
|
35
|
+
title: string;
|
|
36
|
+
closeButton: string;
|
|
37
|
+
body: string;
|
|
38
|
+
footer: string;
|
|
39
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
40
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
41
|
+
panel: string;
|
|
42
|
+
}>;
|
|
43
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
44
|
+
panel: string;
|
|
45
|
+
}>;
|
|
46
|
+
}, {
|
|
47
|
+
backdrop: string;
|
|
48
|
+
panel: string;
|
|
49
|
+
header: string;
|
|
50
|
+
title: string;
|
|
51
|
+
closeButton: string;
|
|
52
|
+
body: string;
|
|
53
|
+
footer: string;
|
|
54
|
+
}>>;
|
|
55
|
+
type ModalStyleProps = Parameters<typeof modalStyles>[0];
|
|
56
|
+
//#endregion
|
|
57
|
+
export { ModalStyleProps, modalStyles };
|
|
58
|
+
//# sourceMappingURL=modal.styles.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.styles.d.mts","names":[],"sources":["../../src/modal/modal.styles.ts"],"mappings":";;;;;;;;cAsEa,yCAAW;;IArB2B;;;IAOL;;;;;;;;;;;;IAPK;;;IAOL;;;;;;;;;;;;IAPK;;;IAOL;;;;;;;;;;;KAoBlC,kBAAkB,kBAAkB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { focusRing } from "../styles/focus-ring.mjs";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
//#region src/modal/modal.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raster の Modal は **中央配置・閉じるボタンはヘッダー右上**(architecture.md §5 テーマA)。
|
|
6
|
+
*
|
|
7
|
+
* 影を使わないので、階層は backdrop の暗転と 1px の境界線だけで作る。
|
|
8
|
+
*/
|
|
9
|
+
const slots = {
|
|
10
|
+
backdrop: [
|
|
11
|
+
"fixed inset-0 z-50 grid place-items-center p-4",
|
|
12
|
+
"bg-[var(--novi-color-overlay)]",
|
|
13
|
+
"data-[entering]:motion-safe:animate-[novi-fade-in_120ms_ease-out]"
|
|
14
|
+
].join(" "),
|
|
15
|
+
panel: [
|
|
16
|
+
"text-[var(--novi-color-fg)]",
|
|
17
|
+
"w-full outline-none",
|
|
18
|
+
"bg-[var(--novi-color-bg)]",
|
|
19
|
+
"border border-[var(--novi-color-border-strong)]",
|
|
20
|
+
"shadow-none",
|
|
21
|
+
"max-h-[calc(100dvh-2rem)] overflow-auto"
|
|
22
|
+
].join(" "),
|
|
23
|
+
header: [
|
|
24
|
+
"flex items-baseline justify-between gap-4",
|
|
25
|
+
"px-6 pt-5 pb-4",
|
|
26
|
+
"border-b border-[var(--novi-color-border)]"
|
|
27
|
+
].join(" "),
|
|
28
|
+
title: "text-[length:var(--novi-text-lg)] font-medium tracking-tight text-[var(--novi-color-fg)]",
|
|
29
|
+
closeButton: [
|
|
30
|
+
"shrink-0 grid place-items-center size-8 -mr-2",
|
|
31
|
+
"text-[var(--novi-color-muted)] hover:text-[var(--novi-color-fg)]",
|
|
32
|
+
"transition-colors duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]",
|
|
33
|
+
focusRing
|
|
34
|
+
].join(" "),
|
|
35
|
+
body: "px-6 py-5 text-[var(--novi-color-fg)] leading-[var(--novi-leading-body)]",
|
|
36
|
+
footer: ["flex justify-end gap-2 px-6 py-4", "border-t border-[var(--novi-color-border)]"].join(" ")
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Modal のスタイル定義。
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const myModal = tv({ extend: modalStyles, slots: { panel: 'border-2' } })
|
|
43
|
+
*/
|
|
44
|
+
const modalStyles = tv({
|
|
45
|
+
slots,
|
|
46
|
+
variants: {
|
|
47
|
+
size: {
|
|
48
|
+
sm: { panel: "max-w-sm" },
|
|
49
|
+
md: { panel: "max-w-md" },
|
|
50
|
+
lg: { panel: "max-w-lg" },
|
|
51
|
+
full: { panel: "max-w-none h-[calc(100dvh-2rem)]" }
|
|
52
|
+
},
|
|
53
|
+
radius: {
|
|
54
|
+
none: { panel: "rounded-[var(--novi-radius-none)]" },
|
|
55
|
+
sm: { panel: "rounded-[var(--novi-radius-sm)]" },
|
|
56
|
+
md: { panel: "rounded-[var(--novi-radius-md)]" },
|
|
57
|
+
lg: { panel: "rounded-[var(--novi-radius-lg)]" },
|
|
58
|
+
full: { panel: "rounded-[var(--novi-radius-full)]" }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
size: "md",
|
|
63
|
+
radius: "none"
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
export { modalStyles };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=modal.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.styles.mjs","names":[],"sources":["../../src/modal/modal.styles.ts"],"sourcesContent":["import type {\n modalRequiredSlots,\n modalSlots,\n NoviRadius,\n NoviSize,\n SlotMap,\n VariantMap,\n} from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\nimport { focusRing } from '../styles/focus-ring'\n\n/**\n * Raster の Modal は **中央配置・閉じるボタンはヘッダー右上**(architecture.md §5 テーマA)。\n *\n * 影を使わないので、階層は backdrop の暗転と 1px の境界線だけで作る。\n */\nconst slots = {\n backdrop: [\n 'fixed inset-0 z-50 grid place-items-center p-4',\n 'bg-[var(--novi-color-overlay)]',\n 'data-[entering]:motion-safe:animate-[novi-fade-in_120ms_ease-out]',\n ].join(' '),\n panel: [\n 'text-[var(--novi-color-fg)]',\n 'w-full outline-none',\n 'bg-[var(--novi-color-bg)]',\n 'border border-[var(--novi-color-border-strong)]',\n 'shadow-none',\n 'max-h-[calc(100dvh-2rem)] overflow-auto',\n ].join(' '),\n // 見出しと閉じるを同じ行に置く。情報の階層を横方向で作る\n header: [\n 'flex items-baseline justify-between gap-4',\n 'px-6 pt-5 pb-4',\n 'border-b border-[var(--novi-color-border)]',\n ].join(' '),\n title: 'text-[length:var(--novi-text-lg)] font-medium tracking-tight text-[var(--novi-color-fg)]',\n closeButton: [\n 'shrink-0 grid place-items-center size-8 -mr-2',\n 'text-[var(--novi-color-muted)] hover:text-[var(--novi-color-fg)]',\n 'transition-colors duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n focusRing,\n ].join(' '),\n body: 'px-6 py-5 text-[var(--novi-color-fg)] leading-[var(--novi-leading-body)]',\n footer: ['flex justify-end gap-2 px-6 py-4', 'border-t border-[var(--novi-color-border)]'].join(\n ' ',\n ),\n} satisfies SlotMap<typeof modalSlots, (typeof modalRequiredSlots)[number]>\n\nconst size: VariantMap<NoviSize | 'full', { panel: string }> = {\n sm: { panel: 'max-w-sm' },\n md: { panel: 'max-w-md' },\n lg: { panel: 'max-w-lg' },\n full: { panel: 'max-w-none h-[calc(100dvh-2rem)]' },\n}\n\nconst radius: VariantMap<NoviRadius, { panel: string }> = {\n none: { panel: 'rounded-[var(--novi-radius-none)]' },\n sm: { panel: 'rounded-[var(--novi-radius-sm)]' },\n md: { panel: 'rounded-[var(--novi-radius-md)]' },\n lg: { panel: 'rounded-[var(--novi-radius-lg)]' },\n full: { panel: 'rounded-[var(--novi-radius-full)]' },\n}\n\n/**\n * Modal のスタイル定義。\n *\n * @example\n * const myModal = tv({ extend: modalStyles, slots: { panel: 'border-2' } })\n */\nexport const modalStyles = tv({\n slots,\n variants: { size, radius },\n defaultVariants: { size: 'md', radius: 'none' },\n})\n\nexport type ModalStyleProps = Parameters<typeof modalStyles>[0]\n"],"mappings":";;;;;;;;AAgBA,MAAM,QAAQ;CACZ,UAAU;EACR;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CAEV,QAAQ;EACN;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,OAAO;CACP,aAAa;EACX;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,MAAM;CACN,QAAQ,CAAC,oCAAoC,4CAA4C,CAAC,CAAC,KACzF,GACF;AACF;;;;;;;AAuBA,MAAa,cAAc,GAAG;CAC5B;CACA,UAAU;EAAE;GAtBZ,IAAI,EAAE,OAAO,WAAW;GACxB,IAAI,EAAE,OAAO,WAAW;GACxB,IAAI,EAAE,OAAO,WAAW;GACxB,MAAM,EAAE,OAAO,mCAAmC;EAmBtC;EAAM;GAflB,MAAM,EAAE,OAAO,oCAAoC;GACnD,IAAI,EAAE,OAAO,kCAAkC;GAC/C,IAAI,EAAE,OAAO,kCAAkC;GAC/C,IAAI,EAAE,OAAO,kCAAkC;GAC/C,MAAM,EAAE,OAAO,oCAAoC;EAWjC;CAAO;CACzB,iBAAiB;EAAE,MAAM;EAAM,QAAQ;CAAO;AAChD,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Popover, PopoverContent, Tooltip } from "./popover.mjs";
|
|
2
|
+
import { PopoverStyleProps, TooltipStyleProps, popoverStyles, tooltipStyles } from "./popover.styles.mjs";
|
|
3
|
+
export { Popover, PopoverContent, type PopoverStyleProps, Tooltip, type TooltipStyleProps, popoverStyles, tooltipStyles };
|