@jirawatpyk/aura-react 5.27.0 → 5.28.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.
package/dist/esm/Tag.js CHANGED
@@ -1,16 +1,20 @@
1
1
  'use client';
2
2
  import * as React from "react";
3
3
  import { Icon } from "./Icon.js";
4
- import { cx, devWarnOnce, omit } from "./internal.js";
4
+ import { cx, devWarnOnce, omit, useIsoLayoutEffect } from "./internal.js";
5
+ import { Tooltip } from "./Tooltip.js";
5
6
  import { useStrings } from "./locale.js";
6
7
  import { IconCheck, IconX } from "./icons.js";
7
- function textOf(node) {
8
+ function textOf(node, all) {
8
9
  if (node == null || typeof node === "boolean") return "";
9
10
  if (typeof node === "string" || typeof node === "number") return String(node);
10
- if (Array.isArray(node)) return node.map(textOf).join("");
11
+ if (Array.isArray(node))
12
+ return node.map(function(n) {
13
+ return textOf(n, all);
14
+ }).join("");
11
15
  if (React.isValidElement(node)) {
12
16
  const p = node.props;
13
- return p["aria-hidden"] === true || p["aria-hidden"] === "true" ? "" : textOf(p.children);
17
+ return !all && (p["aria-hidden"] === true || p["aria-hidden"] === "true") ? "" : textOf(p.children, all);
14
18
  }
15
19
  return "";
16
20
  }
@@ -27,9 +31,29 @@ const Tag = React.forwardRef(function Tag2(props, ref) {
27
31
  "removeLabel",
28
32
  "touchHeight"
29
33
  ]);
34
+ const textRef = React.useRef(null);
35
+ const cutState = React.useState(false), isCut = cutState[0];
36
+ const check = React.useCallback(function() {
37
+ const el = textRef.current;
38
+ if (el) cutState[1](el.scrollWidth > el.clientWidth + 1);
39
+ }, []);
40
+ useIsoLayoutEffect(check);
41
+ useIsoLayoutEffect(
42
+ function() {
43
+ const el = textRef.current;
44
+ if (!el || typeof ResizeObserver === "undefined") return;
45
+ const ro = new ResizeObserver(check);
46
+ ro.observe(el);
47
+ return function() {
48
+ ro.disconnect();
49
+ };
50
+ },
51
+ [check]
52
+ );
53
+ const fullText = isCut ? textOf(props.children, true).replace(/\s+/g, " ").trim() : "";
30
54
  const inner = [
31
55
  props.icon ? /* @__PURE__ */ React.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
32
- /* @__PURE__ */ React.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
56
+ /* @__PURE__ */ React.createElement("span", { key: "t", ref: textRef, className: "aura-tag__text", title: fullText || void 0 }, props.children)
33
57
  ];
34
58
  if (selectable) {
35
59
  return /* @__PURE__ */ React.createElement(
@@ -57,16 +81,19 @@ const Tag = React.forwardRef(function Tag2(props, ref) {
57
81
  "tag-remove-label",
58
82
  'Tag: the remove button has no name \u2014 its children have no text. Pass removeLabel (e.g. "Remove Acme AB").'
59
83
  );
60
- return /* @__PURE__ */ React.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React.createElement(
61
- "button",
62
- {
63
- type: "button",
64
- className: "aura-tag__remove",
65
- "aria-label": props.removeLabel || t.remove(name),
66
- onClick: props.onRemove
67
- },
68
- /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null), size: 12 })
69
- ) : null);
84
+ return /* @__PURE__ */ React.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? function() {
85
+ const btn = /* @__PURE__ */ React.createElement(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ className: "aura-tag__remove",
90
+ "aria-label": props.removeLabel || t.remove(name),
91
+ onClick: props.onRemove
92
+ },
93
+ /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null), size: 12 })
94
+ );
95
+ return /* @__PURE__ */ React.createElement(Tooltip, { content: fullText, open: fullText ? void 0 : false }, btn);
96
+ }() : null);
70
97
  });
