@novi-ui/flatlay 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 +418 -0
- package/dist/accordion/accordion.d.mts +35 -0
- package/dist/accordion/accordion.d.mts.map +1 -0
- package/dist/accordion/accordion.mjs +74 -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 +91 -0
- package/dist/accordion/accordion.styles.mjs.map +1 -0
- package/dist/accordion/index.d.mts +3 -0
- package/dist/avatar/avatar.d.mts +22 -0
- package/dist/avatar/avatar.d.mts.map +1 -0
- package/dist/avatar/avatar.mjs +60 -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 +55 -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 +110 -0
- package/dist/badge/badge.styles.mjs.map +1 -0
- package/dist/badge/index.d.mts +3 -0
- package/dist/breadcrumbs/breadcrumbs.d.mts +36 -0
- package/dist/breadcrumbs/breadcrumbs.d.mts.map +1 -0
- package/dist/breadcrumbs/breadcrumbs.mjs +82 -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 +45 -0
- package/dist/breadcrumbs/breadcrumbs.styles.mjs.map +1 -0
- package/dist/breadcrumbs/index.d.mts +3 -0
- package/dist/button/button.d.mts +18 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +79 -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 +137 -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 +73 -0
- package/dist/card/card.styles.d.mts.map +1 -0
- package/dist/card/card.styles.mjs +72 -0
- package/dist/card/card.styles.mjs.map +1 -0
- package/dist/card/index.d.mts +3 -0
- package/dist/checkbox/checkbox.d.mts +27 -0
- package/dist/checkbox/checkbox.d.mts.map +1 -0
- package/dist/checkbox/checkbox.mjs +109 -0
- package/dist/checkbox/checkbox.mjs.map +1 -0
- package/dist/checkbox/checkbox.styles.d.mts +114 -0
- package/dist/checkbox/checkbox.styles.d.mts.map +1 -0
- package/dist/checkbox/checkbox.styles.mjs +105 -0
- package/dist/checkbox/checkbox.styles.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +3 -0
- package/dist/color-picker/color-picker.d.mts +30 -0
- package/dist/color-picker/color-picker.d.mts.map +1 -0
- package/dist/color-picker/color-picker.mjs +100 -0
- package/dist/color-picker/color-picker.mjs.map +1 -0
- package/dist/color-picker/color-picker.styles.d.mts +91 -0
- package/dist/color-picker/color-picker.styles.d.mts.map +1 -0
- package/dist/color-picker/color-picker.styles.mjs +79 -0
- package/dist/color-picker/color-picker.styles.mjs.map +1 -0
- package/dist/color-picker/index.d.mts +3 -0
- package/dist/flatlay.css +381 -0
- package/dist/flatlay.scoped.css +381 -0
- package/dist/index.d.mts +67 -0
- package/dist/index.mjs +46 -0
- package/dist/input/index.d.mts +3 -0
- package/dist/input/input.d.mts +23 -0
- package/dist/input/input.d.mts.map +1 -0
- package/dist/input/input.mjs +89 -0
- package/dist/input/input.mjs.map +1 -0
- package/dist/input/input.styles.d.mts +97 -0
- package/dist/input/input.styles.d.mts.map +1 -0
- package/dist/input/input.styles.mjs +96 -0
- package/dist/input/input.styles.mjs.map +1 -0
- package/dist/menu/index.d.mts +3 -0
- package/dist/menu/menu.d.mts +66 -0
- package/dist/menu/menu.d.mts.map +1 -0
- package/dist/menu/menu.mjs +118 -0
- package/dist/menu/menu.mjs.map +1 -0
- package/dist/menu/menu.styles.d.mts +114 -0
- package/dist/menu/menu.styles.d.mts.map +1 -0
- package/dist/menu/menu.styles.mjs +66 -0
- package/dist/menu/menu.styles.mjs.map +1 -0
- package/dist/modal/index.d.mts +3 -0
- package/dist/modal/modal.d.mts +55 -0
- package/dist/modal/modal.d.mts.map +1 -0
- package/dist/modal/modal.mjs +120 -0
- package/dist/modal/modal.mjs.map +1 -0
- package/dist/modal/modal.styles.d.mts +70 -0
- package/dist/modal/modal.styles.d.mts.map +1 -0
- package/dist/modal/modal.styles.mjs +83 -0
- package/dist/modal/modal.styles.mjs.map +1 -0
- package/dist/popover/index.d.mts +3 -0
- package/dist/popover/popover.d.mts +33 -0
- package/dist/popover/popover.d.mts.map +1 -0
- package/dist/popover/popover.mjs +57 -0
- package/dist/popover/popover.mjs.map +1 -0
- package/dist/popover/popover.styles.d.mts +40 -0
- package/dist/popover/popover.styles.d.mts.map +1 -0
- package/dist/popover/popover.styles.mjs +47 -0
- package/dist/popover/popover.styles.mjs.map +1 -0
- package/dist/progress/index.d.mts +3 -0
- package/dist/progress/progress.d.mts +15 -0
- package/dist/progress/progress.d.mts.map +1 -0
- package/dist/progress/progress.mjs +55 -0
- package/dist/progress/progress.mjs.map +1 -0
- package/dist/progress/progress.styles.d.mts +100 -0
- package/dist/progress/progress.styles.d.mts.map +1 -0
- package/dist/progress/progress.styles.mjs +65 -0
- package/dist/progress/progress.styles.mjs.map +1 -0
- package/dist/radio/index.d.mts +3 -0
- package/dist/radio/radio.d.mts +25 -0
- package/dist/radio/radio.d.mts.map +1 -0
- package/dist/radio/radio.mjs +99 -0
- package/dist/radio/radio.mjs.map +1 -0
- package/dist/radio/radio.styles.d.mts +114 -0
- package/dist/radio/radio.styles.d.mts.map +1 -0
- package/dist/radio/radio.styles.mjs +103 -0
- package/dist/radio/radio.styles.mjs.map +1 -0
- package/dist/select/index.d.mts +3 -0
- package/dist/select/select.d.mts +40 -0
- package/dist/select/select.d.mts.map +1 -0
- package/dist/select/select.mjs +121 -0
- package/dist/select/select.mjs.map +1 -0
- package/dist/select/select.styles.d.mts +85 -0
- package/dist/select/select.styles.d.mts.map +1 -0
- package/dist/select/select.styles.mjs +111 -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 +47 -0
- package/dist/skeleton/skeleton.styles.d.mts.map +1 -0
- package/dist/skeleton/skeleton.styles.mjs +31 -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 +50 -0
- package/dist/spinner/spinner.styles.mjs.map +1 -0
- package/dist/styles/focus-ring.mjs +30 -0
- package/dist/styles/focus-ring.mjs.map +1 -0
- package/dist/styles/inflow.mjs +156 -0
- package/dist/styles/inflow.mjs.map +1 -0
- package/dist/styles/mono.mjs +24 -0
- package/dist/styles/mono.mjs.map +1 -0
- package/dist/switch/index.d.mts +3 -0
- package/dist/switch/switch.d.mts +18 -0
- package/dist/switch/switch.d.mts.map +1 -0
- package/dist/switch/switch.mjs +58 -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 +86 -0
- package/dist/switch/switch.styles.mjs.map +1 -0
- package/dist/tabs/index.d.mts +3 -0
- package/dist/tabs/tabs.d.mts +64 -0
- package/dist/tabs/tabs.d.mts.map +1 -0
- package/dist/tabs/tabs.mjs +93 -0
- package/dist/tabs/tabs.mjs.map +1 -0
- package/dist/tabs/tabs.styles.d.mts +64 -0
- package/dist/tabs/tabs.styles.d.mts.map +1 -0
- package/dist/tabs/tabs.styles.mjs +118 -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 +70 -0
- package/dist/textarea/textarea.styles.d.mts.map +1 -0
- package/dist/textarea/textarea.styles.mjs +85 -0
- package/dist/textarea/textarea.styles.mjs.map +1 -0
- package/dist/toast/index.d.mts +3 -0
- package/dist/toast/toast.d.mts +47 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +100 -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 +79 -0
- package/dist/toast/toast.styles.mjs.map +1 -0
- package/dist/tokens/color-set.mjs +124 -0
- package/dist/tokens/color-set.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +3 -0
- package/dist/tooltip/tooltip.d.mts +20 -0
- package/dist/tooltip/tooltip.d.mts.map +1 -0
- package/dist/tooltip/tooltip.mjs +45 -0
- package/dist/tooltip/tooltip.mjs.map +1 -0
- package/dist/tooltip/tooltip.styles.d.mts +48 -0
- package/dist/tooltip/tooltip.styles.d.mts.map +1 -0
- package/dist/tooltip/tooltip.styles.mjs +39 -0
- package/dist/tooltip/tooltip.styles.mjs.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
* Raster は右上に ✕、Tactile はフッターに閉じるを置く。Flatlay が左端なのは、
|
|
12
|
+
* 書類の「戻る」が常に左上にあるから。名前が同じで位置が違う3例目(design.md)。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
16
|
+
*/
|
|
17
|
+
declare function ModalTitle({ children, className }: PartProps): import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Modal の本体。`size` が効くのはここで、**本文の最大行長**として解釈される。
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
23
|
+
*/
|
|
24
|
+
declare function ModalBody({ children, className }: PartProps): import("react").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Modal の操作列。上辺の罫線で本文と切り、**左揃え**で並ぶ。
|
|
27
|
+
*
|
|
28
|
+
* 右揃え(Raster)でも縦積み(Tactile)でもないのは、
|
|
29
|
+
* ヘッダの「← 戻る」と縦の線を合わせるため。
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <ModalFooter>
|
|
33
|
+
* <Button color="danger">削除</Button>
|
|
34
|
+
* </ModalFooter>
|
|
35
|
+
*/
|
|
36
|
+
declare function ModalFooter({ children, className }: PartProps): import("react").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* 全画面テイクオーバー。開いている間フォーカスは内側に閉じ込められ、Escape で戻る。
|
|
39
|
+
*
|
|
40
|
+
* 浮かせる先が無いので、別の面を重ねる代わりに**紙ごと差し替える**。
|
|
41
|
+
* 地は暗転せず紙色のままで、文書が切り替わったことは
|
|
42
|
+
* ヘッダの「← 戻る」と下辺の罫線が示す(ADR-F2)。
|
|
43
|
+
*
|
|
44
|
+
* `size` は幅でも高さでもなく**本文の最大行長**です。
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* <Modal isOpen={isOpen} onOpenChange={setIsOpen}>
|
|
48
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
49
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
50
|
+
* </Modal>
|
|
51
|
+
*/
|
|
52
|
+
declare function Modal({ size, isOpen, defaultOpen, onOpenChange, isDismissable, isKeyboardDismissDisabled, children, className, classNames, id }: ModalProps): import("react").JSX.Element;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Modal, ModalBody, ModalFooter, ModalTitle };
|
|
55
|
+
//# 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;;;;;;;;;;;iBA4Bc,aAAa,UAAU,aAAa,4BAAS,IAAA;;;;;;;iBAkB7C,YAAY,UAAU,aAAa,4BAAS,IAAA;;;;;;;;;;;;iBAmB5C,cAAc,UAAU,aAAa,4BAAS,IAAA;;;;;;;;;;;;;;;;iBA8B9C,QACd,MACA,QACA,aACA,cACA,eACA,2BACA,UACA,WACA,YACA,MACC,6BAAU,IAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { backArrowClass, 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
|
+
import { Children, isValidElement } from "react";
|
|
6
|
+
//#region src/modal/modal.tsx
|
|
7
|
+
/** 「← 戻る」。テイクオーバーは閉じて消えるのではなく、前の紙に戻る。 */
|
|
8
|
+
function CloseButton({ className }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
10
|
+
slot: "close",
|
|
11
|
+
"data-slot": "closeButton",
|
|
12
|
+
className: modalStyles().closeButton({ class: className }),
|
|
13
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
className: backArrowClass,
|
|
16
|
+
children: "←"
|
|
17
|
+
}), "戻る"]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Modal の見出し。**ヘッダ行の中で「← 戻る」の右に並ぶ。**
|
|
22
|
+
*
|
|
23
|
+
* Raster は右上に ✕、Tactile はフッターに閉じるを置く。Flatlay が左端なのは、
|
|
24
|
+
* 書類の「戻る」が常に左上にあるから。名前が同じで位置が違う3例目(design.md)。
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
28
|
+
*/
|
|
29
|
+
function ModalTitle({ children, className }) {
|
|
30
|
+
const s = modalStyles();
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
"data-slot": "header",
|
|
33
|
+
className: s.header(),
|
|
34
|
+
children: [/* @__PURE__ */ jsx(CloseButton, {}), /* @__PURE__ */ jsx(Heading, {
|
|
35
|
+
slot: "title",
|
|
36
|
+
"data-slot": "title",
|
|
37
|
+
className: s.title({ class: className }),
|
|
38
|
+
children
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Modal の本体。`size` が効くのはここで、**本文の最大行長**として解釈される。
|
|
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
|
+
* 右揃え(Raster)でも縦積み(Tactile)でもないのは、
|
|
59
|
+
* ヘッダの「← 戻る」と縦の線を合わせるため。
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <ModalFooter>
|
|
63
|
+
* <Button color="danger">削除</Button>
|
|
64
|
+
* </ModalFooter>
|
|
65
|
+
*/
|
|
66
|
+
function ModalFooter({ children, className }) {
|
|
67
|
+
return /* @__PURE__ */ jsx("div", {
|
|
68
|
+
"data-slot": "footer",
|
|
69
|
+
className: modalStyles().footer({ class: className }),
|
|
70
|
+
children
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** 子に `ModalTitle` が含まれるか。含まれない場合だけ既定のヘッダを足す。 */
|
|
74
|
+
function hasTitle(children) {
|
|
75
|
+
return Children.toArray(children).some((child) => isValidElement(child) && child.type === ModalTitle);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 全画面テイクオーバー。開いている間フォーカスは内側に閉じ込められ、Escape で戻る。
|
|
79
|
+
*
|
|
80
|
+
* 浮かせる先が無いので、別の面を重ねる代わりに**紙ごと差し替える**。
|
|
81
|
+
* 地は暗転せず紙色のままで、文書が切り替わったことは
|
|
82
|
+
* ヘッダの「← 戻る」と下辺の罫線が示す(ADR-F2)。
|
|
83
|
+
*
|
|
84
|
+
* `size` は幅でも高さでもなく**本文の最大行長**です。
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* <Modal isOpen={isOpen} onOpenChange={setIsOpen}>
|
|
88
|
+
* <ModalTitle>削除しますか</ModalTitle>
|
|
89
|
+
* <ModalBody>この操作は取り消せません。</ModalBody>
|
|
90
|
+
* </Modal>
|
|
91
|
+
*/
|
|
92
|
+
function Modal$1({ size, isOpen, defaultOpen, onOpenChange, isDismissable = true, isKeyboardDismissDisabled, children, className, classNames, id }) {
|
|
93
|
+
const s = modalStyles({ size });
|
|
94
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
95
|
+
isOpen,
|
|
96
|
+
defaultOpen,
|
|
97
|
+
onOpenChange,
|
|
98
|
+
isDismissable,
|
|
99
|
+
isKeyboardDismissDisabled,
|
|
100
|
+
"data-slot": "backdrop",
|
|
101
|
+
className: s.backdrop({ class: classNames?.backdrop }),
|
|
102
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
103
|
+
"data-slot": "panel",
|
|
104
|
+
className: s.panel({ class: [className, classNames?.panel] }),
|
|
105
|
+
children: /* @__PURE__ */ jsxs(Dialog, {
|
|
106
|
+
id,
|
|
107
|
+
className: "outline-none flex flex-col grow",
|
|
108
|
+
children: [!hasTitle(children) && /* @__PURE__ */ jsx("div", {
|
|
109
|
+
"data-slot": "header",
|
|
110
|
+
className: s.header({ class: classNames?.header }),
|
|
111
|
+
children: /* @__PURE__ */ jsx(CloseButton, { className: classNames?.closeButton })
|
|
112
|
+
}), children]
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Modal$1 as Modal, ModalBody, ModalFooter, ModalTitle };
|
|
119
|
+
|
|
120
|
+
//# 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 { Children, isValidElement, type ReactNode } from 'react'\nimport { Button, Dialog, Heading, ModalOverlay, Modal as RACModal } from 'react-aria-components'\nimport { backArrowClass, modalStyles } from './modal.styles'\n\ninterface PartProps {\n children?: ReactNode\n className?: string\n}\n\n/** 「← 戻る」。テイクオーバーは閉じて消えるのではなく、前の紙に戻る。 */\nfunction CloseButton({ className }: { className?: string }) {\n return (\n <Button\n slot=\"close\"\n data-slot=\"closeButton\"\n className={modalStyles().closeButton({ class: className })}\n >\n <span aria-hidden=\"true\" className={backArrowClass}>\n ←\n </span>\n 戻る\n </Button>\n )\n}\n\n/**\n * Modal の見出し。**ヘッダ行の中で「← 戻る」の右に並ぶ。**\n *\n * Raster は右上に ✕、Tactile はフッターに閉じるを置く。Flatlay が左端なのは、\n * 書類の「戻る」が常に左上にあるから。名前が同じで位置が違う3例目(design.md)。\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 <CloseButton />\n <Heading slot=\"title\" data-slot=\"title\" className={s.title({ class: className })}>\n {children}\n </Heading>\n </div>\n )\n}\n\n/**\n * Modal の本体。`size` が効くのはここで、**本文の最大行長**として解釈される。\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 * 右揃え(Raster)でも縦積み(Tactile)でもないのは、\n * ヘッダの「← 戻る」と縦の線を合わせるため。\n *\n * @example\n * <ModalFooter>\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/** 子に `ModalTitle` が含まれるか。含まれない場合だけ既定のヘッダを足す。 */\nfunction hasTitle(children: ReactNode): boolean {\n return Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === ModalTitle,\n )\n}\n\n/**\n * 全画面テイクオーバー。開いている間フォーカスは内側に閉じ込められ、Escape で戻る。\n *\n * 浮かせる先が無いので、別の面を重ねる代わりに**紙ごと差し替える**。\n * 地は暗転せず紙色のままで、文書が切り替わったことは\n * ヘッダの「← 戻る」と下辺の罫線が示す(ADR-F2)。\n *\n * `size` は幅でも高さでもなく**本文の最大行長**です。\n *\n * @example\n * <Modal isOpen={isOpen} onOpenChange={setIsOpen}>\n * <ModalTitle>削除しますか</ModalTitle>\n * <ModalBody>この操作は取り消せません。</ModalBody>\n * </Modal>\n */\nexport function Modal({\n size,\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 })\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 flex flex-col grow\">\n {/* 出口を必ず1つ持たせる。利用者が ModalTitle を置いた場合はそちらに入るので、\n ここで足すと header slot が二重になる */}\n {!hasTitle(children) && (\n <div data-slot=\"header\" className={s.header({ class: classNames?.header })}>\n <CloseButton className={classNames?.closeButton} />\n </div>\n )}\n\n {children}\n </Dialog>\n </RACModal>\n </ModalOverlay>\n )\n}\n"],"mappings":";;;;;;;AAaA,SAAS,YAAY,EAAE,aAAqC;CAC1D,OACE,qBAAC,QAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,YAAY,CAAC,CAAC,YAAY,EAAE,OAAO,UAAU,CAAC;EAH3D,UAAA,CAKE,oBAAC,QAAD;GAAM,eAAY;GAAO,WAAW;GAAgB,UAAA;EAE9C,CAAA,GAAC,IAED;;AAEZ;;;;;;;;;;AAWA,SAAgB,WAAW,EAAE,UAAU,aAAwB;CAC7D,MAAM,IAAI,YAAY;CACtB,OACE,qBAAC,OAAD;EAAK,aAAU;EAAS,WAAW,EAAE,OAAO;EAA5C,UAAA,CACE,oBAAC,aAAD,CAAc,CAAA,GACd,oBAAC,SAAD;GAAS,MAAK;GAAQ,aAAU;GAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,UAAU,CAAC;GAC5E;EACM,CAAA,CACN;;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;;;;;;;;;;;;AAaA,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;;AAGA,SAAS,SAAS,UAA8B;CAC9C,OAAO,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAC/B,UAAU,eAAe,KAAK,KAAK,MAAM,SAAS,UACrD;AACF;;;;;;;;;;;;;;;;AAiBA,SAAgBA,QAAM,EACpB,MACA,QACA,aACA,cACA,gBAAgB,MAChB,2BACA,UACA,WACA,YACA,MACa;CACb,MAAM,IAAI,YAAY,EAAE,KAAK,CAAC;CAE9B,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,qBAAC,QAAD;IAAY;IAAI,WAAU;IAA1B,UAAA,CAGG,CAAC,SAAS,QAAQ,KACjB,oBAAC,OAAD;KAAK,aAAU;KAAS,WAAW,EAAE,OAAO,EAAE,OAAO,YAAY,OAAO,CAAC;KACvE,UAAA,oBAAC,aAAD,EAAa,WAAW,YAAY,YAAc,CAAA;IAC/C,CAAA,GAGN,QACK;;EACA,CAAA;CACE,CAAA;AAElB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { VariantMap } from "@novi-ui/core";
|
|
2
|
+
//#region src/modal/modal.styles.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Modal のスタイル定義。
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { modalStyles } from '@novi-ui/flatlay'
|
|
8
|
+
* import { tv } from 'tailwind-variants'
|
|
9
|
+
*
|
|
10
|
+
* const myModal = tv({ extend: modalStyles, slots: { body: 'max-w-[80rem]' } })
|
|
11
|
+
*/
|
|
12
|
+
declare const modalStyles: import("tailwind-variants").TVReturnType<{
|
|
13
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
14
|
+
body: string;
|
|
15
|
+
footer: string;
|
|
16
|
+
}>;
|
|
17
|
+
}, {
|
|
18
|
+
backdrop: string;
|
|
19
|
+
panel: string;
|
|
20
|
+
header: string;
|
|
21
|
+
/**
|
|
22
|
+
* 閉じるは**ヘッダ左端の「← 戻る」**。
|
|
23
|
+
* 右上の ✕(Raster)・フッターのフルワイド(Tactile)に続く第3の位置。
|
|
24
|
+
* ✕ が「閉じて消す」なら、テイクオーバーは前の紙に**戻る**ので矢印になる。
|
|
25
|
+
*/
|
|
26
|
+
closeButton: string;
|
|
27
|
+
title: string;
|
|
28
|
+
body: string;
|
|
29
|
+
footer: string;
|
|
30
|
+
}, undefined, {
|
|
31
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
32
|
+
body: string;
|
|
33
|
+
footer: string;
|
|
34
|
+
}>;
|
|
35
|
+
}, {
|
|
36
|
+
backdrop: string;
|
|
37
|
+
panel: string;
|
|
38
|
+
header: string;
|
|
39
|
+
/**
|
|
40
|
+
* 閉じるは**ヘッダ左端の「← 戻る」**。
|
|
41
|
+
* 右上の ✕(Raster)・フッターのフルワイド(Tactile)に続く第3の位置。
|
|
42
|
+
* ✕ が「閉じて消す」なら、テイクオーバーは前の紙に**戻る**ので矢印になる。
|
|
43
|
+
*/
|
|
44
|
+
closeButton: string;
|
|
45
|
+
title: string;
|
|
46
|
+
body: string;
|
|
47
|
+
footer: string;
|
|
48
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
49
|
+
size: VariantMap<"sm" | "md" | "lg" | "full", {
|
|
50
|
+
body: string;
|
|
51
|
+
footer: string;
|
|
52
|
+
}>;
|
|
53
|
+
}, {
|
|
54
|
+
backdrop: string;
|
|
55
|
+
panel: string;
|
|
56
|
+
header: string;
|
|
57
|
+
/**
|
|
58
|
+
* 閉じるは**ヘッダ左端の「← 戻る」**。
|
|
59
|
+
* 右上の ✕(Raster)・フッターのフルワイド(Tactile)に続く第3の位置。
|
|
60
|
+
* ✕ が「閉じて消す」なら、テイクオーバーは前の紙に**戻る**ので矢印になる。
|
|
61
|
+
*/
|
|
62
|
+
closeButton: string;
|
|
63
|
+
title: string;
|
|
64
|
+
body: string;
|
|
65
|
+
footer: string;
|
|
66
|
+
}>>;
|
|
67
|
+
type ModalStyleProps = Parameters<typeof modalStyles>[0];
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ModalStyleProps, modalStyles };
|
|
70
|
+
//# 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":";;;;;;;;;;;cAoFa,yCAAW;;IAnB0B;IAAgB;;;;;;;;;;;;;;;;;IAAhB;IAAgB;;;;;;;;;;;;;;;;;IAAhB;IAAgB;;;;;;;;;;;;;;;;KAyBtD,kBAAkB,kBAAkB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { disabledState, focusRing } from "../styles/focus-ring.mjs";
|
|
2
|
+
import { mono } from "../styles/mono.mjs";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
//#region src/modal/modal.styles.ts
|
|
5
|
+
/**
|
|
6
|
+
* Flatlay の Modal は **全画面テイクオーバー**(design.md 着手条件1)。
|
|
7
|
+
*
|
|
8
|
+
* 中央ダイアログ(Raster)・ボトムシート(Tactile)に続く第3の構造。
|
|
9
|
+
* 浮かせる先が無いので「別の面を重ねる」ができない。代わりに**紙ごと差し替える**。
|
|
10
|
+
*
|
|
11
|
+
* `position` 規律の**例外1号**。viewport 全面を占めるには `fixed` が要る。
|
|
12
|
+
* ただし z-index は使わない — ポータル先が body 末尾なので、DOM 順だけで最前になる。
|
|
13
|
+
* ここで z-10 を1つ足した瞬間に「重なりの順序を持つ UI」に変わってしまう(ADR-F2 / FR-06)。
|
|
14
|
+
*
|
|
15
|
+
* 地が暗転しないのも同じ理由。暗転は「背後に何かがある」ことの表現で、
|
|
16
|
+
* それ自体が z 軸の語彙になる。`--novi-color-overlay` は紙色に固定されている。
|
|
17
|
+
*/
|
|
18
|
+
const slots = {
|
|
19
|
+
backdrop: "fixed inset-0 flex bg-[var(--novi-color-overlay)]",
|
|
20
|
+
panel: ["w-full h-full flex flex-col overflow-auto outline-none", "bg-[var(--novi-color-bg)] text-[var(--novi-color-fg)]"].join(" "),
|
|
21
|
+
header: ["shrink-0 flex items-center gap-3 px-4 h-10", "border-b border-[var(--novi-color-border-strong)]"].join(" "),
|
|
22
|
+
/**
|
|
23
|
+
* 閉じるは**ヘッダ左端の「← 戻る」**。
|
|
24
|
+
* 右上の ✕(Raster)・フッターのフルワイド(Tactile)に続く第3の位置。
|
|
25
|
+
* ✕ が「閉じて消す」なら、テイクオーバーは前の紙に**戻る**ので矢印になる。
|
|
26
|
+
*/
|
|
27
|
+
closeButton: [
|
|
28
|
+
"shrink-0 inline-flex items-center gap-1.5 h-7 px-2 -ml-2",
|
|
29
|
+
"text-[length:var(--novi-text-sm)] text-[var(--novi-color-muted)]",
|
|
30
|
+
"border border-transparent",
|
|
31
|
+
"hover:text-[var(--novi-color-fg)] hover:bg-[var(--novi-color-subtle)]",
|
|
32
|
+
"data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]",
|
|
33
|
+
"transition-[background-color,border-color,color]",
|
|
34
|
+
"duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]",
|
|
35
|
+
focusRing,
|
|
36
|
+
disabledState
|
|
37
|
+
].join(" "),
|
|
38
|
+
title: "truncate text-[length:var(--novi-text-base)] font-medium",
|
|
39
|
+
body: "grow w-full px-4 py-4 leading-[var(--novi-leading-body)]",
|
|
40
|
+
footer: ["shrink-0 flex items-center gap-2 w-full px-4 py-3", "border-t border-[var(--novi-color-border)]"].join(" ")
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Modal のスタイル定義。
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* import { modalStyles } from '@novi-ui/flatlay'
|
|
47
|
+
* import { tv } from 'tailwind-variants'
|
|
48
|
+
*
|
|
49
|
+
* const myModal = tv({ extend: modalStyles, slots: { body: 'max-w-[80rem]' } })
|
|
50
|
+
*/
|
|
51
|
+
const modalStyles = tv({
|
|
52
|
+
slots,
|
|
53
|
+
variants: { size: {
|
|
54
|
+
sm: {
|
|
55
|
+
body: "max-w-[32rem]",
|
|
56
|
+
footer: "max-w-[32rem]"
|
|
57
|
+
},
|
|
58
|
+
md: {
|
|
59
|
+
body: "max-w-[44rem]",
|
|
60
|
+
footer: "max-w-[44rem]"
|
|
61
|
+
},
|
|
62
|
+
lg: {
|
|
63
|
+
body: "max-w-[56rem]",
|
|
64
|
+
footer: "max-w-[56rem]"
|
|
65
|
+
},
|
|
66
|
+
full: {
|
|
67
|
+
body: "max-w-none",
|
|
68
|
+
footer: "max-w-none"
|
|
69
|
+
}
|
|
70
|
+
} },
|
|
71
|
+
defaultVariants: { size: "md" }
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* 「← 戻る」の矢印。**等幅で出す**(ADR-F7)。
|
|
75
|
+
*
|
|
76
|
+
* SVG ではなく文字なのは、記号そのものが帳票の語彙だから。
|
|
77
|
+
* 等幅にすると、隣に別の記号ボタンが並んだときに幅が揃う。
|
|
78
|
+
*/
|
|
79
|
+
const backArrowClass = `shrink-0 ${mono}`;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { backArrowClass, modalStyles };
|
|
82
|
+
|
|
83
|
+
//# 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 { modalRequiredSlots, modalSlots, NoviSize, SlotMap, VariantMap } from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\nimport { disabledState, focusRing } from '../styles/focus-ring'\nimport { mono } from '../styles/mono'\n\n/**\n * Flatlay の Modal は **全画面テイクオーバー**(design.md 着手条件1)。\n *\n * 中央ダイアログ(Raster)・ボトムシート(Tactile)に続く第3の構造。\n * 浮かせる先が無いので「別の面を重ねる」ができない。代わりに**紙ごと差し替える**。\n *\n * `position` 規律の**例外1号**。viewport 全面を占めるには `fixed` が要る。\n * ただし z-index は使わない — ポータル先が body 末尾なので、DOM 順だけで最前になる。\n * ここで z-10 を1つ足した瞬間に「重なりの順序を持つ UI」に変わってしまう(ADR-F2 / FR-06)。\n *\n * 地が暗転しないのも同じ理由。暗転は「背後に何かがある」ことの表現で、\n * それ自体が z 軸の語彙になる。`--novi-color-overlay` は紙色に固定されている。\n */\nconst slots = {\n // 暗転しないので、backdrop は「覆う膜」ではなく差し替わった紙そのもの\n backdrop: 'fixed inset-0 flex bg-[var(--novi-color-overlay)]',\n panel: [\n 'w-full h-full flex flex-col overflow-auto outline-none',\n 'bg-[var(--novi-color-bg)] text-[var(--novi-color-fg)]',\n ].join(' '),\n // 書類のヘッダ行。下辺の罫線が「ここから別の文書」を示す唯一の手がかりになる\n header: [\n 'shrink-0 flex items-center gap-3 px-4 h-10',\n 'border-b border-[var(--novi-color-border-strong)]',\n ].join(' '),\n /**\n * 閉じるは**ヘッダ左端の「← 戻る」**。\n * 右上の ✕(Raster)・フッターのフルワイド(Tactile)に続く第3の位置。\n * ✕ が「閉じて消す」なら、テイクオーバーは前の紙に**戻る**ので矢印になる。\n */\n closeButton: [\n 'shrink-0 inline-flex items-center gap-1.5 h-7 px-2 -ml-2',\n 'text-[length:var(--novi-text-sm)] text-[var(--novi-color-muted)]',\n 'border border-transparent',\n 'hover:text-[var(--novi-color-fg)] hover:bg-[var(--novi-color-subtle)]',\n 'data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]',\n 'transition-[background-color,border-color,color]',\n 'duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n focusRing,\n disabledState,\n ].join(' '),\n title: 'truncate text-[length:var(--novi-text-base)] font-medium',\n // 本文だけが行長の制限を受ける。`mx-auto` ではなく左寄せなのは、\n // 帳票の本文が紙の左端から始まるため(中央寄せは「作品」の版面設計の言葉)\n body: 'grow w-full px-4 py-4 leading-[var(--novi-leading-body)]',\n // 操作行は上辺の罫線で本文と切る。左揃えは header の「← 戻る」と縦の線を合わせるため\n footer: [\n 'shrink-0 flex items-center gap-2 w-full px-4 py-3',\n 'border-t border-[var(--novi-color-border)]',\n ].join(' '),\n} satisfies SlotMap<typeof modalSlots, (typeof modalRequiredSlots)[number]>\n\n/**\n * テイクオーバーでは面積が全画面に固定されるので、幅(Raster)も高さ(Tactile)も\n * 段階を作れない。残るのは**本文の最大行長**で、`size` はそれとして解釈する。\n *\n * 語彙は core が共通で固定し、解釈はテーマの自由(ADR-06)。3例目。\n * footer にも同じ制限を掛けるのは、操作が本文の列から外れると\n * 「どの文書に対する操作か」が読めなくなるため。\n */\nconst size: VariantMap<NoviSize | 'full', { body: string; footer: string }> = {\n sm: { body: 'max-w-[32rem]', footer: 'max-w-[32rem]' },\n md: { body: 'max-w-[44rem]', footer: 'max-w-[44rem]' },\n lg: { body: 'max-w-[56rem]', footer: 'max-w-[56rem]' },\n full: { body: 'max-w-none', footer: 'max-w-none' },\n}\n\n// `radius` は実装しない。全画面を占める面に角は無く、書いても描画に出ない。\n// 死ぬコードを置くくらいなら、解釈を持たないことを明示する(README に記載)。\n\n/**\n * Modal のスタイル定義。\n *\n * @example\n * import { modalStyles } from '@novi-ui/flatlay'\n * import { tv } from 'tailwind-variants'\n *\n * const myModal = tv({ extend: modalStyles, slots: { body: 'max-w-[80rem]' } })\n */\nexport const modalStyles = tv({\n slots,\n variants: { size },\n defaultVariants: { size: 'md' },\n})\n\nexport type ModalStyleProps = Parameters<typeof modalStyles>[0]\n\n/**\n * 「← 戻る」の矢印。**等幅で出す**(ADR-F7)。\n *\n * SVG ではなく文字なのは、記号そのものが帳票の語彙だから。\n * 等幅にすると、隣に別の記号ボタンが並んだときに幅が揃う。\n */\nexport const backArrowClass = `shrink-0 ${mono}`\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAM,QAAQ;CAEZ,UAAU;CACV,OAAO,CACL,0DACA,uDACF,CAAC,CAAC,KAAK,GAAG;CAEV,QAAQ,CACN,8CACA,mDACF,CAAC,CAAC,KAAK,GAAG;;;;;;CAMV,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,OAAO;CAGP,MAAM;CAEN,QAAQ,CACN,qDACA,4CACF,CAAC,CAAC,KAAK,GAAG;AACZ;;;;;;;;;;AA6BA,MAAa,cAAc,GAAG;CAC5B;CACA,UAAU,EAAE;EApBZ,IAAI;GAAE,MAAM;GAAiB,QAAQ;EAAgB;EACrD,IAAI;GAAE,MAAM;GAAiB,QAAQ;EAAgB;EACrD,IAAI;GAAE,MAAM;GAAiB,QAAQ;EAAgB;EACrD,MAAM;GAAE,MAAM;GAAc,QAAQ;EAAa;CAiBrC,EAAK;CACjB,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;;;;;;;AAUD,MAAa,iBAAiB,YAAY"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { PopoverProps } from "@novi-ui/core";
|
|
3
|
+
//#region src/popover/popover.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Popover の中身。
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <PopoverContent>ここに補足を書く</PopoverContent>
|
|
9
|
+
*/
|
|
10
|
+
declare function PopoverContent({ children, className }: {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* トリガーに紐づく注記の面。**面はトリガーの直後、フローの中に生える**
|
|
16
|
+
* (両テーマはトリガーの隣に浮かぶ)。
|
|
17
|
+
*
|
|
18
|
+
* 開くと後続が押し下げられるので、何かが隠れることが無い。
|
|
19
|
+
* Escape で閉じてトリガーへフォーカスが戻る。
|
|
20
|
+
*
|
|
21
|
+
* `placement` / `offset` は受け取るが**効かない**。浮かないものに寄せる先は無い。
|
|
22
|
+
* `arrow` slot も描かない。指す先が無いので、矢印は嘘になる。
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <Popover>
|
|
26
|
+
* <Button>詳細</Button>
|
|
27
|
+
* <PopoverContent>ここに補足を書く</PopoverContent>
|
|
28
|
+
* </Popover>
|
|
29
|
+
*/
|
|
30
|
+
declare function Popover({ radius, isOpen, defaultOpen, onOpenChange, children, className, classNames, id }: PopoverProps): import("react").JSX.Element;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Popover, PopoverContent };
|
|
33
|
+
//# sourceMappingURL=popover.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.mts","names":[],"sources":["../../src/popover/popover.tsx"],"mappings":";;;;;;;;;iBAcgB,iBACd,UACA;EAEA,WAAW;EACX;oBACD,IAAA;;;;;;;;;;;;;;;;;iBAwBe,UACd,QACA,QACA,aACA,cACA,UACA,WACA,YACA,MACC,+BAAY,IAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { InflowPopover } from "../styles/inflow.mjs";
|
|
3
|
+
import { popoverStyles } from "./popover.styles.mjs";
|
|
4
|
+
import { Dialog, DialogTrigger } from "react-aria-components";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/popover/popover.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Popover の中身。
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <PopoverContent>ここに補足を書く</PopoverContent>
|
|
12
|
+
*/
|
|
13
|
+
function PopoverContent({ children, className }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-slot": "content",
|
|
16
|
+
className: popoverStyles().content({ class: className }),
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* トリガーに紐づく注記の面。**面はトリガーの直後、フローの中に生える**
|
|
22
|
+
* (両テーマはトリガーの隣に浮かぶ)。
|
|
23
|
+
*
|
|
24
|
+
* 開くと後続が押し下げられるので、何かが隠れることが無い。
|
|
25
|
+
* Escape で閉じてトリガーへフォーカスが戻る。
|
|
26
|
+
*
|
|
27
|
+
* `placement` / `offset` は受け取るが**効かない**。浮かないものに寄せる先は無い。
|
|
28
|
+
* `arrow` slot も描かない。指す先が無いので、矢印は嘘になる。
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Popover>
|
|
32
|
+
* <Button>詳細</Button>
|
|
33
|
+
* <PopoverContent>ここに補足を書く</PopoverContent>
|
|
34
|
+
* </Popover>
|
|
35
|
+
*/
|
|
36
|
+
function Popover$1({ radius, isOpen, defaultOpen, onOpenChange, children, className, classNames, id }) {
|
|
37
|
+
const s = popoverStyles({ radius });
|
|
38
|
+
const [trigger, ...content] = Array.isArray(children) ? children : [children];
|
|
39
|
+
return /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
40
|
+
isOpen,
|
|
41
|
+
defaultOpen,
|
|
42
|
+
onOpenChange,
|
|
43
|
+
children: [trigger, /* @__PURE__ */ jsx(InflowPopover, {
|
|
44
|
+
dataSlot: "root",
|
|
45
|
+
className: s.root({ class: [className, classNames?.root] }),
|
|
46
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
47
|
+
id,
|
|
48
|
+
className: "outline-none",
|
|
49
|
+
children: content
|
|
50
|
+
})
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Popover$1 as Popover, PopoverContent };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=popover.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.mjs","names":["Popover"],"sources":["../../src/popover/popover.tsx"],"sourcesContent":["'use client'\n\nimport type { PopoverProps } from '@novi-ui/core'\nimport type { ReactNode } from 'react'\nimport { Dialog, DialogTrigger } from 'react-aria-components'\nimport { InflowPopover } from '../styles/inflow'\nimport { popoverStyles } from './popover.styles'\n\n/**\n * Popover の中身。\n *\n * @example\n * <PopoverContent>ここに補足を書く</PopoverContent>\n */\nexport function PopoverContent({\n children,\n className,\n}: {\n children?: ReactNode\n className?: string\n}) {\n return (\n <div data-slot=\"content\" className={popoverStyles().content({ class: className })}>\n {children}\n </div>\n )\n}\n\n/**\n * トリガーに紐づく注記の面。**面はトリガーの直後、フローの中に生える**\n * (両テーマはトリガーの隣に浮かぶ)。\n *\n * 開くと後続が押し下げられるので、何かが隠れることが無い。\n * Escape で閉じてトリガーへフォーカスが戻る。\n *\n * `placement` / `offset` は受け取るが**効かない**。浮かないものに寄せる先は無い。\n * `arrow` slot も描かない。指す先が無いので、矢印は嘘になる。\n *\n * @example\n * <Popover>\n * <Button>詳細</Button>\n * <PopoverContent>ここに補足を書く</PopoverContent>\n * </Popover>\n */\nexport function Popover({\n radius,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n className,\n classNames,\n id,\n}: PopoverProps) {\n const s = popoverStyles({ radius })\n const items = Array.isArray(children) ? children : [children]\n const [trigger, ...content] = items\n\n return (\n <DialogTrigger isOpen={isOpen} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {trigger}\n\n {/* 注記面はトリガーの直後。ここに面が生えることで、後続が押し下がる */}\n <InflowPopover dataSlot=\"root\" className={s.root({ class: [className, classNames?.root] })}>\n {/* RAC の Popover は id を受け取らないため Dialog に付ける */}\n <Dialog id={id} className=\"outline-none\">\n {content}\n </Dialog>\n </InflowPopover>\n </DialogTrigger>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,eAAe,EAC7B,UACA,aAIC;CACD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAU,WAAW,cAAc,CAAC,CAAC,QAAQ,EAAE,OAAO,UAAU,CAAC;EAC7E;CACE,CAAA;AAET;;;;;;;;;;;;;;;;;AAkBA,SAAgBA,UAAQ,EACtB,QACA,QACA,aACA,cACA,UACA,WACA,YACA,MACe;CACf,MAAM,IAAI,cAAc,EAAE,OAAO,CAAC;CAElC,MAAM,CAAC,SAAS,GAAG,WADL,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ;CAG5D,OACE,qBAAC,eAAD;EAAuB;EAAqB;EAA2B;EAAvE,UAAA,CACG,SAGD,oBAAC,eAAD;GAAe,UAAS;GAAO,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,YAAY,IAAI,EAAE,CAAC;GAEvF,UAAA,oBAAC,QAAD;IAAY;IAAI,WAAU;IACvB,UAAA;GACK,CAAA;EACK,CAAA,CACF;;AAEnB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VariantMap } from "@novi-ui/core";
|
|
2
|
+
//#region src/popover/popover.styles.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Popover のスタイル定義。
|
|
5
|
+
*
|
|
6
|
+
* 展開部の位置は `InflowPopover` が `!` 付きのリセットで固定するので、
|
|
7
|
+
* ここで `position` 系を書いても効かない(書く必要も無い)。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const myPopover = tv({ extend: popoverStyles, slots: { content: 'px-4' } })
|
|
11
|
+
*/
|
|
12
|
+
declare const popoverStyles: import("tailwind-variants").TVReturnType<{
|
|
13
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
14
|
+
root: string;
|
|
15
|
+
}>;
|
|
16
|
+
}, {
|
|
17
|
+
root: string;
|
|
18
|
+
arrow: string;
|
|
19
|
+
content: string;
|
|
20
|
+
}, undefined, {
|
|
21
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
22
|
+
root: string;
|
|
23
|
+
}>;
|
|
24
|
+
}, {
|
|
25
|
+
root: string;
|
|
26
|
+
arrow: string;
|
|
27
|
+
content: string;
|
|
28
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
29
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
30
|
+
root: string;
|
|
31
|
+
}>;
|
|
32
|
+
}, {
|
|
33
|
+
root: string;
|
|
34
|
+
arrow: string;
|
|
35
|
+
content: string;
|
|
36
|
+
}>>;
|
|
37
|
+
type PopoverStyleProps = Parameters<typeof popoverStyles>[0];
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PopoverStyleProps, popoverStyles };
|
|
40
|
+
//# sourceMappingURL=popover.styles.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.styles.d.mts","names":[],"sources":["../../src/popover/popover.styles.ts"],"mappings":";;;;;;;;;;;cAiDa,2CAAa;;IAjBmB;;;;;;;;IAAA;;;;;;;;IAAA;;;;;;;KAuBjC,oBAAoB,kBAAkB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
//#region src/popover/popover.styles.ts
|
|
3
|
+
/**
|
|
4
|
+
* Flatlay の Popover は **インフローの注記面**(FR-05)。
|
|
5
|
+
*
|
|
6
|
+
* 両テーマはトリガーに紐づいて浮かぶが、Flatlay には浮かせる先が無い。
|
|
7
|
+
* トリガーの直後に面が生えて後続を押し下げる。矢印(`arrow`)を描かないのは
|
|
8
|
+
* Raster と同じ理由ではなく、**指す先が無いから**。浮いていないものは
|
|
9
|
+
* 「あちらから来た」と示す必要がない。
|
|
10
|
+
*
|
|
11
|
+
* 地を一段落とすのは Menu / Select の展開部と役割を分けるため。
|
|
12
|
+
* あちらは選ぶための一覧で、こちらは**読むための注記**。同じ紙の上で、
|
|
13
|
+
* 書き足された欄であることを地の濃さが示す。
|
|
14
|
+
*/
|
|
15
|
+
const slots = {
|
|
16
|
+
root: [
|
|
17
|
+
"outline-none",
|
|
18
|
+
"border border-[var(--novi-color-border-strong)]",
|
|
19
|
+
"bg-[var(--novi-color-subtle)] text-[var(--novi-color-fg)]"
|
|
20
|
+
].join(" "),
|
|
21
|
+
arrow: "hidden",
|
|
22
|
+
content: "px-3 py-2 leading-[var(--novi-leading-body)]"
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Popover のスタイル定義。
|
|
26
|
+
*
|
|
27
|
+
* 展開部の位置は `InflowPopover` が `!` 付きのリセットで固定するので、
|
|
28
|
+
* ここで `position` 系を書いても効かない(書く必要も無い)。
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const myPopover = tv({ extend: popoverStyles, slots: { content: 'px-4' } })
|
|
32
|
+
*/
|
|
33
|
+
const popoverStyles = tv({
|
|
34
|
+
slots,
|
|
35
|
+
variants: { radius: {
|
|
36
|
+
none: { root: "rounded-[var(--novi-radius-none)]" },
|
|
37
|
+
sm: { root: "rounded-[var(--novi-radius-sm)]" },
|
|
38
|
+
md: { root: "rounded-[var(--novi-radius-md)]" },
|
|
39
|
+
lg: { root: "rounded-[var(--novi-radius-lg)]" },
|
|
40
|
+
full: { root: "rounded-[var(--novi-radius-full)]" }
|
|
41
|
+
} },
|
|
42
|
+
defaultVariants: { radius: "sm" }
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
export { popoverStyles };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=popover.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.styles.mjs","names":[],"sources":["../../src/popover/popover.styles.ts"],"sourcesContent":["import type {\n NoviRadius,\n popoverRequiredSlots,\n popoverSlots,\n SlotMap,\n VariantMap,\n} from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\n\n/**\n * Flatlay の Popover は **インフローの注記面**(FR-05)。\n *\n * 両テーマはトリガーに紐づいて浮かぶが、Flatlay には浮かせる先が無い。\n * トリガーの直後に面が生えて後続を押し下げる。矢印(`arrow`)を描かないのは\n * Raster と同じ理由ではなく、**指す先が無いから**。浮いていないものは\n * 「あちらから来た」と示す必要がない。\n *\n * 地を一段落とすのは Menu / Select の展開部と役割を分けるため。\n * あちらは選ぶための一覧で、こちらは**読むための注記**。同じ紙の上で、\n * 書き足された欄であることを地の濃さが示す。\n */\nconst slots = {\n root: [\n 'outline-none',\n 'border border-[var(--novi-color-border-strong)]',\n 'bg-[var(--novi-color-subtle)] text-[var(--novi-color-fg)]',\n ].join(' '),\n // 浮いていないので、どこから来た面かを指す必要が無い\n arrow: 'hidden',\n content: 'px-3 py-2 leading-[var(--novi-leading-body)]',\n} satisfies SlotMap<typeof popoverSlots, (typeof popoverRequiredSlots)[number]>\n\nconst radius: VariantMap<NoviRadius, { root: string }> = {\n none: { root: 'rounded-[var(--novi-radius-none)]' },\n sm: { root: 'rounded-[var(--novi-radius-sm)]' },\n md: { root: 'rounded-[var(--novi-radius-md)]' },\n lg: { root: 'rounded-[var(--novi-radius-lg)]' },\n full: { root: 'rounded-[var(--novi-radius-full)]' },\n}\n\n/**\n * Popover のスタイル定義。\n *\n * 展開部の位置は `InflowPopover` が `!` 付きのリセットで固定するので、\n * ここで `position` 系を書いても効かない(書く必要も無い)。\n *\n * @example\n * const myPopover = tv({ extend: popoverStyles, slots: { content: 'px-4' } })\n */\nexport const popoverStyles = tv({\n slots,\n variants: { radius },\n defaultVariants: { radius: 'sm' },\n})\n\nexport type PopoverStyleProps = Parameters<typeof popoverStyles>[0]\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,QAAQ;CACZ,MAAM;EACJ;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CAEV,OAAO;CACP,SAAS;AACX;;;;;;;;;;AAmBA,MAAa,gBAAgB,GAAG;CAC9B;CACA,UAAU,EAAE;EAlBZ,MAAM,EAAE,MAAM,oCAAoC;EAClD,IAAI,EAAE,MAAM,kCAAkC;EAC9C,IAAI,EAAE,MAAM,kCAAkC;EAC9C,IAAI,EAAE,MAAM,kCAAkC;EAC9C,MAAM,EAAE,MAAM,oCAAoC;CActC,EAAO;CACnB,iBAAiB,EAAE,QAAQ,KAAK;AAClC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProgressProps } from "@novi-ui/core";
|
|
2
|
+
//#region src/progress/progress.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 進捗の表示。`value` を省略すると不確定(indeterminate)表示になる。
|
|
5
|
+
*
|
|
6
|
+
* Flatlay の進捗は**引かれていく罫線**で、面が伸びるのではなく線が引かれる。
|
|
7
|
+
* `prefers-reduced-motion` が有効なときは不確定表示の点滅を止める。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Progress label="アップロード中" value={62} showValueLabel />
|
|
11
|
+
*/
|
|
12
|
+
declare function Progress({ size, color, label, value, minValue, maxValue, showValueLabel, className, classNames, id }: ProgressProps): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Progress };
|
|
15
|
+
//# sourceMappingURL=progress.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.mts","names":[],"sources":["../../src/progress/progress.tsx"],"mappings":";;;;;;;;;;;iBAegB,WACd,MACA,OACA,OACA,OACA,UACA,UACA,gBACA,WACA,YACA,MACC,gCAAa,IAAA"}
|