@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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/avatar/avatar.styles.d.mts +3 -3
  4. package/dist/badge/badge.styles.d.mts +3 -3
  5. package/dist/button/button.styles.d.mts +3 -3
  6. package/dist/card/card.styles.d.mts +3 -3
  7. package/dist/combo-box/combo-box.d.mts +37 -0
  8. package/dist/combo-box/combo-box.d.mts.map +1 -0
  9. package/dist/combo-box/combo-box.mjs +129 -0
  10. package/dist/combo-box/combo-box.mjs.map +1 -0
  11. package/dist/combo-box/combo-box.styles.d.mts +88 -0
  12. package/dist/combo-box/combo-box.styles.d.mts.map +1 -0
  13. package/dist/combo-box/combo-box.styles.mjs +113 -0
  14. package/dist/combo-box/combo-box.styles.mjs.map +1 -0
  15. package/dist/combo-box/index.d.mts +3 -0
  16. package/dist/date-picker/date-picker.d.mts +16 -0
  17. package/dist/date-picker/date-picker.d.mts.map +1 -0
  18. package/dist/date-picker/date-picker.mjs +140 -0
  19. package/dist/date-picker/date-picker.mjs.map +1 -0
  20. package/dist/date-picker/date-picker.styles.d.mts +103 -0
  21. package/dist/date-picker/date-picker.styles.d.mts.map +1 -0
  22. package/dist/date-picker/date-picker.styles.mjs +131 -0
  23. package/dist/date-picker/date-picker.styles.mjs.map +1 -0
  24. package/dist/date-picker/index.d.mts +3 -0
  25. package/dist/index.d.mts +16 -1
  26. package/dist/index.mjs +11 -1
  27. package/dist/input/input.styles.d.mts +3 -3
  28. package/dist/menu/menu.styles.d.mts +3 -3
  29. package/dist/number-field/index.d.mts +3 -0
  30. package/dist/number-field/number-field.d.mts +16 -0
  31. package/dist/number-field/number-field.d.mts.map +1 -0
  32. package/dist/number-field/number-field.mjs +93 -0
  33. package/dist/number-field/number-field.mjs.map +1 -0
  34. package/dist/number-field/number-field.styles.d.mts +88 -0
  35. package/dist/number-field/number-field.styles.d.mts.map +1 -0
  36. package/dist/number-field/number-field.styles.mjs +102 -0
  37. package/dist/number-field/number-field.styles.mjs.map +1 -0
  38. package/dist/pagination/index.d.mts +3 -0
  39. package/dist/pagination/pagination.d.mts +13 -0
  40. package/dist/pagination/pagination.d.mts.map +1 -0
  41. package/dist/pagination/pagination.mjs +98 -0
  42. package/dist/pagination/pagination.mjs.map +1 -0
  43. package/dist/pagination/pagination.styles.d.mts +67 -0
  44. package/dist/pagination/pagination.styles.d.mts.map +1 -0
  45. package/dist/pagination/pagination.styles.mjs +83 -0
  46. package/dist/pagination/pagination.styles.mjs.map +1 -0
  47. package/dist/popover/popover.styles.d.mts +3 -3
  48. package/dist/select/select.d.mts +1 -1
  49. package/dist/select/select.mjs +1 -1
  50. package/dist/select/select.mjs.map +1 -1
  51. package/dist/select/select.styles.d.mts +3 -3
  52. package/dist/skeleton/skeleton.styles.d.mts +3 -3
  53. package/dist/table/index.d.mts +3 -0
  54. package/dist/table/table.d.mts +104 -0
  55. package/dist/table/table.d.mts.map +1 -0
  56. package/dist/table/table.mjs +167 -0
  57. package/dist/table/table.mjs.map +1 -0
  58. package/dist/table/table.styles.d.mts +58 -0
  59. package/dist/table/table.styles.d.mts.map +1 -0
  60. package/dist/table/table.styles.mjs +84 -0
  61. package/dist/table/table.styles.mjs.map +1 -0
  62. package/dist/textarea/textarea.styles.d.mts +3 -3
  63. package/dist/toast/toast.styles.d.mts +3 -3
  64. package/dist/tooltip/tooltip.styles.d.mts +3 -3
  65. package/package.json +9 -7
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { numberFieldStyles } from "./number-field.styles.mjs";
3
+ import { Button, FieldError, Group, Input, Label, NumberField, Text } from "react-aria-components";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useImeSafeKeys } from "@novi-ui/core/client";
6
+ //#region src/number-field/number-field.tsx
7
+ /**
8
+ * 数値の入力。矢印キーと増減ボタンで `step` ずつ刻む。
9
+ *
10
+ * 数値は右詰めの等幅で、**増減は右端の罫線セルに `−` `+` の活字**で置く。
11
+ * 帳票の金額欄と同じ読み方になる(Raster は細い線、Tactile は左右の面)。
12
+ * 空欄は `NaN` ではなく `null` で `onChange` に渡す(ADR-B2)。
13
+ *
14
+ * @example
15
+ * <NumberField label="数量" defaultValue={1} minValue={0} step={1} />
16
+ */
17
+ function NumberField$1({ variant, size, radius, label, placeholder, description, errorMessage, name, value, defaultValue, onChange, minValue, maxValue, step, formatOptions, onKeyDown, isDisabled, isReadOnly, isRequired, isInvalid, className, classNames, id }) {
18
+ const s = numberFieldStyles({
19
+ variant,
20
+ size,
21
+ radius
22
+ });
23
+ const keyProps = useImeSafeKeys(onKeyDown);
24
+ return /* @__PURE__ */ jsxs(NumberField, {
25
+ id,
26
+ name,
27
+ value: value === null ? NaN : value,
28
+ defaultValue,
29
+ onChange: (next) => onChange?.(Number.isNaN(next) ? null : next),
30
+ minValue,
31
+ maxValue,
32
+ step,
33
+ formatOptions,
34
+ isDisabled,
35
+ isReadOnly,
36
+ isRequired,
37
+ isInvalid,
38
+ "data-slot": "root",
39
+ className: s.root({ class: [className, classNames?.root] }),
40
+ children: [
41
+ label !== void 0 && /* @__PURE__ */ jsx(Label, {
42
+ "data-slot": "label",
43
+ className: s.label({ class: classNames?.label }),
44
+ children: label
45
+ }),
46
+ /* @__PURE__ */ jsxs(Group, {
47
+ "data-slot": "inputWrapper",
48
+ className: s.inputWrapper({ class: classNames?.inputWrapper }),
49
+ children: [
50
+ /* @__PURE__ */ jsx(Input, {
51
+ "data-slot": "input",
52
+ placeholder,
53
+ className: s.input({ class: classNames?.input }),
54
+ ...keyProps
55
+ }),
56
+ /* @__PURE__ */ jsx(Button, {
57
+ slot: "decrement",
58
+ "data-slot": "decrement",
59
+ className: s.decrement({ class: classNames?.decrement }),
60
+ children: /* @__PURE__ */ jsx("span", {
61
+ "aria-hidden": "true",
62
+ children: "−"
63
+ })
64
+ }),
65
+ /* @__PURE__ */ jsx(Button, {
66
+ slot: "increment",
67
+ "data-slot": "increment",
68
+ className: s.increment({ class: classNames?.increment }),
69
+ children: /* @__PURE__ */ jsx("span", {
70
+ "aria-hidden": "true",
71
+ children: "+"
72
+ })
73
+ })
74
+ ]
75
+ }),
76
+ description !== void 0 && /* @__PURE__ */ jsx(Text, {
77
+ slot: "description",
78
+ "data-slot": "description",
79
+ className: s.description({ class: classNames?.description }),
80
+ children: description
81
+ }),
82
+ /* @__PURE__ */ jsx(FieldError, {
83
+ "data-slot": "errorMessage",
84
+ className: s.errorMessage({ class: classNames?.errorMessage }),
85
+ children: errorMessage
86
+ })
87
+ ]
88
+ });
89
+ }
90
+ //#endregion
91
+ export { NumberField$1 as NumberField };
92
+
93
+ //# sourceMappingURL=number-field.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-field.mjs","names":["NumberField","RACNumberField"],"sources":["../../src/number-field/number-field.tsx"],"sourcesContent":["'use client'\n\nimport type { NumberFieldProps } from '@novi-ui/core'\nimport { useImeSafeKeys } from '@novi-ui/core/client'\nimport {\n Button,\n FieldError,\n Group,\n Input,\n Label,\n NumberField as RACNumberField,\n Text,\n} from 'react-aria-components'\nimport { numberFieldStyles } from './number-field.styles'\n\n/**\n * 数値の入力。矢印キーと増減ボタンで `step` ずつ刻む。\n *\n * 数値は右詰めの等幅で、**増減は右端の罫線セルに `−` `+` の活字**で置く。\n * 帳票の金額欄と同じ読み方になる(Raster は細い線、Tactile は左右の面)。\n * 空欄は `NaN` ではなく `null` で `onChange` に渡す(ADR-B2)。\n *\n * @example\n * <NumberField label=\"数量\" defaultValue={1} minValue={0} step={1} />\n */\nexport function NumberField({\n variant,\n size,\n radius,\n label,\n placeholder,\n description,\n errorMessage,\n name,\n value,\n defaultValue,\n onChange,\n minValue,\n maxValue,\n step,\n formatOptions,\n onKeyDown,\n isDisabled,\n isReadOnly,\n isRequired,\n isInvalid,\n className,\n classNames,\n id,\n}: NumberFieldProps) {\n const s = numberFieldStyles({ variant, size, radius })\n const keyProps = useImeSafeKeys<HTMLInputElement>(onKeyDown)\n\n return (\n <RACNumberField\n id={id}\n name={name}\n // RAC は空欄を NaN で表す。外には出さない(ADR-B2)\n value={value === null ? Number.NaN : value}\n defaultValue={defaultValue}\n onChange={(next) => onChange?.(Number.isNaN(next) ? null : next)}\n minValue={minValue}\n maxValue={maxValue}\n step={step}\n formatOptions={formatOptions}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n isInvalid={isInvalid}\n data-slot=\"root\"\n className={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 <Group\n data-slot=\"inputWrapper\"\n className={s.inputWrapper({ class: classNames?.inputWrapper })}\n >\n <Input\n data-slot=\"input\"\n placeholder={placeholder}\n className={s.input({ class: classNames?.input })}\n {...keyProps}\n />\n <Button\n slot=\"decrement\"\n data-slot=\"decrement\"\n className={s.decrement({ class: classNames?.decrement })}\n >\n <span aria-hidden=\"true\">−</span>\n </Button>\n <Button\n slot=\"increment\"\n data-slot=\"increment\"\n className={s.increment({ class: classNames?.increment })}\n >\n <span aria-hidden=\"true\">+</span>\n </Button>\n </Group>\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 </RACNumberField>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAgBA,cAAY,EAC1B,SACA,MACA,QACA,OACA,aACA,aACA,cACA,MACA,OACA,cACA,UACA,UACA,UACA,MACA,eACA,WACA,YACA,YACA,YACA,WACA,WACA,YACA,MACmB;CACnB,MAAM,IAAI,kBAAkB;EAAE;EAAS;EAAM;CAAO,CAAC;CACrD,MAAM,WAAW,eAAiC,SAAS;CAE3D,OACE,qBAACC,aAAD;EACM;EACE;EAEN,OAAO,UAAU,OAAO,MAAa;EACvB;EACd,WAAW,SAAS,WAAW,OAAO,MAAM,IAAI,IAAI,OAAO,IAAI;EACrD;EACA;EACJ;EACS;EACH;EACA;EACA;EACD;EACX,aAAU;EACV,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,YAAY,IAAI,EAAE,CAAC;EAhB5D,UAAA;GAkBG,UAAU,KAAA,KACT,oBAAC,OAAD;IAAO,aAAU;IAAQ,WAAW,EAAE,MAAM,EAAE,OAAO,YAAY,MAAM,CAAC;IACrE,UAAA;GACI,CAAA;GAGT,qBAAC,OAAD;IACE,aAAU;IACV,WAAW,EAAE,aAAa,EAAE,OAAO,YAAY,aAAa,CAAC;IAF/D,UAAA;KAIE,oBAAC,OAAD;MACE,aAAU;MACG;MACb,WAAW,EAAE,MAAM,EAAE,OAAO,YAAY,MAAM,CAAC;MAC/C,GAAI;KACL,CAAA;KACD,oBAAC,QAAD;MACE,MAAK;MACL,aAAU;MACV,WAAW,EAAE,UAAU,EAAE,OAAO,YAAY,UAAU,CAAC;MAEvD,UAAA,oBAAC,QAAD;OAAM,eAAY;OAAO,UAAA;MAAO,CAAA;KAC1B,CAAA;KACR,oBAAC,QAAD;MACE,MAAK;MACL,aAAU;MACV,WAAW,EAAE,UAAU,EAAE,OAAO,YAAY,UAAU,CAAC;MAEvD,UAAA,oBAAC,QAAD;OAAM,eAAY;OAAO,UAAA;MAAO,CAAA;KAC1B,CAAA;IACH;;GAEN,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;EACE;;AAEpB"}
@@ -0,0 +1,88 @@
1
+ import { VariantMap } from "@novi-ui/core";
2
+ //#region src/number-field/number-field.styles.d.ts
3
+ /**
4
+ * NumberField のスタイル定義。
5
+ *
6
+ * @example
7
+ * import { numberFieldStyles } from '@novi-ui/flatlay'
8
+ * import { tv } from 'tailwind-variants'
9
+ *
10
+ * const myField = tv({ extend: numberFieldStyles, slots: { input: 'text-left' } })
11
+ */
12
+ declare const numberFieldStyles: import("tailwind-variants").TVReturnType<{
13
+ size: VariantMap<"sm" | "md" | "lg", {
14
+ inputWrapper: string;
15
+ input: string;
16
+ }>;
17
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
18
+ inputWrapper: string;
19
+ }>;
20
+ variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
21
+ inputWrapper: string;
22
+ }>;
23
+ }, {
24
+ root: string;
25
+ label: string;
26
+ /**
27
+ * 記入欄の枠。罫線の幅は全 variant が持ち、色だけを variant が決める(Flatlay の型)。
28
+ * 増減セルの縦罫線も同じ色を継ぐので、`border-color` は枠にだけ書く。
29
+ */
30
+ inputWrapper: string;
31
+ input: string;
32
+ decrement: string;
33
+ increment: string;
34
+ description: string;
35
+ errorMessage: string;
36
+ }, undefined, {
37
+ size: VariantMap<"sm" | "md" | "lg", {
38
+ inputWrapper: string;
39
+ input: string;
40
+ }>;
41
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
42
+ inputWrapper: string;
43
+ }>;
44
+ variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
45
+ inputWrapper: string;
46
+ }>;
47
+ }, {
48
+ root: string;
49
+ label: string;
50
+ /**
51
+ * 記入欄の枠。罫線の幅は全 variant が持ち、色だけを variant が決める(Flatlay の型)。
52
+ * 増減セルの縦罫線も同じ色を継ぐので、`border-color` は枠にだけ書く。
53
+ */
54
+ inputWrapper: string;
55
+ input: string;
56
+ decrement: string;
57
+ increment: string;
58
+ description: string;
59
+ errorMessage: string;
60
+ }, import("tailwind-variants").TVReturnTypeLike<{
61
+ size: VariantMap<"sm" | "md" | "lg", {
62
+ inputWrapper: string;
63
+ input: string;
64
+ }>;
65
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
66
+ inputWrapper: string;
67
+ }>;
68
+ variant: VariantMap<"solid" | "outline" | "soft" | "ghost" | "plain", {
69
+ inputWrapper: string;
70
+ }>;
71
+ }, {
72
+ root: string;
73
+ label: string;
74
+ /**
75
+ * 記入欄の枠。罫線の幅は全 variant が持ち、色だけを variant が決める(Flatlay の型)。
76
+ * 増減セルの縦罫線も同じ色を継ぐので、`border-color` は枠にだけ書く。
77
+ */
78
+ inputWrapper: string;
79
+ input: string;
80
+ decrement: string;
81
+ increment: string;
82
+ description: string;
83
+ errorMessage: string;
84
+ }>>;
85
+ type NumberFieldStyleProps = Parameters<typeof numberFieldStyles>[0];
86
+ //#endregion
87
+ export { NumberFieldStyleProps, numberFieldStyles };
88
+ //# sourceMappingURL=number-field.styles.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-field.styles.d.mts","names":[],"sources":["../../src/number-field/number-field.styles.ts"],"mappings":";;;;;;;;;;;cA6Ga,+CAAiB;;IAhCmB;IAAe;;;IAeX;;;IA5BE;;;;;;;;;;;;;;;;;IAaN;IAAe;;;IAeX;;;IA5BE;;;;;;;;;;;;;;;;;IAaN;IAAe;;;IAeX;;;IA5BE;;;;;;;;;;;;;;;;KAoD3C,wBAAwB,kBAAkB"}
@@ -0,0 +1,102 @@
1
+ import { disabledState, focusRing } from "../styles/focus-ring.mjs";
2
+ import { mono, monoNumeric } from "../styles/mono.mjs";
3
+ import { tv } from "tailwind-variants";
4
+ //#region src/number-field/number-field.styles.ts
5
+ /**
6
+ * 増減ボタン。**罫線で区切ったセル**に等幅の `−` `+` を置く(ADR-F7)。
7
+ * 面も影も持たず、押した瞬間だけ反転する(スタンプ。ADR-F3)。
8
+ * 記号は文字で描く。帳票の語彙は活字であって図形ではない。
9
+ */
10
+ const stepper = [
11
+ "shrink-0 self-stretch inline-flex items-center justify-center",
12
+ "px-[var(--novi-pad-control-x-sm)]",
13
+ "text-[var(--novi-color-muted)]",
14
+ "border-l",
15
+ "outline-none",
16
+ monoNumeric,
17
+ "hover:text-[var(--novi-color-fg)] hover:bg-[var(--novi-color-subtle)]",
18
+ "data-[focus-visible]:text-[var(--novi-color-fg)]",
19
+ "data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]",
20
+ "data-[disabled]:opacity-40 data-[disabled]:cursor-default",
21
+ "transition-[background-color,color]",
22
+ "duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]"
23
+ ].join(" ");
24
+ const slots = {
25
+ root: "flex flex-col gap-1.5",
26
+ label: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-fg)] ${mono}`,
27
+ /**
28
+ * 記入欄の枠。罫線の幅は全 variant が持ち、色だけを variant が決める(Flatlay の型)。
29
+ * 増減セルの縦罫線も同じ色を継ぐので、`border-color` は枠にだけ書く。
30
+ */
31
+ inputWrapper: [
32
+ "flex items-center w-full overflow-hidden",
33
+ "text-[var(--novi-color-fg)]",
34
+ "border",
35
+ "rounded-[var(--novi-radius-sm)]",
36
+ "data-[invalid]:border-[var(--novi-color-danger)]",
37
+ "transition-[border-color,opacity]",
38
+ "duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]",
39
+ focusRing,
40
+ disabledState
41
+ ].join(" "),
42
+ input: [
43
+ "w-full min-w-0 bg-transparent outline-none text-right",
44
+ `text-[var(--novi-color-fg)] ${monoNumeric}`,
45
+ "placeholder:text-[var(--novi-color-muted)]"
46
+ ].join(" "),
47
+ decrement: stepper,
48
+ increment: stepper,
49
+ description: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-muted)] ${mono}`,
50
+ errorMessage: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-danger)] ${mono}`
51
+ };
52
+ /**
53
+ * NumberField のスタイル定義。
54
+ *
55
+ * @example
56
+ * import { numberFieldStyles } from '@novi-ui/flatlay'
57
+ * import { tv } from 'tailwind-variants'
58
+ *
59
+ * const myField = tv({ extend: numberFieldStyles, slots: { input: 'text-left' } })
60
+ */
61
+ const numberFieldStyles = tv({
62
+ slots,
63
+ variants: {
64
+ size: {
65
+ sm: {
66
+ inputWrapper: "h-7",
67
+ input: "px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-sm)]"
68
+ },
69
+ md: {
70
+ inputWrapper: "h-8",
71
+ input: "px-[var(--novi-pad-control-x-md)] text-[length:var(--novi-text-base)]"
72
+ },
73
+ lg: {
74
+ inputWrapper: "h-10",
75
+ input: "px-[var(--novi-pad-control-x-lg)] text-[length:var(--novi-text-base)]"
76
+ }
77
+ },
78
+ radius: {
79
+ none: { inputWrapper: "rounded-[var(--novi-radius-none)]" },
80
+ sm: { inputWrapper: "rounded-[var(--novi-radius-sm)]" },
81
+ md: { inputWrapper: "rounded-[var(--novi-radius-md)]" },
82
+ lg: { inputWrapper: "rounded-[var(--novi-radius-lg)]" },
83
+ full: { inputWrapper: "rounded-[var(--novi-radius-full)]" }
84
+ },
85
+ variant: {
86
+ solid: { inputWrapper: "bg-[var(--novi-color-surface)] border-[var(--novi-color-border-strong)]" },
87
+ outline: { inputWrapper: "bg-transparent border-[var(--novi-color-border-strong)]" },
88
+ soft: { inputWrapper: "bg-[var(--novi-color-subtle)] border-[var(--novi-color-border)]" },
89
+ ghost: { inputWrapper: "bg-transparent border-transparent border-b-[var(--novi-color-border-strong)]" },
90
+ plain: { inputWrapper: "bg-transparent border-transparent" }
91
+ }
92
+ },
93
+ defaultVariants: {
94
+ size: "md",
95
+ radius: "sm",
96
+ variant: "outline"
97
+ }
98
+ });
99
+ //#endregion
100
+ export { numberFieldStyles };
101
+
102
+ //# sourceMappingURL=number-field.styles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-field.styles.mjs","names":[],"sources":["../../src/number-field/number-field.styles.ts"],"sourcesContent":["import type {\n NoviRadius,\n NoviSize,\n NoviVariant,\n numberFieldRequiredSlots,\n numberFieldSlots,\n SlotMap,\n VariantMap,\n} from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\nimport { disabledState, focusRing } from '../styles/focus-ring'\nimport { mono, monoNumeric } from '../styles/mono'\n\n/**\n * 増減ボタン。**罫線で区切ったセル**に等幅の `−` `+` を置く(ADR-F7)。\n * 面も影も持たず、押した瞬間だけ反転する(スタンプ。ADR-F3)。\n * 記号は文字で描く。帳票の語彙は活字であって図形ではない。\n */\nconst stepper = [\n 'shrink-0 self-stretch inline-flex items-center justify-center',\n 'px-[var(--novi-pad-control-x-sm)]',\n 'text-[var(--novi-color-muted)]',\n 'border-l',\n 'outline-none',\n monoNumeric,\n 'hover:text-[var(--novi-color-fg)] hover:bg-[var(--novi-color-subtle)]',\n 'data-[focus-visible]:text-[var(--novi-color-fg)]',\n 'data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]',\n 'data-[disabled]:opacity-40 data-[disabled]:cursor-default',\n 'transition-[background-color,color]',\n 'duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n].join(' ')\n\nconst slots = {\n root: 'flex flex-col gap-1.5',\n label: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-fg)] ${mono}`,\n /**\n * 記入欄の枠。罫線の幅は全 variant が持ち、色だけを variant が決める(Flatlay の型)。\n * 増減セルの縦罫線も同じ色を継ぐので、`border-color` は枠にだけ書く。\n */\n inputWrapper: [\n 'flex items-center w-full overflow-hidden',\n 'text-[var(--novi-color-fg)]',\n 'border',\n 'rounded-[var(--novi-radius-sm)]',\n 'data-[invalid]:border-[var(--novi-color-danger)]',\n 'transition-[border-color,opacity]',\n 'duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n focusRing,\n disabledState,\n ].join(' '),\n // 数値は右詰めの等幅。帳票の金額欄と同じ\n input: [\n 'w-full min-w-0 bg-transparent outline-none text-right',\n `text-[var(--novi-color-fg)] ${monoNumeric}`,\n 'placeholder:text-[var(--novi-color-muted)]',\n ].join(' '),\n decrement: stepper,\n increment: stepper,\n description: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-muted)] ${mono}`,\n // 色だけに頼らずテキストを必ず伴う(WCAG 1.4.1)\n errorMessage: `text-[length:var(--novi-text-sm)] text-[var(--novi-color-danger)] ${mono}`,\n} satisfies SlotMap<typeof numberFieldSlots, (typeof numberFieldRequiredSlots)[number]>\n\nconst variant: VariantMap<NoviVariant, { inputWrapper: string }> = {\n solid: {\n inputWrapper: 'bg-[var(--novi-color-surface)] border-[var(--novi-color-border-strong)]',\n },\n outline: { inputWrapper: 'bg-transparent border-[var(--novi-color-border-strong)]' },\n soft: { inputWrapper: 'bg-[var(--novi-color-subtle)] border-[var(--novi-color-border)]' },\n ghost: {\n inputWrapper: 'bg-transparent border-transparent border-b-[var(--novi-color-border-strong)]',\n },\n plain: { inputWrapper: 'bg-transparent border-transparent' },\n}\n\n/** 高さは Button / Input と揃える。28 / 32 / 40px。 */\nconst size: VariantMap<NoviSize, { inputWrapper: string; input: string }> = {\n sm: {\n inputWrapper: 'h-7',\n input: 'px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-sm)]',\n },\n md: {\n inputWrapper: 'h-8',\n input: 'px-[var(--novi-pad-control-x-md)] text-[length:var(--novi-text-base)]',\n },\n lg: {\n inputWrapper: 'h-10',\n input: 'px-[var(--novi-pad-control-x-lg)] text-[length:var(--novi-text-base)]',\n },\n}\n\nconst radius: VariantMap<NoviRadius, { inputWrapper: string }> = {\n none: { inputWrapper: 'rounded-[var(--novi-radius-none)]' },\n sm: { inputWrapper: 'rounded-[var(--novi-radius-sm)]' },\n md: { inputWrapper: 'rounded-[var(--novi-radius-md)]' },\n lg: { inputWrapper: 'rounded-[var(--novi-radius-lg)]' },\n full: { inputWrapper: 'rounded-[var(--novi-radius-full)]' },\n}\n\n/**\n * NumberField のスタイル定義。\n *\n * @example\n * import { numberFieldStyles } from '@novi-ui/flatlay'\n * import { tv } from 'tailwind-variants'\n *\n * const myField = tv({ extend: numberFieldStyles, slots: { input: 'text-left' } })\n */\nexport const numberFieldStyles = tv({\n slots,\n // `variant` は最後に宣言する。先に書くと size のクラスに負ける\n variants: { size, radius, variant },\n defaultVariants: { size: 'md', radius: 'sm', variant: 'outline' },\n})\n\nexport type NumberFieldStyleProps = Parameters<typeof numberFieldStyles>[0]\n"],"mappings":";;;;;;;;;AAkBA,MAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;AAEV,MAAM,QAAQ;CACZ,MAAM;CACN,OAAO,iEAAiE;;;;;CAKxE,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CAEV,OAAO;EACL;EACA,+BAA+B;EAC/B;CACF,CAAC,CAAC,KAAK,GAAG;CACV,WAAW;CACX,WAAW;CACX,aAAa,oEAAoE;CAEjF,cAAc,qEAAqE;AACrF;;;;;;;;;;AA+CA,MAAa,oBAAoB,GAAG;CAClC;CAEA,UAAU;EAAE;GAlCZ,IAAI;IACF,cAAc;IACd,OAAO;GACT;GACA,IAAI;IACF,cAAc;IACd,OAAO;GACT;GACA,IAAI;IACF,cAAc;IACd,OAAO;GACT;EAuBY;EAAM;GAnBlB,MAAM,EAAE,cAAc,oCAAoC;GAC1D,IAAI,EAAE,cAAc,kCAAkC;GACtD,IAAI,EAAE,cAAc,kCAAkC;GACtD,IAAI,EAAE,cAAc,kCAAkC;GACtD,MAAM,EAAE,cAAc,oCAAoC;EAexC;EAAQ;GA/C1B,OAAO,EACL,cAAc,0EAChB;GACA,SAAS,EAAE,cAAc,0DAA0D;GACnF,MAAM,EAAE,cAAc,kEAAkE;GACxF,OAAO,EACL,cAAc,+EAChB;GACA,OAAO,EAAE,cAAc,oCAAoC;EAuCjC;CAAQ;CAClC,iBAAiB;EAAE,MAAM;EAAM,QAAQ;EAAM,SAAS;CAAU;AAClE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Pagination } from "./pagination.mjs";
2
+ import { PaginationStyleProps, paginationStyles } from "./pagination.styles.mjs";
3
+ export { Pagination, type PaginationStyleProps, paginationStyles };
@@ -0,0 +1,13 @@
1
+ import { PaginationProps } from "@novi-ui/core";
2
+ //#region src/pagination/pagination.d.ts
3
+ /**
4
+ * 一覧のページを移動する。**罫線で区切った 1 本の帯**に数字を並べ、現在地は反転させる
5
+ * (Raster は数字だけを並べ、Tactile は面を塗る)。前後は `‹` `›` の活字。
6
+ *
7
+ * @example
8
+ * <Pagination total={10} page={page} onChange={setPage} />
9
+ */
10
+ declare function Pagination({ size, radius, total, page, defaultPage, onChange, siblingCount, boundaryCount, isDisabled, 'aria-label': ariaLabel, className, classNames, id }: PaginationProps): import("react").JSX.Element;
11
+ //#endregion
12
+ export { Pagination };
13
+ //# sourceMappingURL=pagination.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.mts","names":[],"sources":["../../src/pagination/pagination.tsx"],"mappings":";;;;;;;;;iBAegB,aACd,MACA,QACA,OACA,MACA,aACA,UACA,cACA,eACA,0BACc,WACd,WACA,YACA,MACC,kCAAe,IAAA"}
@@ -0,0 +1,98 @@
1
+ "use client";
2
+ import { paginationStyles } from "./pagination.styles.mjs";
3
+ import { Button } from "react-aria-components";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useState } from "react";
6
+ import { paginationRange } from "@novi-ui/core/client";
7
+ //#region src/pagination/pagination.tsx
8
+ /**
9
+ * 一覧のページを移動する。**罫線で区切った 1 本の帯**に数字を並べ、現在地は反転させる
10
+ * (Raster は数字だけを並べ、Tactile は面を塗る)。前後は `‹` `›` の活字。
11
+ *
12
+ * @example
13
+ * <Pagination total={10} page={page} onChange={setPage} />
14
+ */
15
+ function Pagination({ size, radius, total, page, defaultPage = 1, onChange, siblingCount, boundaryCount, isDisabled, "aria-label": ariaLabel = "ページ送り", className, classNames, id }) {
16
+ const s = paginationStyles({
17
+ size,
18
+ radius
19
+ });
20
+ const [internal, setInternal] = useState(defaultPage);
21
+ const clamp = (n) => Math.min(Math.max(n, 1), Math.max(total, 1));
22
+ const current = clamp(page ?? internal);
23
+ const go = (n) => {
24
+ const next = clamp(n);
25
+ if (next === current) return;
26
+ if (page === void 0) setInternal(next);
27
+ onChange?.(next);
28
+ };
29
+ const slots = paginationRange(current, total, {
30
+ siblingCount,
31
+ boundaryCount
32
+ });
33
+ const entries = slots.map((slot, i) => ({
34
+ slot,
35
+ key: slot === "ellipsis" ? `ellipsis-after-${slots[i - 1]}` : `page-${slot}`
36
+ }));
37
+ return /* @__PURE__ */ jsx("nav", {
38
+ id,
39
+ "aria-label": ariaLabel,
40
+ "data-slot": "root",
41
+ className: s.root({ class: [className, classNames?.root] }),
42
+ children: /* @__PURE__ */ jsxs("ul", {
43
+ "data-slot": "list",
44
+ className: s.list({ class: classNames?.list }),
45
+ children: [
46
+ /* @__PURE__ */ jsx("li", {
47
+ className: "flex",
48
+ children: /* @__PURE__ */ jsx(Button, {
49
+ "data-slot": "prev",
50
+ "aria-label": "前のページ",
51
+ isDisabled: isDisabled || current <= 1,
52
+ onPress: () => go(current - 1),
53
+ className: s.prev({ class: classNames?.prev }),
54
+ children: /* @__PURE__ */ jsx("span", {
55
+ "aria-hidden": "true",
56
+ children: "‹"
57
+ })
58
+ })
59
+ }),
60
+ entries.map(({ slot, key }) => slot === "ellipsis" ? /* @__PURE__ */ jsx("li", {
61
+ "data-slot": "ellipsis",
62
+ "aria-hidden": "true",
63
+ className: s.ellipsis({ class: classNames?.ellipsis }),
64
+ children: "…"
65
+ }, key) : /* @__PURE__ */ jsx("li", {
66
+ className: "flex",
67
+ children: /* @__PURE__ */ jsx(Button, {
68
+ "data-slot": "item",
69
+ "aria-label": `${slot}ページ`,
70
+ "aria-current": slot === current ? "page" : void 0,
71
+ isDisabled,
72
+ onPress: () => go(slot),
73
+ className: s.item({ class: classNames?.item }),
74
+ children: slot
75
+ })
76
+ }, key)),
77
+ /* @__PURE__ */ jsx("li", {
78
+ className: "flex",
79
+ children: /* @__PURE__ */ jsx(Button, {
80
+ "data-slot": "next",
81
+ "aria-label": "次のページ",
82
+ isDisabled: isDisabled || current >= total,
83
+ onPress: () => go(current + 1),
84
+ className: s.next({ class: classNames?.next }),
85
+ children: /* @__PURE__ */ jsx("span", {
86
+ "aria-hidden": "true",
87
+ children: "›"
88
+ })
89
+ })
90
+ })
91
+ ]
92
+ })
93
+ });
94
+ }
95
+ //#endregion
96
+ export { Pagination };
97
+
98
+ //# sourceMappingURL=pagination.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.mjs","names":[],"sources":["../../src/pagination/pagination.tsx"],"sourcesContent":["'use client'\n\nimport type { PaginationProps } from '@novi-ui/core'\nimport { paginationRange } from '@novi-ui/core/client'\nimport { useState } from 'react'\nimport { Button } from 'react-aria-components'\nimport { paginationStyles } from './pagination.styles'\n\n/**\n * 一覧のページを移動する。**罫線で区切った 1 本の帯**に数字を並べ、現在地は反転させる\n * (Raster は数字だけを並べ、Tactile は面を塗る)。前後は `‹` `›` の活字。\n *\n * @example\n * <Pagination total={10} page={page} onChange={setPage} />\n */\nexport function Pagination({\n size,\n radius,\n total,\n page,\n defaultPage = 1,\n onChange,\n siblingCount,\n boundaryCount,\n isDisabled,\n 'aria-label': ariaLabel = 'ページ送り',\n className,\n classNames,\n id,\n}: PaginationProps) {\n const s = paginationStyles({ size, radius })\n const [internal, setInternal] = useState(defaultPage)\n const clamp = (n: number) => Math.min(Math.max(n, 1), Math.max(total, 1))\n const current = clamp(page ?? internal)\n\n const go = (n: number) => {\n const next = clamp(n)\n if (next === current) return\n if (page === undefined) setInternal(next)\n onChange?.(next)\n }\n\n // 省略記号は最大 2 つ出る。配列の添字ではなく「どの数字の直後か」で区別する\n const slots = paginationRange(current, total, { siblingCount, boundaryCount })\n const entries = slots.map((slot, i) => ({\n slot,\n key: slot === 'ellipsis' ? `ellipsis-after-${slots[i - 1]}` : `page-${slot}`,\n }))\n\n return (\n <nav\n id={id}\n aria-label={ariaLabel}\n data-slot=\"root\"\n className={s.root({ class: [className, classNames?.root] })}\n >\n <ul data-slot=\"list\" className={s.list({ class: classNames?.list })}>\n <li className=\"flex\">\n <Button\n data-slot=\"prev\"\n aria-label=\"前のページ\"\n isDisabled={isDisabled || current <= 1}\n onPress={() => go(current - 1)}\n className={s.prev({ class: classNames?.prev })}\n >\n <span aria-hidden=\"true\">‹</span>\n </Button>\n </li>\n\n {entries.map(({ slot, key }) =>\n slot === 'ellipsis' ? (\n <li\n key={key}\n data-slot=\"ellipsis\"\n aria-hidden=\"true\"\n className={s.ellipsis({ class: classNames?.ellipsis })}\n >\n …\n </li>\n ) : (\n <li key={key} className=\"flex\">\n <Button\n data-slot=\"item\"\n aria-label={`${slot}ページ`}\n aria-current={slot === current ? 'page' : undefined}\n isDisabled={isDisabled}\n onPress={() => go(slot)}\n className={s.item({ class: classNames?.item })}\n >\n {slot}\n </Button>\n </li>\n ),\n )}\n\n <li className=\"flex\">\n <Button\n data-slot=\"next\"\n aria-label=\"次のページ\"\n isDisabled={isDisabled || current >= total}\n onPress={() => go(current + 1)}\n className={s.next({ class: classNames?.next })}\n >\n <span aria-hidden=\"true\">›</span>\n </Button>\n </li>\n </ul>\n </nav>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,WAAW,EACzB,MACA,QACA,OACA,MACA,cAAc,GACd,UACA,cACA,eACA,YACA,cAAc,YAAY,SAC1B,WACA,YACA,MACkB;CAClB,MAAM,IAAI,iBAAiB;EAAE;EAAM;CAAO,CAAC;CAC3C,MAAM,CAAC,UAAU,eAAe,SAAS,WAAW;CACpD,MAAM,SAAS,MAAc,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC;CACxE,MAAM,UAAU,MAAM,QAAQ,QAAQ;CAEtC,MAAM,MAAM,MAAc;EACxB,MAAM,OAAO,MAAM,CAAC;EACpB,IAAI,SAAS,SAAS;EACtB,IAAI,SAAS,KAAA,GAAW,YAAY,IAAI;EACxC,WAAW,IAAI;CACjB;CAGA,MAAM,QAAQ,gBAAgB,SAAS,OAAO;EAAE;EAAc;CAAc,CAAC;CAC7E,MAAM,UAAU,MAAM,KAAK,MAAM,OAAO;EACtC;EACA,KAAK,SAAS,aAAa,kBAAkB,MAAM,IAAI,OAAO,QAAQ;CACxE,EAAE;CAEF,OACE,oBAAC,OAAD;EACM;EACJ,cAAY;EACZ,aAAU;EACV,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,YAAY,IAAI,EAAE,CAAC;EAE1D,UAAA,qBAAC,MAAD;GAAI,aAAU;GAAO,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;GAAlE,UAAA;IACE,oBAAC,MAAD;KAAI,WAAU;KACZ,UAAA,oBAAC,QAAD;MACE,aAAU;MACV,cAAW;MACX,YAAY,cAAc,WAAW;MACrC,eAAe,GAAG,UAAU,CAAC;MAC7B,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;MAE7C,UAAA,oBAAC,QAAD;OAAM,eAAY;OAAO,UAAA;MAAO,CAAA;KAC1B,CAAA;IACN,CAAA;IAEH,QAAQ,KAAK,EAAE,MAAM,UACpB,SAAS,aACP,oBAAC,MAAD;KAEE,aAAU;KACV,eAAY;KACZ,WAAW,EAAE,SAAS,EAAE,OAAO,YAAY,SAAS,CAAC;KACtD,UAAA;IAEG,GANG,GAMH,IAEJ,oBAAC,MAAD;KAAc,WAAU;KACtB,UAAA,oBAAC,QAAD;MACE,aAAU;MACV,cAAY,GAAG,KAAK;MACpB,gBAAc,SAAS,UAAU,SAAS,KAAA;MAC9B;MACZ,eAAe,GAAG,IAAI;MACtB,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;MAE5C,UAAA;KACK,CAAA;IACN,GAXK,GAWL,CAER;IAEA,oBAAC,MAAD;KAAI,WAAU;KACZ,UAAA,oBAAC,QAAD;MACE,aAAU;MACV,cAAW;MACX,YAAY,cAAc,WAAW;MACrC,eAAe,GAAG,UAAU,CAAC;MAC7B,WAAW,EAAE,KAAK,EAAE,OAAO,YAAY,KAAK,CAAC;MAE7C,UAAA,oBAAC,QAAD;OAAM,eAAY;OAAO,UAAA;MAAO,CAAA;KAC1B,CAAA;IACN,CAAA;GACF;;CACD,CAAA;AAET"}
@@ -0,0 +1,67 @@
1
+ import { VariantMap } from "@novi-ui/core";
2
+ //#region src/pagination/pagination.styles.d.ts
3
+ /**
4
+ * Pagination のスタイル定義。
5
+ *
6
+ * @example
7
+ * import { paginationStyles } from '@novi-ui/flatlay'
8
+ * import { tv } from 'tailwind-variants'
9
+ *
10
+ * const myPagination = tv({ extend: paginationStyles, slots: { item: 'min-w-10' } })
11
+ */
12
+ declare const paginationStyles: import("tailwind-variants").TVReturnType<{
13
+ size: VariantMap<"sm" | "md" | "lg", {
14
+ item: string;
15
+ prev: string;
16
+ next: string;
17
+ ellipsis: string;
18
+ }>;
19
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
20
+ list: string;
21
+ }>;
22
+ }, {
23
+ root: string;
24
+ list: string;
25
+ item: string;
26
+ prev: string;
27
+ next: string;
28
+ ellipsis: string;
29
+ }, undefined, {
30
+ size: VariantMap<"sm" | "md" | "lg", {
31
+ item: string;
32
+ prev: string;
33
+ next: string;
34
+ ellipsis: string;
35
+ }>;
36
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
37
+ list: string;
38
+ }>;
39
+ }, {
40
+ root: string;
41
+ list: string;
42
+ item: string;
43
+ prev: string;
44
+ next: string;
45
+ ellipsis: string;
46
+ }, import("tailwind-variants").TVReturnTypeLike<{
47
+ size: VariantMap<"sm" | "md" | "lg", {
48
+ item: string;
49
+ prev: string;
50
+ next: string;
51
+ ellipsis: string;
52
+ }>;
53
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
54
+ list: string;
55
+ }>;
56
+ }, {
57
+ root: string;
58
+ list: string;
59
+ item: string;
60
+ prev: string;
61
+ next: string;
62
+ ellipsis: string;
63
+ }>>;
64
+ type PaginationStyleProps = Parameters<typeof paginationStyles>[0];
65
+ //#endregion
66
+ export { PaginationStyleProps, paginationStyles };
67
+ //# sourceMappingURL=pagination.styles.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.styles.d.mts","names":[],"sources":["../../src/pagination/pagination.styles.ts"],"mappings":";;;;;;;;;;;cAqFa,8CAAgB;;IAvCY;IAAc;IAAc;IAAkB;;;IAsB1C;;;;;;;;;;;IAtBJ;IAAc;IAAc;IAAkB;;;IAsB1C;;;;;;;;;;;IAtBJ;IAAc;IAAc;IAAkB;;;IAsB1C;;;;;;;;;;KAuBjC,uBAAuB,kBAAkB"}
@@ -0,0 +1,83 @@
1
+ import { disabledState, focusRing } from "../styles/focus-ring.mjs";
2
+ import { monoNumeric } from "../styles/mono.mjs";
3
+ import { tv } from "tailwind-variants";
4
+ //#region src/pagination/pagination.styles.ts
5
+ /**
6
+ * ページ番号と前後のボタンに共通のセル。**罫線で区切った 1 本の帯**に並び、
7
+ * 現在地は反転(スタンプ)。押した瞬間も反転する(ADR-F3)。
8
+ * 数字は等幅で、帳票のページ番号と同じ字形(ADR-F7)。
9
+ */
10
+ const cell = [
11
+ "inline-flex items-center justify-center",
12
+ `text-[var(--novi-color-fg)] ${monoNumeric}`,
13
+ "outline-none",
14
+ "hover:bg-[var(--novi-color-subtle)]",
15
+ "data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]",
16
+ "aria-[current=page]:bg-[var(--novi-color-fg)] aria-[current=page]:text-[var(--novi-color-bg)]",
17
+ "transition-[background-color,color]",
18
+ "duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]",
19
+ focusRing,
20
+ disabledState
21
+ ].join(" ");
22
+ const slots = {
23
+ root: "inline-flex",
24
+ list: [
25
+ "flex items-stretch list-none m-0 p-0",
26
+ "border border-[var(--novi-color-border-strong)]",
27
+ "divide-x divide-[var(--novi-color-border)]",
28
+ "overflow-hidden"
29
+ ].join(" "),
30
+ item: cell,
31
+ prev: cell,
32
+ next: cell,
33
+ ellipsis: `inline-flex items-center justify-center text-[var(--novi-color-muted)] select-none ${monoNumeric}`
34
+ };
35
+ /**
36
+ * Pagination のスタイル定義。
37
+ *
38
+ * @example
39
+ * import { paginationStyles } from '@novi-ui/flatlay'
40
+ * import { tv } from 'tailwind-variants'
41
+ *
42
+ * const myPagination = tv({ extend: paginationStyles, slots: { item: 'min-w-10' } })
43
+ */
44
+ const paginationStyles = tv({
45
+ slots,
46
+ variants: {
47
+ size: {
48
+ sm: {
49
+ item: "h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]",
50
+ prev: "h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]",
51
+ next: "h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]",
52
+ ellipsis: "h-7 min-w-7 text-[length:var(--novi-text-sm)]"
53
+ },
54
+ md: {
55
+ item: "h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]",
56
+ prev: "h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]",
57
+ next: "h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]",
58
+ ellipsis: "h-8 min-w-8 text-[length:var(--novi-text-base)]"
59
+ },
60
+ lg: {
61
+ item: "h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]",
62
+ prev: "h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]",
63
+ next: "h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]",
64
+ ellipsis: "h-10 min-w-10 text-[length:var(--novi-text-base)]"
65
+ }
66
+ },
67
+ radius: {
68
+ none: { list: "rounded-[var(--novi-radius-none)]" },
69
+ sm: { list: "rounded-[var(--novi-radius-sm)]" },
70
+ md: { list: "rounded-[var(--novi-radius-md)]" },
71
+ lg: { list: "rounded-[var(--novi-radius-lg)]" },
72
+ full: { list: "rounded-[var(--novi-radius-full)]" }
73
+ }
74
+ },
75
+ defaultVariants: {
76
+ size: "md",
77
+ radius: "sm"
78
+ }
79
+ });
80
+ //#endregion
81
+ export { paginationStyles };
82
+
83
+ //# sourceMappingURL=pagination.styles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.styles.mjs","names":[],"sources":["../../src/pagination/pagination.styles.ts"],"sourcesContent":["import type {\n NoviRadius,\n NoviSize,\n paginationRequiredSlots,\n paginationSlots,\n SlotMap,\n VariantMap,\n} from '@novi-ui/core'\nimport { tv } from 'tailwind-variants'\nimport { disabledState, focusRing } from '../styles/focus-ring'\nimport { monoNumeric } from '../styles/mono'\n\n/**\n * ページ番号と前後のボタンに共通のセル。**罫線で区切った 1 本の帯**に並び、\n * 現在地は反転(スタンプ)。押した瞬間も反転する(ADR-F3)。\n * 数字は等幅で、帳票のページ番号と同じ字形(ADR-F7)。\n */\nconst cell = [\n 'inline-flex items-center justify-center',\n `text-[var(--novi-color-fg)] ${monoNumeric}`,\n 'outline-none',\n 'hover:bg-[var(--novi-color-subtle)]',\n 'data-[pressed]:bg-[var(--novi-color-fg)] data-[pressed]:text-[var(--novi-color-bg)]',\n 'aria-[current=page]:bg-[var(--novi-color-fg)] aria-[current=page]:text-[var(--novi-color-bg)]',\n 'transition-[background-color,color]',\n 'duration-[var(--novi-duration-fast)] ease-[var(--novi-ease-standard)]',\n focusRing,\n disabledState,\n].join(' ')\n\nconst slots = {\n root: 'inline-flex',\n // 帯そのものが枠。行の切れ目は縦の罫線\n list: [\n 'flex items-stretch list-none m-0 p-0',\n 'border border-[var(--novi-color-border-strong)]',\n 'divide-x divide-[var(--novi-color-border)]',\n 'overflow-hidden',\n ].join(' '),\n item: cell,\n prev: cell,\n next: cell,\n ellipsis: `inline-flex items-center justify-center text-[var(--novi-color-muted)] select-none ${monoNumeric}`,\n} satisfies SlotMap<typeof paginationSlots, (typeof paginationRequiredSlots)[number]>\n\n/** 高さは行の階級に載せる。28 / 32 / 40px */\nconst size: VariantMap<NoviSize, { item: string; prev: string; next: string; ellipsis: string }> = {\n sm: {\n item: 'h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]',\n prev: 'h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]',\n next: 'h-7 min-w-7 px-1.5 text-[length:var(--novi-text-sm)]',\n ellipsis: 'h-7 min-w-7 text-[length:var(--novi-text-sm)]',\n },\n md: {\n item: 'h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]',\n prev: 'h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]',\n next: 'h-8 min-w-8 px-1.5 text-[length:var(--novi-text-base)]',\n ellipsis: 'h-8 min-w-8 text-[length:var(--novi-text-base)]',\n },\n lg: {\n item: 'h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]',\n prev: 'h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]',\n next: 'h-10 min-w-10 px-[var(--novi-pad-control-x-sm)] text-[length:var(--novi-text-base)]',\n ellipsis: 'h-10 min-w-10 text-[length:var(--novi-text-base)]',\n },\n}\n\n// 角丸は帯(list)だけが持つ。セルは隣と罫線で接しているので角を持たない\nconst radius: VariantMap<NoviRadius, { list: string }> = {\n none: { list: 'rounded-[var(--novi-radius-none)]' },\n sm: { list: 'rounded-[var(--novi-radius-sm)]' },\n md: { list: 'rounded-[var(--novi-radius-md)]' },\n lg: { list: 'rounded-[var(--novi-radius-lg)]' },\n full: { list: 'rounded-[var(--novi-radius-full)]' },\n}\n\n/**\n * Pagination のスタイル定義。\n *\n * @example\n * import { paginationStyles } from '@novi-ui/flatlay'\n * import { tv } from 'tailwind-variants'\n *\n * const myPagination = tv({ extend: paginationStyles, slots: { item: 'min-w-10' } })\n */\nexport const paginationStyles = tv({\n slots,\n variants: { size, radius },\n defaultVariants: { size: 'md', radius: 'sm' },\n})\n\nexport type PaginationStyleProps = Parameters<typeof paginationStyles>[0]\n"],"mappings":";;;;;;;;;AAiBA,MAAM,OAAO;CACX;CACA,+BAA+B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;AAEV,MAAM,QAAQ;CACZ,MAAM;CAEN,MAAM;EACJ;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,GAAG;CACV,MAAM;CACN,MAAM;CACN,MAAM;CACN,UAAU,sFAAsF;AAClG;;;;;;;;;;AA0CA,MAAa,mBAAmB,GAAG;CACjC;CACA,UAAU;EAAE;GAxCZ,IAAI;IACF,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;GACZ;GACA,IAAI;IACF,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;GACZ;GACA,IAAI;IACF,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;GACZ;EAuBY;EAAM;GAlBlB,MAAM,EAAE,MAAM,oCAAoC;GAClD,IAAI,EAAE,MAAM,kCAAkC;GAC9C,IAAI,EAAE,MAAM,kCAAkC;GAC9C,IAAI,EAAE,MAAM,kCAAkC;GAC9C,MAAM,EAAE,MAAM,oCAAoC;EAchC;CAAO;CACzB,iBAAiB;EAAE,MAAM;EAAM,QAAQ;CAAK;AAC9C,CAAC"}
@@ -10,7 +10,7 @@ import { VariantMap } from "@novi-ui/core";
10
10
  * const myPopover = tv({ extend: popoverStyles, slots: { content: 'px-4' } })
