@novi-ui/flatlay 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/avatar/avatar.styles.d.mts +3 -3
- package/dist/badge/badge.styles.d.mts +3 -3
- package/dist/button/button.styles.d.mts +3 -3
- package/dist/card/card.styles.d.mts +3 -3
- package/dist/combo-box/combo-box.d.mts +37 -0
- package/dist/combo-box/combo-box.d.mts.map +1 -0
- package/dist/combo-box/combo-box.mjs +129 -0
- package/dist/combo-box/combo-box.mjs.map +1 -0
- package/dist/combo-box/combo-box.styles.d.mts +88 -0
- package/dist/combo-box/combo-box.styles.d.mts.map +1 -0
- package/dist/combo-box/combo-box.styles.mjs +113 -0
- package/dist/combo-box/combo-box.styles.mjs.map +1 -0
- package/dist/combo-box/index.d.mts +3 -0
- package/dist/date-picker/date-picker.d.mts +16 -0
- package/dist/date-picker/date-picker.d.mts.map +1 -0
- package/dist/date-picker/date-picker.mjs +140 -0
- package/dist/date-picker/date-picker.mjs.map +1 -0
- package/dist/date-picker/date-picker.styles.d.mts +103 -0
- package/dist/date-picker/date-picker.styles.d.mts.map +1 -0
- package/dist/date-picker/date-picker.styles.mjs +131 -0
- package/dist/date-picker/date-picker.styles.mjs.map +1 -0
- package/dist/date-picker/index.d.mts +3 -0
- package/dist/index.d.mts +16 -1
- package/dist/index.mjs +11 -1
- package/dist/input/input.styles.d.mts +3 -3
- package/dist/menu/menu.styles.d.mts +3 -3
- package/dist/number-field/index.d.mts +3 -0
- package/dist/number-field/number-field.d.mts +16 -0
- package/dist/number-field/number-field.d.mts.map +1 -0
- package/dist/number-field/number-field.mjs +93 -0
- package/dist/number-field/number-field.mjs.map +1 -0
- package/dist/number-field/number-field.styles.d.mts +88 -0
- package/dist/number-field/number-field.styles.d.mts.map +1 -0
- package/dist/number-field/number-field.styles.mjs +102 -0
- package/dist/number-field/number-field.styles.mjs.map +1 -0
- package/dist/pagination/index.d.mts +3 -0
- package/dist/pagination/pagination.d.mts +13 -0
- package/dist/pagination/pagination.d.mts.map +1 -0
- package/dist/pagination/pagination.mjs +98 -0
- package/dist/pagination/pagination.mjs.map +1 -0
- package/dist/pagination/pagination.styles.d.mts +67 -0
- package/dist/pagination/pagination.styles.d.mts.map +1 -0
- package/dist/pagination/pagination.styles.mjs +83 -0
- package/dist/pagination/pagination.styles.mjs.map +1 -0
- package/dist/popover/popover.styles.d.mts +3 -3
- package/dist/select/select.d.mts +1 -1
- package/dist/select/select.mjs +1 -1
- package/dist/select/select.mjs.map +1 -1
- package/dist/select/select.styles.d.mts +3 -3
- package/dist/skeleton/skeleton.styles.d.mts +3 -3
- package/dist/table/index.d.mts +3 -0
- package/dist/table/table.d.mts +104 -0
- package/dist/table/table.d.mts.map +1 -0
- package/dist/table/table.mjs +167 -0
- package/dist/table/table.mjs.map +1 -0
- package/dist/table/table.styles.d.mts +58 -0
- package/dist/table/table.styles.d.mts.map +1 -0
- package/dist/table/table.styles.mjs +84 -0
- package/dist/table/table.styles.mjs.map +1 -0
- package/dist/textarea/textarea.styles.d.mts +3 -3
- package/dist/toast/toast.styles.d.mts +3 -3
- package/dist/tooltip/tooltip.styles.d.mts +3 -3
- package/package.json +9 -7
package/dist/select/select.mjs
CHANGED
|
@@ -38,7 +38,7 @@ function SelectItem({ id, isDisabled, children, className }) {
|
|
|
38
38
|
* 矢印キーで移動、Escape で閉じてトリガーへフォーカスが戻る。
|
|
39
39
|
*
|
|
40
40
|
* トリガーは `<button>` で編集可能要素ではないため IME の変換は発生しない。
|
|
41
|
-
* テキスト入力を伴う選択が必要な場合は ComboBox
|
|
41
|
+
* テキスト入力を伴う選択が必要な場合は ComboBox を使う。
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* <Select label="都道府県" selectedKey={pref} onSelectionChange={setPref}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.mjs","names":["Select","RACSelect"],"sources":["../../src/select/select.tsx"],"sourcesContent":["'use client'\n\nimport type { SelectProps } from '@novi-ui/core'\nimport type { ReactNode } from 'react'\nimport {\n Button,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n Select as RACSelect,\n SelectValue,\n Text,\n} from 'react-aria-components'\nimport { InflowPopover } from '../styles/inflow'\nimport { optionMarkerClass, selectStyles } from './select.styles'\n\nexport interface SelectItemProps {\n /** 選択値。`onSelectionChange` に渡る */\n id: string\n isDisabled?: boolean\n children?: ReactNode\n className?: string\n}\n\n/**\n * Select の選択肢。`Select` の子として置く。\n *\n * 選択済みの印は行頭の `▸`(両テーマはチェックマーク)。押下の反転と衝突しないよう、\n * 状態は記号で、押した瞬間は面の反転で示すという役割分担にしている。\n *\n * @example\n * <SelectItem id=\"tokyo\">東京都</SelectItem>\n */\nexport function SelectItem({ id, isDisabled, children, className }: SelectItemProps) {\n return (\n <ListBoxItem\n id={id}\n isDisabled={isDisabled}\n textValue={typeof children === 'string' ? children : undefined}\n data-slot=\"option\"\n className={className ?? selectStyles().option()}\n >\n {({ isSelected }) => (\n <>\n <span aria-hidden=\"true\" className={optionMarkerClass}>\n {isSelected ? '▸' : ''}\n </span>\n <span className=\"truncate\">{children}</span>\n </>\n )}\n </ListBoxItem>\n )\n}\n\n/**\n * 一覧から1つ選ぶ。**選択肢はトリガーの直後、フローの中に展開される**\n * (Raster は隣に浮き、Tactile は画面下端のシート)。\n *\n * 開くと後続が押し下げられるので、何かが隠れることが無い。\n * 矢印キーで移動、Escape で閉じてトリガーへフォーカスが戻る。\n *\n * トリガーは `<button>` で編集可能要素ではないため IME の変換は発生しない。\n * テキスト入力を伴う選択が必要な場合は ComboBox
|
|
1
|
+
{"version":3,"file":"select.mjs","names":["Select","RACSelect"],"sources":["../../src/select/select.tsx"],"sourcesContent":["'use client'\n\nimport type { SelectProps } from '@novi-ui/core'\nimport type { ReactNode } from 'react'\nimport {\n Button,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n Select as RACSelect,\n SelectValue,\n Text,\n} from 'react-aria-components'\nimport { InflowPopover } from '../styles/inflow'\nimport { optionMarkerClass, selectStyles } from './select.styles'\n\nexport interface SelectItemProps {\n /** 選択値。`onSelectionChange` に渡る */\n id: string\n isDisabled?: boolean\n children?: ReactNode\n className?: string\n}\n\n/**\n * Select の選択肢。`Select` の子として置く。\n *\n * 選択済みの印は行頭の `▸`(両テーマはチェックマーク)。押下の反転と衝突しないよう、\n * 状態は記号で、押した瞬間は面の反転で示すという役割分担にしている。\n *\n * @example\n * <SelectItem id=\"tokyo\">東京都</SelectItem>\n */\nexport function SelectItem({ id, isDisabled, children, className }: SelectItemProps) {\n return (\n <ListBoxItem\n id={id}\n isDisabled={isDisabled}\n textValue={typeof children === 'string' ? children : undefined}\n data-slot=\"option\"\n className={className ?? selectStyles().option()}\n >\n {({ isSelected }) => (\n <>\n <span aria-hidden=\"true\" className={optionMarkerClass}>\n {isSelected ? '▸' : ''}\n </span>\n <span className=\"truncate\">{children}</span>\n </>\n )}\n </ListBoxItem>\n )\n}\n\n/**\n * 一覧から1つ選ぶ。**選択肢はトリガーの直後、フローの中に展開される**\n * (Raster は隣に浮き、Tactile は画面下端のシート)。\n *\n * 開くと後続が押し下げられるので、何かが隠れることが無い。\n * 矢印キーで移動、Escape で閉じてトリガーへフォーカスが戻る。\n *\n * トリガーは `<button>` で編集可能要素ではないため IME の変換は発生しない。\n * テキスト入力を伴う選択が必要な場合は ComboBox を使う。\n *\n * @example\n * <Select label=\"都道府県\" selectedKey={pref} onSelectionChange={setPref}>\n * <SelectItem id=\"tokyo\">東京都</SelectItem>\n * <SelectItem id=\"osaka\">大阪府</SelectItem>\n * </Select>\n */\nexport function Select({\n variant,\n size,\n radius,\n label,\n placeholder = '選択してください',\n description,\n errorMessage,\n name,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n isOpen,\n defaultOpen,\n onOpenChange,\n isDisabled,\n isRequired,\n isInvalid,\n children,\n className,\n classNames,\n id,\n}: SelectProps) {\n const s = selectStyles({ variant, size, radius })\n\n return (\n <RACSelect\n id={id}\n name={name}\n selectedKey={selectedKey}\n defaultSelectedKey={defaultSelectedKey}\n onSelectionChange={(key) => onSelectionChange?.(key === null ? null : String(key))}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n isRequired={isRequired}\n isInvalid={isInvalid}\n placeholder={placeholder}\n data-slot=\"root\"\n // trigger 側から invalid / open を参照するために group を付ける\n className={`group ${s.root({ class: [className, classNames?.root] })}`}\n >\n {label !== undefined && (\n <Label data-slot=\"label\" className={s.label({ class: classNames?.label })}>\n {label}\n </Label>\n )}\n\n <Button data-slot=\"trigger\" className={s.trigger({ class: classNames?.trigger })}>\n <SelectValue data-slot=\"value\" className={s.value({ class: classNames?.value })} />\n <span aria-hidden=\"true\" data-slot=\"icon\" className={s.icon({ class: classNames?.icon })}>\n {/* 回さずに差し替える。開いている間だけ字が反転する */}\n <span className=\"group-data-[open]:hidden\">▾</span>\n <span className=\"hidden group-data-[open]:inline\">▴</span>\n </span>\n </Button>\n\n {/* 展開部はトリガーの直後。ここに面が生えることで、description 以降が押し下がる */}\n <InflowPopover dataSlot=\"popover\" className={s.popover({ class: classNames?.popover })}>\n <ListBox data-slot=\"listbox\" className={s.listbox({ class: classNames?.listbox })}>\n {children}\n </ListBox>\n </InflowPopover>\n\n {description !== undefined && (\n <Text\n slot=\"description\"\n data-slot=\"description\"\n className={s.description({ class: classNames?.description })}\n >\n {description}\n </Text>\n )}\n\n <FieldError\n data-slot=\"errorMessage\"\n className={s.errorMessage({ class: classNames?.errorMessage })}\n >\n {errorMessage}\n </FieldError>\n </RACSelect>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,SAAgB,WAAW,EAAE,IAAI,YAAY,UAAU,aAA8B;CACnF,OACE,oBAAC,aAAD;EACM;EACQ;EACZ,WAAW,OAAO,aAAa,WAAW,WAAW,KAAA;EACrD,aAAU;EACV,WAAW,aAAa,aAAa,CAAC,CAAC,OAAO;EAE5C,WAAA,EAAE,iBACF,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,eAAY;GAAO,WAAW;GACjC,UAAA,aAAa,MAAM;EAChB,CAAA,GACN,oBAAC,QAAD;GAAM,WAAU;GAAY;EAAe,CAAA,CAC3C,EAAA,CAAA;CAEO,CAAA;AAEjB;;;;;;;;;;;;;;;;;AAkBA,SAAgBA,SAAO,EACrB,SACA,MACA,QACA,OACA,cAAc,YACd,aACA,cACA,MACA,aACA,oBACA,mBACA,QACA,aACA,cACA,YACA,YACA,WACA,UACA,WACA,YACA,MACc;CACd,MAAM,IAAI,aAAa;EAAE;EAAS;EAAM;CAAO,CAAC;CAEhD,OACE,qBAACC,QAAD;EACM;EACE;EACO;EACO;EACpB,oBAAoB,QAAQ,oBAAoB,QAAQ,OAAO,OAAO,OAAO,GAAG,CAAC;EACzE;EACK;EACC;EACF;EACA;EACD;EACE;EACb,aAAU;EAEV,WAAW,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,YAAY,IAAI,EAAE,CAAC;EAfrE,UAAA;GAiBG,UAAU,KAAA,KACT,oBAAC,OAAD;IAAO,aAAU;IAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,YAAY,MAAM,CAAC;IACrE,UAAA;GACI,CAAA;GAGT,qBAAC,QAAD;IAAQ,aAAU;IAAU,WAAW,EAAE,QAAQ,EAAE,OAAO,YAAY,QAAQ,CAAC;IAA/E,UAAA,CACE,oBAAC,aAAD;KAAa,aAAU;KAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,YAAY,MAAM,CAAC;IAAI,CAAA,GAClF,qBAAC,QAAD;KAAM,eAAY;KAAO,aAAU;KAAO,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;KAAvF,UAAA,CAEE,oBAAC,QAAD;MAAM,WAAU;MAA2B,UAAA;KAAO,CAAA,GAClD,oBAAC,QAAD;MAAM,WAAU;MAAkC,UAAA;KAAO,CAAA,CACrD;IACA,CAAA,CAAA;;GAGR,oBAAC,eAAD;IAAe,UAAS;IAAU,WAAW,EAAE,QAAQ,EAAE,OAAO,YAAY,QAAQ,CAAC;IACnF,UAAA,oBAAC,SAAD;KAAS,aAAU;KAAU,WAAW,EAAE,QAAQ,EAAE,OAAO,YAAY,QAAQ,CAAC;KAC7E;IACM,CAAA;GACI,CAAA;GAEd,gBAAgB,KAAA,KACf,oBAAC,MAAD;IACE,MAAK;IACL,aAAU;IACV,WAAW,EAAE,YAAY,EAAE,OAAO,YAAY,YAAY,CAAC;IAE1D,UAAA;GACG,CAAA;GAGR,oBAAC,YAAD;IACE,aAAU;IACV,WAAW,EAAE,aAAa,EAAE,OAAO,YAAY,aAAa,CAAC;IAE5D,UAAA;GACS,CAAA;EACH;;AAEf"}
|
|
@@ -17,7 +17,7 @@ declare const selectStyles: import("tailwind-variants").TVReturnType<{
|
|
|
17
17
|
trigger: string;
|
|
18
18
|
option: string;
|
|
19
19
|
}>;
|
|
20
|
-
radius: VariantMap<"
|
|
20
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
21
21
|
trigger: string;
|
|
22
22
|
}>;
|
|
23
23
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -39,7 +39,7 @@ declare const selectStyles: import("tailwind-variants").TVReturnType<{
|
|
|
39
39
|
trigger: string;
|
|
40
40
|
option: string;
|
|
41
41
|
}>;
|
|
42
|
-
radius: VariantMap<"
|
|
42
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
43
43
|
trigger: string;
|
|
44
44
|
}>;
|
|
45
45
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -61,7 +61,7 @@ declare const selectStyles: import("tailwind-variants").TVReturnType<{
|
|
|
61
61
|
trigger: string;
|
|
62
62
|
option: string;
|
|
63
63
|
}>;
|
|
64
|
-
radius: VariantMap<"
|
|
64
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
65
65
|
trigger: string;
|
|
66
66
|
}>;
|
|
67
67
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -11,7 +11,7 @@ import { VariantMap } from "@novi-ui/core";
|
|
|
11
11
|
* const mySkeleton = tv({ extend: skeletonStyles, slots: { root: 'opacity-50' } })
|
|
12
12
|
*/
|
|
13
13
|
declare const skeletonStyles: import("tailwind-variants").TVReturnType<{
|
|
14
|
-
radius: VariantMap<"
|
|
14
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
15
15
|
root: string;
|
|
16
16
|
}>;
|
|
17
17
|
}, {
|
|
@@ -21,7 +21,7 @@ declare const skeletonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
21
21
|
*/
|
|
22
22
|
root: string;
|
|
23
23
|
}, undefined, {
|
|
24
|
-
radius: VariantMap<"
|
|
24
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
25
25
|
root: string;
|
|
26
26
|
}>;
|
|
27
27
|
}, {
|
|
@@ -31,7 +31,7 @@ declare const skeletonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
31
31
|
*/
|
|
32
32
|
root: string;
|
|
33
33
|
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
34
|
-
radius: VariantMap<"
|
|
34
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
35
35
|
root: string;
|
|
36
36
|
}>;
|
|
37
37
|
}, {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableHeader, TableHeaderProps, TableRow, TableRowProps } from "./table.mjs";
|
|
2
|
+
import { TableStyleProps, tableStyles } from "./table.styles.mjs";
|
|
3
|
+
export { Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, type TableHeaderProps, TableRow, type TableRowProps, type TableStyleProps, tableStyles };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TableProps } from "@novi-ui/core";
|
|
3
|
+
//#region src/table/table.d.ts
|
|
4
|
+
interface TableHeaderProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 見出し行。`TableColumn` を並べる。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <TableHeader>
|
|
13
|
+
* <TableColumn id="name" isRowHeader>商品名</TableColumn>
|
|
14
|
+
* </TableHeader>
|
|
15
|
+
*/
|
|
16
|
+
declare function TableHeader({ children, className }: TableHeaderProps): import("react").JSX.Element;
|
|
17
|
+
interface TableColumnProps {
|
|
18
|
+
/** 列の id。`sortDescriptor.column` に入る */
|
|
19
|
+
id: string;
|
|
20
|
+
/** この列で並べ替えられる。見出しが押せるようになり `aria-sort` が付く */
|
|
21
|
+
allowsSorting?: boolean;
|
|
22
|
+
/** 行の名前になる列。少なくとも 1 列に付ける */
|
|
23
|
+
isRowHeader?: boolean;
|
|
24
|
+
/** 金額や数量は `end`(右寄せ) */
|
|
25
|
+
align?: 'start' | 'end';
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 見出しのセル。
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <TableColumn id="amount" allowsSorting align="end">金額</TableColumn>
|
|
34
|
+
*/
|
|
35
|
+
declare function TableColumn({ id, allowsSorting, isRowHeader, align, children, className }: TableColumnProps): import("react").JSX.Element;
|
|
36
|
+
interface TableBodyProps {
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
/** 行が 0 件のときに本体へ出す内容 */
|
|
39
|
+
renderEmptyState?: () => ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 本体。`TableRow` を並べる。行が無いときは `renderEmptyState` の内容が出る。
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <TableBody renderEmptyState={() => '該当する注文はありません'}>
|
|
47
|
+
* {rows}
|
|
48
|
+
* </TableBody>
|
|
49
|
+
*/
|
|
50
|
+
declare function TableBody({ children, renderEmptyState, className }: TableBodyProps): import("react").JSX.Element;
|
|
51
|
+
interface TableRowProps {
|
|
52
|
+
/** 行の id。選択と `onRowAction` に渡る */
|
|
53
|
+
id: string;
|
|
54
|
+
isDisabled?: boolean;
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 行。`TableCell` を列の数だけ並べる。
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <TableRow id="1042">
|
|
63
|
+
* <TableCell>#1042</TableCell>
|
|
64
|
+
* </TableRow>
|
|
65
|
+
*/
|
|
66
|
+
declare function TableRow({ id, isDisabled, children, className }: TableRowProps): import("react").JSX.Element;
|
|
67
|
+
interface TableCellProps {
|
|
68
|
+
/** 金額や数量は `end`(右寄せ)。見出しと揃える */
|
|
69
|
+
align?: 'start' | 'end';
|
|
70
|
+
children?: ReactNode;
|
|
71
|
+
className?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* セル。
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* <TableCell align="end">¥12,800</TableCell>
|
|
78
|
+
*/
|
|
79
|
+
declare function TableCell({ align, children, className }: TableCellProps): import("react").JSX.Element;
|
|
80
|
+
/**
|
|
81
|
+
* 一覧を行と列で見せる。**縦横の罫線で升目を切った帳票**。見出しは等幅、数字は等幅の右詰め
|
|
82
|
+
* (Raster は横罫だけ、Tactile は行が面)。
|
|
83
|
+
*
|
|
84
|
+
* 行の選択は行そのものを押す(チェックボックスは出さない)。
|
|
85
|
+
* 狭い画面では表そのものが横にスクロールする。`overflow-x-auto` の枠で包むこと。
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* <Table aria-label="注文一覧" sortDescriptor={sort} onSortChange={setSort}>
|
|
89
|
+
* <TableHeader>
|
|
90
|
+
* <TableColumn id="no" isRowHeader>注文番号</TableColumn>
|
|
91
|
+
* <TableColumn id="amount" allowsSorting align="end">金額</TableColumn>
|
|
92
|
+
* </TableHeader>
|
|
93
|
+
* <TableBody>
|
|
94
|
+
* <TableRow id="1042">
|
|
95
|
+
* <TableCell>#1042</TableCell>
|
|
96
|
+
* <TableCell align="end">¥12,800</TableCell>
|
|
97
|
+
* </TableRow>
|
|
98
|
+
* </TableBody>
|
|
99
|
+
* </Table>
|
|
100
|
+
*/
|
|
101
|
+
declare function Table({ 'aria-label': ariaLabel, size, sortDescriptor, onSortChange, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, disabledKeys, onRowAction, children, className, classNames }: TableProps): import("react").JSX.Element;
|
|
102
|
+
//#endregion
|
|
103
|
+
export { Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableHeader, TableHeaderProps, TableRow, TableRowProps };
|
|
104
|
+
//# sourceMappingURL=table.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.mts","names":[],"sources":["../../src/table/table.tsx"],"mappings":";;;UAkCiB;EACf,WAAW;EACX;;;;;;;;;;iBAWc,cAAc,UAAU,aAAa,mCAAgB,IAAA;UAYpD;;EAEf;;EAEA;;EAEA;;EAEA;EACA,WAAW;EACX;;;;;;;;iBASc,cACd,IACA,eACA,aACA,OACA,UACA,aACC,mCAAgB,IAAA;UAwBF;EACf,WAAW;;EAEX,yBAAyB;EACzB;;;;;;;;;;iBAWc,YAAY,UAAU,kBAAkB,aAAa,iCAAc,IAAA;UAqBlE;;EAEf;EACA;EACA,WAAW;EACX;;;;;;;;;;iBAWc,WAAW,IAAI,YAAY,UAAU,aAAa,gCAAa,IAAA;UAc9D;;EAEf;EACA,WAAW;EACX;;;;;;;;iBASc,YAAY,OAAiB,UAAU,aAAa,iCAAc,IAAA;;;;;;;;;;;;;;;;;;;;;;iBAmClE,sBACA,WACd,MACA,gBACA,cACA,eACA,cACA,qBACA,mBACA,cACA,aACA,UACA,WACA,cACC,6BAAU,IAAA"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { alignEndClass, tableStyles } from "./table.styles.mjs";
|
|
3
|
+
import { Cell, Column, Row, Table, TableBody, TableHeader } from "react-aria-components";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
//#region src/table/table.tsx
|
|
7
|
+
/**
|
|
8
|
+
* 表の中の部品が size と classNames を受け取るための経路。
|
|
9
|
+
* 利用者向けの Provider ではなく、Table の内側だけで閉じる。
|
|
10
|
+
*/
|
|
11
|
+
const TableContext = createContext({ s: tableStyles() });
|
|
12
|
+
function SortIcon({ direction }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("span", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: direction === "ascending" ? "▲" : direction === "descending" ? "▼" : "↕"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 見出し行。`TableColumn` を並べる。
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <TableHeader>
|
|
23
|
+
* <TableColumn id="name" isRowHeader>商品名</TableColumn>
|
|
24
|
+
* </TableHeader>
|
|
25
|
+
*/
|
|
26
|
+
function TableHeader$1({ children, className }) {
|
|
27
|
+
const { s, classNames } = useContext(TableContext);
|
|
28
|
+
return /* @__PURE__ */ jsx(TableHeader, {
|
|
29
|
+
"data-slot": "header",
|
|
30
|
+
className: s.header({ class: [className, classNames?.header] }),
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 見出しのセル。
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <TableColumn id="amount" allowsSorting align="end">金額</TableColumn>
|
|
39
|
+
*/
|
|
40
|
+
function TableColumn({ id, allowsSorting, isRowHeader, align = "start", children, className }) {
|
|
41
|
+
const { s, classNames } = useContext(TableContext);
|
|
42
|
+
return /* @__PURE__ */ jsx(Column, {
|
|
43
|
+
id,
|
|
44
|
+
allowsSorting,
|
|
45
|
+
isRowHeader,
|
|
46
|
+
"data-slot": "column",
|
|
47
|
+
className: `group ${s.column({ class: [
|
|
48
|
+
align === "end" ? alignEndClass : "",
|
|
49
|
+
className,
|
|
50
|
+
classNames?.column
|
|
51
|
+
] })}`,
|
|
52
|
+
children: ({ sortDirection }) => /* @__PURE__ */ jsxs(Fragment, { children: [children, allowsSorting && /* @__PURE__ */ jsx("span", {
|
|
53
|
+
"data-slot": "sortIcon",
|
|
54
|
+
className: s.sortIcon({ class: classNames?.sortIcon }),
|
|
55
|
+
children: /* @__PURE__ */ jsx(SortIcon, { direction: sortDirection })
|
|
56
|
+
})] })
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 本体。`TableRow` を並べる。行が無いときは `renderEmptyState` の内容が出る。
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <TableBody renderEmptyState={() => '該当する注文はありません'}>
|
|
64
|
+
* {rows}
|
|
65
|
+
* </TableBody>
|
|
66
|
+
*/
|
|
67
|
+
function TableBody$1({ children, renderEmptyState, className }) {
|
|
68
|
+
const { s, classNames } = useContext(TableContext);
|
|
69
|
+
return /* @__PURE__ */ jsx(TableBody, {
|
|
70
|
+
"data-slot": "body",
|
|
71
|
+
className: s.body({ class: [className, classNames?.body] }),
|
|
72
|
+
renderEmptyState: renderEmptyState === void 0 ? void 0 : () => /* @__PURE__ */ jsx("div", {
|
|
73
|
+
"data-slot": "empty",
|
|
74
|
+
className: s.empty({ class: classNames?.empty }),
|
|
75
|
+
children: renderEmptyState()
|
|
76
|
+
}),
|
|
77
|
+
children
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 行。`TableCell` を列の数だけ並べる。
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* <TableRow id="1042">
|
|
85
|
+
* <TableCell>#1042</TableCell>
|
|
86
|
+
* </TableRow>
|
|
87
|
+
*/
|
|
88
|
+
function TableRow({ id, isDisabled, children, className }) {
|
|
89
|
+
const { s, classNames } = useContext(TableContext);
|
|
90
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
91
|
+
id,
|
|
92
|
+
isDisabled,
|
|
93
|
+
"data-slot": "row",
|
|
94
|
+
className: s.row({ class: [className, classNames?.row] }),
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* セル。
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* <TableCell align="end">¥12,800</TableCell>
|
|
103
|
+
*/
|
|
104
|
+
function TableCell({ align = "start", children, className }) {
|
|
105
|
+
const { s, classNames } = useContext(TableContext);
|
|
106
|
+
return /* @__PURE__ */ jsx(Cell, {
|
|
107
|
+
"data-slot": "cell",
|
|
108
|
+
className: s.cell({ class: [
|
|
109
|
+
align === "end" ? alignEndClass : "",
|
|
110
|
+
className,
|
|
111
|
+
classNames?.cell
|
|
112
|
+
] }),
|
|
113
|
+
children
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 一覧を行と列で見せる。**縦横の罫線で升目を切った帳票**。見出しは等幅、数字は等幅の右詰め
|
|
118
|
+
* (Raster は横罫だけ、Tactile は行が面)。
|
|
119
|
+
*
|
|
120
|
+
* 行の選択は行そのものを押す(チェックボックスは出さない)。
|
|
121
|
+
* 狭い画面では表そのものが横にスクロールする。`overflow-x-auto` の枠で包むこと。
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* <Table aria-label="注文一覧" sortDescriptor={sort} onSortChange={setSort}>
|
|
125
|
+
* <TableHeader>
|
|
126
|
+
* <TableColumn id="no" isRowHeader>注文番号</TableColumn>
|
|
127
|
+
* <TableColumn id="amount" allowsSorting align="end">金額</TableColumn>
|
|
128
|
+
* </TableHeader>
|
|
129
|
+
* <TableBody>
|
|
130
|
+
* <TableRow id="1042">
|
|
131
|
+
* <TableCell>#1042</TableCell>
|
|
132
|
+
* <TableCell align="end">¥12,800</TableCell>
|
|
133
|
+
* </TableRow>
|
|
134
|
+
* </TableBody>
|
|
135
|
+
* </Table>
|
|
136
|
+
*/
|
|
137
|
+
function Table$1({ "aria-label": ariaLabel, size, sortDescriptor, onSortChange, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, disabledKeys, onRowAction, children, className, classNames }) {
|
|
138
|
+
const s = tableStyles({ size });
|
|
139
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
140
|
+
value: {
|
|
141
|
+
s,
|
|
142
|
+
classNames
|
|
143
|
+
},
|
|
144
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
145
|
+
"aria-label": ariaLabel,
|
|
146
|
+
sortDescriptor,
|
|
147
|
+
onSortChange: (d) => onSortChange?.({
|
|
148
|
+
column: String(d.column),
|
|
149
|
+
direction: d.direction
|
|
150
|
+
}),
|
|
151
|
+
selectionMode,
|
|
152
|
+
selectionBehavior: "replace",
|
|
153
|
+
selectedKeys,
|
|
154
|
+
defaultSelectedKeys,
|
|
155
|
+
onSelectionChange: (keys) => onSelectionChange?.(keys === "all" ? "all" : new Set([...keys].map(String))),
|
|
156
|
+
disabledKeys,
|
|
157
|
+
onRowAction: onRowAction === void 0 ? void 0 : (key) => onRowAction(String(key)),
|
|
158
|
+
"data-slot": "root",
|
|
159
|
+
className: s.root({ class: [className, classNames?.root] }),
|
|
160
|
+
children
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { Table$1 as Table, TableBody$1 as TableBody, TableCell, TableColumn, TableHeader$1 as TableHeader, TableRow };
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.mjs","names":["TableHeader","RACTableHeader","TableBody","RACTableBody","Table","RACTable"],"sources":["../../src/table/table.tsx"],"sourcesContent":["'use client'\n\nimport type { TableProps, TableSortDescriptor } from '@novi-ui/core'\nimport { createContext, type ReactNode, useContext } from 'react'\nimport {\n Cell,\n Column,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n Row,\n} from 'react-aria-components'\nimport { alignEndClass, tableStyles } from './table.styles'\n\ntype Styles = ReturnType<typeof tableStyles>\ntype SlotClassNames = NonNullable<TableProps['classNames']>\n\n/**\n * 表の中の部品が size と classNames を受け取るための経路。\n * 利用者向けの Provider ではなく、Table の内側だけで閉じる。\n */\nconst TableContext = createContext<{ s: Styles; classNames?: SlotClassNames }>({\n s: tableStyles(),\n})\n\nfunction SortIcon({ direction }: { direction: 'ascending' | 'descending' | undefined }) {\n // 図形ではなく活字。帳票の語彙は記号であって図形ではない(ADR-F7)\n return (\n <span aria-hidden=\"true\">\n {direction === 'ascending' ? '▲' : direction === 'descending' ? '▼' : '↕'}\n </span>\n )\n}\n\nexport interface TableHeaderProps {\n children?: ReactNode\n className?: string\n}\n\n/**\n * 見出し行。`TableColumn` を並べる。\n *\n * @example\n * <TableHeader>\n * <TableColumn id=\"name\" isRowHeader>商品名</TableColumn>\n * </TableHeader>\n */\nexport function TableHeader({ children, className }: TableHeaderProps) {\n const { s, classNames } = useContext(TableContext)\n return (\n <RACTableHeader\n data-slot=\"header\"\n className={s.header({ class: [className, classNames?.header] })}\n >\n {children}\n </RACTableHeader>\n )\n}\n\nexport interface TableColumnProps {\n /** 列の id。`sortDescriptor.column` に入る */\n id: string\n /** この列で並べ替えられる。見出しが押せるようになり `aria-sort` が付く */\n allowsSorting?: boolean\n /** 行の名前になる列。少なくとも 1 列に付ける */\n isRowHeader?: boolean\n /** 金額や数量は `end`(右寄せ) */\n align?: 'start' | 'end'\n children?: ReactNode\n className?: string\n}\n\n/**\n * 見出しのセル。\n *\n * @example\n * <TableColumn id=\"amount\" allowsSorting align=\"end\">金額</TableColumn>\n */\nexport function TableColumn({\n id,\n allowsSorting,\n isRowHeader,\n align = 'start',\n children,\n className,\n}: TableColumnProps) {\n const { s, classNames } = useContext(TableContext)\n return (\n <Column\n id={id}\n allowsSorting={allowsSorting}\n isRowHeader={isRowHeader}\n data-slot=\"column\"\n className={`group ${s.column({ class: [align === 'end' ? alignEndClass : '', className, classNames?.column] })}`}\n >\n {({ sortDirection }) => (\n <>\n {children}\n {allowsSorting && (\n <span data-slot=\"sortIcon\" className={s.sortIcon({ class: classNames?.sortIcon })}>\n <SortIcon direction={sortDirection} />\n </span>\n )}\n </>\n )}\n </Column>\n )\n}\n\nexport interface TableBodyProps {\n children?: ReactNode\n /** 行が 0 件のときに本体へ出す内容 */\n renderEmptyState?: () => ReactNode\n className?: string\n}\n\n/**\n * 本体。`TableRow` を並べる。行が無いときは `renderEmptyState` の内容が出る。\n *\n * @example\n * <TableBody renderEmptyState={() => '該当する注文はありません'}>\n * {rows}\n * </TableBody>\n */\nexport function TableBody({ children, renderEmptyState, className }: TableBodyProps) {\n const { s, classNames } = useContext(TableContext)\n return (\n <RACTableBody\n data-slot=\"body\"\n className={s.body({ class: [className, classNames?.body] })}\n renderEmptyState={\n renderEmptyState === undefined\n ? undefined\n : () => (\n <div data-slot=\"empty\" className={s.empty({ class: classNames?.empty })}>\n {renderEmptyState()}\n </div>\n )\n }\n >\n {children}\n </RACTableBody>\n )\n}\n\nexport interface TableRowProps {\n /** 行の id。選択と `onRowAction` に渡る */\n id: string\n isDisabled?: boolean\n children?: ReactNode\n className?: string\n}\n\n/**\n * 行。`TableCell` を列の数だけ並べる。\n *\n * @example\n * <TableRow id=\"1042\">\n * <TableCell>#1042</TableCell>\n * </TableRow>\n */\nexport function TableRow({ id, isDisabled, children, className }: TableRowProps) {\n const { s, classNames } = useContext(TableContext)\n return (\n <Row\n id={id}\n isDisabled={isDisabled}\n data-slot=\"row\"\n className={s.row({ class: [className, classNames?.row] })}\n >\n {children}\n </Row>\n )\n}\n\nexport interface TableCellProps {\n /** 金額や数量は `end`(右寄せ)。見出しと揃える */\n align?: 'start' | 'end'\n children?: ReactNode\n className?: string\n}\n\n/**\n * セル。\n *\n * @example\n * <TableCell align=\"end\">¥12,800</TableCell>\n */\nexport function TableCell({ align = 'start', children, className }: TableCellProps) {\n const { s, classNames } = useContext(TableContext)\n return (\n <Cell\n data-slot=\"cell\"\n className={s.cell({\n class: [align === 'end' ? alignEndClass : '', className, classNames?.cell],\n })}\n >\n {children}\n </Cell>\n )\n}\n\n/**\n * 一覧を行と列で見せる。**縦横の罫線で升目を切った帳票**。見出しは等幅、数字は等幅の右詰め\n * (Raster は横罫だけ、Tactile は行が面)。\n *\n * 行の選択は行そのものを押す(チェックボックスは出さない)。\n * 狭い画面では表そのものが横にスクロールする。`overflow-x-auto` の枠で包むこと。\n *\n * @example\n * <Table aria-label=\"注文一覧\" sortDescriptor={sort} onSortChange={setSort}>\n * <TableHeader>\n * <TableColumn id=\"no\" isRowHeader>注文番号</TableColumn>\n * <TableColumn id=\"amount\" allowsSorting align=\"end\">金額</TableColumn>\n * </TableHeader>\n * <TableBody>\n * <TableRow id=\"1042\">\n * <TableCell>#1042</TableCell>\n * <TableCell align=\"end\">¥12,800</TableCell>\n * </TableRow>\n * </TableBody>\n * </Table>\n */\nexport function Table({\n 'aria-label': ariaLabel,\n size,\n sortDescriptor,\n onSortChange,\n selectionMode,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n disabledKeys,\n onRowAction,\n children,\n className,\n classNames,\n}: TableProps) {\n const s = tableStyles({ size })\n\n return (\n <TableContext.Provider value={{ s, classNames }}>\n {/* RAC の Table は id を受け取らない(DOM に出す口が無い)。NoviBaseProps の id は表では効かない */}\n <RACTable\n aria-label={ariaLabel}\n sortDescriptor={sortDescriptor}\n onSortChange={(d) =>\n onSortChange?.({\n column: String(d.column),\n direction: d.direction,\n } as TableSortDescriptor)\n }\n selectionMode={selectionMode}\n // 行そのものを押して選ぶ。チェックボックスの列は出さない\n selectionBehavior=\"replace\"\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n onSelectionChange={(keys) =>\n onSelectionChange?.(keys === 'all' ? 'all' : new Set([...keys].map(String)))\n }\n disabledKeys={disabledKeys}\n onRowAction={onRowAction === undefined ? undefined : (key) => onRowAction(String(key))}\n data-slot=\"root\"\n className={s.root({ class: [className, classNames?.root] })}\n >\n {children}\n </RACTable>\n </TableContext.Provider>\n )\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { VariantMap } from "@novi-ui/core";
|
|
2
|
+
//#region src/table/table.styles.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Table のスタイル定義。
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { tableStyles } from '@novi-ui/flatlay'
|
|
8
|
+
* import { tv } from 'tailwind-variants'
|
|
9
|
+
*
|
|
10
|
+
* const myTable = tv({ extend: tableStyles, slots: { header: 'bg-transparent' } })
|
|
11
|
+
*/
|
|
12
|
+
declare const tableStyles: import("tailwind-variants").TVReturnType<{
|
|
13
|
+
size: VariantMap<"sm" | "md" | "lg", {
|
|
14
|
+
column: string;
|
|
15
|
+
cell: string;
|
|
16
|
+
}>;
|
|
17
|
+
}, {
|
|
18
|
+
root: string;
|
|
19
|
+
header: string;
|
|
20
|
+
column: string;
|
|
21
|
+
sortIcon: string;
|
|
22
|
+
body: string;
|
|
23
|
+
row: string;
|
|
24
|
+
cell: string;
|
|
25
|
+
empty: string;
|
|
26
|
+
}, undefined, {
|
|
27
|
+
size: VariantMap<"sm" | "md" | "lg", {
|
|
28
|
+
column: string;
|
|
29
|
+
cell: string;
|
|
30
|
+
}>;
|
|
31
|
+
}, {
|
|
32
|
+
root: string;
|
|
33
|
+
header: string;
|
|
34
|
+
column: string;
|
|
35
|
+
sortIcon: string;
|
|
36
|
+
body: string;
|
|
37
|
+
row: string;
|
|
38
|
+
cell: string;
|
|
39
|
+
empty: string;
|
|
40
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
41
|
+
size: VariantMap<"sm" | "md" | "lg", {
|
|
42
|
+
column: string;
|
|
43
|
+
cell: string;
|
|
44
|
+
}>;
|
|
45
|
+
}, {
|
|
46
|
+
root: string;
|
|
47
|
+
header: string;
|
|
48
|
+
column: string;
|
|
49
|
+
sortIcon: string;
|
|
50
|
+
body: string;
|
|
51
|
+
row: string;
|
|
52
|
+
cell: string;
|
|
53
|
+
empty: string;
|
|
54
|
+
}>>;
|
|
55
|
+
type TableStyleProps = Parameters<typeof tableStyles>[0];
|
|
56
|
+
//#endregion
|
|
57
|
+
export { TableStyleProps, tableStyles };
|
|
58
|
+
//# sourceMappingURL=table.styles.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.styles.d.mts","names":[],"sources":["../../src/table/table.styles.ts"],"mappings":";;;;;;;;;;;cAmFa,yCAAW;;IAxBmB;IAAc;;;;;;;;;;;;;IAAd;IAAc;;;;;;;;;;;;;IAAd;IAAc;;;;;;;;;;;;KA8B7C,kBAAkB,kBAAkB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { focusRing } from "../styles/focus-ring.mjs";
|
|
2
|
+
import { heading, monoNumeric } from "../styles/mono.mjs";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
//#region src/table/table.styles.ts
|
|
5
|
+
/**
|
|
6
|
+
* Flatlay の表は**帳票**。縦横の罫線で升目を切り、見出しは等幅、数字は等幅の右詰め
|
|
7
|
+
* (Raster は横罫だけ、Tactile は行が面)。選んだ行は反転しない — 行は押す面ではなく
|
|
8
|
+
* 読む行なので、地色を変えるだけに留める。
|
|
9
|
+
*/
|
|
10
|
+
const slots = {
|
|
11
|
+
root: [
|
|
12
|
+
"w-full border-collapse text-left",
|
|
13
|
+
"border border-[var(--novi-color-border-strong)]",
|
|
14
|
+
"text-[var(--novi-color-fg)]",
|
|
15
|
+
"outline-none"
|
|
16
|
+
].join(" "),
|
|
17
|
+
header: "bg-[var(--novi-color-subtle)]",
|
|
18
|
+
column: [
|
|
19
|
+
`text-[length:var(--novi-text-sm)] ${heading}`,
|
|
20
|
+
"border border-[var(--novi-color-border)] border-b-[var(--novi-color-border-strong)]",
|
|
21
|
+
"whitespace-nowrap align-middle",
|
|
22
|
+
"outline-none",
|
|
23
|
+
"data-[allows-sorting]:cursor-pointer",
|
|
24
|
+
"data-[allows-sorting]:hover:bg-[var(--novi-color-border)]",
|
|
25
|
+
"data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]",
|
|
26
|
+
focusRing
|
|
27
|
+
].join(" "),
|
|
28
|
+
sortIcon: [`ml-1 inline-flex align-middle text-[var(--novi-color-muted)] ${monoNumeric}`, "group-aria-[sort=ascending]:text-[var(--novi-color-fg)] group-aria-[sort=descending]:text-[var(--novi-color-fg)]"].join(" "),
|
|
29
|
+
body: "",
|
|
30
|
+
row: [
|
|
31
|
+
"outline-none",
|
|
32
|
+
"text-[var(--novi-color-fg)]",
|
|
33
|
+
"data-[hovered]:bg-[var(--novi-color-subtle)]",
|
|
34
|
+
"data-[selected]:bg-[var(--novi-color-subtle)] data-[selected]:font-medium",
|
|
35
|
+
"data-[disabled]:opacity-40",
|
|
36
|
+
"data-[focus-visible]:outline-2 data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-[var(--novi-color-ring)]",
|
|
37
|
+
"transition-[background-color]",
|
|
38
|
+
"duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]"
|
|
39
|
+
].join(" "),
|
|
40
|
+
cell: [
|
|
41
|
+
"align-middle",
|
|
42
|
+
"border border-[var(--novi-color-border)]",
|
|
43
|
+
"outline-none",
|
|
44
|
+
"data-[focus-visible]:outline-2 data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-[var(--novi-color-ring)]"
|
|
45
|
+
].join(" "),
|
|
46
|
+
empty: [
|
|
47
|
+
"flex items-center justify-center",
|
|
48
|
+
"py-[var(--novi-pad-surface-y)] px-[var(--novi-pad-surface-x)]",
|
|
49
|
+
`text-[var(--novi-color-muted)] text-[length:var(--novi-text-sm)] ${heading}`
|
|
50
|
+
].join(" ")
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Table のスタイル定義。
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* import { tableStyles } from '@novi-ui/flatlay'
|
|
57
|
+
* import { tv } from 'tailwind-variants'
|
|
58
|
+
*
|
|
59
|
+
* const myTable = tv({ extend: tableStyles, slots: { header: 'bg-transparent' } })
|
|
60
|
+
*/
|
|
61
|
+
const tableStyles = tv({
|
|
62
|
+
slots,
|
|
63
|
+
variants: { size: {
|
|
64
|
+
sm: {
|
|
65
|
+
column: "h-7 px-[var(--novi-pad-control-x-sm)]",
|
|
66
|
+
cell: "h-7 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-sm)]"
|
|
67
|
+
},
|
|
68
|
+
md: {
|
|
69
|
+
column: "h-8 px-[var(--novi-pad-control-x-sm)]",
|
|
70
|
+
cell: "h-8 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]"
|
|
71
|
+
},
|
|
72
|
+
lg: {
|
|
73
|
+
column: "h-10 px-[var(--novi-pad-control-x-md)]",
|
|
74
|
+
cell: "h-10 px-[var(--novi-pad-control-x-md)] text-[length:var(--novi-text-base)]"
|
|
75
|
+
}
|
|
76
|
+
} },
|
|
77
|
+
defaultVariants: { size: "md" }
|
|
78
|
+
});
|
|
79
|
+
/** 右寄せの列(金額・数量)。帳票の数字は等幅で右詰め */
|
|
80
|
+
const alignEndClass = `text-right ${monoNumeric}`;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { alignEndClass, tableStyles };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=table.styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.styles.mjs","names":[],"sources":["../../src/table/table.styles.ts"],"sourcesContent":["import type { NoviSize, SlotMap, tableRequiredSlots, tableSlots, VariantMap } from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\nimport { focusRing } from '../styles/focus-ring'\nimport { heading, monoNumeric } from '../styles/mono'\n\n/**\n * Flatlay の表は**帳票**。縦横の罫線で升目を切り、見出しは等幅、数字は等幅の右詰め\n * (Raster は横罫だけ、Tactile は行が面)。選んだ行は反転しない — 行は押す面ではなく\n * 読む行なので、地色を変えるだけに留める。\n */\nconst slots = {\n root: [\n 'w-full border-collapse text-left',\n 'border border-[var(--novi-color-border-strong)]',\n 'text-[var(--novi-color-fg)]',\n 'outline-none',\n ].join(' '),\n header: 'bg-[var(--novi-color-subtle)]',\n column: [\n `text-[length:var(--novi-text-sm)] ${heading}`,\n 'border border-[var(--novi-color-border)] border-b-[var(--novi-color-border-strong)]',\n 'whitespace-nowrap align-middle',\n 'outline-none',\n 'data-[allows-sorting]:cursor-pointer',\n 'data-[allows-sorting]:hover:bg-[var(--novi-color-border)]',\n 'data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]',\n focusRing,\n ].join(' '),\n // 並べ替えの印は活字。方向が決まっている間だけ濃くなる\n sortIcon: [\n `ml-1 inline-flex align-middle text-[var(--novi-color-muted)] ${monoNumeric}`,\n 'group-aria-[sort=ascending]:text-[var(--novi-color-fg)] group-aria-[sort=descending]:text-[var(--novi-color-fg)]',\n ].join(' '),\n body: '',\n row: [\n 'outline-none',\n // 面(hover / 選択)を持つので文字色も持つ。ダークで不可視にならない\n 'text-[var(--novi-color-fg)]',\n 'data-[hovered]:bg-[var(--novi-color-subtle)]',\n 'data-[selected]:bg-[var(--novi-color-subtle)] data-[selected]:font-medium',\n 'data-[disabled]:opacity-40',\n 'data-[focus-visible]:outline-2 data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-[var(--novi-color-ring)]',\n 'transition-[background-color]',\n 'duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n ].join(' '),\n cell: [\n 'align-middle',\n 'border border-[var(--novi-color-border)]',\n 'outline-none',\n 'data-[focus-visible]:outline-2 data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-[var(--novi-color-ring)]',\n ].join(' '),\n empty: [\n 'flex items-center justify-center',\n 'py-[var(--novi-pad-surface-y)] px-[var(--novi-pad-surface-x)]',\n `text-[var(--novi-color-muted)] text-[length:var(--novi-text-sm)] ${heading}`,\n ].join(' '),\n} satisfies SlotMap<typeof tableSlots, (typeof tableRequiredSlots)[number]>\n\n/** 行の高さは行の階級に載せる。28 / 32 / 40px */\nconst size: VariantMap<NoviSize, { column: string; cell: string }> = {\n sm: {\n column: 'h-7 px-[var(--novi-pad-control-x-sm)]',\n cell: 'h-7 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-sm)]',\n },\n md: {\n column: 'h-8 px-[var(--novi-pad-control-x-sm)]',\n cell: 'h-8 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]',\n },\n lg: {\n column: 'h-10 px-[var(--novi-pad-control-x-md)]',\n cell: 'h-10 px-[var(--novi-pad-control-x-md)] text-[length:var(--novi-text-base)]',\n },\n}\n\n/**\n * Table のスタイル定義。\n *\n * @example\n * import { tableStyles } from '@novi-ui/flatlay'\n * import { tv } from 'tailwind-variants'\n *\n * const myTable = tv({ extend: tableStyles, slots: { header: 'bg-transparent' } })\n */\nexport const tableStyles = tv({\n slots,\n variants: { size },\n defaultVariants: { size: 'md' },\n})\n\nexport type TableStyleProps = Parameters<typeof tableStyles>[0]\n\n/** 右寄せの列(金額・数量)。帳票の数字は等幅で右詰め */\nexport const alignEndClass = `text-right ${monoNumeric}`\n"],"mappings":";;;;;;;;;AAUA,MAAM,QAAQ;CACZ,MAAM;EACJ;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,QAAQ;CACR,QAAQ;EACN,qCAAqC;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CAEV,UAAU,CACR,gEAAgE,eAChE,kHACF,CAAC,CAAC,KAAK,GAAG;CACV,MAAM;CACN,KAAK;EACH;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,MAAM;EACJ;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,OAAO;EACL;EACA;EACA,oEAAoE;CACtE,CAAC,CAAC,KAAK,GAAG;AACZ;;;;;;;;;;AA2BA,MAAa,cAAc,GAAG;CAC5B;CACA,UAAU,EAAE;EAzBZ,IAAI;GACF,QAAQ;GACR,MAAM;EACR;EACA,IAAI;GACF,QAAQ;GACR,MAAM;EACR;EACA,IAAI;GACF,QAAQ;GACR,MAAM;EACR;CAcY,EAAK;CACjB,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;;AAKD,MAAa,gBAAgB,cAAc"}
|
|
@@ -14,7 +14,7 @@ declare const textareaStyles: import("tailwind-variants").TVReturnType<{
|
|
|
14
14
|
inputWrapper: string;
|
|
15
15
|
textarea: string;
|
|
16
16
|
}>;
|
|
17
|
-
radius: VariantMap<"
|
|
17
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
18
18
|
inputWrapper: string;
|
|
19
19
|
}>;
|
|
20
20
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -32,7 +32,7 @@ declare const textareaStyles: import("tailwind-variants").TVReturnType<{
|
|
|
32
32
|
inputWrapper: string;
|
|
33
33
|
textarea: string;
|
|
34
34
|
}>;
|
|
35
|
-
radius: VariantMap<"
|
|
35
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
36
36
|
inputWrapper: string;
|
|
37
37
|
}>;
|
|
38
38
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -50,7 +50,7 @@ declare const textareaStyles: import("tailwind-variants").TVReturnType<{
|
|
|
50
50
|
inputWrapper: string;
|
|
51
51
|
textarea: string;
|
|
52
52
|
}>;
|
|
53
|
-
radius: VariantMap<"
|
|
53
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
54
54
|
inputWrapper: string;
|
|
55
55
|
}>;
|
|
56
56
|
variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
|
|
@@ -10,7 +10,7 @@ declare const toastStyles: import("tailwind-variants").TVReturnType<{
|
|
|
10
10
|
color: VariantMap<"default" | "primary" | "secondary" | "success" | "warning" | "danger", {
|
|
11
11
|
root: string;
|
|
12
12
|
}>;
|
|
13
|
-
radius: VariantMap<"
|
|
13
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
14
14
|
root: string;
|
|
15
15
|
}>;
|
|
16
16
|
}, {
|
|
@@ -26,7 +26,7 @@ declare const toastStyles: import("tailwind-variants").TVReturnType<{
|
|
|
26
26
|
color: VariantMap<"default" | "primary" | "secondary" | "success" | "warning" | "danger", {
|
|
27
27
|
root: string;
|
|
28
28
|
}>;
|
|
29
|
-
radius: VariantMap<"
|
|
29
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
30
30
|
root: string;
|
|
31
31
|
}>;
|
|
32
32
|
}, {
|
|
@@ -42,7 +42,7 @@ declare const toastStyles: import("tailwind-variants").TVReturnType<{
|
|
|
42
42
|
color: VariantMap<"default" | "primary" | "secondary" | "success" | "warning" | "danger", {
|
|
43
43
|
root: string;
|
|
44
44
|
}>;
|
|
45
|
-
radius: VariantMap<"
|
|
45
|
+
radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
|
|
46
46
|
root: string;
|
|
47
47
|
}>;
|
|
48
48
|
}, {
|
|
@@ -9,16 +9,16 @@ declare const tooltipStyles: import("tailwind-variants").TVReturnType<{
|
|
|
9
9
|
[key: string]: {
|
|
10
10
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
11
11
|
root?: import("tailwind-variants").ClassValue;
|
|
12
|
-
content?: import("tailwind-variants").ClassValue;
|
|
13
12
|
arrow?: import("tailwind-variants").ClassValue;
|
|
13
|
+
content?: import("tailwind-variants").ClassValue;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
} | {
|
|
17
17
|
[x: string]: {
|
|
18
18
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
19
19
|
root?: import("tailwind-variants").ClassValue;
|
|
20
|
-
content?: import("tailwind-variants").ClassValue;
|
|
21
20
|
arrow?: import("tailwind-variants").ClassValue;
|
|
21
|
+
content?: import("tailwind-variants").ClassValue;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
} | {}, {
|
|
@@ -29,8 +29,8 @@ declare const tooltipStyles: import("tailwind-variants").TVReturnType<{
|
|
|
29
29
|
[key: string]: {
|
|
30
30
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
31
31
|
root?: import("tailwind-variants").ClassValue;
|
|
32
|
-
content?: import("tailwind-variants").ClassValue;
|
|
33
32
|
arrow?: import("tailwind-variants").ClassValue;
|
|
33
|
+
content?: import("tailwind-variants").ClassValue;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
} | {}, {
|