71
98
  export {
72
99
  Tag
package/dist/index.d.cts CHANGED
@@ -437,6 +437,8 @@ export interface FormErrorSummaryProps {
437
437
  /** An applied filter, shown as a removable chip. */
438
438
  export interface ActiveFilter {
439
439
  id: string;
440
+ /** The chip's text, "{filter}: {value}". It takes its own width in the chips row; only a chip wider than the row is
441
+ * cut, and then its full text shows on hover and on the remove button's focus (5.28). */
440
442
  label: React$1.ReactNode;
441
443
  onRemove: () => void;
442
444
  }
package/dist/index.d.ts CHANGED
@@ -437,6 +437,8 @@ export interface FormErrorSummaryProps {
437
437
  /** An applied filter, shown as a removable chip. */
438
438
  export interface ActiveFilter {
439
439
  id: string;
440
+ /** The chip's text, "{filter}: {value}". It takes its own width in the chips row; only a chip wider than the row is
441
+ * cut, and then its full text shows on hover and on the remove button's focus (5.28). */
440
442
  label: React$1.ReactNode;
441
443
  onRemove: () => void;
442
444
  }
package/dist/styles.css CHANGED
@@ -321,6 +321,7 @@ a.aura-icon-btn { text-decoration: none; }
321
321
  .aura-btn.aura-btn--touch.aura-btn--full { height: auto; min-height: var(--aura-touch-target); }
322
322
  .aura-icon-btn.aura-icon-btn--touch { width: var(--aura-touch-target); height: var(--aura-touch-target); }
323
323
  .aura-tag.aura-tag--touch { min-height: var(--aura-touch-target); }
324
+ .aura-filterbar__clear { min-height: var(--aura-touch-target); } /* 5.28 (Chamber-OS 133) */
324
325
  }
325
326
  /* Touch: same 32px look, a 44px hit area around it (WCAG 2.5.5). */
326
327
  @media (pointer: coarse) {
@@ -1503,6 +1504,12 @@ button.aura-stepper__step:hover .aura-stepper__label { text-decoration: underlin
1503
1504
  .aura-filterbar__count { font-size: 13px; color: var(--aura-fg-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
1504
1505
  .aura-filterbar__actions { display: flex; align-items: center; gap: var(--aura-space-2); }
1505
1506
  .aura-filterbar__chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--aura-space-2); }
1507
+ /* 5.28 (Chamber-OS 132): an applied-filter chip takes its text's width, cut only when it is wider than the row. */
1508
+ .aura-filterbar__chips > .aura-tag { max-width: 100%; min-width: 0; }
1509
+ /* A long chip mustn't widen the bar or anything around it: the row's width comes from the bar, never from its chips.
1510
+ * (So a FilterBar with only chips needs a width from its parent — it is full width in a block.) */
1511
+ .aura-filterbar__chips { contain: inline-size; }
1512
+ .aura-filterbar__chips > .aura-tag .aura-tag__text { max-width: none; min-width: 0; }
1506
1513
  .aura-filterbar__clear {
1507
1514
  border: 0; background: transparent; padding: 4px var(--aura-space-2); border-radius: var(--aura-radius-sm);
1508
1515
  font: inherit; font-size: 13px; font-weight: 500; color: var(--aura-fg-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
@@ -323,6 +323,7 @@ a.aura-icon-btn { text-decoration: none; }
323
323
  .aura-btn.aura-btn--touch.aura-btn--full { height: auto; min-height: var(--aura-touch-target); }
324
324
  .aura-icon-btn.aura-icon-btn--touch { width: var(--aura-touch-target); height: var(--aura-touch-target); }
325
325
  .aura-tag.aura-tag--touch { min-height: var(--aura-touch-target); }
326
+ .aura-filterbar__clear { min-height: var(--aura-touch-target); } /* 5.28 (Chamber-OS 133) */
326
327
  }
327
328
  /* Touch: same 32px look, a 44px hit area around it (WCAG 2.5.5). */
328
329
  @media (pointer: coarse) {
@@ -1505,6 +1506,12 @@ button.aura-stepper__step:hover .aura-stepper__label { text-decoration: underlin
1505
1506
  .aura-filterbar__count { font-size: 13px; color: var(--aura-fg-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
1506
1507
  .aura-filterbar__actions { display: flex; align-items: center; gap: var(--aura-space-2); }
1507
1508
  .aura-filterbar__chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--aura-space-2); }
1509
+ /* 5.28 (Chamber-OS 132): an applied-filter chip takes its text's width, cut only when it is wider than the row. */
1510
+ .aura-filterbar__chips > .aura-tag { max-width: 100%; min-width: 0; }
1511
+ /* A long chip mustn't widen the bar or anything around it: the row's width comes from the bar, never from its chips.
1512
+ * (So a FilterBar with only chips needs a width from its parent — it is full width in a block.) */
1513
+ .aura-filterbar__chips { contain: inline-size; }
1514
+ .aura-filterbar__chips > .aura-tag .aura-tag__text { max-width: none; min-width: 0; }
1508
1515
  .aura-filterbar__clear {
1509
1516
  border: 0; background: transparent; padding: 4px var(--aura-space-2); border-radius: var(--aura-radius-sm);
1510
1517
  font: inherit; font-size: 13px; font-weight: 500; color: var(--aura-fg-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jirawatpyk/aura-react",
3
- "version": "5.27.0",
3
+ "version": "5.28.0",
4
4
  "description": "AURA Design System — React components (Enterprise Standard, Human Creative). Thai-first: Buddhist-era dates, Thai collation.",
5
5
  "license": "MIT",
6
6
  "type": "module",