@olundot/ui 0.23.0 → 0.23.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @olundot/ui
2
2
 
3
+ ## 0.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e2448e1: `BulkActionBar`의 작업 줄이 맨 앞 작업만 남겨도 카드에 들어가지 않을 때, 이동 버튼이 보이면 키 표시를 먼저 숨긴다. 그래도 넘치면 맨 앞 작업도 더보기 메뉴로 옮긴다. 375px 폭에서 이동 버튼이 카드 왼쪽 밖으로 나가던 문제를 고친다. 키 표시를 숨겨도 라벨, 접근 이름, `aria-keyshortcuts`는 그대로다. 이동 버튼이 보이지 않을 때는 기존처럼 맨 앞 작업 하나를 남긴다.
8
+
3
9
  ## 0.23.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1396,7 +1396,8 @@ interface BulkActionBarProps extends BulkActionBarBaseProps {
1396
1396
  * with the clear (✕) button on its right, `summary` under it at full width, then
1397
1397
  * one line of outline sm Buttons: the move button back to the list at the left (shown
1398
1398
  * only while keyboard focus is in the card), the actions at the right. A line that does
1399
- * not fit folds actions into a ⋯ menu from the end. `variant: "destructive"` is outline danger. The card is
1399
+ * not fit folds actions into a ⋯ menu from the end, then hides the move button's key caps, then
1400
+ * folds the first action too. `variant: "destructive"` is outline danger. The card is
1400
1401
  * min(360px, its slot − 32px) wide; while it is near the viewport bottom the document root
1401
1402
  * carries `--olun-bulk-bar-offset` (viewport bottom → card top) for toasts to clear it.
1402
1403
  * The card is a named region around a toolbar; DOM order is count → move → actions → ⋯ → ✕.
