@kjun-ui/react 0.20.0 → 0.21.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 (114) hide show
  1. package/dist/index.cjs +3911 -1680
  2. package/dist/index.js +3591 -1360
  3. package/dist/styles.css +1410 -356
  4. package/dist/types/packages/react/src/app-navigation.d.cts +9 -4
  5. package/dist/types/packages/react/src/app-navigation.d.ts +9 -4
  6. package/dist/types/packages/react/src/card-actions-context.d.cts +2 -0
  7. package/dist/types/packages/react/src/card-actions-context.d.ts +2 -0
  8. package/dist/types/packages/react/src/card.d.cts +15 -5
  9. package/dist/types/packages/react/src/card.d.ts +15 -5
  10. package/dist/types/packages/react/src/chip.d.cts +4 -2
  11. package/dist/types/packages/react/src/chip.d.ts +4 -2
  12. package/dist/types/packages/react/src/color-picker-parts.d.cts +58 -0
  13. package/dist/types/packages/react/src/color-picker-parts.d.ts +58 -0
  14. package/dist/types/packages/react/src/color-picker.d.cts +51 -0
  15. package/dist/types/packages/react/src/color-picker.d.ts +51 -0
  16. package/dist/types/packages/react/src/data-state.d.cts +3 -3
  17. package/dist/types/packages/react/src/data-state.d.ts +3 -3
  18. package/dist/types/packages/react/src/display.d.cts +14 -5
  19. package/dist/types/packages/react/src/display.d.ts +14 -5
  20. package/dist/types/packages/react/src/fab.d.cts +16 -7
  21. package/dist/types/packages/react/src/fab.d.ts +16 -7
  22. package/dist/types/packages/react/src/index.d.cts +4 -0
  23. package/dist/types/packages/react/src/index.d.ts +4 -0
  24. package/dist/types/packages/react/src/kpi-hero.d.cts +53 -0
  25. package/dist/types/packages/react/src/kpi-hero.d.ts +53 -0
  26. package/dist/types/packages/react/src/kpi-row.d.cts +41 -0
  27. package/dist/types/packages/react/src/kpi-row.d.ts +41 -0
  28. package/dist/types/packages/react/src/kpi.d.cts +2 -72
  29. package/dist/types/packages/react/src/kpi.d.ts +2 -72
  30. package/dist/types/packages/react/src/list-context.d.cts +8 -0
  31. package/dist/types/packages/react/src/list-context.d.ts +8 -0
  32. package/dist/types/packages/react/src/list.d.cts +50 -8
  33. package/dist/types/packages/react/src/list.d.ts +50 -8
  34. package/dist/types/packages/react/src/modal.d.cts +5 -2
  35. package/dist/types/packages/react/src/modal.d.ts +5 -2
  36. package/dist/types/packages/react/src/navigation.d.cts +2 -1
  37. package/dist/types/packages/react/src/navigation.d.ts +2 -1
  38. package/dist/types/packages/react/src/number-display.d.cts +2 -0
  39. package/dist/types/packages/react/src/number-display.d.ts +2 -0
  40. package/dist/types/packages/react/src/reorder-controls.d.cts +43 -0
  41. package/dist/types/packages/react/src/reorder-controls.d.ts +43 -0
  42. package/dist/types/packages/react/src/skeletons.d.cts +2 -1
  43. package/dist/types/packages/react/src/skeletons.d.ts +2 -1
  44. package/dist/types/packages/react/src/split-pane.d.cts +30 -0
  45. package/dist/types/packages/react/src/split-pane.d.ts +30 -0
  46. package/dist/types/packages/react/src/stacked-bar.d.cts +22 -0
  47. package/dist/types/packages/react/src/stacked-bar.d.ts +22 -0
  48. package/dist/types/packages/react/src/table-grid.d.cts +1 -1
  49. package/dist/types/packages/react/src/table-grid.d.ts +1 -1
  50. package/dist/types/packages/react/src/zone-gauge.d.cts +28 -0
  51. package/dist/types/packages/react/src/zone-gauge.d.ts +28 -0
  52. package/dist/types/shared/package-runtime/alert-action-size.d.cts +1 -0
  53. package/dist/types/shared/package-runtime/alert-action-size.d.ts +1 -0
  54. package/dist/types/shared/package-runtime/bottom-bar.d.cts +15 -0
  55. package/dist/types/shared/package-runtime/bottom-bar.d.ts +15 -0
  56. package/dist/types/shared/package-runtime/bottom-navigation.d.cts +25 -0
  57. package/dist/types/shared/package-runtime/bottom-navigation.d.ts +25 -0
  58. package/dist/types/shared/package-runtime/card-layout.d.cts +34 -0
  59. package/dist/types/shared/package-runtime/card-layout.d.ts +34 -0
  60. package/dist/types/shared/package-runtime/chart-skeleton.d.cts +1 -1
  61. package/dist/types/shared/package-runtime/chart-skeleton.d.ts +1 -1
  62. package/dist/types/shared/package-runtime/chip-size.d.cts +4 -0
  63. package/dist/types/shared/package-runtime/chip-size.d.ts +4 -0
  64. package/dist/types/shared/package-runtime/color-picker-model.d.cts +51 -0
  65. package/dist/types/shared/package-runtime/color-picker-model.d.ts +51 -0
  66. package/dist/types/shared/package-runtime/color-picker.d.cts +92 -0
  67. package/dist/types/shared/package-runtime/color-picker.d.ts +92 -0
  68. package/dist/types/shared/package-runtime/color.d.cts +22 -0
  69. package/dist/types/shared/package-runtime/color.d.ts +22 -0
  70. package/dist/types/shared/package-runtime/distribution.d.cts +133 -0
  71. package/dist/types/shared/package-runtime/distribution.d.ts +133 -0
  72. package/dist/types/shared/package-runtime/empty-geometry.d.cts +19 -0
  73. package/dist/types/shared/package-runtime/empty-geometry.d.ts +19 -0
  74. package/dist/types/shared/package-runtime/kpi.d.cts +89 -0
  75. package/dist/types/shared/package-runtime/kpi.d.ts +89 -0
  76. package/dist/types/shared/package-runtime/layer-state.d.cts +2 -1
  77. package/dist/types/shared/package-runtime/layer-state.d.ts +2 -1
  78. package/dist/types/shared/package-runtime/list-leading.d.cts +38 -0
  79. package/dist/types/shared/package-runtime/list-leading.d.ts +38 -0
  80. package/dist/types/shared/package-runtime/list-row.d.cts +115 -4
  81. package/dist/types/shared/package-runtime/list-row.d.ts +115 -4
  82. package/dist/types/shared/package-runtime/market-layout.d.cts +3 -1
  83. package/dist/types/shared/package-runtime/market-layout.d.ts +3 -1
  84. package/dist/types/shared/package-runtime/market-query.d.cts +15 -0
  85. package/dist/types/shared/package-runtime/market-query.d.ts +15 -0
  86. package/dist/types/shared/package-runtime/messages/ko.d.cts +27 -0
  87. package/dist/types/shared/package-runtime/messages/ko.d.ts +27 -0
  88. package/dist/types/shared/package-runtime/messages-context.d.cts +27 -0
  89. package/dist/types/shared/package-runtime/messages-context.d.ts +27 -0
  90. package/dist/types/shared/package-runtime/number-sign.d.cts +9 -0
  91. package/dist/types/shared/package-runtime/number-sign.d.ts +9 -0
  92. package/dist/types/shared/package-runtime/popover-scroll.d.cts +3 -0
  93. package/dist/types/shared/package-runtime/popover-scroll.d.ts +3 -0
  94. package/dist/types/shared/package-runtime/radio-keyboard.d.cts +2 -0
  95. package/dist/types/shared/package-runtime/radio-keyboard.d.ts +2 -0
  96. package/dist/types/shared/package-runtime/reorder-session.d.cts +62 -0
  97. package/dist/types/shared/package-runtime/reorder-session.d.ts +62 -0
  98. package/dist/types/shared/package-runtime/reorder.d.cts +81 -0
  99. package/dist/types/shared/package-runtime/reorder.d.ts +81 -0
  100. package/dist/types/shared/package-runtime/skeleton-text.d.cts +14 -0
  101. package/dist/types/shared/package-runtime/skeleton-text.d.ts +14 -0
  102. package/dist/types/shared/package-runtime/split-pane.d.cts +46 -0
  103. package/dist/types/shared/package-runtime/split-pane.d.ts +46 -0
  104. package/dist/types/shared/package-runtime/table-columns.d.cts +28 -0
  105. package/dist/types/shared/package-runtime/table-columns.d.ts +28 -0
  106. package/dist/types/shared/package-runtime/table-presentation.d.cts +22 -2
  107. package/dist/types/shared/package-runtime/table-presentation.d.ts +22 -2
  108. package/dist/types/shared/package-runtime/table.d.cts +29 -0
  109. package/dist/types/shared/package-runtime/table.d.ts +29 -0
  110. package/dist/types/shared/package-runtime/use-color-picker.d.cts +51 -0
  111. package/dist/types/shared/package-runtime/use-color-picker.d.ts +51 -0
  112. package/dist/types/shared/package-runtime/use-layer.d.cts +4 -2
  113. package/dist/types/shared/package-runtime/use-layer.d.ts +4 -2
  114. package/package.json +3 -3
