@orianatech/pire 0.19.0 → 0.20.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.
@@ -3,6 +3,21 @@ export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
3
3
  /** Provide to render the remove affordance — filter tokens, multi-select values. */
4
4
  onRemove?: () => void;
5
5
  isDisabled?: boolean;
6
+ /**
7
+ * Marks the tag as one of a set of **categories** — kinds of a thing, where none is good or bad.
8
+ * Use it for payment kinds, document types, cost-centre groups.
9
+ *
10
+ * This is what `Badge` is not for. `Badge`'s five values are *states*: painting a category
11
+ * "negative" says something went wrong when nothing did.
12
+ *
13
+ * The number is a slot in the shared `--viz` ramp, not a colour. Assign in order and do not
14
+ * cycle past 6 — colour-blind separation is measured between adjacent slots, and a seventh
15
+ * category implies a distinction the eye cannot recover. Fold the tail into one "Other".
16
+ *
17
+ * The colour rides on a swatch, never on the text: the label stays in normal ink so it keeps
18
+ * its contrast, and the category is never carried by colour alone.
19
+ */
20
+ category?: 1 | 2 | 3 | 4 | 5 | 6;
6
21
  }
7
22
  /** A removable token: applied filters, multi-select values. */
8
- export declare function Tag({ children, onRemove, isDisabled, className, ...rest }: TagProps): React.JSX.Element;
23
+ export declare function Tag({ children, onRemove, isDisabled, category, className, ...rest }: TagProps): React.JSX.Element;
@@ -3,7 +3,22 @@ export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
3
3
  /** Provide to render the remove affordance — filter tokens, multi-select values. */
4
4
  onRemove?: () => void;
5
5
  isDisabled?: boolean;
6
+ /**
7
+ * Marks the tag as one of a set of **categories** — kinds of a thing, where none is good or bad.
8
+ * Use it for payment kinds, document types, cost-centre groups.
9
+ *
10
+ * This is what `Badge` is not for. `Badge`'s five values are *states*: painting a category
11
+ * "negative" says something went wrong when nothing did.
12
+ *
13
+ * The number is a slot in the shared `--viz` ramp, not a colour. Assign in order and do not
14
+ * cycle past 6 — colour-blind separation is measured between adjacent slots, and a seventh
15
+ * category implies a distinction the eye cannot recover. Fold the tail into one "Other".
16
+ *
17
+ * The colour rides on a swatch, never on the text: the label stays in normal ink so it keeps
18
+ * its contrast, and the category is never carried by colour alone.
19
+ */
20
+ category?: 1 | 2 | 3 | 4 | 5 | 6;
6
21
  }
7
22
  /** A removable token: applied filters, multi-select values. */
8
- export declare function Tag({ children, onRemove, isDisabled, className, ...rest }: TagProps): React.JSX.Element;
23
+ export declare function Tag({ children, onRemove, isDisabled, category, className, ...rest }: TagProps): React.JSX.Element;
9
24
  //# sourceMappingURL=Tag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAKpC,MAAM,WAAW,QAAS,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACrE,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+DAA+D;AAC/D,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,qBAYnF"}
1
+ {"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAKpC,MAAM,WAAW,QAAS,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACrE,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAClC;AAED,+DAA+D;AAC/D,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,qBAe7F"}
@@ -62,6 +62,18 @@
62
62
  .pire-badge[data-status="neutral"]{background:var(--status-neutral-bg);color:var(--status-neutral-fg);border-color:var(--status-neutral-border)}
63
63
  .pire-tag{display:inline-flex;align-items:center;gap:var(--sp-1);height:24px;padding:0 var(--sp-1) 0 var(--sp-2);border:1px solid var(--border-default);border-radius:var(--radius-1);background:var(--surface-sunken);color:var(--text-primary);font:var(--type-caption);white-space:nowrap}
64
64
  .pire-tag[data-disabled]{color:var(--text-disabled);background:var(--surface-disabled)}
65
+ /* Category identity rides on a mark, never on the label: the text keeps --text-primary so its
66
+ contrast holds in every token scope, and the category is never colour-alone. Slots come from the
67
+ shared --viz ramp, which is already validated for colour-blind separation between adjacent
68
+ slots — a second categorical palette would have to earn that again and could be confused with
69
+ this one. */
70
+ .pire-tag-swatch{flex:0 0 auto;width:8px;height:8px;border-radius:var(--radius-pill);background:var(--viz-1)}
71
+ .pire-tag-swatch[data-category="2"]{background:var(--viz-2)}
72
+ .pire-tag-swatch[data-category="3"]{background:var(--viz-3)}
73
+ .pire-tag-swatch[data-category="4"]{background:var(--viz-4)}
74
+ .pire-tag-swatch[data-category="5"]{background:var(--viz-5)}
75
+ .pire-tag-swatch[data-category="6"]{background:var(--viz-6)}
76
+ .pire-tag[data-disabled] .pire-tag-swatch{background:var(--text-disabled)}
65
77
  .pire-tag-remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:var(--radius-1);background:transparent;color:var(--text-secondary);cursor:pointer}
66
78
  .pire-tag-remove[data-hovered]{background:var(--surface-active);color:var(--text-primary)}
67
79
 
package/dist/index.cjs CHANGED
@@ -604,8 +604,9 @@ function Badge({ children, status = "neutral", showIcon = true, className, ...re
604
604
  // src/components/core/Tag.tsx
605
605
  var import_react_aria_components4 = require("react-aria-components");
606
606
  var import_jsx_runtime6 = require("react/jsx-runtime");
607
- function Tag({ children, onRemove, isDisabled, className, ...rest }) {
607
+ function Tag({ children, onRemove, isDisabled, category, className, ...rest }) {
608
608
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: cx("pire-tag", className), "data-disabled": isDisabled ? "true" : void 0, ...rest, children: [
609
+ category ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pire-tag-swatch", "data-category": category, "aria-hidden": "true" }) : null,
609
610
  children,
610
611
  onRemove ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
611
612
  import_react_aria_components4.Button,