@vygruppen/spor-react 12.22.2 → 12.23.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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +11 -0
- package/dist/index.cjs +139 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.mjs +139 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/input/CountryCodeSelect.tsx +1 -0
- package/src/input/Input.tsx +5 -1
- package/src/input/Textarea.tsx +12 -20
- package/src/table/Table.tsx +142 -14
- package/src/table/index.tsx +0 -6
- package/src/table/sort-utils.ts +51 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @vygruppen/spor-react@12.
|
|
2
|
+
> @vygruppen/spor-react@12.23.0 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 326.79 KB
|
|
15
14
|
ESM dist/icons/index.mjs 110.00 B
|
|
16
|
-
ESM dist/index.mjs.
|
|
15
|
+
ESM dist/index.mjs 330.04 KB
|
|
17
16
|
ESM dist/icons/index.mjs.map 157.00 B
|
|
18
|
-
ESM
|
|
19
|
-
|
|
17
|
+
ESM dist/index.mjs.map 699.16 KB
|
|
18
|
+
ESM ⚡️ Build success in 2774ms
|
|
19
|
+
CJS dist/index.cjs 353.93 KB
|
|
20
20
|
CJS dist/icons/index.cjs 381.00 B
|
|
21
|
-
CJS dist/index.cjs.map
|
|
21
|
+
CJS dist/index.cjs.map 699.16 KB
|
|
22
22
|
CJS dist/icons/index.cjs.map 157.00 B
|
|
23
|
-
CJS ⚡️ Build success in
|
|
24
|
-
DTS ⚡️ Build success in
|
|
23
|
+
CJS ⚡️ Build success in 2775ms
|
|
24
|
+
DTS ⚡️ Build success in 21345ms
|
|
25
25
|
DTS dist/icons/index.d.ts 44.00 B
|
|
26
|
-
DTS dist/index.d.ts
|
|
26
|
+
DTS dist/index.d.ts 147.69 KB
|
|
27
27
|
DTS dist/icons/index.d.cts 44.00 B
|
|
28
|
-
DTS dist/index.d.cts
|
|
28
|
+
DTS dist/index.d.cts 147.69 KB
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @vygruppen/spor-react@12.
|
|
2
|
+
> @vygruppen/spor-react@12.23.0 postinstall /home/runner/work/spor/spor/packages/spor-react
|
|
3
3
|
> chakra typegen src/theme/index.ts
|
|
4
4
|
|
|
5
|
-
[dotenv@17.2.3] injecting env (0) from .env -- tip:
|
|
5
|
+
[dotenv@17.2.3] injecting env (0) from .env -- tip: 🔄 add secrets lifecycle management: https://dotenvx.com/ops
|
|
6
6
|
[90m┌[39m Chakra CLI ⚡️
|
|
7
7
|
[?25l[90m│[39m
|
|
8
8
|
[35m◒[39m Generating conditions types...
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @vygruppen/spor-react
|
|
2
2
|
|
|
3
|
+
## 12.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b179f2f: Added a props `sortable` to Table that lets you sort columns by clicking on them.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a8cfc72: UU fixes on input, phonenumber input, and textarea components. Fix double announcement of labels, order when navigating with voiceover, and connect textarea-id to textarea-label.
|
|
12
|
+
- @vygruppen/spor-icon-react@4.5.1
|
|
13
|
+
|
|
3
14
|
## 12.22.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -3237,6 +3237,7 @@ var Input = React20.forwardRef(
|
|
|
3237
3237
|
const recipe = react.useRecipe({ key: "input" });
|
|
3238
3238
|
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
|
3239
3239
|
const styles = recipe(recipeProps);
|
|
3240
|
+
const labelId = React20.useId();
|
|
3240
3241
|
const inputRef = React20.useRef(null);
|
|
3241
3242
|
React20.useImperativeHandle(ref, () => inputRef.current, []);
|
|
3242
3243
|
const { shouldFloat, handleFocus, handleBlur, handleChange, isControlled } = useFloatingInputState({
|
|
@@ -3257,7 +3258,7 @@ var Input = React20.forwardRef(
|
|
|
3257
3258
|
errorText,
|
|
3258
3259
|
id: props.id,
|
|
3259
3260
|
labelAsChild,
|
|
3260
|
-
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { children: [
|
|
3261
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { id: labelId, children: [
|
|
3261
3262
|
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
|
|
3262
3263
|
label
|
|
3263
3264
|
] }),
|
|
@@ -3291,7 +3292,8 @@ var Input = React20.forwardRef(
|
|
|
3291
3292
|
onChange: handleChange,
|
|
3292
3293
|
placeholder: "",
|
|
3293
3294
|
css: styles,
|
|
3294
|
-
fontSize: fontSize ?? "mobile.md"
|
|
3295
|
+
fontSize: fontSize ?? "mobile.md",
|
|
3296
|
+
"aria-labelledby": labelId
|
|
3295
3297
|
}
|
|
3296
3298
|
),
|
|
3297
3299
|
endElement && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4309,6 +4311,7 @@ var CountryCodeSelect = React20.forwardRef((props, ref) => {
|
|
|
4309
4311
|
lazyMount: true,
|
|
4310
4312
|
"aria-label": t(texts17.countryCode),
|
|
4311
4313
|
sideRadiusVariant: "rightSideSquare",
|
|
4314
|
+
role: "combobox",
|
|
4312
4315
|
children: filteredCallingCodes.items.map((code) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { item: code, children: code.label }, code.label))
|
|
4313
4316
|
}
|
|
4314
4317
|
);
|
|
@@ -4663,7 +4666,7 @@ var Textarea = React20.forwardRef(
|
|
|
4663
4666
|
errorText,
|
|
4664
4667
|
readOnly,
|
|
4665
4668
|
helperText,
|
|
4666
|
-
floatingLabel,
|
|
4669
|
+
floatingLabel = true,
|
|
4667
4670
|
...restProps
|
|
4668
4671
|
} = props;
|
|
4669
4672
|
const recipe = react.useRecipe({ key: "textarea" });
|
|
@@ -4679,7 +4682,8 @@ var Textarea = React20.forwardRef(
|
|
|
4679
4682
|
onChange: props.onChange,
|
|
4680
4683
|
inputRef
|
|
4681
4684
|
});
|
|
4682
|
-
|
|
4685
|
+
const labelId = React20.useId();
|
|
4686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4683
4687
|
Field3,
|
|
4684
4688
|
{
|
|
4685
4689
|
errorText,
|
|
@@ -4690,31 +4694,24 @@ var Textarea = React20.forwardRef(
|
|
|
4690
4694
|
floatingLabel,
|
|
4691
4695
|
shouldFloat,
|
|
4692
4696
|
position: "relative",
|
|
4693
|
-
children:
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
{
|
|
4712
|
-
ref: labelRef,
|
|
4713
|
-
"data-float": shouldFloat ? true : void 0,
|
|
4714
|
-
children: label
|
|
4715
|
-
}
|
|
4716
|
-
)
|
|
4717
|
-
]
|
|
4697
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { id: labelId, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("label", { ref: labelRef, children: label }) }),
|
|
4698
|
+
id: restProps.id,
|
|
4699
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4700
|
+
react.Textarea,
|
|
4701
|
+
{
|
|
4702
|
+
...restProps,
|
|
4703
|
+
css: styles,
|
|
4704
|
+
className: "peer",
|
|
4705
|
+
ref: inputRef,
|
|
4706
|
+
value: isControlled ? props.value : void 0,
|
|
4707
|
+
onFocus: handleFocus,
|
|
4708
|
+
onBlur: handleBlur,
|
|
4709
|
+
onChange: handleChange,
|
|
4710
|
+
style: { "--label-height": `${labelHeight}px` },
|
|
4711
|
+
placeholder: " ",
|
|
4712
|
+
"aria-labelledby": labelId
|
|
4713
|
+
}
|
|
4714
|
+
)
|
|
4718
4715
|
}
|
|
4719
4716
|
);
|
|
4720
4717
|
}
|
|
@@ -6284,24 +6281,121 @@ var TabsList = react.Tabs.List;
|
|
|
6284
6281
|
var TabsTrigger = react.Tabs.Trigger;
|
|
6285
6282
|
var TabsIndicator = react.Tabs.Indicator;
|
|
6286
6283
|
var TabsContent = react.Tabs.Content;
|
|
6287
|
-
var
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6284
|
+
var getNextSortState = (current, key, columnIndex) => ({
|
|
6285
|
+
key,
|
|
6286
|
+
columnIndex,
|
|
6287
|
+
direction: current.key === key && current.direction === "asc" ? "desc" : "asc"
|
|
6288
|
+
});
|
|
6289
|
+
var getSortKey = (children) => typeof children === "string" ? children.trim() : null;
|
|
6290
|
+
var getColumnIndex = (element) => {
|
|
6291
|
+
var _a5;
|
|
6292
|
+
return Array.prototype.indexOf.call((_a5 = element.parentElement) == null ? void 0 : _a5.children, element);
|
|
6293
|
+
};
|
|
6294
|
+
var getCellText = (row, columnIndex) => {
|
|
6295
|
+
const cell = React20.Children.toArray(
|
|
6296
|
+
row.props.children
|
|
6297
|
+
)[columnIndex];
|
|
6298
|
+
if (!React20.isValidElement(cell))
|
|
6299
|
+
return "";
|
|
6300
|
+
const props = cell.props;
|
|
6301
|
+
return typeof props["data-sort"] === "string" && props["data-sort"] || typeof props.children === "string" && props.children.trim() || "";
|
|
6302
|
+
};
|
|
6303
|
+
var sortRows = (children, columnIndex, direction) => React20.Children.toArray(children).toSorted((a, b) => {
|
|
6304
|
+
if (!React20.isValidElement(a) || !React20.isValidElement(b))
|
|
6305
|
+
return 0;
|
|
6306
|
+
const cmp = getCellText(a, columnIndex).localeCompare(
|
|
6307
|
+
getCellText(b, columnIndex)
|
|
6308
|
+
);
|
|
6309
|
+
return direction === "asc" ? cmp : -cmp;
|
|
6310
|
+
});
|
|
6311
|
+
var SortContext = React20.createContext({
|
|
6312
|
+
enabled: false,
|
|
6313
|
+
sortState: { key: null, direction: "asc", columnIndex: null },
|
|
6314
|
+
onSort: () => {
|
|
6315
|
+
}
|
|
6316
|
+
});
|
|
6317
|
+
var useTableSort = () => React20.useContext(SortContext);
|
|
6318
|
+
var Table = React20.forwardRef(
|
|
6319
|
+
({
|
|
6320
|
+
variant = "ghost",
|
|
6321
|
+
size,
|
|
6322
|
+
colorPalette = "green",
|
|
6323
|
+
children,
|
|
6324
|
+
sortable = false,
|
|
6325
|
+
...rest
|
|
6326
|
+
}, ref) => {
|
|
6327
|
+
const [sortState, setSortState] = React20.useState({
|
|
6328
|
+
key: null,
|
|
6329
|
+
direction: "asc",
|
|
6330
|
+
columnIndex: null
|
|
6331
|
+
});
|
|
6332
|
+
const handleSort = (key, columnIndex) => {
|
|
6333
|
+
if (!sortable)
|
|
6334
|
+
return;
|
|
6335
|
+
setSortState(getNextSortState(sortState, key, columnIndex));
|
|
6336
|
+
};
|
|
6337
|
+
const recipe = react.useSlotRecipe({ key: "table" });
|
|
6338
|
+
const styles = recipe({ variant, size });
|
|
6339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6340
|
+
react.Table.Root,
|
|
6341
|
+
{
|
|
6342
|
+
variant,
|
|
6343
|
+
size,
|
|
6344
|
+
colorPalette,
|
|
6345
|
+
css: styles,
|
|
6346
|
+
ref,
|
|
6347
|
+
...rest,
|
|
6348
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6349
|
+
SortContext.Provider,
|
|
6350
|
+
{
|
|
6351
|
+
value: { enabled: sortable, sortState, onSort: handleSort },
|
|
6352
|
+
children
|
|
6353
|
+
}
|
|
6354
|
+
)
|
|
6355
|
+
}
|
|
6356
|
+
);
|
|
6357
|
+
}
|
|
6358
|
+
);
|
|
6359
|
+
Table.displayName = "Table";
|
|
6360
|
+
var TableColumnHeader = React20.forwardRef(({ children, onClick, ...rest }, ref) => {
|
|
6361
|
+
const { enabled, sortState, onSort } = useTableSort();
|
|
6362
|
+
const key = getSortKey(children);
|
|
6363
|
+
const isActive = enabled && key != null && key === sortState.key;
|
|
6291
6364
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6292
|
-
react.Table.
|
|
6365
|
+
react.Table.ColumnHeader,
|
|
6293
6366
|
{
|
|
6294
|
-
variant,
|
|
6295
|
-
size,
|
|
6296
|
-
colorPalette,
|
|
6297
|
-
css: styles,
|
|
6298
6367
|
ref,
|
|
6299
|
-
|
|
6300
|
-
|
|
6368
|
+
onClick: (event) => {
|
|
6369
|
+
if (enabled && key) {
|
|
6370
|
+
onSort(key, getColumnIndex(event.currentTarget));
|
|
6371
|
+
}
|
|
6372
|
+
onClick == null ? void 0 : onClick(event);
|
|
6373
|
+
},
|
|
6374
|
+
cursor: enabled && key ? "pointer" : void 0,
|
|
6375
|
+
...rest,
|
|
6376
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { children: [
|
|
6377
|
+
children,
|
|
6378
|
+
isActive && (sortState.direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.DropdownUpFill18Icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.DropdownDownFill18Icon, {}))
|
|
6379
|
+
] })
|
|
6301
6380
|
}
|
|
6302
6381
|
);
|
|
6303
6382
|
});
|
|
6304
|
-
|
|
6383
|
+
TableColumnHeader.displayName = "ColumnHeader";
|
|
6384
|
+
var TableRow = React20.forwardRef(
|
|
6385
|
+
(props, ref) => /* @__PURE__ */ jsxRuntime.jsx(react.Table.Row, { ref, ...props })
|
|
6386
|
+
);
|
|
6387
|
+
TableRow.displayName = "TableRow";
|
|
6388
|
+
var TableBody = React20.forwardRef(
|
|
6389
|
+
({ children, ...rest }, ref) => {
|
|
6390
|
+
const { sortState } = useTableSort();
|
|
6391
|
+
const sorted = React20.useMemo(
|
|
6392
|
+
() => sortState.columnIndex == null ? children : sortRows(children, sortState.columnIndex, sortState.direction),
|
|
6393
|
+
[children, sortState]
|
|
6394
|
+
);
|
|
6395
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Table.Body, { ref, ...rest, children: sorted });
|
|
6396
|
+
}
|
|
6397
|
+
);
|
|
6398
|
+
TableBody.displayName = "TableBody";
|
|
6305
6399
|
var attachedInputsRecipe = react.defineRecipe({
|
|
6306
6400
|
base: {
|
|
6307
6401
|
display: "flex",
|
|
@@ -11869,10 +11963,6 @@ Object.defineProperty(exports, "Stack", {
|
|
|
11869
11963
|
enumerable: true,
|
|
11870
11964
|
get: function () { return react.Stack; }
|
|
11871
11965
|
});
|
|
11872
|
-
Object.defineProperty(exports, "TableBody", {
|
|
11873
|
-
enumerable: true,
|
|
11874
|
-
get: function () { return react.TableBody; }
|
|
11875
|
-
});
|
|
11876
11966
|
Object.defineProperty(exports, "TableCaption", {
|
|
11877
11967
|
enumerable: true,
|
|
11878
11968
|
get: function () { return react.TableCaption; }
|
|
@@ -11889,10 +11979,6 @@ Object.defineProperty(exports, "TableColumnGroup", {
|
|
|
11889
11979
|
enumerable: true,
|
|
11890
11980
|
get: function () { return react.TableColumnGroup; }
|
|
11891
11981
|
});
|
|
11892
|
-
Object.defineProperty(exports, "TableColumnHeader", {
|
|
11893
|
-
enumerable: true,
|
|
11894
|
-
get: function () { return react.TableColumnHeader; }
|
|
11895
|
-
});
|
|
11896
11982
|
Object.defineProperty(exports, "TableFooter", {
|
|
11897
11983
|
enumerable: true,
|
|
11898
11984
|
get: function () { return react.TableFooter; }
|
|
@@ -11905,10 +11991,6 @@ Object.defineProperty(exports, "TableRoot", {
|
|
|
11905
11991
|
enumerable: true,
|
|
11906
11992
|
get: function () { return react.TableRoot; }
|
|
11907
11993
|
});
|
|
11908
|
-
Object.defineProperty(exports, "TableRow", {
|
|
11909
|
-
enumerable: true,
|
|
11910
|
-
get: function () { return react.TableRow; }
|
|
11911
|
-
});
|
|
11912
11994
|
Object.defineProperty(exports, "VStack", {
|
|
11913
11995
|
enumerable: true,
|
|
11914
11996
|
get: function () { return react.VStack; }
|
|
@@ -12160,6 +12242,9 @@ exports.StepperStep = StepperStep;
|
|
|
12160
12242
|
exports.SvgBox = SvgBox;
|
|
12161
12243
|
exports.Switch = Switch;
|
|
12162
12244
|
exports.Table = Table;
|
|
12245
|
+
exports.TableBody = TableBody;
|
|
12246
|
+
exports.TableColumnHeader = TableColumnHeader;
|
|
12247
|
+
exports.TableRow = TableRow;
|
|
12163
12248
|
exports.Tabs = Tabs;
|
|
12164
12249
|
exports.TabsContent = TabsContent;
|
|
12165
12250
|
exports.TabsIndicator = TabsIndicator;
|
|
@@ -12184,6 +12269,7 @@ exports.themes = themes;
|
|
|
12184
12269
|
exports.useCalendar = useCalendar;
|
|
12185
12270
|
exports.useColorMode = useColorMode;
|
|
12186
12271
|
exports.useColorModeValue = useColorModeValue;
|
|
12272
|
+
exports.useTableSort = useTableSort;
|
|
12187
12273
|
exports.useTranslation = useTranslation;
|
|
12188
12274
|
//# sourceMappingURL=out.js.map
|
|
12189
12275
|
//# sourceMappingURL=index.cjs.map
|