twico-ui 1.32.0 → 1.32.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/dist/index.mjs CHANGED
@@ -5867,6 +5867,7 @@ function Combobox({
5867
5867
  setQuery("");
5868
5868
  }
5869
5869
  function commit(v) {
5870
+ if (disabled) return;
5870
5871
  const o = flat.find((x) => x.value === v);
5871
5872
  if (o && o.disabled) return;
5872
5873
  if (value === void 0) setInternal(v);
@@ -6043,7 +6044,7 @@ function Combobox({
6043
6044
  ...rest
6044
6045
  }
6045
6046
  ),
6046
- clearable && selected && !open ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-cb__clear", "aria-label": "Clear", onClick: (e) => {
6047
+ clearable && selected && !open && !disabled ? /* @__PURE__ */ jsx("button", { type: "button", className: "twc-cb__clear", "aria-label": "Clear", onClick: (e) => {
6047
6048
  e.stopPropagation();
6048
6049
  commit(null);
6049
6050
  }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) }) : null,
@@ -7333,6 +7334,7 @@ var MULTI_CSS = `
7333
7334
  background: var(--_accent-subtle); color: var(--_accent-subtle-fg);
7334
7335
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold);
7335
7336
  }
7337
+ .twc-ms__control[data-disabled="true"] .twc-ms__chip { padding-inline-end: 9px; } /* #342: no \u2715 \u2192 symmetric pad */
7336
7338
  .twc-ms__chip-x { display: inline-grid; place-items: center; width: 16px; height: 16px; border: none; padding: 0; background: transparent; color: inherit; cursor: pointer; border-radius: var(--radius-full); opacity: 0.7; }
7337
7339
  .twc-ms__chip-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 18%, transparent); }
7338
7340
  .twc-ms__chip-x svg { width: 12px; height: 12px; }
@@ -7575,6 +7577,7 @@ function MultiSelect({
7575
7577
  setScrollTop(next);
7576
7578
  }, [active, open, virtualized, rows, listH]);
7577
7579
  function commit(next) {
7580
+ if (disabled) return;
7578
7581
  if (value === void 0) setInternal(next);
7579
7582
  onChange?.(next);
7580
7583
  }
@@ -7731,10 +7734,10 @@ function MultiSelect({
7731
7734
  children: [
7732
7735
  (maxTagCount != null ? selectedOpts.slice(0, maxTagCount) : selectedOpts).map((o) => /* @__PURE__ */ jsxs("span", { className: "twc-ms__chip", children: [
7733
7736
  o.label,
7734
- /* @__PURE__ */ jsx("button", { type: "button", tabIndex: -1, className: "twc-ms__chip-x", "aria-label": `Remove ${o.label}`, onClick: (e) => {
7737
+ !disabled ? /* @__PURE__ */ jsx("button", { type: "button", tabIndex: -1, className: "twc-ms__chip-x", "aria-label": `Remove ${o.label}`, onClick: (e) => {
7735
7738
  e.stopPropagation();
7736
7739
  toggle(o.value);
7737
- }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) })
7740
+ }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) }) : null
7738
7741
  ] }, o.value)),
7739
7742
  maxTagCount != null && selectedOpts.length > maxTagCount ? /* @__PURE__ */ jsxs("span", { className: "twc-ms__more", title: selectedOpts.slice(maxTagCount).map((o) => o.label).join(", "), children: [
7740
7743
  "+",
@@ -7787,8 +7790,10 @@ function MultiSelect({
7787
7790
  tabIndex: -1,
7788
7791
  onClick: (e) => {
7789
7792
  e.stopPropagation();
7790
- setOpen((o) => !o);
7791
- inputRef.current?.focus();
7793
+ if (!disabled) {
7794
+ setOpen((o) => !o);
7795
+ inputRef.current?.focus();
7796
+ }
7792
7797
  },
7793
7798
  children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) })
7794
7799
  }
@@ -10533,6 +10538,7 @@ function Datatable({
10533
10538
  if (el) el.focus();
10534
10539
  }
10535
10540
  function onGridKeyDown(e) {
10541
+ if (e.target.closest("input, textarea, select, [contenteditable='true']")) return;
10536
10542
  if (editing) return;
10537
10543
  const td = e.target.closest(".twc-dt__td[data-r]");
10538
10544
  if (!td) return;
@@ -15728,6 +15734,7 @@ function FileUpload({
15728
15734
  } else if (accepted.length) set(accepted.slice(0, 1));
15729
15735
  }
15730
15736
  function remove(i) {
15737
+ if (disabled) return;
15731
15738
  set(files.filter((_, idx) => idx !== i));
15732
15739
  }
15733
15740
  return /* @__PURE__ */ jsxs("div", { className: `twc-upload ${className}`, "data-size": size, ...rest, children: [
@@ -15798,7 +15805,7 @@ function FileUpload({
15798
15805
  /* @__PURE__ */ jsx("span", { className: "twc-upload__file-name", children: f.name }),
15799
15806
  /* @__PURE__ */ jsx("span", { className: "twc-upload__file-size", children: fmtSize(f.size) })
15800
15807
  ] }),
15801
- /* @__PURE__ */ jsx("button", { className: "twc-upload__file-x", "aria-label": `Remove ${f.name}`, onClick: () => remove(i), type: "button", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) })
15808
+ !disabled ? /* @__PURE__ */ jsx("button", { className: "twc-upload__file-x", "aria-label": `Remove ${f.name}`, onClick: () => remove(i), type: "button", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) }) : null
15802
15809
  ] }, fileKey(f))) }) : null,
15803
15810
  error ? /* @__PURE__ */ jsx("span", { id: descId, className: "twc-field__error", children: error }) : null
15804
15811
  ] });