@vygruppen/spor-react 12.22.2 → 12.24.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 +21 -0
- package/dist/index.cjs +151 -56
- 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 +151 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- 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 +156 -16
- 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.24.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
|
|
14
|
+
ESM dist/index.mjs 330.53 KB
|
|
15
15
|
ESM dist/icons/index.mjs 110.00 B
|
|
16
|
-
ESM dist/index.mjs.map
|
|
16
|
+
ESM dist/index.mjs.map 700.07 KB
|
|
17
17
|
ESM dist/icons/index.mjs.map 157.00 B
|
|
18
|
-
ESM ⚡️ Build success in
|
|
19
|
-
CJS dist/index.cjs
|
|
18
|
+
ESM ⚡️ Build success in 2926ms
|
|
19
|
+
CJS dist/index.cjs 354.42 KB
|
|
20
20
|
CJS dist/icons/index.cjs 381.00 B
|
|
21
|
-
CJS dist/index.cjs.map
|
|
21
|
+
CJS dist/index.cjs.map 700.07 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 2927ms
|
|
24
|
+
DTS ⚡️ Build success in 22676ms
|
|
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.24.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: ⚙️ override existing env vars with { override: true }
|
|
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,26 @@
|
|
|
1
1
|
# @vygruppen/spor-react
|
|
2
2
|
|
|
3
|
+
## 12.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5afeedd: Updated the Table sortable styling
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @vygruppen/spor-icon-react@4.5.1
|
|
12
|
+
|
|
13
|
+
## 12.23.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- b179f2f: Added a props `sortable` to Table that lets you sort columns by clicking on them.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 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.
|
|
22
|
+
- @vygruppen/spor-icon-react@4.5.1
|
|
23
|
+
|
|
3
24
|
## 12.22.2
|
|
4
25
|
|
|
5
26
|
### 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,130 @@ 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
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6284
|
+
var getNextSortState = (current, key, columnIndex) => {
|
|
6285
|
+
if (current.key !== key)
|
|
6286
|
+
return { key, columnIndex, direction: "asc" };
|
|
6287
|
+
if (current.direction === "asc")
|
|
6288
|
+
return { key, columnIndex, direction: "desc" };
|
|
6289
|
+
return { key: null, direction: "asc", columnIndex: null };
|
|
6290
|
+
};
|
|
6291
|
+
var getSortKey = (children) => typeof children === "string" ? children.trim() : null;
|
|
6292
|
+
var getColumnIndex = (element) => {
|
|
6293
|
+
var _a5;
|
|
6294
|
+
return Array.prototype.indexOf.call((_a5 = element.parentElement) == null ? void 0 : _a5.children, element);
|
|
6295
|
+
};
|
|
6296
|
+
var getCellText = (row, columnIndex) => {
|
|
6297
|
+
const cell = React20.Children.toArray(
|
|
6298
|
+
row.props.children
|
|
6299
|
+
)[columnIndex];
|
|
6300
|
+
if (!React20.isValidElement(cell))
|
|
6301
|
+
return "";
|
|
6302
|
+
const props = cell.props;
|
|
6303
|
+
return typeof props["data-sort"] === "string" && props["data-sort"] || typeof props.children === "string" && props.children.trim() || "";
|
|
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)
|
|
6302
6310
|
);
|
|
6311
|
+
return direction === "asc" ? cmp : -cmp;
|
|
6312
|
+
});
|
|
6313
|
+
var SortContext = React20.createContext({
|
|
6314
|
+
enabled: false,
|
|
6315
|
+
sortState: { key: null, direction: "asc", columnIndex: null },
|
|
6316
|
+
onSort: () => {
|
|
6317
|
+
}
|
|
6303
6318
|
});
|
|
6319
|
+
var useTableSort = () => React20.useContext(SortContext);
|
|
6320
|
+
var Table = React20.forwardRef(
|
|
6321
|
+
({
|
|
6322
|
+
variant = "ghost",
|
|
6323
|
+
size,
|
|
6324
|
+
colorPalette = "green",
|
|
6325
|
+
children,
|
|
6326
|
+
sortable = false,
|
|
6327
|
+
...rest
|
|
6328
|
+
}, ref) => {
|
|
6329
|
+
const [sortState, setSortState] = React20.useState({
|
|
6330
|
+
key: null,
|
|
6331
|
+
direction: "asc",
|
|
6332
|
+
columnIndex: null
|
|
6333
|
+
});
|
|
6334
|
+
const handleSort = (key, columnIndex) => {
|
|
6335
|
+
if (!sortable)
|
|
6336
|
+
return;
|
|
6337
|
+
setSortState(getNextSortState(sortState, key, columnIndex));
|
|
6338
|
+
};
|
|
6339
|
+
const recipe = react.useSlotRecipe({ key: "table" });
|
|
6340
|
+
const styles = recipe({ variant, size });
|
|
6341
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6342
|
+
react.Table.Root,
|
|
6343
|
+
{
|
|
6344
|
+
variant,
|
|
6345
|
+
size,
|
|
6346
|
+
colorPalette,
|
|
6347
|
+
css: styles,
|
|
6348
|
+
ref,
|
|
6349
|
+
...rest,
|
|
6350
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6351
|
+
SortContext.Provider,
|
|
6352
|
+
{
|
|
6353
|
+
value: { enabled: sortable, sortState, onSort: handleSort },
|
|
6354
|
+
children
|
|
6355
|
+
}
|
|
6356
|
+
)
|
|
6357
|
+
}
|
|
6358
|
+
);
|
|
6359
|
+
}
|
|
6360
|
+
);
|
|
6304
6361
|
Table.displayName = "Table";
|
|
6362
|
+
var TableColumnHeader = React20.forwardRef(({ children, ...rest }, ref) => {
|
|
6363
|
+
const { enabled, sortState, onSort } = useTableSort();
|
|
6364
|
+
const key = getSortKey(children);
|
|
6365
|
+
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,
|
|
6383
|
+
{
|
|
6384
|
+
transform: "rotate(90deg)",
|
|
6385
|
+
color: "icon.disabled"
|
|
6386
|
+
}
|
|
6387
|
+
)
|
|
6388
|
+
}
|
|
6389
|
+
)
|
|
6390
|
+
] }) });
|
|
6391
|
+
});
|
|
6392
|
+
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
|
+
var TableBody = React20.forwardRef(
|
|
6398
|
+
({ children, ...rest }, ref) => {
|
|
6399
|
+
const { sortState } = useTableSort();
|
|
6400
|
+
const sorted = React20.useMemo(
|
|
6401
|
+
() => sortState.columnIndex == null ? children : sortRows(children, sortState.columnIndex, sortState.direction),
|
|
6402
|
+
[children, sortState]
|
|
6403
|
+
);
|
|
6404
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Table.Body, { ref, ...rest, children: sorted });
|
|
6405
|
+
}
|
|
6406
|
+
);
|
|
6407
|
+
TableBody.displayName = "TableBody";
|
|
6305
6408
|
var attachedInputsRecipe = react.defineRecipe({
|
|
6306
6409
|
base: {
|
|
6307
6410
|
display: "flex",
|
|
@@ -11869,10 +11972,6 @@ Object.defineProperty(exports, "Stack", {
|
|
|
11869
11972
|
enumerable: true,
|
|
11870
11973
|
get: function () { return react.Stack; }
|
|
11871
11974
|
});
|
|
11872
|
-
Object.defineProperty(exports, "TableBody", {
|
|
11873
|
-
enumerable: true,
|
|
11874
|
-
get: function () { return react.TableBody; }
|
|
11875
|
-
});
|
|
11876
11975
|
Object.defineProperty(exports, "TableCaption", {
|
|
11877
11976
|
enumerable: true,
|
|
11878
11977
|
get: function () { return react.TableCaption; }
|
|
@@ -11889,10 +11988,6 @@ Object.defineProperty(exports, "TableColumnGroup", {
|
|
|
11889
11988
|
enumerable: true,
|
|
11890
11989
|
get: function () { return react.TableColumnGroup; }
|
|
11891
11990
|
});
|
|
11892
|
-
Object.defineProperty(exports, "TableColumnHeader", {
|
|
11893
|
-
enumerable: true,
|
|
11894
|
-
get: function () { return react.TableColumnHeader; }
|
|
11895
|
-
});
|
|
11896
11991
|
Object.defineProperty(exports, "TableFooter", {
|
|
11897
11992
|
enumerable: true,
|
|
11898
11993
|
get: function () { return react.TableFooter; }
|
|
@@ -11905,10 +12000,6 @@ Object.defineProperty(exports, "TableRoot", {
|
|
|
11905
12000
|
enumerable: true,
|
|
11906
12001
|
get: function () { return react.TableRoot; }
|
|
11907
12002
|
});
|
|
11908
|
-
Object.defineProperty(exports, "TableRow", {
|
|
11909
|
-
enumerable: true,
|
|
11910
|
-
get: function () { return react.TableRow; }
|
|
11911
|
-
});
|
|
11912
12003
|
Object.defineProperty(exports, "VStack", {
|
|
11913
12004
|
enumerable: true,
|
|
11914
12005
|
get: function () { return react.VStack; }
|
|
@@ -12160,6 +12251,9 @@ exports.StepperStep = StepperStep;
|
|
|
12160
12251
|
exports.SvgBox = SvgBox;
|
|
12161
12252
|
exports.Switch = Switch;
|
|
12162
12253
|
exports.Table = Table;
|
|
12254
|
+
exports.TableBody = TableBody;
|
|
12255
|
+
exports.TableColumnHeader = TableColumnHeader;
|
|
12256
|
+
exports.TableRow = TableRow;
|
|
12163
12257
|
exports.Tabs = Tabs;
|
|
12164
12258
|
exports.TabsContent = TabsContent;
|
|
12165
12259
|
exports.TabsIndicator = TabsIndicator;
|
|
@@ -12184,6 +12278,7 @@ exports.themes = themes;
|
|
|
12184
12278
|
exports.useCalendar = useCalendar;
|
|
12185
12279
|
exports.useColorMode = useColorMode;
|
|
12186
12280
|
exports.useColorModeValue = useColorModeValue;
|
|
12281
|
+
exports.useTableSort = useTableSort;
|
|
12187
12282
|
exports.useTranslation = useTranslation;
|
|
12188
12283
|
//# sourceMappingURL=out.js.map
|
|
12189
12284
|
//# sourceMappingURL=index.cjs.map
|