@sia.soul/sia-react-ui 0.1.5 → 0.1.6

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/core.css CHANGED
@@ -3251,15 +3251,22 @@ fieldset:disabled .sia-input-number__floating-placeholder {
3251
3251
  text-overflow: ellipsis;
3252
3252
  white-space: nowrap;
3253
3253
  }
3254
- .sia-table__cell--ellipsis > .sia-table__cell-content > .sia-space {
3254
+ .sia-table__cell--ellipsis > .sia-table__cell-content :is(.sia-space, .sia-flex, [data-table-inline-layout]) {
3255
3255
  display: inline-flex;
3256
3256
  width: max-content;
3257
3257
  flex-wrap: nowrap !important;
3258
- flex-direction: row;
3258
+ flex-direction: row !important;
3259
3259
  vertical-align: middle;
3260
3260
  }
3261
- .sia-table__cell--ellipsis > .sia-table__cell-content > .sia-space > * {
3261
+ .sia-table__cell--ellipsis > .sia-table__cell-content :is(.sia-space, .sia-flex, [data-table-inline-layout]) > * {
3262
3262
  flex-shrink: 0;
3263
+ width: auto;
3264
+ flex-direction: row;
3265
+ }
3266
+ .sia-table__cell--ellipsis > .sia-table__cell-content[data-custom-content] {
3267
+ display: -webkit-box;
3268
+ -webkit-box-orient: vertical;
3269
+ -webkit-line-clamp: 1;
3263
3270
  }
3264
3271
  .sia-table__cell--ellipsis > .sia-table__cell-content[data-content-overflow=true]::after {
3265
3272
  position: absolute;
package/dist/index.cjs CHANGED
@@ -9869,14 +9869,32 @@ function TableCellContent({ children, ellipsis, title }) {
9869
9869
  (0, import_react42.useLayoutEffect)(() => {
9870
9870
  const element = ref.current;
9871
9871
  if (!element || !ellipsis || !customContent) return;
9872
- const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1);
9872
+ const layouts = [];
9873
+ const normalizeLayouts = (parent) => {
9874
+ for (const child of parent.children) {
9875
+ if (!(child instanceof HTMLElement)) continue;
9876
+ const component = [...child.classList].some((name) => name.startsWith("sia-") && !name.startsWith("sia-space") && name !== "sia-flex");
9877
+ if (component || child.matches("button, input, textarea, select, [contenteditable]")) continue;
9878
+ const display = getComputedStyle(child).display;
9879
+ if (["flex", "inline-flex", "grid", "inline-grid"].includes(display)) {
9880
+ child.setAttribute("data-table-inline-layout", "");
9881
+ layouts.push(child);
9882
+ }
9883
+ normalizeLayouts(child);
9884
+ }
9885
+ };
9886
+ normalizeLayouts(element);
9887
+ const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1);
9873
9888
  update();
9874
9889
  const observer = new ResizeObserver(update);
9875
9890
  observer.observe(element);
9876
9891
  for (const child of element.children) observer.observe(child);
9877
- return () => observer.disconnect();
9892
+ return () => {
9893
+ observer.disconnect();
9894
+ layouts.forEach((layout) => layout.removeAttribute("data-table-inline-layout"));
9895
+ };
9878
9896
  }, [children, ellipsis, customContent]);
9879
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { ref, className: "sia-table__cell-content", title, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
9897
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { ref, className: "sia-table__cell-content", title, "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
9880
9898
  }
9881
9899
 
9882
9900
  // src/components/Table/Table.tsx
package/dist/index.css CHANGED
@@ -3251,15 +3251,22 @@ fieldset:disabled .sia-input-number__floating-placeholder {
3251
3251
  text-overflow: ellipsis;
3252
3252
  white-space: nowrap;
3253
3253
  }
3254
- .sia-table__cell--ellipsis > .sia-table__cell-content > .sia-space {
3254
+ .sia-table__cell--ellipsis > .sia-table__cell-content :is(.sia-space, .sia-flex, [data-table-inline-layout]) {
3255
3255
  display: inline-flex;
3256
3256
  width: max-content;
3257
3257
  flex-wrap: nowrap !important;
3258
- flex-direction: row;
3258
+ flex-direction: row !important;
3259
3259
  vertical-align: middle;
3260
3260
  }
3261
- .sia-table__cell--ellipsis > .sia-table__cell-content > .sia-space > * {
3261
+ .sia-table__cell--ellipsis > .sia-table__cell-content :is(.sia-space, .sia-flex, [data-table-inline-layout]) > * {
3262
3262
  flex-shrink: 0;
3263
+ width: auto;
3264
+ flex-direction: row;
3265
+ }
3266
+ .sia-table__cell--ellipsis > .sia-table__cell-content[data-custom-content] {
3267
+ display: -webkit-box;
3268
+ -webkit-box-orient: vertical;
3269
+ -webkit-line-clamp: 1;
3263
3270
  }
3264
3271
  .sia-table__cell--ellipsis > .sia-table__cell-content[data-content-overflow=true]::after {
3265
3272
  position: absolute;
package/dist/index.js CHANGED
@@ -4470,14 +4470,32 @@ function TableCellContent({ children, ellipsis, title }) {
4470
4470
  useLayoutEffect(() => {
4471
4471
  const element = ref.current;
4472
4472
  if (!element || !ellipsis || !customContent) return;
4473
- const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1);
4473
+ const layouts = [];
4474
+ const normalizeLayouts = (parent) => {
4475
+ for (const child of parent.children) {
4476
+ if (!(child instanceof HTMLElement)) continue;
4477
+ const component = [...child.classList].some((name) => name.startsWith("sia-") && !name.startsWith("sia-space") && name !== "sia-flex");
4478
+ if (component || child.matches("button, input, textarea, select, [contenteditable]")) continue;
4479
+ const display = getComputedStyle(child).display;
4480
+ if (["flex", "inline-flex", "grid", "inline-grid"].includes(display)) {
4481
+ child.setAttribute("data-table-inline-layout", "");
4482
+ layouts.push(child);
4483
+ }
4484
+ normalizeLayouts(child);
4485
+ }
4486
+ };
4487
+ normalizeLayouts(element);
4488
+ const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1);
4474
4489
  update();
4475
4490
  const observer = new ResizeObserver(update);
4476
4491
  observer.observe(element);
4477
4492
  for (const child of element.children) observer.observe(child);
4478
- return () => observer.disconnect();
4493
+ return () => {
4494
+ observer.disconnect();
4495
+ layouts.forEach((layout) => layout.removeAttribute("data-table-inline-layout"));
4496
+ };
4479
4497
  }, [children, ellipsis, customContent]);
4480
- return /* @__PURE__ */ jsx19("div", { ref, className: "sia-table__cell-content", title, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
4498
+ return /* @__PURE__ */ jsx19("div", { ref, className: "sia-table__cell-content", title, "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
4481
4499
  }
4482
4500
 
4483
4501
  // src/components/Table/Table.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",