@robert-stackflow/oneui 0.3.0 → 0.4.1

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.
@@ -1,12 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import s from "./Form.module.css";
3
+ import { FormLayoutContext } from "./FormLayout.js";
3
4
  function Form({
4
5
  controller,
5
6
  onSubmit,
6
7
  children,
8
+ layout = "stacked",
9
+ labelWidth,
7
10
  ...props
8
11
  }) {
9
- return /* @__PURE__ */ jsx(
12
+ return /* @__PURE__ */ jsx(FormLayoutContext, { value: { layout, labelWidth }, children: /* @__PURE__ */ jsx(
10
13
  "form",
11
14
  {
12
15
  ...props,
@@ -19,7 +22,7 @@ function Form({
19
22
  },
20
23
  children: /* @__PURE__ */ jsx("fieldset", { className: s.fields, disabled: controller.isSubmitting, children })
21
24
  }
22
- );
25
+ ) });
23
26
  }
24
27
  export {
25
28
  Form
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { FieldOptions } from "./field";
3
- export declare function FormField({ children, pending, requiredIndicator, optional, onBlur, ...options }: FieldOptions & {
3
+ import { type FormLayoutOptions } from "./FormLayout";
4
+ export declare function FormField({ children, pending, requiredIndicator, optional, onBlur, layout: suppliedLayout, labelWidth: suppliedLabelWidth, ...options }: FieldOptions & FormLayoutOptions & {
4
5
  children: ReactNode;
5
6
  pending?: boolean;
6
7
  requiredIndicator?: "asterisk" | "text" | "none";
@@ -1,30 +1,52 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useUIConfig } from "./UIProvider.js";
3
3
  import { FieldMessages } from "./FieldMessages.js";
4
4
  import { Spinner } from "./Spinner.js";
5
- import { useRef } from "react";
5
+ import { useContext } from "react";
6
6
  import { FieldContext, useFieldControl } from "./field.js";
7
7
  import { FieldLabel } from "./FieldLabel.js";
8
8
  import s from "./FormField.module.css";
9
+ import { FormLayoutContext } from "./FormLayout.js";
9
10
  function FormField({
10
11
  children,
11
12
  pending = false,
12
13
  requiredIndicator,
13
14
  optional = false,
14
15
  onBlur,
16
+ layout: suppliedLayout,
17
+ labelWidth: suppliedLabelWidth,
15
18
  ...options
16
19
  }) {
17
- const config = useUIConfig();
18
- const field = useFieldControl(options), root = useRef(null);
19
- return /* @__PURE__ */ jsx(FieldContext, { value: field, children: /* @__PURE__ */ jsxs(
20
+ const config = useUIConfig(), inherited = useContext(FormLayoutContext);
21
+ const field = useFieldControl(options);
22
+ const showLabel = !!field.label || pending, layout = showLabel ? suppliedLayout ?? inherited.layout ?? "stacked" : "stacked", labelWidth = suppliedLabelWidth ?? inherited.labelWidth;
23
+ const label = showLabel ? /* @__PURE__ */ jsxs("div", { className: s.labelRow, children: [
24
+ field.label && /* @__PURE__ */ jsx(
25
+ FieldLabel,
26
+ {
27
+ label: field.label,
28
+ htmlFor: field.id,
29
+ required: field.required,
30
+ indicator: requiredIndicator ?? config.requiredIndicator,
31
+ optional
32
+ }
33
+ ),
34
+ " ",
35
+ pending && /* @__PURE__ */ jsx(Spinner, { size: 13, label: "\u6B63\u5728\u6821\u9A8C" + field.label })
36
+ ] }) : null;
37
+ return /* @__PURE__ */ jsx(FieldContext, { value: field, children: /* @__PURE__ */ jsx(
20
38
  "div",
21
39
  {
22
- ref: root,
23
40
  className: s.field,
24
41
  "data-invalid": !!field.error,
25
42
  "data-disabled": field.disabled || void 0,
43
+ "data-layout": layout,
44
+ style: labelWidth === void 0 ? void 0 : {
45
+ "--field-label-width": typeof labelWidth === "number" ? labelWidth + "px" : labelWidth
46
+ },
26
47
  onBlur: (event) => {
27
- const next = event.relatedTarget, node = root.current;
48
+ const next = event.relatedTarget, node = event.currentTarget;
49
+ if (!node.isConnected) return;
28
50
  if (next && node.contains(next)) return;
29
51
  const portals = [...node.querySelectorAll("[aria-controls]")].map(
30
52
  (control) => document.getElementById(
@@ -34,23 +56,27 @@ function FormField({
34
56
  if (next && portals.some((portal) => portal?.contains(next))) return;
35
57
  onBlur?.();
36
58
  },
37
- children: [
38
- /* @__PURE__ */ jsxs("div", { className: s.labelRow, children: [
39
- /* @__PURE__ */ jsx(
40
- FieldLabel,
41
- {
42
- label: field.label,
43
- htmlFor: field.id,
44
- required: field.required,
45
- indicator: requiredIndicator ?? config.requiredIndicator,
46
- optional
47
- }
48
- ),
49
- pending && /* @__PURE__ */ jsx(Spinner, { size: 13, label: "\u6B63\u5728\u6821\u9A8C" + field.label })
59
+ children: layout === "inline" ? /* @__PURE__ */ jsxs(Fragment, { children: [
60
+ /* @__PURE__ */ jsxs("div", { className: s.inlineLabel, children: [
61
+ label,
62
+ /* @__PURE__ */ jsx(FieldMessages, { id: field.id, hint: field.hint })
50
63
  ] }),
64
+ /* @__PURE__ */ jsxs("div", { className: s.inlineControl, children: [
65
+ /* @__PURE__ */ jsx("div", { className: s.controlContent, children }),
66
+ /* @__PURE__ */ jsx(FieldMessages, { id: field.id, error: field.error })
67
+ ] })
68
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ label,
51
70
  children,
52
- /* @__PURE__ */ jsx(FieldMessages, { id: field.id, hint: field.hint, error: field.error })
53
- ]
71
+ /* @__PURE__ */ jsx(
72
+ FieldMessages,
73
+ {
74
+ id: field.id,
75
+ hint: field.hint,
76
+ error: field.error
77
+ }
78
+ )
79
+ ] })
54
80
  }
55
81
  ) });
56
82
  }
@@ -79,6 +79,46 @@
79
79
  .label {
80
80
  font-size: var(--field-label-size);
81
81
  }
82
+ .field[data-layout="inline"] {
83
+ display: grid;
84
+ grid-template-columns: var(--field-label-width, minmax(160px, 0.8fr)) minmax(
85
+ 0,
86
+ 1.2fr
87
+ );
88
+ align-items: center;
89
+ gap: 24px;
90
+ }
91
+ .inlineLabel,
92
+ .inlineControl {
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: 6px;
96
+ min-width: 0;
97
+ }
98
+ .controlContent {
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: flex-end;
102
+ min-width: 0;
103
+ }
104
+ .controlContent > * {
105
+ max-width: 100%;
106
+ }
107
+ .inlineLabel .labelRow {
108
+ justify-content: flex-start;
109
+ }
110
+ .field[data-disabled="true"] .inlineLabel > .labelRow {
111
+ opacity: 0.55;
112
+ }
113
+ @media (max-width: 700px) {
114
+ .field[data-layout="inline"] {
115
+ display: flex;
116
+ gap: 8px;
117
+ }
118
+ .controlContent {
119
+ justify-content: flex-start;
120
+ }
121
+ }
82
122
  .hint,
83
123
  .error {
84
124
  font-size: var(--field-message-size);
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
- export declare function FormGroup({ label, children, disabled, required, hint, error, }: {
2
+ import { type FormLayoutOptions } from "./FormLayout";
3
+ export declare function FormGroup({ label, children, disabled, required, hint, error, layout, labelWidth, }: FormLayoutOptions & {
3
4
  label: string;
4
5
  children: ReactNode;
5
6
  disabled?: boolean;
@@ -3,27 +3,41 @@ import { FieldMessages } from "./FieldMessages.js";
3
3
  import { useId } from "react";
4
4
  import { FieldLabel } from "./FieldLabel.js";
5
5
  import s from "./FormField.module.css";
6
+ import { useContext } from "react";
7
+ import { FormLayoutContext } from "./FormLayout.js";
6
8
  function FormGroup({
7
9
  label,
8
10
  children,
9
11
  disabled = false,
10
12
  required = false,
11
13
  hint,
12
- error
14
+ error,
15
+ layout,
16
+ labelWidth
13
17
  }) {
14
18
  const id = useId();
15
- return /* @__PURE__ */ jsxs(
16
- "fieldset",
19
+ const inherited = useContext(FormLayoutContext);
20
+ return /* @__PURE__ */ jsx(
21
+ FormLayoutContext,
17
22
  {
18
- className: s.group,
19
- disabled,
20
- "aria-invalid": !!error,
21
- "aria-describedby": [hint ? id + "-hint" : "", error ? id + "-error" : ""].filter(Boolean).join(" ") || void 0,
22
- children: [
23
- /* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(FieldLabel, { as: "span", label, required }) }),
24
- children,
25
- /* @__PURE__ */ jsx(FieldMessages, { id, hint, error })
26
- ]
23
+ value: {
24
+ layout: layout ?? inherited.layout,
25
+ labelWidth: labelWidth ?? inherited.labelWidth
26
+ },
27
+ children: /* @__PURE__ */ jsxs(
28
+ "fieldset",
29
+ {
30
+ className: s.group,
31
+ disabled,
32
+ "aria-invalid": !!error,
33
+ "aria-describedby": [hint ? id + "-hint" : "", error ? id + "-error" : ""].filter(Boolean).join(" ") || void 0,
34
+ children: [
35
+ /* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(FieldLabel, { as: "span", label, required }) }),
36
+ children,
37
+ /* @__PURE__ */ jsx(FieldMessages, { id, hint, error })
38
+ ]
39
+ }
40
+ )
27
41
  }
28
42
  );
29
43
  }
@@ -0,0 +1,6 @@
1
+ export type FormLayout = "stacked" | "inline";
2
+ export type FormLayoutOptions = {
3
+ layout?: FormLayout;
4
+ labelWidth?: number | string;
5
+ };
6
+ export declare const FormLayoutContext: import("react").Context<FormLayoutOptions>;
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+ const FormLayoutContext = createContext({
3
+ layout: "stacked"
4
+ });
5
+ export {
6
+ FormLayoutContext
7
+ };
@@ -1,7 +1,5 @@
1
1
  import { type FieldOptions } from "./field";
2
- export declare function NumberInput({ value, onChange, label, min, max, step, disabled, readOnly, invalid, ...options }: FieldOptions & {
3
- value: number;
4
- onChange(value: number): void;
2
+ export type NumberInputProps = FieldOptions & {
5
3
  label: string;
6
4
  min?: number;
7
5
  max?: number;
@@ -9,4 +7,14 @@ export declare function NumberInput({ value, onChange, label, min, max, step, di
9
7
  disabled?: boolean;
10
8
  readOnly?: boolean;
11
9
  invalid?: boolean;
12
- }): import("react").JSX.Element;
10
+ placeholder?: string;
11
+ } & ({
12
+ nullable: true;
13
+ value: number | null;
14
+ onChange(value: number | null): void;
15
+ } | {
16
+ nullable?: false;
17
+ value: number;
18
+ onChange(value: number): void;
19
+ });
20
+ export declare function NumberInput(props: NumberInputProps): import("react").JSX.Element;
@@ -3,28 +3,48 @@ import { fieldInputProps, useFieldControl } from "./field.js";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { Minus, Plus } from "lucide-react";
5
5
  import s from "./NumberInput.module.css";
6
- function NumberInput({
7
- value,
8
- onChange,
9
- label,
10
- min = -Infinity,
11
- max = Infinity,
12
- step = 1,
13
- disabled,
14
- readOnly,
15
- invalid = false,
16
- ...options
17
- }) {
18
- const field = useFieldControl({ ...options, label, disabled, readOnly });
19
- disabled = field.disabled;
20
- readOnly = field.readOnly;
21
- const [draft, setDraft] = useState(String(value)), input = useRef(null);
6
+ function NumberInput(props) {
7
+ const {
8
+ value,
9
+ label,
10
+ min = -Infinity,
11
+ max = Infinity,
12
+ step = 1,
13
+ disabled: suppliedDisabled,
14
+ readOnly: suppliedReadOnly,
15
+ invalid = false,
16
+ nullable = false,
17
+ placeholder,
18
+ ...options
19
+ } = props;
20
+ const onChange = (next) => {
21
+ if (props.nullable) props.onChange(next);
22
+ else if (next !== null) props.onChange(next);
23
+ };
24
+ const text = (next) => next === null ? "" : String(next);
25
+ const field = useFieldControl({
26
+ ...options,
27
+ label,
28
+ disabled: suppliedDisabled,
29
+ readOnly: suppliedReadOnly
30
+ });
31
+ const { disabled, readOnly } = field;
32
+ const [draft, setDraft] = useState(text(value)), input = useRef(null);
22
33
  const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
23
34
  const clamp = (n) => Math.min(max, Math.max(min, n));
24
- useEffect(() => setDraft(String(value)), [value]);
25
- const parsed = () => draft.trim() && Number.isFinite(Number(draft)) ? Number(draft) : value;
35
+ useEffect(() => setDraft(text(value)), [value]);
36
+ const parsed = () => draft.trim() && Number.isFinite(Number(draft)) ? Number(draft) : value ?? 0;
26
37
  const commit = () => {
27
38
  if (readOnly) return;
39
+ if (nullable && !draft.trim()) {
40
+ setDraft("");
41
+ if (value !== null) onChange(null);
42
+ return;
43
+ }
44
+ if (!draft.trim() || !Number.isFinite(Number(draft))) {
45
+ setDraft(text(value));
46
+ return;
47
+ }
28
48
  const next = clamp(parsed());
29
49
  setDraft(String(next));
30
50
  if (next !== value) onChange(next);
@@ -64,7 +84,8 @@ function NumberInput({
64
84
  role: "spinbutton",
65
85
  "aria-invalid": field.invalid || invalid,
66
86
  "aria-label": label,
67
- "aria-valuenow": value,
87
+ "aria-valuenow": value ?? void 0,
88
+ placeholder,
68
89
  "aria-valuemin": Number.isFinite(min) ? min : void 0,
69
90
  "aria-valuemax": Number.isFinite(max) ? max : void 0,
70
91
  value: draft,
@@ -81,7 +102,7 @@ function NumberInput({
81
102
  } else if (e.key === "Enter") {
82
103
  e.preventDefault();
83
104
  commit();
84
- } else if (e.key === "Escape") setDraft(String(value));
105
+ } else if (e.key === "Escape") setDraft(text(value));
85
106
  else if (e.key === "Home" && Number.isFinite(min)) {
86
107
  e.preventDefault();
87
108
  setDraft(String(min));
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, }: {
2
+ export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, compact, size: controlSize, className, }: {
3
3
  page: number;
4
4
  pageSize: number;
5
5
  total: number;
@@ -8,4 +8,8 @@ export declare function Pagination({ page, pageSize, total, onPageChange, onPage
8
8
  pageSizes?: number[];
9
9
  summary?: ReactNode;
10
10
  resetPageOnSizeChange?: boolean;
11
+ /** Removes outer spacing and groups controls for dialogs and dense toolbars. */
12
+ compact?: boolean;
13
+ size?: "default" | "small";
14
+ className?: string;
11
15
  }): import("react").JSX.Element;
@@ -18,7 +18,10 @@ function Pagination({
18
18
  onPageSizeChange,
19
19
  pageSizes = [5, 10, 20, 50],
20
20
  summary,
21
- resetPageOnSizeChange = true
21
+ resetPageOnSizeChange = true,
22
+ compact = false,
23
+ size: controlSize = "default",
24
+ className = ""
22
25
  }) {
23
26
  const size = Math.max(1, pageSize), pages = Math.max(1, Math.ceil(total / size)), current = Math.min(pages, Math.max(1, page)), id = useId(), [draft, setDraft] = useState(String(current));
24
27
  useEffect(() => setDraft(String(current)), [current]);
@@ -41,119 +44,126 @@ function Pagination({
41
44
  pages
42
45
  ])
43
46
  ].sort((a, b) => a - b);
44
- return /* @__PURE__ */ jsxs("nav", { className: s.pagination, "aria-label": "\u5206\u9875", children: [
45
- /* @__PURE__ */ jsxs("span", { className: s.summary, children: [
46
- total ? (current - 1) * size + 1 + "\u2013" + Math.min(current * size, total) : 0,
47
- " ",
48
- "/ ",
49
- total,
50
- " \u9879",
51
- summary
52
- ] }),
53
- /* @__PURE__ */ jsxs("div", { className: s.controls, children: [
54
- onPageSizeChange && /* @__PURE__ */ jsx(
55
- Select,
56
- {
57
- label: "\u6BCF\u9875\u6761\u6570",
58
- value: String(size),
59
- onChange: (v) => {
60
- onPageSizeChange(Number(v));
61
- if (resetPageOnSizeChange) onPageChange(1);
62
- },
63
- options: [.../* @__PURE__ */ new Set([...pageSizes, size])].sort((a, b) => a - b).map((n) => ({ value: String(n), label: n + " / \u9875" }))
64
- }
65
- ),
66
- /* @__PURE__ */ jsxs("div", { className: s.pages, children: [
67
- /* @__PURE__ */ jsx(
68
- Button,
69
- {
70
- className: s.arrow,
71
- "aria-label": "\u7B2C\u4E00\u9875",
72
- disabled: current === 1,
73
- onClick: () => onPageChange(1),
74
- children: /* @__PURE__ */ jsx(ChevronsLeft, {})
75
- }
76
- ),
77
- /* @__PURE__ */ jsx(
78
- Button,
79
- {
80
- className: s.arrow,
81
- "aria-label": "\u4E0A\u4E00\u9875",
82
- disabled: current === 1,
83
- onClick: () => onPageChange(current - 1),
84
- children: /* @__PURE__ */ jsx(ChevronLeft, {})
85
- }
86
- ),
87
- visible.map((n, i) => /* @__PURE__ */ jsxs("span", { className: s.number, children: [
88
- i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx("span", { className: s.ellipsis, children: "\u2026" }),
89
- /* @__PURE__ */ jsx(
90
- Button,
47
+ return /* @__PURE__ */ jsxs(
48
+ "nav",
49
+ {
50
+ className: `${s.pagination} ${compact ? s.compact : ""} ${controlSize === "small" ? s.small : ""} ${className}`,
51
+ "aria-label": "\u5206\u9875",
52
+ children: [
53
+ /* @__PURE__ */ jsxs("span", { className: s.summary, children: [
54
+ total ? (current - 1) * size + 1 + "\u2013" + Math.min(current * size, total) : 0,
55
+ " ",
56
+ "/ ",
57
+ total,
58
+ " \u9879",
59
+ summary
60
+ ] }),
61
+ /* @__PURE__ */ jsxs("div", { className: s.controls, children: [
62
+ onPageSizeChange && /* @__PURE__ */ jsx(
63
+ Select,
91
64
  {
92
- className: s.page,
93
- "aria-label": "\u7B2C " + n + " \u9875",
94
- "aria-current": n === current ? "page" : void 0,
95
- variant: n === current ? "primary" : "ghost",
96
- onClick: () => onPageChange(n),
97
- children: n
65
+ label: "\u6BCF\u9875\u6761\u6570",
66
+ value: String(size),
67
+ onChange: (v) => {
68
+ onPageSizeChange(Number(v));
69
+ if (resetPageOnSizeChange) onPageChange(1);
70
+ },
71
+ options: [.../* @__PURE__ */ new Set([...pageSizes, size])].sort((a, b) => a - b).map((n) => ({ value: String(n), label: n + " / \u9875" }))
98
72
  }
99
- )
100
- ] }, n)),
101
- /* @__PURE__ */ jsx(
102
- Button,
103
- {
104
- className: s.arrow,
105
- "aria-label": "\u4E0B\u4E00\u9875",
106
- disabled: current === pages,
107
- onClick: () => onPageChange(current + 1),
108
- children: /* @__PURE__ */ jsx(ChevronRight, {})
109
- }
110
- ),
111
- /* @__PURE__ */ jsx(
112
- Button,
113
- {
114
- className: s.arrow,
115
- "aria-label": "\u6700\u540E\u4E00\u9875",
116
- disabled: current === pages,
117
- onClick: () => onPageChange(pages),
118
- children: /* @__PURE__ */ jsx(ChevronsRight, {})
119
- }
120
- )
121
- ] }),
122
- /* @__PURE__ */ jsxs(
123
- "form",
124
- {
125
- className: s.jump,
126
- onSubmit: (e) => {
127
- e.preventDefault();
128
- jump();
129
- },
130
- children: [
131
- /* @__PURE__ */ jsx("label", { htmlFor: id, children: "\u8DF3\u81F3" }),
73
+ ),
74
+ /* @__PURE__ */ jsxs("div", { className: s.pages, children: [
132
75
  /* @__PURE__ */ jsx(
133
- "input",
76
+ Button,
134
77
  {
135
- id,
136
- className: control.surface,
137
- "aria-label": "\u8DF3\u8F6C\u9875\u7801",
138
- "aria-description": "\u8F93\u5165\u9875\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4",
139
- inputMode: "numeric",
140
- value: draft,
141
- onChange: (e) => setDraft(e.target.value),
142
- onBlur: jump,
143
- onKeyDown: (e) => {
144
- if (e.key === "Escape") {
145
- e.preventDefault();
146
- setDraft(String(current));
147
- }
78
+ className: s.arrow,
79
+ "aria-label": "\u7B2C\u4E00\u9875",
80
+ disabled: current === 1,
81
+ onClick: () => onPageChange(1),
82
+ children: /* @__PURE__ */ jsx(ChevronsLeft, {})
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ Button,
87
+ {
88
+ className: s.arrow,
89
+ "aria-label": "\u4E0A\u4E00\u9875",
90
+ disabled: current === 1,
91
+ onClick: () => onPageChange(current - 1),
92
+ children: /* @__PURE__ */ jsx(ChevronLeft, {})
93
+ }
94
+ ),
95
+ visible.map((n, i) => /* @__PURE__ */ jsxs("span", { className: s.number, children: [
96
+ i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx("span", { className: s.ellipsis, children: "\u2026" }),
97
+ /* @__PURE__ */ jsx(
98
+ Button,
99
+ {
100
+ className: s.page,
101
+ "aria-label": "\u7B2C " + n + " \u9875",
102
+ "aria-current": n === current ? "page" : void 0,
103
+ variant: n === current ? "primary" : "ghost",
104
+ onClick: () => onPageChange(n),
105
+ children: n
148
106
  }
107
+ )
108
+ ] }, n)),
109
+ /* @__PURE__ */ jsx(
110
+ Button,
111
+ {
112
+ className: s.arrow,
113
+ "aria-label": "\u4E0B\u4E00\u9875",
114
+ disabled: current === pages,
115
+ onClick: () => onPageChange(current + 1),
116
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
149
117
  }
150
118
  ),
151
- /* @__PURE__ */ jsx("span", { children: "\u9875" })
152
- ]
153
- }
154
- )
155
- ] })
156
- ] });
119
+ /* @__PURE__ */ jsx(
120
+ Button,
121
+ {
122
+ className: s.arrow,
123
+ "aria-label": "\u6700\u540E\u4E00\u9875",
124
+ disabled: current === pages,
125
+ onClick: () => onPageChange(pages),
126
+ children: /* @__PURE__ */ jsx(ChevronsRight, {})
127
+ }
128
+ )
129
+ ] }),
130
+ /* @__PURE__ */ jsxs(
131
+ "form",
132
+ {
133
+ className: s.jump,
134
+ onSubmit: (e) => {
135
+ e.preventDefault();
136
+ jump();
137
+ },
138
+ children: [
139
+ /* @__PURE__ */ jsx("label", { htmlFor: id, children: "\u8DF3\u81F3" }),
140
+ /* @__PURE__ */ jsx(
141
+ "input",
142
+ {
143
+ id,
144
+ className: control.surface,
145
+ "aria-label": "\u8DF3\u8F6C\u9875\u7801",
146
+ "aria-description": "\u8F93\u5165\u9875\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4",
147
+ inputMode: "numeric",
148
+ value: draft,
149
+ onChange: (e) => setDraft(e.target.value),
150
+ onBlur: jump,
151
+ onKeyDown: (e) => {
152
+ if (e.key === "Escape") {
153
+ e.preventDefault();
154
+ setDraft(String(current));
155
+ }
156
+ }
157
+ }
158
+ ),
159
+ /* @__PURE__ */ jsx("span", { children: "\u9875" })
160
+ ]
161
+ }
162
+ )
163
+ ] })
164
+ ]
165
+ }
166
+ );
157
167
  }
158
168
  export {
159
169
  Pagination