@@ -20,9 +20,21 @@ export declare function tablePresentation<Row extends object>(props: TableProps<
20
20
  footerActions: TableColumn<Row> | undefined;
21
21
  /** One footer row holds the expand toggle and the row actions. */
22
22
  cardFooter: boolean;
23
+ /** A reorderable card's move buttons end the title line unless a footer row already exists; then they join it. */
24
+ headerMover: boolean;
23
25
  /** A section's field arrangement: rows cards put every field on a label-value line. */
24
26
  cardBody(section: TableCardSection): "metrics" | "grid" | "stack" | "rows";
25
- columnsForSection(row: Row, section: TableCardSection): TableColumn<Row>[];
27
+ /**
28
+ * A section's fields for one row, in order. Spans are the grid's own (worked out once per row over the columns as
29
+ * shown), so a card leaves out exactly the fields the grid covers. A cell that spans other columns is a note about
30
+ * them, not the first column's value: it takes the whole line under its section's name (a column group's label),
31
+ * or no name without one.
32
+ */
33
+ cardFields(row: Row, section: TableCardSection): {
34
+ column: TableColumn<Row>;
35
+ label: string;
36
+ full: boolean;
37
+ }[];
26
38
  };
27
39
  /** Narrow layouts have no header row to sort by, so the toolbar offers each sortable column in both orders. */
