@vygruppen/spor-react 12.24.0 → 12.24.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@12.24.0 build /home/runner/work/spor/spor/packages/spor-react
2
+ > @vygruppen/spor-react@12.24.2 build /home/runner/work/spor/spor/packages/spor-react
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx, src/icons/index.tsx
@@ -11,18 +11,18 @@ CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
13
  DTS Build start
14
- ESM dist/index.mjs 330.53 KB
14
+ ESM dist/index.mjs 331.61 KB
15
15
  ESM dist/icons/index.mjs 110.00 B
16
- ESM dist/index.mjs.map 700.07 KB
17
16
  ESM dist/icons/index.mjs.map 157.00 B
18
- ESM ⚡️ Build success in 2926ms
19
- CJS dist/index.cjs 354.42 KB
17
+ ESM dist/index.mjs.map 701.37 KB
18
+ ESM ⚡️ Build success in 2707ms
19
+ CJS dist/index.cjs 355.78 KB
20
20
  CJS dist/icons/index.cjs 381.00 B
21
- CJS dist/index.cjs.map 700.07 KB
21
+ CJS dist/index.cjs.map 701.37 KB
22
22
  CJS dist/icons/index.cjs.map 157.00 B
23
- CJS ⚡️ Build success in 2927ms
24
- DTS ⚡️ Build success in 22676ms
23
+ CJS ⚡️ Build success in 2708ms
24
+ DTS ⚡️ Build success in 21715ms
25
25
  DTS dist/icons/index.d.ts 44.00 B
26
- DTS dist/index.d.ts 147.69 KB
26
+ DTS dist/index.d.ts 147.56 KB
27
27
  DTS dist/icons/index.d.cts 44.00 B
28
- DTS dist/index.d.cts 147.69 KB
28
+ DTS dist/index.d.cts 147.56 KB
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@12.24.0 postinstall /home/runner/work/spor/spor/packages/spor-react
2
+ > @vygruppen/spor-react@12.24.2 postinstall /home/runner/work/spor/spor/packages/spor-react
3
3
  > chakra typegen src/theme/index.ts
4
4
 
5
5
  [dotenv@17.2.3] injecting env (0) from .env -- tip: ⚙️ override existing env vars with { override: true }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 12.24.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 8047512: Add icons for tiktok. Rename twitter-icon to "x"
8
+ - f8656b9: fix(UU): Input field label being announced twice
9
+ - 2bf118b: fix: Not able to change borderRadius when using AttachedInputs
10
+ - Updated dependencies [8047512]
11
+ - @vygruppen/spor-icon-react@4.5.2
12
+
13
+ ## 12.24.1
14
+
15
+ ### Patch Changes
16
+
17
+ - c9487f9: Fix issue with dynamic children not working for table sort, and fix column header no longer needing `children: string` to work
18
+
3
19
  ## 12.24.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1991,13 +1991,14 @@ var Field3 = React20__namespace.forwardRef(
1991
1991
  direction,
1992
1992
  id,
1993
1993
  children: [
1994
- label && !floatingLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { asChild: labelAsChild, children: renderLabelWithIndicator(label, labelAsChild) }),
1994
+ label && !floatingLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { asChild: labelAsChild, "aria-hidden": true, children: renderLabelWithIndicator(label, labelAsChild) }),
1995
1995
  children,
1996
1996
  label && floatingLabel && /* @__PURE__ */ jsxRuntime.jsx(
1997
1997
  FloatingLabel,
1998
1998
  {
1999
1999
  "data-float": shouldFloat ? true : void 0,
2000
2000
  asChild: labelAsChild,
2001
+ "aria-hidden": true,
2001
2002
  children: renderLabelWithIndicator(label, labelAsChild)
2002
2003
  }
2003
2004
  ),
@@ -4694,7 +4695,7 @@ var Textarea = React20.forwardRef(
4694
4695
  floatingLabel,
4695
4696
  shouldFloat,
4696
4697
  position: "relative",
4697
- label: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { id: labelId, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("label", { ref: labelRef, children: label }) }),
4698
+ label: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { id: labelId, children: /* @__PURE__ */ jsxRuntime.jsx("label", { ref: labelRef, children: label }) }),
4698
4699
  id: restProps.id,