package/dist/index.js CHANGED
@@ -9798,6 +9798,7 @@ var visuallyHiddenStyle = {
9798
9798
  function MoveButton({
9799
9799
  mac,
9800
9800
  shown,
9801
+ keys,
9801
9802
  onMove
9802
9803
  }) {
9803
9804
  return /* @__PURE__ */ jsxs36(
@@ -9805,7 +9806,11 @@ function MoveButton({
9805
9806
  {
9806
9807
  appearance: "outline",
9807
9808
  size: "sm",
9808
- className: "mr-auto shrink-0 pr-[var(--space-2)] before:-inset-y-[5px] [@media(hover:none)_and_(pointer:coarse)]:hidden",
9809
+ className: cn(
9810
+ "mr-auto shrink-0",
9811
+ keys && "pr-[var(--space-2)]",
9812
+ "before:-inset-y-[5px] [@media(hover:none)_and_(pointer:coarse)]:hidden"
9813
+ ),
9809
9814
  style: shown ? void 0 : visuallyHiddenStyle,
9810
9815
  "data-slot": "bulk-action-bar-move",
9811
9816
  "data-hidden": shown ? void 0 : "",
@@ -9814,23 +9819,32 @@ function MoveButton({
9814
9819
  onClick: onMove,
9815
9820
  children: [
9816
9821
  /* @__PURE__ */ jsx40("span", { "data-slot": "bulk-action-bar-move-label", children: TO_LIST_LABEL }),
9817
- /* @__PURE__ */ jsxs36("span", { "aria-hidden": "true", "data-slot": "bulk-action-bar-keys", style: { display: "inline-flex", gap: "var(--space-1)" }, children: [
9818
- /* @__PURE__ */ jsx40("kbd", { style: keyCapStyle, children: mac ? "\u2303" : "Ctrl" }),
9819
- /* @__PURE__ */ jsx40("kbd", { style: keyCapStyle, children: "." })
9820
- ] })
9822
+ /* @__PURE__ */ jsxs36(
9823
+ "span",
9824
+ {
9825
+ "aria-hidden": "true",
9826
+ "data-slot": "bulk-action-bar-keys",
9827
+ style: { display: "inline-flex", gap: "var(--space-1)", ...keys ? void 0 : foldedStyle },
9828
+ children: [
9829
+ /* @__PURE__ */ jsx40("kbd", { style: keyCapStyle, children: mac ? "\u2303" : "Ctrl" }),
9830
+ /* @__PURE__ */ jsx40("kbd", { style: keyCapStyle, children: "." })
9831
+ ]
9832
+ }
9833
+ )
9821
9834
  ]
9822
9835
  }
9823
9836
  );
9824
9837
  }
9825
- var sameFold = (a, b) => a !== null && a.folded === b.folded && a.texts.join("\n") === b.texts.join("\n");
9838
+ var sameFold = (a, b) => a !== null && a.folded === b.folded && a.keys === b.keys && a.texts.join("\n") === b.texts.join("\n");
9826
9839
  var ROW_GAP = 8;
9827
9840
  var MORE_WIDTH = 30;
9828
9841
  var MOVE_EDGES = 2 + 12 + 6 + 8;
9842
+ var MOVE_EDGES_NO_KEYS = 2 + 12 + 12;
9829
9843
  function measureFold(row, actionCount) {
9830
9844
  const buttons = Array.from(row.querySelectorAll('[data-slot="bulk-action-bar-action"]'));
9831
9845
  const texts = buttons.map((node) => node.textContent ?? "");
9832
9846
  const available = row.clientWidth;
9833
- if (available === 0) return { folded: 0, texts };
9847
+ if (available === 0) return { folded: 0, keys: true, texts };
9834
9848
  const scale = row.getBoundingClientRect().width / available || 1;
9835
9849
  const width = (node) => (node?.getBoundingClientRect().width ?? 0) / scale;
9836
9850
  const move = row.querySelector('[data-slot="bulk-action-bar-move"]');
@@ -9838,15 +9852,17 @@ function measureFold(row, actionCount) {
9838
9852
  const label = hasMove ? width(row.querySelector('[data-slot="bulk-action-bar-move-label"]')) : 0;
9839
9853
  const keys = hasMove ? width(row.querySelector('[data-slot="bulk-action-bar-keys"]')) : 0;
9840
9854
  const actions = buttons.map(width);
9841
- const need = (folded2) => {
9855
+ const fits = (folded2, withKeys) => {
9842
9856
  const items = actions.slice(0, actionCount - folded2);
9843
- if (hasMove) items.unshift(keys + label + MOVE_EDGES);
9857
+ if (hasMove) items.unshift(withKeys ? keys + label + MOVE_EDGES : label + MOVE_EDGES_NO_KEYS);
9844
9858
  if (folded2 > 0) items.push(MORE_WIDTH);
9845
- return items.reduce((sum, item) => sum + item, 0) + ROW_GAP * Math.max(0, items.length - 1);
9859
+ return items.reduce((sum, item) => sum + item, 0) + ROW_GAP * Math.max(0, items.length - 1) <= available + 0.5;
9846
9860
  };
9847
9861
  let folded = 0;
9848
- while (folded < actionCount - 1 && need(folded) > available + 0.5) folded += 1;
9849
- return { folded, texts };
9862
+ while (folded < actionCount - 1 && !fits(folded, true)) folded += 1;
9863
+ if (!hasMove || fits(folded, true)) return { folded, keys: true, texts };
9864
+ while (folded < actionCount && !fits(folded, false)) folded += 1;
9865
+ return { folded, keys: false, texts };
9850
9866
  }
9851
9867
  var CLEAR_CLEARANCE = 32;
9852
9868
  var IDLE_HEIGHT = 40;
@@ -10037,7 +10053,7 @@ function BulkActionBar({
10037
10053
  activeRef.current = active;
10038
10054
  scopePropRef.current = shortcutScope;
10039
10055
  menuOpenRef.current = menuOpen;
10040
- menuKeysRef.current = actions.slice(actions.length - Math.min(fold?.folded ?? 0, Math.max(0, actions.length - 1))).map((action) => action.key);
10056
+ menuKeysRef.current = actions.slice(actions.length - Math.min(fold?.folded ?? 0, actions.length)).map((action) => action.key);
10041
10057
  });
10042
10058
  const toBar = React38.useCallback(() => {
10043
10059
  const node = cardRef.current;
@@ -10210,7 +10226,8 @@ function BulkActionBar({
10210
10226
  moreLostFocusRef.current = false;
10211
10227
  if (!focused || focused === document.body) {
10212
10228
  const shown = (button) => !button.disabled && !button.hasAttribute("data-folded");
10213
- const back = buttons.find((button, i) => actions[i]?.key === foldedFocusRef.current && shown(button)) ?? buttons.find(shown);
10229
+ const move = row.querySelector('[data-slot="bulk-action-bar-move"]');
10230
+ const back = buttons.find((button, i) => actions[i]?.key === foldedFocusRef.current && shown(button)) ?? buttons.find(shown) ?? (move && !move.hasAttribute("data-hidden") && isShown(move) ? move : null) ?? clearRef.current;
10214
10231
  back?.focus();
10215
10232
  }
10216
10233
  foldedFocusRef.current = null;
@@ -10300,7 +10317,7 @@ function BulkActionBar({
10300
10317
  }
10301
10318
  ) : null;
10302
10319
  const showMove = active;
10303
- const folded = Math.min(fold?.folded ?? 0, Math.max(0, actions.length - 1));
10320
+ const folded = Math.min(fold?.folded ?? 0, actions.length);
10304
10321
  const shownCount = actions.length - folded;
10305
10322
  const menuItems = actions.slice(shownCount).map((action, i) => ({
10306
10323
  id: action.key,
@@ -10373,7 +10390,7 @@ function BulkActionBar({
10373
10390
  marginTop: "var(--space-3)"
10374
10391
  },
10375
10392
  children: [
10376
- showMove ? /* @__PURE__ */ jsx40(MoveButton, { mac, shown: keyboardIn, onMove: toList }) : null,
10393
+ showMove ? /* @__PURE__ */ jsx40(MoveButton, { mac, shown: keyboardIn, keys: fold?.keys ?? true, onMove: toList }) : null,
10377
10394
  actions.map((action, index) => /* @__PURE__ */ jsx40(CardActionButton, { action, folded: index >= shownCount }, action.key)),
10378
10395
  folded > 0 ? /* @__PURE__ */ jsx40(
10379
10396
  ActionMenu,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olundot/ui",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "OLUN. shared React UI components built on OLUN design tokens",
5
5
  "license": "MIT",
6
6
  "keywords": [