jenosize-ui 0.2.0 → 0.2.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.
- package/README.md +2 -2
- package/dist/{PaymentInput-CKPIPNWH.d.ts → PaymentInput-Dn5WVQVy.d.ts} +4 -0
- package/dist/{Select-CVbEQ2Ep.d.ts → Select-Dt5ARIH8.d.ts} +4 -0
- package/dist/{TagInput-CTJYOB4J.d.ts → TagInput-BaBeve6L.d.ts} +4 -0
- package/dist/area-chart.d.ts +3 -2
- package/dist/area-chart.js +6 -5
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.js +9 -8
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +5 -4
- package/dist/bar-chart.d.ts +3 -2
- package/dist/bar-chart.js +6 -5
- package/dist/breadcrumb.d.ts +4 -0
- package/dist/breadcrumb.js +4 -2
- package/dist/button.d.ts +6 -1
- package/dist/button.js +9 -8
- package/dist/calendar.d.ts +5 -0
- package/dist/calendar.js +15 -13
- package/dist/callout.d.ts +6 -6
- package/dist/callout.js +11 -9
- package/dist/card-D56VxyAe.d.ts +123 -0
- package/dist/card.d.ts +3 -51
- package/dist/card.js +5 -5
- package/dist/checkbox.js +8 -7
- package/dist/{chunk-75M43ELV.js → chunk-22M75A3N.js} +75 -45
- package/dist/{chunk-A46ED5JQ.js → chunk-33TOK7ES.js} +7 -5
- package/dist/{chunk-RNXRZGXN.js → chunk-3H444OJA.js} +5 -3
- package/dist/{chunk-DJYWPJZ3.js → chunk-3QXLIZIX.js} +3 -12
- package/dist/chunk-3ZEEGXYF.js +8 -0
- package/dist/chunk-45Y2ZGNK.js +34 -0
- package/dist/{chunk-ILICYNK7.js → chunk-4RBIWI2Q.js} +3 -3
- package/dist/{chunk-FIGBJGH2.js → chunk-4VGEJG4M.js} +115 -79
- package/dist/{chunk-EX374YWB.js → chunk-54SIZR63.js} +15 -7
- package/dist/chunk-5AZKP4KZ.js +49 -0
- package/dist/{chunk-NA35YZRD.js → chunk-5DP7W5HX.js} +13 -11
- package/dist/{chunk-QKDEQFOQ.js → chunk-5KSD4WKN.js} +13 -4
- package/dist/{chunk-RIXEUAPY.js → chunk-5XPMY2LF.js} +5 -5
- package/dist/{chunk-6UBYHSBX.js → chunk-5ZEUTSCV.js} +5 -5
- package/dist/{chunk-DCGTB7P7.js → chunk-667ZHY3T.js} +111 -39
- package/dist/{chunk-MYQ3FD4Y.js → chunk-6B6BWTXC.js} +8 -5
- package/dist/{chunk-6HJA7NPL.js → chunk-6H4LNWQ7.js} +3 -3
- package/dist/{chunk-JAVNGTOE.js → chunk-6MMBQVRO.js} +58 -43
- package/dist/{chunk-JMWYCT63.js → chunk-7GUPNTAH.js} +14 -6
- package/dist/{chunk-TBN644IN.js → chunk-7ZM7SNCZ.js} +3 -3
- package/dist/{chunk-BD5YKFRA.js → chunk-A323V6AI.js} +5 -3
- package/dist/{chunk-AC6ZWKRN.js → chunk-AFYXSZGW.js} +2 -2
- package/dist/chunk-AIARANKE.js +33 -0
- package/dist/{chunk-54S5CUY6.js → chunk-AIGYMTCU.js} +5 -4
- package/dist/{chunk-C6OTOTKI.js → chunk-AZ7DKRBY.js} +5 -5
- package/dist/{chunk-QBHQOX23.js → chunk-BBKE4W3B.js} +18 -10
- package/dist/{chunk-4BRMM3I5.js → chunk-BFVJHH7S.js} +7 -6
- package/dist/{chunk-FFTRB2UU.js → chunk-CFFWYXDW.js} +18 -6
- package/dist/{chunk-42FCPC77.js → chunk-CGHYXWTT.js} +10 -4
- package/dist/{chunk-VEOYCAJP.js → chunk-CKMWBVRR.js} +27 -7
- package/dist/{chunk-GTHJWR3Q.js → chunk-D7EE5GWU.js} +21 -22
- package/dist/{chunk-NMERLWT7.js → chunk-E2YZ7IMT.js} +23 -7
- package/dist/{chunk-GAFGIT4Q.js → chunk-FFMTYQXE.js} +30 -10
- package/dist/{chunk-L53Y7KUV.js → chunk-FH7Z7SGQ.js} +61 -28
- package/dist/{chunk-5JRM3OES.js → chunk-FNQJJO63.js} +3 -3
- package/dist/{chunk-MD4AR43X.js → chunk-FWRHBMWT.js} +3 -3
- package/dist/{chunk-4K6V6NNK.js → chunk-GLKFFA7N.js} +10 -8
- package/dist/{chunk-EDOUI2BG.js → chunk-GQRSABRN.js} +4 -4
- package/dist/{chunk-BNIWT6CW.js → chunk-GZMDZF2V.js} +7 -6
- package/dist/{chunk-HSVBTIP2.js → chunk-HHYEAFCL.js} +70 -27
- package/dist/{chunk-P7DH62UY.js → chunk-I6WMNXC7.js} +5 -5
- package/dist/{chunk-34J5AANZ.js → chunk-IQNVSQRK.js} +3 -3
- package/dist/{chunk-MCUASLZH.js → chunk-KHGW72BM.js} +3 -3
- package/dist/{chunk-4R7WDDCW.js → chunk-KZP6B6B3.js} +4 -4
- package/dist/{chunk-7HV6EIGZ.js → chunk-LLPWQDF7.js} +3 -3
- package/dist/{chunk-FZBZGA3P.js → chunk-LO22VQL5.js} +4 -4
- package/dist/{chunk-JXHZHUB3.js → chunk-LQURV7HQ.js} +9 -7
- package/dist/{chunk-EDT5J5WK.js → chunk-LYXPJERB.js} +14 -4
- package/dist/{chunk-6IUTVDNI.js → chunk-MCQG4H6T.js} +35 -3
- package/dist/{chunk-JYBGO6GY.js → chunk-MVG5MABV.js} +11 -8
- package/dist/{chunk-PXEJ5RKO.js → chunk-N3RVMBPX.js} +6 -9
- package/dist/{chunk-VWGAMOSE.js → chunk-NKG4N6HA.js} +3 -3
- package/dist/{chunk-A5WQLN4B.js → chunk-OACWA4TC.js} +14 -52
- package/dist/{chunk-LBYCCLVI.js → chunk-OLLD2BZN.js} +9 -9
- package/dist/{chunk-T2WAD4QP.js → chunk-POQTE7JI.js} +55 -16
- package/dist/{chunk-74HPBSVY.js → chunk-QDKETK7D.js} +4 -4
- package/dist/{chunk-VH35QHD4.js → chunk-QHH6AUR3.js} +16 -8
- package/dist/chunk-RJTVCA62.js +42 -0
- package/dist/{chunk-DTMYD63D.js → chunk-S5TEWPWW.js} +46 -26
- package/dist/{chunk-3GT43XPK.js → chunk-SB3DG572.js} +15 -8
- package/dist/{chunk-NKDW6C7K.js → chunk-SKRR3ZMP.js} +3 -3
- package/dist/{chunk-CTENRS34.js → chunk-T4ZFZTY6.js} +8 -6
- package/dist/{chunk-YLEHYDXC.js → chunk-T5574MXM.js} +33 -45
- package/dist/{chunk-USL3TDZM.js → chunk-U4WSJAYK.js} +321 -105
- package/dist/{chunk-4W6AYGLR.js → chunk-UGKELBNC.js} +55 -39
- package/dist/{chunk-M5TVCASC.js → chunk-ULGCGKOE.js} +8 -6
- package/dist/{chunk-JUWDRRD6.js → chunk-X2VMIBK5.js} +4 -4
- package/dist/{chunk-763VS2FY.js → chunk-YHBI52P2.js} +3 -3
- package/dist/chunk-YIHKQ63K.js +13 -0
- package/dist/{chunk-3Z3SDKIA.js → chunk-YQYVGWIC.js} +5 -5
- package/dist/{chunk-4HKDD3PR.js → chunk-ZHAT2XZ4.js} +91 -57
- package/dist/{chunk-CWMFEF6R.js → chunk-ZMFY7WAY.js} +60 -24
- package/dist/{chunk-WKWAUU64.js → chunk-ZZSNTCCL.js} +6 -5
- package/dist/combobox.d.ts +5 -0
- package/dist/combobox.js +12 -11
- package/dist/date-input.d.ts +4 -0
- package/dist/date-input.js +11 -9
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +23 -21
- package/dist/dialog.d.ts +21 -1
- package/dist/dialog.js +10 -8
- package/dist/drawer.d.ts +11 -1
- package/dist/drawer.js +9 -7
- package/dist/dropdown-menu.d.ts +12 -0
- package/dist/dropdown-menu.js +6 -5
- package/dist/dropzone.d.ts +3 -2
- package/dist/dropzone.js +13 -12
- package/dist/form.d.ts +5 -4
- package/dist/form.js +60 -44
- package/dist/header-navigation.d.ts +5 -1
- package/dist/header-navigation.js +21 -19
- package/dist/helper.d.ts +36 -0
- package/dist/helper.js +3 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +81 -76
- package/dist/indicator.js +4 -4
- package/dist/input.d.ts +4 -0
- package/dist/input.js +9 -8
- package/dist/kanban-board.d.ts +21 -81
- package/dist/kanban-board.js +14 -12
- package/dist/labels-DPrh0se9.d.ts +627 -0
- package/dist/line-chart.d.ts +3 -2
- package/dist/line-chart.js +6 -5
- package/dist/{nav-DcCyt00p.d.ts → nav-CKKqjBs6.d.ts} +10 -0
- package/dist/number-input.d.ts +4 -0
- package/dist/number-input.js +9 -8
- package/dist/pagination.d.ts +7 -1
- package/dist/pagination.js +11 -10
- package/dist/payment-input.d.ts +3 -2
- package/dist/payment-input.js +9 -8
- package/dist/pie-chart.d.ts +7 -3
- package/dist/pie-chart.js +6 -5
- package/dist/popover.js +9 -7
- package/dist/progress-steps.js +2 -2
- package/dist/progress.d.ts +21 -1
- package/dist/progress.js +3 -2
- package/dist/provider.d.ts +212 -0
- package/dist/provider.js +7 -0
- package/dist/radar-chart.d.ts +7 -3
- package/dist/radar-chart.js +6 -5
- package/dist/radial-chart.d.ts +7 -3
- package/dist/radial-chart.js +6 -5
- package/dist/radio.js +8 -7
- package/dist/select.d.ts +2 -1
- package/dist/select.js +14 -13
- package/dist/shared-CxAedkiy.d.ts +68 -0
- package/dist/sidebar-navigation.d.ts +28 -7
- package/dist/sidebar-navigation.js +15 -13
- package/dist/skeleton.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/switch.js +4 -4
- package/dist/table.d.ts +56 -6
- package/dist/table.js +36 -34
- package/dist/tabs.d.ts +22 -0
- package/dist/tabs.js +3 -3
- package/dist/tag-input.d.ts +3 -2
- package/dist/tag-input.js +12 -11
- package/dist/tag.d.ts +4 -0
- package/dist/tag.js +3 -2
- package/dist/textarea.js +6 -5
- package/dist/theme.css +69 -6
- package/dist/theme.js +10 -9
- package/dist/toast.d.ts +11 -2
- package/dist/toast.js +11 -9
- package/dist/{tooltip-surface-Dmvb8v5K.d.ts → tooltip-surface-C2I9o2QM.d.ts} +1 -1
- package/dist/tooltip.d.ts +2 -2
- package/dist/tooltip.js +3 -3
- package/dist/tree.d.ts +5 -0
- package/dist/tree.js +5 -4
- package/dist/{types-6kvYwtRH.d.ts → types-DR9rAEy1.d.ts} +45 -13
- package/dist/{use-uploads-ButS4dGe.d.ts → use-uploads-KaPqDklo.d.ts} +9 -0
- package/dist/verification-code-input.js +8 -7
- package/package.json +12 -1
- package/dist/chunk-MFJP5FA7.js +0 -20
- package/dist/shared-BNXAdgh2.d.ts +0 -9
- package/dist/surface-DFyDnrTJ.d.ts +0 -34
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { DRAG_GHOST, DROP_LINE, DROP_LINE_Y, DROP_LINE_X, dragGhostProps, ghostPosition } from './chunk-5ZPUAGOP.js';
|
|
2
2
|
import { useAutoScroll, useDrag } from './chunk-P6CON2R2.js';
|
|
3
|
-
import { DropdownMenu } from './chunk-
|
|
4
|
-
import { Skeleton } from './chunk-
|
|
5
|
-
import {
|
|
6
|
-
import { ButtonUtility } from './chunk-
|
|
3
|
+
import { DropdownMenu } from './chunk-6B6BWTXC.js';
|
|
4
|
+
import { Skeleton } from './chunk-LLPWQDF7.js';
|
|
5
|
+
import { surfaceBox } from './chunk-45Y2ZGNK.js';
|
|
6
|
+
import { ButtonUtility } from './chunk-AZ7DKRBY.js';
|
|
7
7
|
import { Slot } from './chunk-52IFGFTL.js';
|
|
8
8
|
import { ChevronsRightIcon, ChevronRightIcon, ChevronDownIcon, GripVerticalIcon, ChevronsLeftIcon, EllipsisIcon, PlusIcon, LoaderCircleIcon, RotateCwIcon } from './chunk-BLIZ3CL3.js';
|
|
9
|
-
import { warnNeedsName, devWarn } from './chunk-QDYE5LVT.js';
|
|
10
9
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
10
|
+
import { useLabels, usePublishedLabels, LabelsContext } from './chunk-RJTVCA62.js';
|
|
11
|
+
import { warnNeedsName, devWarn } from './chunk-QDYE5LVT.js';
|
|
11
12
|
import * as React from 'react';
|
|
12
|
-
import {
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
14
|
|
|
14
15
|
// src/components/kanban-board/dnd.ts
|
|
15
16
|
function insertionIndex(y, rects) {
|
|
@@ -140,8 +141,50 @@ function keyIntent(event, state) {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
// src/components/kanban-board/labels.ts
|
|
145
|
+
var KANBAN_BOARD_LABELS = {
|
|
146
|
+
expandColumn: "Expand column",
|
|
147
|
+
collapseColumn: "Collapse column",
|
|
148
|
+
/** The per-column overflow menu's trigger tooltip. */
|
|
149
|
+
columnActions: "Column actions",
|
|
150
|
+
/** The fallback behind a column's own `emptyMessage`. */
|
|
151
|
+
emptyColumn: "Nothing here yet",
|
|
152
|
+
loadMore: "Load more",
|
|
153
|
+
loading: "Loading\u2026",
|
|
154
|
+
loadFailed: "Couldn't load \u2014 retry",
|
|
155
|
+
/* ── the keyboard drag's live region ───────────────────────────────── */
|
|
156
|
+
grabbed: (ctx) => `${ctx.label} grabbed. Use arrow keys to move, space to drop, escape to cancel.`,
|
|
157
|
+
/**
|
|
158
|
+
* The cursor's position, as a FRAGMENT composed into three other messages.
|
|
159
|
+
*
|
|
160
|
+
* It stays a separate key precisely because it is a fragment: a translation that reorders
|
|
161
|
+
* "lane, column, position N of M" cannot do so if the phrase is baked into its three callers.
|
|
162
|
+
* The ctx carries already-resolved display titles, never board internals.
|
|
163
|
+
*/
|
|
164
|
+
positionText: (ctx) => `${ctx.lane == null ? "" : `${ctx.lane}, `}${ctx.column}, position ${ctx.index} of ${ctx.total}`,
|
|
165
|
+
position: (ctx) => `${ctx.label}, ${ctx.position}.`,
|
|
166
|
+
dropped: (ctx) => `${ctx.label} dropped in ${ctx.position}.`,
|
|
167
|
+
cancelled: (ctx) => `Move cancelled. ${ctx.label} returned to ${ctx.column}.`,
|
|
168
|
+
/** The COLUMN reorder (Alt+←/→ on a header), announced through the same one status region. */
|
|
169
|
+
columnMoved: (ctx) => `${ctx.column} moved to position ${ctx.index} of ${ctx.total}.`,
|
|
170
|
+
/**
|
|
171
|
+
* Every card's `aria-describedby` — the longest single sentence the board speaks, and the last one
|
|
172
|
+
* still hard-coded. It hid in a module `const`, which is a shape no gate rule matches, behind a
|
|
173
|
+
* `sr-only` the line-scoped `sr-only` rule could not see across.
|
|
174
|
+
*/
|
|
175
|
+
grabHint: "Press space or enter to pick this card up, then use the arrow keys to move it.",
|
|
176
|
+
/**
|
|
177
|
+
* `aria-roledescription` — spoken IN PLACE OF the role, so an untranslated value leaves a screen
|
|
178
|
+
* reader with no fallback at all. Three of them, and the gate had no rule for the attribute.
|
|
179
|
+
*/
|
|
180
|
+
roleBoard: "board",
|
|
181
|
+
roleColumn: "draggable column",
|
|
182
|
+
roleCard: "draggable card"
|
|
183
|
+
};
|
|
184
|
+
|
|
143
185
|
// src/components/kanban-board/shared.ts
|
|
144
|
-
var
|
|
186
|
+
var COLUMN_WELL = surfaceBox("outlined", "none");
|
|
187
|
+
var CARD_WELL = surfaceBox("outlined", "sm");
|
|
145
188
|
var KANBAN_GEOMETRY = {
|
|
146
189
|
sm: {
|
|
147
190
|
column: "w-64",
|
|
@@ -173,12 +216,6 @@ var KANBAN_GEOMETRY = {
|
|
|
173
216
|
}
|
|
174
217
|
};
|
|
175
218
|
var COLUMN_BASE = "flex shrink-0 flex-col overflow-hidden rounded-xl";
|
|
176
|
-
var COLUMN_SURFACE = {
|
|
177
|
-
/* SPREAD, not three copied lines: every Card variant is a column surface by construction, and a
|
|
178
|
-
fourth one added to `lib/surface.ts` needs no edit here. */
|
|
179
|
-
...SURFACE_VARIANT,
|
|
180
|
-
plain: ""
|
|
181
|
-
};
|
|
182
219
|
var COLUMN_DISABLED = "opacity-60";
|
|
183
220
|
var HEADER_BASE = "flex shrink-0 items-center gap-2";
|
|
184
221
|
var HEADER_TITLE = "min-w-0 flex-1 truncate text-primary";
|
|
@@ -197,8 +234,8 @@ var CARD_GHOST = cn(DRAG_GHOST, "rotate-2");
|
|
|
197
234
|
var DROP_INDICATOR = cn(DROP_LINE, DROP_LINE_Y, "shrink-0 list-none");
|
|
198
235
|
var HEADER_DRAGGABLE = "cursor-grab outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2 active:cursor-grabbing";
|
|
199
236
|
var HEADER_GRIPPED = "outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2";
|
|
200
|
-
var COLUMN_PLACEHOLDER = "border-2 border-secondary border-dashed bg-transparent [&>*]:opacity-40";
|
|
201
|
-
var COLUMN_GHOST = cn(DRAG_GHOST, "flex rotate-1 items-center gap-2 rounded-xl",
|
|
237
|
+
var COLUMN_PLACEHOLDER = "border-2 border-secondary border-dashed bg-transparent ring-0 [&>*]:opacity-40";
|
|
238
|
+
var COLUMN_GHOST = cn(DRAG_GHOST, "flex rotate-1 items-center gap-2 rounded-xl", COLUMN_WELL);
|
|
202
239
|
var COLUMN_INDICATOR = cn(DROP_LINE, DROP_LINE_X, "-mx-px shrink-0 self-stretch");
|
|
203
240
|
var CARD_REFUSED = "cursor-not-allowed";
|
|
204
241
|
var CELL_EMPTY = "flex flex-1 items-center justify-center rounded-lg px-3 py-6 text-center text-sm text-tertiary";
|
|
@@ -214,7 +251,6 @@ var LANE_CELL_COLLAPSED = "min-h-9";
|
|
|
214
251
|
var LANE_TOGGLE = "-my-1 flex w-full cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-left outline-focus-ring hover:bg-ghost-hover focus-visible:outline-2";
|
|
215
252
|
var LOADING_CARDS = 3;
|
|
216
253
|
var ANNOUNCE_MS = 300;
|
|
217
|
-
var GRAB_HINT = "Press space or enter to pick this card up, then use the arrow keys to move it.";
|
|
218
254
|
var OWNED_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"]);
|
|
219
255
|
var DEFAULT_ROOT_MARGIN = 240;
|
|
220
256
|
var COLUMN_KEY_STATE = {
|
|
@@ -233,7 +269,9 @@ function resolveRootMargin(value) {
|
|
|
233
269
|
}
|
|
234
270
|
var columnLabel = (column) => column === void 0 ? "" : typeof column.title === "string" ? column.title : column.id;
|
|
235
271
|
function KanbanBoard(props) {
|
|
236
|
-
const { board, size = "md", height = "auto", handle = "card",
|
|
272
|
+
const { board, size = "md", height = "auto", handle = "card", bordered = true, loading = false, labels, className } = props;
|
|
273
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, labels);
|
|
274
|
+
const publishedLabels = usePublishedLabels("kanbanBoard", labels);
|
|
237
275
|
const ariaLabel = props["aria-label"];
|
|
238
276
|
const ariaLabelledBy = props["aria-labelledby"];
|
|
239
277
|
const geometry = KANBAN_GEOMETRY[size];
|
|
@@ -295,10 +333,14 @@ function KanbanBoard(props) {
|
|
|
295
333
|
const cell = board.layout[cursor.lane]?.cells[cursor.column];
|
|
296
334
|
const total = cell === void 0 ? 0 : cell.items.length;
|
|
297
335
|
const laneTitle = board.layout[cursor.lane]?.lane;
|
|
298
|
-
|
|
299
|
-
|
|
336
|
+
return t.positionText({
|
|
337
|
+
lane: laneTitle == null ? void 0 : columnLabel({ id: laneTitle.id, title: laneTitle.title }),
|
|
338
|
+
column: columnLabel(board.columns[cursor.column]),
|
|
339
|
+
index: cursor.index + 1,
|
|
340
|
+
total: Math.max(total, cursor.index + 1)
|
|
341
|
+
});
|
|
300
342
|
},
|
|
301
|
-
[board.columns, board.layout]
|
|
343
|
+
[board.columns, board.layout, t]
|
|
302
344
|
);
|
|
303
345
|
const dragNodeRef = React.useRef(null);
|
|
304
346
|
const autoScroll = useAutoScroll(dragNodeRef, {
|
|
@@ -463,15 +505,18 @@ function KanbanBoard(props) {
|
|
|
463
505
|
}),
|
|
464
506
|
[]
|
|
465
507
|
);
|
|
466
|
-
const moveColumnBy = React.useCallback(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
508
|
+
const moveColumnBy = React.useCallback(
|
|
509
|
+
(id, delta) => {
|
|
510
|
+
const live = boardRef.current;
|
|
511
|
+
const at = live.columns.findIndex((c) => c.id === id);
|
|
512
|
+
if (at === -1) return;
|
|
513
|
+
const candidate = { id, index: at + delta };
|
|
514
|
+
if (!live.canMoveColumn(candidate)) return;
|
|
515
|
+
live.moveColumn(candidate);
|
|
516
|
+
announceRef.current(t.columnMoved({ column: columnLabel(live.columns[at]), index: candidate.index + 1, total: live.columns.length }));
|
|
517
|
+
},
|
|
518
|
+
[t]
|
|
519
|
+
);
|
|
475
520
|
const draft = board.draft;
|
|
476
521
|
const onFocus = (event) => {
|
|
477
522
|
const card = event.target.closest("[data-kanban-card]");
|
|
@@ -531,7 +576,7 @@ function KanbanBoard(props) {
|
|
|
531
576
|
point: null,
|
|
532
577
|
kind: "keyboard"
|
|
533
578
|
});
|
|
534
|
-
announce(
|
|
579
|
+
announce(t.grabbed({ label }));
|
|
535
580
|
return;
|
|
536
581
|
}
|
|
537
582
|
case "draft": {
|
|
@@ -543,7 +588,7 @@ function KanbanBoard(props) {
|
|
|
543
588
|
const backHome = cell.column === draft.from.column && cell.lane === draft.from.lane && intent.cursor.index === draft.from.index;
|
|
544
589
|
if (!backHome && !board.canMove(candidate)) return;
|
|
545
590
|
board.setDraft({ ...draft, target: cell, index: intent.cursor.index });
|
|
546
|
-
announce(
|
|
591
|
+
announce(t.position({ label: draft.label, position: positionText(intent.cursor) }));
|
|
547
592
|
return;
|
|
548
593
|
}
|
|
549
594
|
case "drop": {
|
|
@@ -552,9 +597,9 @@ function KanbanBoard(props) {
|
|
|
552
597
|
const candidate = { id: draft.id, from: draft.from, to: { ...draft.target, index: draft.index } };
|
|
553
598
|
const committed = board.canMove(candidate);
|
|
554
599
|
if (committed) board.move(candidate);
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
);
|
|
600
|
+
const landing = { lane: laneIndexOf(board, draft.target.lane), column: columnIndexOf(board, draft.target.column), index: draft.index };
|
|
601
|
+
const origin2 = columnLabel(board.columns[columnIndexOf(board, draft.from.column)]);
|
|
602
|
+
announce(committed ? t.dropped({ label: draft.label, position: positionText(landing) }) : t.cancelled({ label: draft.label, column: origin2 }));
|
|
558
603
|
board.setGrabbed(null);
|
|
559
604
|
board.setDraft(null);
|
|
560
605
|
pendingFocus.current = draft.id;
|
|
@@ -564,7 +609,8 @@ function KanbanBoard(props) {
|
|
|
564
609
|
case "cancel": {
|
|
565
610
|
event.preventDefault();
|
|
566
611
|
if (grabbing) {
|
|
567
|
-
|
|
612
|
+
const origin2 = columnLabel(board.columns[columnIndexOf(board, draft.from.column)]);
|
|
613
|
+
announce(t.cancelled({ label: draft.label, column: origin2 }));
|
|
568
614
|
pendingFocus.current = draft.id;
|
|
569
615
|
setFocusedId(draft.id);
|
|
570
616
|
}
|
|
@@ -580,13 +626,13 @@ function KanbanBoard(props) {
|
|
|
580
626
|
}
|
|
581
627
|
}
|
|
582
628
|
};
|
|
583
|
-
return /* @__PURE__ */ jsxs(
|
|
629
|
+
return /* @__PURE__ */ jsx(LabelsContext.Provider, { value: publishedLabels, children: /* @__PURE__ */ jsxs(
|
|
584
630
|
"section",
|
|
585
631
|
{
|
|
586
632
|
ref: rootRef,
|
|
587
633
|
"aria-label": ariaLabel,
|
|
588
634
|
"aria-labelledby": ariaLabelledBy,
|
|
589
|
-
"aria-roledescription":
|
|
635
|
+
"aria-roledescription": t.roleBoard,
|
|
590
636
|
className: cn(
|
|
591
637
|
// The board is a SCROLLER, not a surface — no fill of its own, or it fights whatever page
|
|
592
638
|
// hosts it.
|
|
@@ -609,7 +655,7 @@ function KanbanBoard(props) {
|
|
|
609
655
|
LanedBoard,
|
|
610
656
|
{
|
|
611
657
|
board,
|
|
612
|
-
|
|
658
|
+
bordered,
|
|
613
659
|
columnDraft,
|
|
614
660
|
columnHandlersFor,
|
|
615
661
|
draft,
|
|
@@ -621,7 +667,6 @@ function KanbanBoard(props) {
|
|
|
621
667
|
onMoveColumn: moveColumnBy,
|
|
622
668
|
rootMargin,
|
|
623
669
|
scope,
|
|
624
|
-
surface,
|
|
625
670
|
tabStopId
|
|
626
671
|
}
|
|
627
672
|
) : board.layout.map(
|
|
@@ -635,7 +680,7 @@ function KanbanBoard(props) {
|
|
|
635
680
|
BoardColumn,
|
|
636
681
|
{
|
|
637
682
|
board,
|
|
638
|
-
|
|
683
|
+
bordered,
|
|
639
684
|
cell,
|
|
640
685
|
column,
|
|
641
686
|
columnDragging: columnDraft?.id === cell.column,
|
|
@@ -650,7 +695,6 @@ function KanbanBoard(props) {
|
|
|
650
695
|
loading,
|
|
651
696
|
onMoveColumn: moveColumnBy,
|
|
652
697
|
rootMargin,
|
|
653
|
-
surface,
|
|
654
698
|
tabStopId
|
|
655
699
|
}
|
|
656
700
|
),
|
|
@@ -660,11 +704,11 @@ function KanbanBoard(props) {
|
|
|
660
704
|
),
|
|
661
705
|
draft !== null && draft.point !== null ? /* @__PURE__ */ jsx("div", { ...dragGhostProps, className: cn(CARD_GHOST, geometry.column, geometry.cardPad), style: ghostPosition(draft.point, geometry.columnPx), children: /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium text-primary", children: draft.label }) }) : null,
|
|
662
706
|
columnDraft === null ? null : /* @__PURE__ */ jsx("div", { ...dragGhostProps, className: cn(COLUMN_GHOST, geometry.column, geometry.header), style: ghostPosition(columnDraft.point, geometry.columnPx), children: /* @__PURE__ */ jsx("p", { className: cn(HEADER_TITLE, geometry.title), children: columnLabel(board.columns.find((c) => c.id === columnDraft.id)) }) }),
|
|
663
|
-
/* @__PURE__ */ jsx("div", { className: "sr-only", id: `${scope}-hint`, children:
|
|
707
|
+
/* @__PURE__ */ jsx("div", { className: "sr-only", id: `${scope}-hint`, children: t.grabHint }),
|
|
664
708
|
/* @__PURE__ */ jsx("div", { "aria-live": "polite", className: "sr-only", role: "status", children: status })
|
|
665
709
|
]
|
|
666
710
|
}
|
|
667
|
-
);
|
|
711
|
+
) });
|
|
668
712
|
}
|
|
669
713
|
var columnIndexOf = (board, column) => board.columns.findIndex((c) => c.id === column);
|
|
670
714
|
var laneIndexOf = (board, lane) => lane === null ? 0 : Math.max(
|
|
@@ -680,7 +724,7 @@ function cardElement(root, id) {
|
|
|
680
724
|
}
|
|
681
725
|
function BoardColumn({
|
|
682
726
|
board,
|
|
683
|
-
|
|
727
|
+
bordered,
|
|
684
728
|
cell,
|
|
685
729
|
column,
|
|
686
730
|
columnDragging,
|
|
@@ -695,23 +739,16 @@ function BoardColumn({
|
|
|
695
739
|
loading,
|
|
696
740
|
onMoveColumn,
|
|
697
741
|
rootMargin,
|
|
698
|
-
surface,
|
|
699
742
|
tabStopId
|
|
700
743
|
}) {
|
|
744
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
701
745
|
const isCollapsed = board.collapsedColumns.has(cell.column);
|
|
702
746
|
if (isCollapsed) {
|
|
703
747
|
return /* @__PURE__ */ jsx(
|
|
704
748
|
"section",
|
|
705
749
|
{
|
|
706
750
|
"aria-labelledby": headerId,
|
|
707
|
-
className: cn(
|
|
708
|
-
COLUMN_BASE,
|
|
709
|
-
COLUMN_SURFACE.outlined,
|
|
710
|
-
geometry.rail,
|
|
711
|
-
column.disabled === true && COLUMN_DISABLED,
|
|
712
|
-
height === "fill" && "h-full",
|
|
713
|
-
column.className
|
|
714
|
-
),
|
|
751
|
+
className: cn(COLUMN_BASE, COLUMN_WELL, geometry.rail, column.disabled === true && COLUMN_DISABLED, height === "fill" && "h-full", column.className),
|
|
715
752
|
"data-kanban-column": cell.column,
|
|
716
753
|
children: /* @__PURE__ */ jsxs("div", { className: RAIL_BASE, "data-kanban-cell": cell.column, "data-kanban-lane": cell.lane ?? "", children: [
|
|
717
754
|
/* @__PURE__ */ jsxs(
|
|
@@ -723,7 +760,7 @@ function BoardColumn({
|
|
|
723
760
|
type: "button",
|
|
724
761
|
children: [
|
|
725
762
|
/* @__PURE__ */ jsx(ChevronsRightIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
726
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
763
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.expandColumn })
|
|
727
764
|
]
|
|
728
765
|
}
|
|
729
766
|
),
|
|
@@ -739,7 +776,7 @@ function BoardColumn({
|
|
|
739
776
|
"aria-labelledby": headerId,
|
|
740
777
|
className: cn(
|
|
741
778
|
COLUMN_BASE,
|
|
742
|
-
|
|
779
|
+
bordered && COLUMN_WELL,
|
|
743
780
|
geometry.column,
|
|
744
781
|
column.disabled === true && COLUMN_DISABLED,
|
|
745
782
|
height === "fill" && "h-full",
|
|
@@ -766,7 +803,6 @@ function BoardColumn({
|
|
|
766
803
|
CellList,
|
|
767
804
|
{
|
|
768
805
|
board,
|
|
769
|
-
cardSurface,
|
|
770
806
|
cell,
|
|
771
807
|
column,
|
|
772
808
|
draft,
|
|
@@ -785,7 +821,7 @@ function BoardColumn({
|
|
|
785
821
|
}
|
|
786
822
|
function LanedBoard({
|
|
787
823
|
board,
|
|
788
|
-
|
|
824
|
+
bordered,
|
|
789
825
|
columnDraft,
|
|
790
826
|
columnHandlersFor,
|
|
791
827
|
draft,
|
|
@@ -797,9 +833,9 @@ function LanedBoard({
|
|
|
797
833
|
onMoveColumn,
|
|
798
834
|
rootMargin,
|
|
799
835
|
scope,
|
|
800
|
-
surface,
|
|
801
836
|
tabStopId
|
|
802
837
|
}) {
|
|
838
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
803
839
|
const rawColumnIndex = columnDraft === null || columnDraft.index === null ? null : columnDraft.index >= columnDraft.fromIndex ? columnDraft.index + 1 : columnDraft.index;
|
|
804
840
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-max flex-col", geometry.strip), children: [
|
|
805
841
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-stretch", geometry.strip), children: [
|
|
@@ -814,7 +850,7 @@ function LanedBoard({
|
|
|
814
850
|
className: cn(
|
|
815
851
|
COLUMN_BASE,
|
|
816
852
|
/* A collapsed column is a rail, and a rail keeps its well under either member. */
|
|
817
|
-
isCollapsed ?
|
|
853
|
+
isCollapsed || bordered ? COLUMN_WELL : void 0,
|
|
818
854
|
isCollapsed ? geometry.rail : geometry.column,
|
|
819
855
|
column.disabled === true && COLUMN_DISABLED,
|
|
820
856
|
columnDraft?.id === column.id && COLUMN_PLACEHOLDER,
|
|
@@ -832,7 +868,7 @@ function LanedBoard({
|
|
|
832
868
|
type: "button",
|
|
833
869
|
children: [
|
|
834
870
|
/* @__PURE__ */ jsx(ChevronsRightIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
835
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
871
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.expandColumn })
|
|
836
872
|
]
|
|
837
873
|
}
|
|
838
874
|
),
|
|
@@ -895,7 +931,7 @@ function LanedBoard({
|
|
|
895
931
|
COLUMN_BASE,
|
|
896
932
|
/* The cells UNDER a collapsed column's rail follow the rail, so the folded column
|
|
897
933
|
reads as one continuous strip rather than a boxed head over naked stubs. */
|
|
898
|
-
isCollapsed ?
|
|
934
|
+
isCollapsed || bordered ? COLUMN_WELL : void 0,
|
|
899
935
|
isCollapsed ? geometry.rail : geometry.column,
|
|
900
936
|
laneCollapsed ? LANE_CELL_COLLAPSED : LANE_CELL_MIN,
|
|
901
937
|
column.disabled === true && COLUMN_DISABLED,
|
|
@@ -918,7 +954,6 @@ function LanedBoard({
|
|
|
918
954
|
CellList,
|
|
919
955
|
{
|
|
920
956
|
board,
|
|
921
|
-
cardSurface,
|
|
922
957
|
cell,
|
|
923
958
|
column,
|
|
924
959
|
draft,
|
|
@@ -949,12 +984,13 @@ function ColumnHeader({
|
|
|
949
984
|
headerId,
|
|
950
985
|
onMoveColumn
|
|
951
986
|
}) {
|
|
987
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
952
988
|
const collapsible = column.collapsible === true;
|
|
953
989
|
const grip = handle === "grip" && columnHandlers !== null;
|
|
954
990
|
return /* @__PURE__ */ jsxs(
|
|
955
991
|
"header",
|
|
956
992
|
{
|
|
957
|
-
"aria-roledescription": columnHandlers === null ? void 0 :
|
|
993
|
+
"aria-roledescription": columnHandlers === null ? void 0 : t.roleColumn,
|
|
958
994
|
className: cn(HEADER_BASE, geometry.header, columnHandlers !== null && (grip ? HEADER_GRIPPED : HEADER_DRAGGABLE)),
|
|
959
995
|
onKeyDown: columnHandlers === null ? void 0 : (event) => {
|
|
960
996
|
const intent = keyIntent(event, COLUMN_KEY_STATE);
|
|
@@ -986,14 +1022,14 @@ function ColumnHeader({
|
|
|
986
1022
|
type: "button",
|
|
987
1023
|
children: [
|
|
988
1024
|
/* @__PURE__ */ jsx(ChevronsLeftIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
989
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1025
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.collapseColumn })
|
|
990
1026
|
]
|
|
991
1027
|
}
|
|
992
1028
|
) : null,
|
|
993
1029
|
column.leading == null ? null : /* @__PURE__ */ jsx(Slot, { className: "text-fg-quaternary [&>svg]:size-4", children: column.leading }),
|
|
994
1030
|
/* @__PURE__ */ jsx("h3", { className: cn(HEADER_TITLE, geometry.title), id: headerId, children: column.title }),
|
|
995
1031
|
column.trailing == null ? null : /* @__PURE__ */ jsx(Slot, { className: HEADER_TRAILING, children: column.trailing }),
|
|
996
|
-
column.actions?.menu === void 0 ? null : /* @__PURE__ */ jsx(DropdownMenu, { items: column.actions.menu, trigger: /* @__PURE__ */ jsx(ButtonUtility, { icon: /* @__PURE__ */ jsx(EllipsisIcon, {}), size: "xs", tooltip:
|
|
1032
|
+
column.actions?.menu === void 0 ? null : /* @__PURE__ */ jsx(DropdownMenu, { items: column.actions.menu, trigger: /* @__PURE__ */ jsx(ButtonUtility, { icon: /* @__PURE__ */ jsx(EllipsisIcon, {}), size: "xs", tooltip: t.columnActions, variant: "tertiary" }) }),
|
|
997
1033
|
column.actions?.add === void 0 ? null : /* @__PURE__ */ jsx(
|
|
998
1034
|
ButtonUtility,
|
|
999
1035
|
{
|
|
@@ -1010,7 +1046,6 @@ function ColumnHeader({
|
|
|
1010
1046
|
}
|
|
1011
1047
|
function CellList({
|
|
1012
1048
|
board,
|
|
1013
|
-
cardSurface,
|
|
1014
1049
|
cell,
|
|
1015
1050
|
column,
|
|
1016
1051
|
draft,
|
|
@@ -1022,6 +1057,7 @@ function CellList({
|
|
|
1022
1057
|
rootMargin,
|
|
1023
1058
|
tabStopId
|
|
1024
1059
|
}) {
|
|
1060
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
1025
1061
|
const indicatorAt = draft === null || draft.index === null || draft.target === null || draft.target.column !== cell.column || draft.target.lane !== cell.lane ? null : draft.from.column === cell.column && draft.from.lane === cell.lane && draft.index >= draft.from.index ? draft.index + 1 : draft.index;
|
|
1026
1062
|
return /* @__PURE__ */ jsxs(
|
|
1027
1063
|
"ul",
|
|
@@ -1032,9 +1068,9 @@ function CellList({
|
|
|
1032
1068
|
"data-kanban-lane": cell.lane ?? "",
|
|
1033
1069
|
role: "list",
|
|
1034
1070
|
children: [
|
|
1035
|
-
loading ? /* @__PURE__ */ jsx(LoadingCards, {
|
|
1071
|
+
loading ? /* @__PURE__ */ jsx(LoadingCards, { geometry }) : cell.items.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1036
1072
|
indicatorAt === 0 ? /* @__PURE__ */ jsx("li", { "aria-hidden": "true", className: cn(DROP_INDICATOR, geometry.cardIndicator) }) : null,
|
|
1037
|
-
/* @__PURE__ */ jsx("li", { className: CELL_EMPTY, children: column.emptyMessage ??
|
|
1073
|
+
/* @__PURE__ */ jsx("li", { className: CELL_EMPTY, children: column.emptyMessage ?? t.emptyColumn })
|
|
1038
1074
|
] }) : cell.items.map((item, index) => {
|
|
1039
1075
|
const id = board.getItemId(item);
|
|
1040
1076
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
@@ -1043,7 +1079,6 @@ function CellList({
|
|
|
1043
1079
|
BoardCard,
|
|
1044
1080
|
{
|
|
1045
1081
|
board,
|
|
1046
|
-
cardSurface,
|
|
1047
1082
|
disabled: column.disabled === true || board.isDisabled(item),
|
|
1048
1083
|
dragHandlers,
|
|
1049
1084
|
dragging: draft !== null && draft.kind === "pointer" && draft.id === id,
|
|
@@ -1066,7 +1101,6 @@ function CellList({
|
|
|
1066
1101
|
}
|
|
1067
1102
|
function BoardCard({
|
|
1068
1103
|
board,
|
|
1069
|
-
cardSurface,
|
|
1070
1104
|
disabled,
|
|
1071
1105
|
dragHandlers,
|
|
1072
1106
|
dragging,
|
|
@@ -1078,16 +1112,17 @@ function BoardCard({
|
|
|
1078
1112
|
item,
|
|
1079
1113
|
refused
|
|
1080
1114
|
}) {
|
|
1115
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
1081
1116
|
const grabbed = board.grabbed === id;
|
|
1082
1117
|
const grip = handle === "grip" && !disabled;
|
|
1083
1118
|
return /* @__PURE__ */ jsxs(
|
|
1084
1119
|
"li",
|
|
1085
1120
|
{
|
|
1086
1121
|
"aria-describedby": isTabStop && !disabled ? hintId : void 0,
|
|
1087
|
-
"aria-roledescription":
|
|
1122
|
+
"aria-roledescription": t.roleCard,
|
|
1088
1123
|
className: cn(
|
|
1089
1124
|
CARD_BASE,
|
|
1090
|
-
|
|
1125
|
+
CARD_WELL,
|
|
1091
1126
|
geometry.cardPad,
|
|
1092
1127
|
// The gap is the grip's gutter and nothing else's — a `card`-mode shell must not add one
|
|
1093
1128
|
// between a caller's own children, which is what a blanket `gap` on the flex box would do.
|
|
@@ -1121,6 +1156,7 @@ function BoardCard({
|
|
|
1121
1156
|
);
|
|
1122
1157
|
}
|
|
1123
1158
|
function CellLoader({ board, cell, dragging, rootMargin }) {
|
|
1159
|
+
const t = useLabels("kanbanBoard", KANBAN_BOARD_LABELS, void 0);
|
|
1124
1160
|
const key = board.cellKey(cell);
|
|
1125
1161
|
const isPending = board.pending.has(key);
|
|
1126
1162
|
const isFailed = board.failed.has(key);
|
|
@@ -1152,16 +1188,16 @@ function CellLoader({ board, cell, dragging, rootMargin }) {
|
|
|
1152
1188
|
type: "button",
|
|
1153
1189
|
children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1154
1190
|
/* @__PURE__ */ jsx(LoaderCircleIcon, { "aria-hidden": "true", className: "size-4 animate-spin" }),
|
|
1155
|
-
|
|
1191
|
+
t.loading
|
|
1156
1192
|
] }) : isFailed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1157
1193
|
/* @__PURE__ */ jsx(RotateCwIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
1158
|
-
|
|
1159
|
-
] }) :
|
|
1194
|
+
t.loadFailed
|
|
1195
|
+
] }) : t.loadMore
|
|
1160
1196
|
}
|
|
1161
1197
|
) });
|
|
1162
1198
|
}
|
|
1163
|
-
function LoadingCards({
|
|
1164
|
-
return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: LOADING_CARDS }, (_, i) => /* @__PURE__ */ jsxs("li", { "aria-hidden": "true", className: cn(CARD_BASE,
|
|
1199
|
+
function LoadingCards({ geometry }) {
|
|
1200
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: LOADING_CARDS }, (_, i) => /* @__PURE__ */ jsxs("li", { "aria-hidden": "true", className: cn(CARD_BASE, CARD_WELL, geometry.cardPad, "cursor-default gap-2"), children: [
|
|
1165
1201
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" }),
|
|
1166
1202
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-1/2" })
|
|
1167
1203
|
] }, i)) });
|
|
@@ -1470,5 +1506,5 @@ function useKanban(options) {
|
|
|
1470
1506
|
}
|
|
1471
1507
|
|
|
1472
1508
|
export { KanbanBoard, cellKey, useKanban };
|
|
1473
|
-
//# sourceMappingURL=chunk-
|
|
1474
|
-
//# sourceMappingURL=chunk-
|
|
1509
|
+
//# sourceMappingURL=chunk-4VGEJG4M.js.map
|
|
1510
|
+
//# sourceMappingURL=chunk-4VGEJG4M.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ACCENT, DISMISS, SOLID, OUTLINE, SUBTLE } from './chunk-
|
|
1
|
+
import { ACCENT, DISMISS, SOLID, OUTLINE, SUBTLE } from './chunk-MCQG4H6T.js';
|
|
2
2
|
import { overflowClasses, overflowBounded } from './chunk-DWKILXHE.js';
|
|
3
|
-
import { SEAMLESS_COLOR, SEAMLESS_CHIP_PX, SEAMLESS_CHIP_NUM, SEAMLESS_CHIP } from './chunk-
|
|
3
|
+
import { SEAMLESS_COLOR, SEAMLESS_CHIP_PX, SEAMLESS_CHIP_NUM, SEAMLESS_CHIP } from './chunk-7ZM7SNCZ.js';
|
|
4
4
|
import { Slot } from './chunk-52IFGFTL.js';
|
|
5
5
|
import { ArrowRightIcon, XIcon } from './chunk-BLIZ3CL3.js';
|
|
6
|
-
import { devWarn } from './chunk-QDYE5LVT.js';
|
|
7
6
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
+
import { useLabels } from './chunk-RJTVCA62.js';
|
|
8
|
+
import { devWarn } from './chunk-QDYE5LVT.js';
|
|
8
9
|
import 'react';
|
|
9
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -101,6 +102,11 @@ function BadgeGroup(props) {
|
|
|
101
102
|
iconNode
|
|
102
103
|
] });
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
// src/components/badge/labels.ts
|
|
107
|
+
var BADGE_LABELS = {
|
|
108
|
+
dismiss: "Dismiss"
|
|
109
|
+
};
|
|
104
110
|
var BASE = "inline-flex items-center justify-center align-middle select-none font-medium";
|
|
105
111
|
function shapeClasses(shape, size) {
|
|
106
112
|
if (shape === "pill") return "rounded-full";
|
|
@@ -178,11 +184,13 @@ function Badge(props) {
|
|
|
178
184
|
overflow = "visible",
|
|
179
185
|
seamless = false,
|
|
180
186
|
onDismiss,
|
|
181
|
-
dismissLabel
|
|
187
|
+
dismissLabel,
|
|
188
|
+
labels,
|
|
182
189
|
className,
|
|
183
190
|
children,
|
|
184
191
|
...rest
|
|
185
192
|
} = props;
|
|
193
|
+
const t = useLabels("badge", BADGE_LABELS, labels);
|
|
186
194
|
if (seamless && (props.color !== void 0 || props.variant !== void 0)) {
|
|
187
195
|
devWarn("<Badge seamless> takes its color from the host \u2014 `color`/`variant` are ignored.");
|
|
188
196
|
}
|
|
@@ -219,7 +227,7 @@ function Badge(props) {
|
|
|
219
227
|
"button",
|
|
220
228
|
{
|
|
221
229
|
type: "button",
|
|
222
|
-
"aria-label": dismissLabel,
|
|
230
|
+
"aria-label": dismissLabel ?? t.dismiss,
|
|
223
231
|
onClick: onDismiss,
|
|
224
232
|
className: cn(
|
|
225
233
|
"inline-flex shrink-0 cursor-pointer items-center justify-center p-0.5",
|
|
@@ -239,5 +247,5 @@ function Badge(props) {
|
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
export { Badge, BadgeGroup };
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
250
|
+
//# sourceMappingURL=chunk-54SIZR63.js.map
|
|
251
|
+
//# sourceMappingURL=chunk-54SIZR63.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/lib/link.tsx
|
|
6
|
+
var LinkContext = React.createContext(void 0);
|
|
7
|
+
if (process.env.NODE_ENV !== "production") LinkContext.displayName = "JenosizeUILinkContext";
|
|
8
|
+
var plainAnchor = (href) => /* @__PURE__ */ jsx("a", { href });
|
|
9
|
+
var NOT_A_ROUTE = /^([a-z][a-z\d+.-]*:|\/\/|\\\\|#)/i;
|
|
10
|
+
function routerOwns(href, options) {
|
|
11
|
+
if (options?.target != null && options.target !== "_self") return false;
|
|
12
|
+
return !NOT_A_ROUTE.test(href.trim());
|
|
13
|
+
}
|
|
14
|
+
function useLinkResolver() {
|
|
15
|
+
const Link = React.useContext(LinkContext);
|
|
16
|
+
return React.useMemo(
|
|
17
|
+
/* `!href`, not `href == null` — an EMPTY string is not a destination either. It was the one
|
|
18
|
+
* question this layer exists to centralise that four call sites still answered for themselves,
|
|
19
|
+
* and they disagreed: `href: ""` was a `<button>` in a Callout, a non-interactive lockup in a
|
|
20
|
+
* header, and an `<a href="">` — a link that silently reloads the current page — in a sidebar
|
|
21
|
+
* brand, every nav row and every crumb. Answering it here means a caller can pass `href`
|
|
22
|
+
* straight through and get one behaviour. */
|
|
23
|
+
() => (href, options) => href ? Link && routerOwns(href, options) ? React.createElement(Link, { href }) : plainAnchor(href) : void 0,
|
|
24
|
+
[Link]
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function useLinkElement(href, options) {
|
|
28
|
+
return useLinkResolver()(href, options);
|
|
29
|
+
}
|
|
30
|
+
function LinkOrButton({ render, className, ariaCurrent, ariaLabel, onClick, children }) {
|
|
31
|
+
return useRender({
|
|
32
|
+
defaultTagName: "button",
|
|
33
|
+
render,
|
|
34
|
+
props: {
|
|
35
|
+
className,
|
|
36
|
+
"aria-current": ariaCurrent ? "page" : void 0,
|
|
37
|
+
"aria-label": ariaLabel,
|
|
38
|
+
onClick,
|
|
39
|
+
children,
|
|
40
|
+
// `type` belongs only on the default <button> form — putting it in the shared object would
|
|
41
|
+
// leak a bogus attribute onto an <a> or a router <Link>. (Breadcrumb's Crumb, verbatim.)
|
|
42
|
+
...render == null && { type: "button" }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { LinkContext, LinkOrButton, useLinkElement, useLinkResolver };
|
|
48
|
+
//# sourceMappingURL=chunk-5AZKP4KZ.js.map
|
|
49
|
+
//# sourceMappingURL=chunk-5AZKP4KZ.js.map
|