11
11
  */
12
12
  declare const popoverStyles: import("tailwind-variants").TVReturnType<{
13
- radius: VariantMap<"none" | "sm" | "md" | "lg" | "full", {
13
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
14
14
  root: string;
15
15
  }>;
16
16
  }, {
@@ -18,7 +18,7 @@ declare const popoverStyles: import("tailwind-variants").TVReturnType<{
18
18
  arrow: string;
19
19
  content: string;
20
20
  }, undefined, {
21
- radius: VariantMap<"none" | "sm" | "md" | "lg" | "full", {
21
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
22
22
  root: string;
23
23
  }>;
24
24
  }, {
@@ -26,7 +26,7 @@ declare const popoverStyles: import("tailwind-variants").TVReturnType<{
26
26
  arrow: string;
27
27
  content: string;
28
28
  }, import("tailwind-variants").TVReturnTypeLike<{
29
- radius: VariantMap<"none" | "sm" | "md" | "lg" | "full", {
29
+ radius: VariantMap<"sm" | "md" | "lg" | "none" | "full", {
30
30
  root: string;
31
31
  }>;
32
32
  }, {
@@ -26,7 +26,7 @@ declare function SelectItem({ id, isDisabled, children, className }: SelectItemP
26
26
  * 矢印キーで移動、Escape で閉じてトリガーへフォーカスが戻る。
27
27
  *
28
28
  * トリガーは `<button>` で編集可能要素ではないため IME の変換は発生しない。
29
- * テキスト入力を伴う選択が必要な場合は ComboBox を使う(MVP の対象外)。
29
+ * テキスト入力を伴う選択が必要な場合は ComboBox を使う。
30
30
  *
31
31
  * @example
32
32
  * <Select label="都道府県" selectedKey={pref} onSelectionChange={setPref}>