28
40
  export declare function tableSortOptions<Row extends object>(props: TableProps<Row, unknown>, messages: {
@@ -63,7 +75,9 @@ export interface TableGroupingProps<Row extends object> {
63
75
  summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
64
76
  }
65
77
  /** Card parts: a card value starts at its label (cardValue) or ends a label-value line (cardRowValue); tiles use smaller titles and highlights. */
66
- export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight";
78
+ export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight" | "merged";
79
+ /** A narrow layout's title opens the row when the row is clickable, so a cell drawn there is then never a button of its own. */
80
+ export declare const tableOpenerRole: (role?: TableCellRole) => role is "title" | "listTitle" | "tileTitle";
67
81
  export interface TableRowsProps<Row extends object> {
68
82
  initialLoading: boolean;
69
83
  skeletonRows: number;
@@ -75,6 +89,8 @@ export interface TableRowsProps<Row extends object> {
75
89
  expandable: boolean;
76
90
  checkbox: (row: Row, index: number) => ReactNode;
77
91
  expand: (row: Row, index: number) => ReactNode;
92
+ /** A reorderable table's move buttons for a row: the grid's last column, a card's footer or a list row's end. */
93
+ mover?: (row: Row, index: number) => ReactNode;
78
94
  cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
79
95
  renderExpand: TableProps<Row>["renderExpand"];
80
96
  emptyContent: ReactNode;
@@ -93,6 +109,10 @@ export interface TableCardsProps<Row extends object> extends TableRowsProps<Row>
93
109
  cellText?: (column: TableColumn<Row>, row: Row, index: number) => string | undefined;
94
110
  }
95
111
  export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
112
+ /** Labels over runs of columns (TableProps.columnGroups). */
113
+ columnGroups?: TableProps<Row>["columnGroups"];
114
+ /** How many columns a row's cell covers (TableProps.cellSpan). */
115
+ cellSpan?: TableProps<Row>["cellSpan"];
96
116
  state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
97
117
  visible: TableColumn<Row>[];
98
118
  maxHeight?: Height;
@@ -20,9 +20,21 @@ export declare function tablePresentation<Row extends object>(props: TableProps<
20
20
  footerActions: TableColumn<Row> | undefined;
21
21
  /** One footer row holds the expand toggle and the row actions. */
22
22
  cardFooter: boolean;
23
+ /** A reorderable card's move buttons end the title line unless a footer row already exists; then they join it. */
24
+ headerMover: boolean;
23
25
  /** A section's field arrangement: rows cards put every field on a label-value line. */
24
26
  cardBody(section: TableCardSection): "metrics" | "grid" | "stack" | "rows";
25
- columnsForSection(row: Row, section: TableCardSection): TableColumn<Row>[];
27
+ /**
28
+ * A section's fields for one row, in order. Spans are the grid's own (worked out once per row over the columns as
29
+ * shown), so a card leaves out exactly the fields the grid covers. A cell that spans other columns is a note about
30
+ * them, not the first column's value: it takes the whole line under its section's name (a column group's label),
31
+ * or no name without one.
32
+ */
33
+ cardFields(row: Row, section: TableCardSection): {
34
+ column: TableColumn<Row>;
35
+ label: string;
36
+ full: boolean;
37
+ }[];
26
38
  };
27
39
  /** Narrow layouts have no header row to sort by, so the toolbar offers each sortable column in both orders. */
28
40
  export declare function tableSortOptions<Row extends object>(props: TableProps<Row, unknown>, messages: {
@@ -63,7 +75,9 @@ export interface TableGroupingProps<Row extends object> {
63
75
  summary: ((column: TableColumn<Row>, rows: Row[]) => ReactNode) | null;
64
76
  }
65
77
  /** Card parts: a card value starts at its label (cardValue) or ends a label-value line (cardRowValue); tiles use smaller titles and highlights. */
66
- export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight";
78
+ export type TableCellRole = "title" | "listTitle" | "listMeta" | "listValue" | "cardValue" | "cardRowValue" | "cardSubtitle" | "cardHighlight" | "tileTitle" | "tileHighlight" | "merged";
79
+ /** A narrow layout's title opens the row when the row is clickable, so a cell drawn there is then never a button of its own. */
80
+ export declare const tableOpenerRole: (role?: TableCellRole) => role is "title" | "listTitle" | "tileTitle";
67
81
  export interface TableRowsProps<Row extends object> {
68
82
  initialLoading: boolean;
69
83
  skeletonRows: number;
@@ -75,6 +89,8 @@ export interface TableRowsProps<Row extends object> {
75
89
  expandable: boolean;
76
90
  checkbox: (row: Row, index: number) => ReactNode;
77
91
  expand: (row: Row, index: number) => ReactNode;
92
+ /** A reorderable table's move buttons for a row: the grid's last column, a card's footer or a list row's end. */
93
+ mover?: (row: Row, index: number) => ReactNode;
78
94
  cell: (column: TableColumn<Row>, row: Row, index: number, role?: TableCellRole) => ReactNode;
79
95
  renderExpand: TableProps<Row>["renderExpand"];
80
96
  emptyContent: ReactNode;
@@ -93,6 +109,10 @@ export interface TableCardsProps<Row extends object> extends TableRowsProps<Row>
93
109
  cellText?: (column: TableColumn<Row>, row: Row, index: number) => string | undefined;
94
110
  }
95
111
  export interface TableGridProps<Row extends object, Height> extends TableRowsProps<Row>, TableGroupingProps<Row> {
112
+ /** Labels over runs of columns (TableProps.columnGroups). */
113
+ columnGroups?: TableProps<Row>["columnGroups"];
114
+ /** How many columns a row's cell covers (TableProps.cellSpan). */
115
+ cellSpan?: TableProps<Row>["cellSpan"];
96
116
  state: TableRowsProps<Row>["state"] & Pick<ReturnType<typeof useTableModel<Row>>, "all" | "some" | "toggleAll" | "sort" | "sortColumn">;
97
117
  visible: TableColumn<Row>[];
98
118
  maxHeight?: Height;
@@ -2,6 +2,8 @@ import { type TableSort, type QueryDisplayProps } from "@kjun-ui/tokens";
2
2
  export type { TableSort } from "@kjun-ui/tokens";
3
3
  import { type ReactNode } from "react";
4
4
  import type { TableSummaryKind } from "./table-groups.cjs";
5
+ import type { TableColumnGroup } from "./table-columns.cjs";
6
+ export type { TableColumnGroup } from "./table-columns.cjs";
5
7
  export type { TableSummaryKind } from "./table-groups.cjs";
6
8
  import { type TableCompare } from "./table-model.cjs";
7
9
  export { getValue } from "./table-model.cjs";
@@ -25,6 +27,12 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
25
27
  secondary?: boolean;
26
28
  className?: string;
27
29
  headerClass?: string;
30
+ /** Makes the cell a button that runs this, instead of opening the row (row clicks and keys stay with the row elsewhere). */
31
+ onCellPress?: (row: Row, index: number) => void;
32
+ /** The cell button's accessible name when its content alone does not say what it does, e.g. "목표가 82,000원, 근거 보기". */
33
+ cellLabel?: (row: Row, index: number) => string;
34
+ /** Web: extra attributes for the grid cell element (data-*, aria-*, title). Native ignores it. */
35
+ cellProps?: (row: Row, index: number) => Record<string, unknown> | undefined;
28
36
  }
29
37
  export interface TableCardSection {
30
38
  key?: string;
@@ -40,6 +48,27 @@ export interface TablePagination {
40
48
  }
41
49
  export interface TableProps<Row extends object = Record<string, unknown>, MaxHeight = number> extends QueryDisplayProps {
42
50
  columns: TableColumn<Row>[];
51
+ /** Labels over runs of columns, by column key: the header gets a second row. Narrow cards use them as sections when cardSections is empty. */
52
+ columnGroups?: TableColumnGroup[];
53
+ /** How many columns a row's cell covers, counting itself (2 merges it with the next column). The covered cells are not drawn. */
54
+ cellSpan?: (row: Row, column: TableColumn<Row>) => number | null | undefined;
55
+ /** Rows listed in `order` get up and down buttons. The app keeps the order, passes `data` in it and saves it. */
56
+ reorderable?: boolean;
57
+ /** The rows' rowKey values in the order shown; a row whose key is not listed cannot move. */
58
+ order?: (string | number)[];
59
+ /** Called with the next order when a row moves; the app applies it. */
60
+ onOrderChange?: (order: (string | number)[]) => void;
61
+ /** The same move in detail: the row's key, where it was and where it went. */
62
+ onReorder?: (move: {
63
+ value: string | number;
64
+ from: number;
65
+ to: number;
66
+ order: (string | number)[];
67
+ }) => void;
68
+ /** Turns the move buttons off. They are also off while the table is sorted by a column or grouped. */
69
+ reorderDisabled?: boolean;
70
+ /** Why moving is off, shown under the table and read with the buttons; a sorted or grouped table says so by default. */
71
+ reorderDisabledText?: string;
43
72
  data?: Row[];
44
73
  rowKey?: string;
45
74
  skeletonRows?: number;
@@ -2,6 +2,8 @@ import { type TableSort, type QueryDisplayProps } from "@kjun-ui/tokens";
2
2
  export type { TableSort } from "@kjun-ui/tokens";
3
3
  import { type ReactNode } from "react";
4
4
  import type { TableSummaryKind } from "./table-groups.js";
5
+ import type { TableColumnGroup } from "./table-columns.js";
6
+ export type { TableColumnGroup } from "./table-columns.js";
5
7
  export type { TableSummaryKind } from "./table-groups.js";
6
8
  import { type TableCompare } from "./table-model.js";
7
9
  export { getValue } from "./table-model.js";
@@ -25,6 +27,12 @@ export interface TableColumn<Row extends object = Record<string, unknown>> {
25
27
  secondary?: boolean;
26
28
  className?: string;
27
29
  headerClass?: string;
30
+ /** Makes the cell a button that runs this, instead of opening the row (row clicks and keys stay with the row elsewhere). */
31
+ onCellPress?: (row: Row, index: number) => void;
32
+ /** The cell button's accessible name when its content alone does not say what it does, e.g. "목표가 82,000원, 근거 보기". */
33
+ cellLabel?: (row: Row, index: number) => string;
34
+ /** Web: extra attributes for the grid cell element (data-*, aria-*, title). Native ignores it. */
35
+ cellProps?: (row: Row, index: number) => Record<string, unknown> | undefined;
28
36
  }
29
37
  export interface TableCardSection {
30
38
  key?: string;
@@ -40,6 +48,27 @@ export interface TablePagination {
40
48
  }
41
49
  export interface TableProps<Row extends object = Record<string, unknown>, MaxHeight = number> extends QueryDisplayProps {
42
50
  columns: TableColumn<Row>[];
51
+ /** Labels over runs of columns, by column key: the header gets a second row. Narrow cards use them as sections when cardSections is empty. */
52
+ columnGroups?: TableColumnGroup[];
53
+ /** How many columns a row's cell covers, counting itself (2 merges it with the next column). The covered cells are not drawn. */
54
+ cellSpan?: (row: Row, column: TableColumn<Row>) => number | null | undefined;
55
+ /** Rows listed in `order` get up and down buttons. The app keeps the order, passes `data` in it and saves it. */
56
+ reorderable?: boolean;
57
+ /** The rows' rowKey values in the order shown; a row whose key is not listed cannot move. */
58
+ order?: (string | number)[];
59
+ /** Called with the next order when a row moves; the app applies it. */
60
+ onOrderChange?: (order: (string | number)[]) => void;
61
+ /** The same move in detail: the row's key, where it was and where it went. */
62
+ onReorder?: (move: {
63
+ value: string | number;
64
+ from: number;
65
+ to: number;
66
+ order: (string | number)[];
67
+ }) => void;
68
+ /** Turns the move buttons off. They are also off while the table is sorted by a column or grouped. */
69
+ reorderDisabled?: boolean;
70
+ /** Why moving is off, shown under the table and read with the buttons; a sorted or grouped table says so by default. */
71
+ reorderDisabledText?: string;
43
72
  data?: Row[];
44
73
  rowKey?: string;
45
74
  skeletonRows?: number;
@@ -0,0 +1,51 @@
1
+ import { type ColorSwatchInput, type PickerState } from "./color-picker.cjs";
2
+ export interface ColorPickerModelOptions {
3
+ value?: string | null;
4
+ defaultValue?: string | null;
5
+ onValueChange?: (value: string | null) => void;
6
+ onChangeCommit?: (value: string | null) => void;
7
+ swatches?: ColorSwatchInput[];
8
+ custom: boolean;
9
+ alpha: boolean;
10
+ input: boolean;
11
+ clearable: boolean;
12
+ open?: boolean;
13
+ defaultOpen: boolean;
14
+ onOpenChange?: (open: boolean) => void;
15
+ disabled?: boolean;
16
+ readOnly?: boolean;
17
+ recentColors?: ColorSwatchInput[];
18
+ onRecentColorsChange?: (colors: string[]) => void;
19
+ eyeDropper?: boolean;
20
+ }
21
+ export declare function useColorPickerModel(o: ColorPickerModelOptions): {
22
+ value: string | null;
23
+ open: boolean;
24
+ setOpen: (next: boolean) => void;
25
+ state: PickerState;
26
+ swatches: {
27
+ value: string;
28
+ label: string;
29
+ }[];
30
+ recent: {
31
+ value: string;
32
+ label: string;
33
+ }[] | null;
34
+ nothing: boolean;
35
+ showInput: boolean;
36
+ selected: number;
37
+ recentSelected: number;
38
+ pick: (next: string | null) => void;
39
+ moveTo: (next: PickerState) => void;
40
+ pickState: (next: PickerState) => void;
41
+ drag: {
42
+ onStart: () => void;
43
+ onEnd: () => void;
44
+ };
45
+ field: {
46
+ onEdit: (live: string | null) => void;
47
+ onCommit: (next: string | null | "revert") => void;
48
+ };
49
+ canPickScreen: boolean;
50
+ pickFromScreen: () => Promise<void>;
51
+ };
@@ -0,0 +1,51 @@
1
+ import { type ColorSwatchInput, type PickerState } from "./color-picker.js";
2
+ export interface ColorPickerModelOptions {
3
+ value?: string | null;
4
+ defaultValue?: string | null;
5
+ onValueChange?: (value: string | null) => void;
6
+ onChangeCommit?: (value: string | null) => void;
7
+ swatches?: ColorSwatchInput[];
8
+ custom: boolean;
9
+ alpha: boolean;
10
+ input: boolean;
11
+ clearable: boolean;
12
+ open?: boolean;
13
+ defaultOpen: boolean;
14
+ onOpenChange?: (open: boolean) => void;
15
+ disabled?: boolean;
16
+ readOnly?: boolean;
17
+ recentColors?: ColorSwatchInput[];
18
+ onRecentColorsChange?: (colors: string[]) => void;
19
+ eyeDropper?: boolean;
20
+ }
21
+ export declare function useColorPickerModel(o: ColorPickerModelOptions): {
22
+ value: string | null;
23
+ open: boolean;
24
+ setOpen: (next: boolean) => void;
25
+ state: PickerState;
26
+ swatches: {
27
+ value: string;
28
+ label: string;
29
+ }[];
30
+ recent: {
31
+ value: string;
32
+ label: string;
33
+ }[] | null;
34
+ nothing: boolean;
35
+ showInput: boolean;
36
+ selected: number;
37
+ recentSelected: number;
38
+ pick: (next: string | null) => void;
39
+ moveTo: (next: PickerState) => void;
40
+ pickState: (next: PickerState) => void;
41
+ drag: {
42
+ onStart: () => void;
43
+ onEnd: () => void;
44
+ };
45
+ field: {
46
+ onEdit: (live: string | null) => void;
47
+ onCommit: (next: string | null | "revert") => void;
48
+ };
49
+ canPickScreen: boolean;
50
+ pickFromScreen: () => Promise<void>;
51
+ };
@@ -11,12 +11,13 @@ export declare function useLayerState(): {
11
11
  top: () => import("./layer-state.cjs").LayerEntry | undefined;
12
12
  topPopup: () => import("./layer-state.cjs").LayerEntry | undefined;
13
13
  windowOf: (id?: string) => string | undefined;
14
+ markRestoredFocus(target: FocusTarget): void;
14
15
  isRestoredFocus(target?: FocusTarget | null): boolean;
15
16
  clearRestoredFocus(target?: FocusTarget | null): void;
16
17
  markClosing(id: string): void;
17
18
  subscribe(listener: () => void): () => void;
18
19
  snapshot: () => number;
19
- open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null): import("./layer-state.cjs").LayerEntry;
20
+ open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null, defaultFocus?: boolean): import("./layer-state.cjs").LayerEntry;
20
21
  remove(id: string, focused?: FocusTarget | null): FocusTarget | null | undefined;
21
22
  requestClose(id: string): void;
22
23
  isActive(id: string): boolean;
@@ -46,12 +47,13 @@ export declare function useLayer(open: boolean, present: boolean, kind: LayerKin
46
47
  top: () => import("./layer-state.cjs").LayerEntry | undefined;
47
48
  topPopup: () => import("./layer-state.cjs").LayerEntry | undefined;
48
49
  windowOf: (id?: string) => string | undefined;
50
+ markRestoredFocus(target: FocusTarget): void;
49
51
  isRestoredFocus(target?: FocusTarget | null): boolean;
50
52
  clearRestoredFocus(target?: FocusTarget | null): void;
51
53
  markClosing(id: string): void;
52
54
  subscribe(listener: () => void): () => void;
53
55
  snapshot: () => number;
54
- open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null): import("./layer-state.cjs").LayerEntry;
56
+ open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null, defaultFocus?: boolean): import("./layer-state.cjs").LayerEntry;
55
57
  remove(id: string, focused?: FocusTarget | null): FocusTarget | null | undefined;
56
58
  requestClose(id: string): void;
57
59
  isActive(id: string): boolean;
@@ -11,12 +11,13 @@ export declare function useLayerState(): {
11
11
  top: () => import("./layer-state.js").LayerEntry | undefined;
12
12
  topPopup: () => import("./layer-state.js").LayerEntry | undefined;
13
13
  windowOf: (id?: string) => string | undefined;
14
+ markRestoredFocus(target: FocusTarget): void;
14
15
  isRestoredFocus(target?: FocusTarget | null): boolean;
15
16
  clearRestoredFocus(target?: FocusTarget | null): void;
16
17
  markClosing(id: string): void;
17
18
  subscribe(listener: () => void): () => void;
18
19
  snapshot: () => number;
19
- open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null): import("./layer-state.js").LayerEntry;
20
+ open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null, defaultFocus?: boolean): import("./layer-state.js").LayerEntry;
20
21
  remove(id: string, focused?: FocusTarget | null): FocusTarget | null | undefined;
21
22
  requestClose(id: string): void;
22
23
  isActive(id: string): boolean;
@@ -46,12 +47,13 @@ export declare function useLayer(open: boolean, present: boolean, kind: LayerKin
46
47
  top: () => import("./layer-state.js").LayerEntry | undefined;
47
48
  topPopup: () => import("./layer-state.js").LayerEntry | undefined;
48
49
  windowOf: (id?: string) => string | undefined;
50
+ markRestoredFocus(target: FocusTarget): void;
49
51
  isRestoredFocus(target?: FocusTarget | null): boolean;
50
52
  clearRestoredFocus(target?: FocusTarget | null): void;
51
53
  markClosing(id: string): void;
52
54
  subscribe(listener: () => void): () => void;
53
55
  snapshot: () => number;
54
- open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null): import("./layer-state.js").LayerEntry;
56
+ open(id: string, kind: LayerKind, parent: string | undefined, dismissCallback: () => void, returnTarget?: FocusTarget | null, defaultFocus?: boolean): import("./layer-state.js").LayerEntry;
55
57
  remove(id: string, focused?: FocusTarget | null): FocusTarget | null | undefined;
56
58
  requestClose(id: string): void;
57
59
  isActive(id: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjun-ui/react",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://ui.kjun.dev",
6
6
  "repository": {
@@ -41,9 +41,9 @@
41
41
  "./package.json": "./package.json"
42
42
  },
43
43
  "dependencies": {
44
- "@kjun-ui/tokens": "0.20.0",
44
+ "@kjun-ui/tokens": "0.21.0",
45
45
  "react-aria-components": "1.21.1",
46
- "@kjun-ui/icons": "0.20.0"
46
+ "@kjun-ui/icons": "0.21.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.2.3",