4699
4700
  children: /* @__PURE__ */ jsxRuntime.jsx(
4700
4701
  react.Textarea,
@@ -6281,38 +6282,49 @@ var TabsList = react.Tabs.List;
6281
6282
  var TabsTrigger = react.Tabs.Trigger;
6282
6283
  var TabsIndicator = react.Tabs.Indicator;
6283
6284
  var TabsContent = react.Tabs.Content;
6284
- var getNextSortState = (current, key, columnIndex) => {
6285
- if (current.key !== key)
6286
- return { key, columnIndex, direction: "asc" };
6285
+
6286
+ // src/table/sort-utils.ts
6287
+ var getNextSortState = (current, columnIndex) => {
6288
+ if (current.columnIndex !== columnIndex)
6289
+ return { columnIndex, direction: "asc" };
6287
6290
  if (current.direction === "asc")
6288
- return { key, columnIndex, direction: "desc" };
6289
- return { key: null, direction: "asc", columnIndex: null };
6291
+ return { columnIndex, direction: "desc" };
6292
+ return { direction: "asc", columnIndex: null };
6290
6293
  };
6291
- var getSortKey = (children) => typeof children === "string" ? children.trim() : null;
6292
6294
  var getColumnIndex = (element) => {
6293
6295
  var _a5;
6294
6296
  return Array.prototype.indexOf.call((_a5 = element.parentElement) == null ? void 0 : _a5.children, element);
6295
6297
  };
6296
- var getCellText = (row, columnIndex) => {
6297
- const cell = React20.Children.toArray(
6298
- row.props.children
6299
- )[columnIndex];
6300
- if (!React20.isValidElement(cell))
6298
+ var getCellSortText = (row, columnIndex) => {
6299
+ var _a5;
6300
+ const cell = row.cells[columnIndex];
6301
+ if (!cell)
6301
6302
  return "";
6302
- const props = cell.props;
6303
- return typeof props["data-sort"] === "string" && props["data-sort"] || typeof props.children === "string" && props.children.trim() || "";
6303
+ return cell.dataset.sort || ((_a5 = cell.textContent) == null ? void 0 : _a5.trim()) || "";
6304
6304
  };
6305
- var sortRows = (children, columnIndex, direction) => React20.Children.toArray(children).toSorted((a, b) => {
6306
- if (!React20.isValidElement(a) || !React20.isValidElement(b))
6307
- return 0;
6308
- const cmp = getCellText(a, columnIndex).localeCompare(
6309
- getCellText(b, columnIndex)
6310
- );
6311
- return direction === "asc" ? cmp : -cmp;
6312
- });
6305
+ var applyDomSort = (tbody, sortState, originalRows) => {
6306
+ if (sortState.columnIndex == null) {
6307
+ for (const row of originalRows)
6308
+ tbody.append(row);
6309
+ } else {
6310
+ const rows = Array.from(tbody.rows);
6311
+ rows.sort((a, b) => {
6312
+ const cmp = getCellSortText(a, sortState.columnIndex).localeCompare(
6313
+ getCellSortText(b, sortState.columnIndex)
6314
+ );
6315
+ return sortState.direction === "asc" ? cmp : -cmp;
6316
+ });
6317
+ for (const row of rows)
6318
+ tbody.append(row);
6319
+ }
6320
+ };
6321
+ var captureRowOrder = (tbody) => (
6322
+ // eslint-disable-next-line unicorn/prefer-spread -- HTMLCollectionOf is not spreadable
6323
+ Array.from(tbody.rows)
6324
+ );
6313
6325
  var SortContext = React20.createContext({
6314
6326
  enabled: false,
6315
- sortState: { key: null, direction: "asc", columnIndex: null },
6327
+ sortState: { direction: "asc", columnIndex: null },
6316
6328
  onSort: () => {
6317
6329
  }
6318
6330
  });
@@ -6327,14 +6339,13 @@ var Table = React20.forwardRef(
6327
6339
  ...rest
6328
6340
  }, ref) => {
6329
6341
  const [sortState, setSortState] = React20.useState({
6330
- key: null,
6331
6342
  direction: "asc",
6332
6343
  columnIndex: null
6333
6344
  });
6334
- const handleSort = (key, columnIndex) => {
6345
+ const handleSort = (columnIndex) => {
6335
6346
  if (!sortable)
6336
6347
  return;
6337
- setSortState(getNextSortState(sortState, key, columnIndex));
6348
+ setSortState(getNextSortState(sortState, columnIndex));
6338
6349
  };
6339
6350
  const recipe = react.useSlotRecipe({ key: "table" });
6340
6351
  const styles = recipe({ variant, size });
@@ -6361,47 +6372,75 @@ var Table = React20.forwardRef(
6361
6372
  Table.displayName = "Table";
6362
6373
  var TableColumnHeader = React20.forwardRef(({ children, ...rest }, ref) => {
6363
6374
  const { enabled, sortState, onSort } = useTableSort();
6364
- const key = getSortKey(children);
6375
+ const [columnIndex, setColumnIndex] = React20.useState(null);
6365
6376
  const props = rest;
6366
- const columnSortable = enabled && key != null && !("data-nosort" in props);
6367
- const isActive = columnSortable && key === sortState.key;
6368
- return /* @__PURE__ */ jsxRuntime.jsx(react.Table.ColumnHeader, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { children: [
6369
- children,
6370
- columnSortable && /* @__PURE__ */ jsxRuntime.jsx(
6371
- react.Button,
6372
- {
6373
- variant: "ghost",
6374
- onClick: (event) => {
6375
- const th = event.currentTarget.closest("th");
6376
- if (th)
6377
- onSort(key, getColumnIndex(th));
6378
- },
6379
- p: "0px !important",
6380
- size: "xs",
6381
- children: isActive ? sortState.direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.ArrowUpFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.ArrowDownFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsxRuntime.jsx(
6382
- spor_icon_react_star.ChangeDirectionFill18Icon,
6377
+ const columnSortable = enabled && !("data-nosort" in props);
6378
+ const isActive = columnSortable && columnIndex != null && columnIndex === sortState.columnIndex;
6379
+ return /* @__PURE__ */ jsxRuntime.jsx(
6380
+ react.Table.ColumnHeader,
6381
+ {
6382
+ ref: (element) => {
6383
+ if (element)
6384
+ setColumnIndex(getColumnIndex(element));
6385
+ if (typeof ref === "function")
6386
+ ref(element);
6387
+ else if (ref)
6388
+ ref.current = element;
6389
+ },
6390
+ ...rest,
6391
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { children: [
6392
+ children,
6393
+ columnSortable && columnIndex != null && /* @__PURE__ */ jsxRuntime.jsx(
6394
+ react.Button,
6383
6395
  {
6384
- transform: "rotate(90deg)",
6385
- color: "icon.disabled"
6396
+ variant: "ghost",
6397
+ onClick: () => onSort(columnIndex),
6398
+ p: "0px !important",
6399
+ size: "xs",
6400
+ children: isActive ? sortState.direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.ArrowUpFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.ArrowDownFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsxRuntime.jsx(
6401
+ spor_icon_react_star.ChangeDirectionFill18Icon,
6402
+ {
6403
+ transform: "rotate(90deg)",
6404
+ color: "icon.disabled"
6405
+ }
6406
+ )
6386
6407
  }
6387
6408
  )
6388
- }
6389
- )
6390
- ] }) });
6409
+ ] })
6410
+ }
6411
+ );
6391
6412
  });
6392
6413
  TableColumnHeader.displayName = "ColumnHeader";
6393
- var TableRow = React20.forwardRef(
6394
- (props, ref) => /* @__PURE__ */ jsxRuntime.jsx(react.Table.Row, { ref, ...props })
6395
- );
6396
- TableRow.displayName = "TableRow";
6397
6414
  var TableBody = React20.forwardRef(
6398
6415
  ({ children, ...rest }, ref) => {
6399
6416
  const { sortState } = useTableSort();
6400
- const sorted = React20.useMemo(
6401
- () => sortState.columnIndex == null ? children : sortRows(children, sortState.columnIndex, sortState.direction),
6402
- [children, sortState]
6417
+ const tbodyRef = React20.useRef(null);
6418
+ const originalOrder = React20.useRef([]);
6419
+ const previousChildren = React20.useRef(children);
6420
+ React20.useLayoutEffect(() => {
6421
+ const tbody = tbodyRef.current;
6422
+ if (!tbody)
6423
+ return;
6424
+ if (previousChildren.current !== children || originalOrder.current.length === 0) {
6425
+ originalOrder.current = captureRowOrder(tbody);
6426
+ previousChildren.current = children;
6427
+ }
6428
+ applyDomSort(tbody, sortState, originalOrder.current);
6429
+ }, [sortState, children]);
6430
+ return /* @__PURE__ */ jsxRuntime.jsx(
6431
+ react.Table.Body,
6432
+ {
6433
+ ref: (element) => {
6434
+ tbodyRef.current = element;
6435
+ if (typeof ref === "function")
6436
+ ref(element);
6437
+ else if (ref)
6438
+ ref.current = element;
6439
+ },
6440
+ ...rest,
6441
+ children
6442
+ }
6403
6443
  );
6404
- return /* @__PURE__ */ jsxRuntime.jsx(react.Table.Body, { ref, ...rest, children: sorted });
6405
6444
  }
6406
6445
  );
6407
6446
  TableBody.displayName = "TableBody";
@@ -6411,7 +6450,7 @@ var attachedInputsRecipe = react.defineRecipe({
6411
6450
  gap: "0.1rem",
6412
6451
  width: "100%",
6413
6452
  "& select": {
6414
- borderEndRadius: 0
6453
+ borderEndRadius: "0 !important"
6415
6454
  },
6416
6455
  "& > *": {
6417
6456
  position: "relative",
@@ -6426,13 +6465,13 @@ var attachedInputsRecipe = react.defineRecipe({
6426
6465
  horizontal: {
6427
6466
  flexDirection: "row",
6428
6467
  "& > *:first-of-type:not(:last-of-type) [data-attachable]": {
6429
- borderEndRadius: 0
6468
+ borderEndRadius: "0 !important"
6430
6469
  },
6431
6470
  "& > *:not(:first-of-type):not(:last-of-type) [data-attachable]": {
6432
- borderRadius: 0
6471
+ borderRadius: "0 !important"
6433
6472
  },
6434
6473
  "& > *:not(:first-of-type):last-of-type [data-attachable]": {
6435
- borderStartRadius: 0
6474
+ borderStartRadius: "0 !important"
6436
6475
  },
6437
6476
  "&[data-with-flip-button]": {
6438
6477
  "& > *:nth-of-type(2) [data-scope='field'][data-part='root']": {
@@ -6448,13 +6487,13 @@ var attachedInputsRecipe = react.defineRecipe({
6448
6487
  vertical: {
6449
6488
  flexDirection: "column",
6450
6489
  "& > *:first-of-type:not(:last-of-type) [data-attachable]": {
6451
- borderBottomRadius: 0
6490
+ borderBottomRadius: "0 !important"
6452
6491
  },
6453
6492
  "& > *:not(:first-of-type):not(:last-of-type) [data-attachable]": {
6454
- borderRadius: 0
6493
+ borderRadius: "0 !important"
6455
6494
  },
6456
6495
  "& > *:not(:first-of-type):last-of-type [data-attachable]": {
6457
- borderTopRadius: 0
6496
+ borderTopRadius: "0 !important"
6458
6497
  }
6459
6498
  }
6460
6499
  }
@@ -9681,7 +9720,12 @@ var nativeSelectSlotRecipe = react.defineSlotRecipe({
9681
9720
  root: {
9682
9721
  width: "100%",
9683
9722
  height: "fit-content",
9684
- position: "relative"
9723
+ position: "relative",
9724
+ backgroundColor: "surface",
9725
+ "& option, & optgroup": {
9726
+ color: "text",
9727
+ backgroundColor: "surface"
9728
+ }
9685
9729
  },
9686
9730
  field: {
9687
9731
  ...inputRecipe.base
@@ -12000,6 +12044,10 @@ Object.defineProperty(exports, "TableRoot", {
12000
12044
  enumerable: true,
12001
12045
  get: function () { return react.TableRoot; }
12002
12046
  });
12047
+ Object.defineProperty(exports, "TableRow", {
12048
+ enumerable: true,
12049
+ get: function () { return react.TableRow; }
12050
+ });
12003
12051
  Object.defineProperty(exports, "VStack", {
12004
12052
  enumerable: true,
12005
12053
  get: function () { return react.VStack; }
@@ -12032,10 +12080,18 @@ Object.defineProperty(exports, "defineRecipe", {
12032
12080
  enumerable: true,
12033
12081
  get: function () { return react.defineRecipe; }
12034
12082
  });
12083
+ Object.defineProperty(exports, "defineSlotRecipe", {
12084
+ enumerable: true,
12085
+ get: function () { return react.defineSlotRecipe; }
12086
+ });
12035
12087
  Object.defineProperty(exports, "defineStyle", {
12036
12088
  enumerable: true,
12037
12089
  get: function () { return react.defineStyle; }
12038
12090
  });
12091
+ Object.defineProperty(exports, "mergeConfigs", {
12092
+ enumerable: true,
12093
+ get: function () { return react.mergeConfigs; }
12094
+ });
12039
12095
  Object.defineProperty(exports, "spor", {
12040
12096
  enumerable: true,
12041
12097
  get: function () { return react.chakra; }
@@ -12253,7 +12309,6 @@ exports.Switch = Switch;
12253
12309
  exports.Table = Table;
12254
12310
  exports.TableBody = TableBody;
12255
12311
  exports.TableColumnHeader = TableColumnHeader;
12256
- exports.TableRow = TableRow;
12257
12312
  exports.Tabs = Tabs;
12258
12313
  exports.TabsContent = TabsContent;
12259
12314
  exports.TabsIndicator = TabsIndicator;