@vygruppen/spor-react 12.22.1 → 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 +25 -0
- package/dist/index.cjs +209 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.mjs +222 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/alert/AlertIcon.tsx +5 -1
- package/src/input/AttachedInputs.tsx +2 -2
- package/src/input/Autocomplete.tsx +42 -22
- package/src/input/CountryCodeSelect.tsx +1 -0
- package/src/input/Field.tsx +3 -1
- package/src/input/FloatingLabel.tsx +2 -2
- package/src/input/Input.tsx +6 -1
- package/src/input/NumericStepper.tsx +1 -4
- 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/src/theme/recipes/attached-inputs.ts +3 -2
- package/src/theme/slot-recipes/autocomplete.ts +0 -1
- package/src/theme/tokens/text-styles.ts +0 -18
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.81 KB
|
|
15
14
|
ESM dist/icons/index.mjs 110.00 B
|
|
15
|
+
ESM dist/index.mjs 330.04 KB
|
|
16
16
|
ESM dist/icons/index.mjs.map 157.00 B
|
|
17
|
-
ESM dist/index.mjs.map
|
|
18
|
-
ESM ⚡️ Build success in
|
|
19
|
-
CJS dist/index.cjs
|
|
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,30 @@
|
|
|
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
|
+
|
|
14
|
+
## 12.22.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 815694c: Improvements to Autocomplete accessibility and bugfixes.
|
|
19
|
+
|
|
20
|
+
Also fix floatingLabel fontSize not being set to 2xs.
|
|
21
|
+
|
|
22
|
+
- 877bd20: Remove unessesary ids from numeric stepper buttons
|
|
23
|
+
- 98504fe: Change from using aria-label in Box to adding a VisuallyHidden elements for better screen reader support of AlertIcon.
|
|
24
|
+
- 3bfb2b1: Align Text font-size breakpoint with other components
|
|
25
|
+
|
|
26
|
+
Changed responsive font-size steps so Text switches size at sm (568px) instead of lg (1025px). This fixes visual size mismatches across the design system.
|
|
27
|
+
|
|
3
28
|
## 12.22.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1043,7 +1043,10 @@ var useScrollDirection = () => {
|
|
|
1043
1043
|
var AlertIcon = React20.forwardRef(
|
|
1044
1044
|
({ variant, customIcon: CustomAlertIcon }, ref) => {
|
|
1045
1045
|
const { t } = useTranslation();
|
|
1046
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { ref, children: [
|
|
1047
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactAria.VisuallyHidden, { children: t(texts5[variant]) }),
|
|
1048
|
+
CustomAlertIcon ? /* @__PURE__ */ jsxRuntime.jsx(CustomAlertIcon, { color: `alert.${variant}.icon` }) : /* @__PURE__ */ jsxRuntime.jsx(BaseAlertIcon, { variant })
|
|
1049
|
+
] });
|
|
1047
1050
|
}
|
|
1048
1051
|
);
|
|
1049
1052
|
AlertIcon.displayName = "AlertIcon";
|
|
@@ -1919,12 +1922,12 @@ var floatingLabelStyles = react.defineStyle({
|
|
|
1919
1922
|
opacity: 0.4
|
|
1920
1923
|
},
|
|
1921
1924
|
pos: "absolute",
|
|
1922
|
-
transition: "
|
|
1925
|
+
transition: "top 160ms ease, font-size 160ms ease",
|
|
1923
1926
|
top: "0.9rem",
|
|
1924
1927
|
color: "text",
|
|
1925
1928
|
fontSize: ["mobile.sm", "desktop.sm"],
|
|
1926
1929
|
"&[data-float]": {
|
|
1927
|
-
fontSize: ["mobile.
|
|
1930
|
+
fontSize: ["mobile.2xs", "desktop.2xs"],
|
|
1928
1931
|
color: "text",
|
|
1929
1932
|
top: "0.3rem"
|
|
1930
1933
|
}
|
|
@@ -1998,7 +2001,7 @@ var Field3 = React20__namespace.forwardRef(
|
|
|
1998
2001
|
children: renderLabelWithIndicator(label, labelAsChild)
|
|
1999
2002
|
}
|
|
2000
2003
|
),
|
|
2001
|
-
errorText && /* @__PURE__ */ jsxRuntime.jsx(react.Field.ErrorText, { children: errorText })
|
|
2004
|
+
errorText && /* @__PURE__ */ jsxRuntime.jsx(react.Field.ErrorText, { "aria-live": "polite", children: errorText })
|
|
2002
2005
|
]
|
|
2003
2006
|
}
|
|
2004
2007
|
),
|
|
@@ -3123,7 +3126,7 @@ var SwitchButton = react.chakra(
|
|
|
3123
3126
|
react.defineRecipe({
|
|
3124
3127
|
base: {
|
|
3125
3128
|
position: "absolute !important",
|
|
3126
|
-
zIndex: "
|
|
3129
|
+
zIndex: "101 !important",
|
|
3127
3130
|
// eslint-disable-next-line spor/use-semantic-tokens
|
|
3128
3131
|
bg: "bg !important",
|
|
3129
3132
|
outlineWidth: "1px !important",
|
|
@@ -3139,7 +3142,7 @@ var SwitchButton = react.chakra(
|
|
|
3139
3142
|
},
|
|
3140
3143
|
vertical: {
|
|
3141
3144
|
top: "calc(50% - 15px)",
|
|
3142
|
-
right: "
|
|
3145
|
+
right: "3rem",
|
|
3143
3146
|
transform: "rotate(90deg)"
|
|
3144
3147
|
}
|
|
3145
3148
|
}
|
|
@@ -3234,6 +3237,7 @@ var Input = React20.forwardRef(
|
|
|
3234
3237
|
const recipe = react.useRecipe({ key: "input" });
|
|
3235
3238
|
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
|
3236
3239
|
const styles = recipe(recipeProps);
|
|
3240
|
+
const labelId = React20.useId();
|
|
3237
3241
|
const inputRef = React20.useRef(null);
|
|
3238
3242
|
React20.useImperativeHandle(ref, () => inputRef.current, []);
|
|
3239
3243
|
const { shouldFloat, handleFocus, handleBlur, handleChange, isControlled } = useFloatingInputState({
|
|
@@ -3254,7 +3258,7 @@ var Input = React20.forwardRef(
|
|
|
3254
3258
|
errorText,
|
|
3255
3259
|
id: props.id,
|
|
3256
3260
|
labelAsChild,
|
|
3257
|
-
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, {
|
|
3261
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { id: labelId, children: [
|
|
3258
3262
|
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
|
|
3259
3263
|
label
|
|
3260
3264
|
] }),
|
|
@@ -3266,6 +3270,7 @@ var Input = React20.forwardRef(
|
|
|
3266
3270
|
{
|
|
3267
3271
|
pointerEvents: "none",
|
|
3268
3272
|
paddingX: 2,
|
|
3273
|
+
"aria-hidden": "true",
|
|
3269
3274
|
fontSize: fontSize ?? "mobile.md",
|
|
3270
3275
|
children: startElement
|
|
3271
3276
|
}
|
|
@@ -3287,7 +3292,8 @@ var Input = React20.forwardRef(
|
|
|
3287
3292
|
onChange: handleChange,
|
|
3288
3293
|
placeholder: "",
|
|
3289
3294
|
css: styles,
|
|
3290
|
-
fontSize: fontSize ?? "mobile.md"
|
|
3295
|
+
fontSize: fontSize ?? "mobile.md",
|
|
3296
|
+
"aria-labelledby": labelId
|
|
3291
3297
|
}
|
|
3292
3298
|
),
|
|
3293
3299
|
endElement && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3318,6 +3324,9 @@ var Autocomplete = ({
|
|
|
3318
3324
|
filteredExternally,
|
|
3319
3325
|
loading,
|
|
3320
3326
|
disabled,
|
|
3327
|
+
emptyLabel,
|
|
3328
|
+
openOnClick = true,
|
|
3329
|
+
openOnFocus = true,
|
|
3321
3330
|
...rest
|
|
3322
3331
|
}) => {
|
|
3323
3332
|
const { contains } = react.useFilter({ sensitivity: "base" });
|
|
@@ -3338,50 +3347,52 @@ var Autocomplete = ({
|
|
|
3338
3347
|
() => filterChildren(children, collection.items),
|
|
3339
3348
|
[children, collection.items]
|
|
3340
3349
|
);
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
mainAxis: 3,
|
|
3356
|
-
crossAxis: -1
|
|
3357
|
-
},
|
|
3358
|
-
flip: false
|
|
3350
|
+
const combobox = react.useCombobox({
|
|
3351
|
+
collection,
|
|
3352
|
+
openOnClick,
|
|
3353
|
+
onInputValueChange: (event) => {
|
|
3354
|
+
if (!filteredExternally) {
|
|
3355
|
+
filter(event.inputValue);
|
|
3356
|
+
}
|
|
3357
|
+
onInputValueChange == null ? void 0 : onInputValueChange(event);
|
|
3358
|
+
},
|
|
3359
|
+
positioning: {
|
|
3360
|
+
placement: "bottom",
|
|
3361
|
+
offset: {
|
|
3362
|
+
mainAxis: 3,
|
|
3363
|
+
crossAxis: -1
|
|
3359
3364
|
},
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3365
|
+
flip: false
|
|
3366
|
+
},
|
|
3367
|
+
disabled,
|
|
3368
|
+
...rest
|
|
3369
|
+
});
|
|
3370
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.RootProvider, { value: combobox, children: [
|
|
3371
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Control, { children: [
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Input, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3373
|
+
Input,
|
|
3374
|
+
{
|
|
3375
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Label, { children: label }),
|
|
3376
|
+
variant,
|
|
3377
|
+
labelAsChild: true,
|
|
3378
|
+
startElement: leftIcon,
|
|
3379
|
+
invalid,
|
|
3380
|
+
helperText,
|
|
3381
|
+
errorText,
|
|
3382
|
+
required,
|
|
3383
|
+
onFocus: () => {
|
|
3384
|
+
if (openOnFocus)
|
|
3385
|
+
combobox.setOpen(true);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
) }),
|
|
3389
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts14.clearValue), children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { size: "xs" }) }) })
|
|
3390
|
+
] }),
|
|
3391
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Content, { children: [
|
|
3392
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Empty, { children: !loading && (emptyLabel ?? t(texts14.noItemsFound)) }),
|
|
3393
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: filteredChildren })
|
|
3394
|
+
] }) })
|
|
3395
|
+
] });
|
|
3385
3396
|
};
|
|
3386
3397
|
var AutocompleteItemGroup = react.Combobox.ItemGroup;
|
|
3387
3398
|
var AutocompleteItemGroupLabel = react.Combobox.ItemGroupLabel;
|
|
@@ -3451,6 +3462,12 @@ var texts14 = createTexts({
|
|
|
3451
3462
|
nn: "Ingen resultat",
|
|
3452
3463
|
sv: "Inga resultat",
|
|
3453
3464
|
en: "No results found"
|
|
3465
|
+
},
|
|
3466
|
+
clearValue: {
|
|
3467
|
+
nb: "T\xF8m verdi",
|
|
3468
|
+
nn: "T\xF8m verdi",
|
|
3469
|
+
sv: "Rensa v\xE4rde",
|
|
3470
|
+
en: "Clear value"
|
|
3454
3471
|
}
|
|
3455
3472
|
});
|
|
3456
3473
|
var CardSelect = ({ size = "md", ...props }) => {
|
|
@@ -4016,7 +4033,6 @@ var NumericStepper = React20__namespace.default.forwardRef((props, ref) => {
|
|
|
4016
4033
|
{
|
|
4017
4034
|
css: styles.root,
|
|
4018
4035
|
width: "auto",
|
|
4019
|
-
id: idProperty,
|
|
4020
4036
|
ref,
|
|
4021
4037
|
label,
|
|
4022
4038
|
helperText,
|
|
@@ -4041,8 +4057,7 @@ var NumericStepper = React20__namespace.default.forwardRef((props, ref) => {
|
|
|
4041
4057
|
focusOnAddButton();
|
|
4042
4058
|
}
|
|
4043
4059
|
},
|
|
4044
|
-
disabled: disabled || value <= minValue
|
|
4045
|
-
id: value <= minValue ? void 0 : idProperty
|
|
4060
|
+
disabled: disabled || value <= minValue
|
|
4046
4061
|
}
|
|
4047
4062
|
),
|
|
4048
4063
|
withInput ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4053,7 +4068,7 @@ var NumericStepper = React20__namespace.default.forwardRef((props, ref) => {
|
|
|
4053
4068
|
name: nameProperty,
|
|
4054
4069
|
value,
|
|
4055
4070
|
disabled,
|
|
4056
|
-
id:
|
|
4071
|
+
id: idProperty,
|
|
4057
4072
|
css: styles.input,
|
|
4058
4073
|
width: `${Math.max(value.toString().length + 1, 3)}ch`,
|
|
4059
4074
|
"aria-live": "assertive",
|
|
@@ -4091,8 +4106,7 @@ var NumericStepper = React20__namespace.default.forwardRef((props, ref) => {
|
|
|
4091
4106
|
)
|
|
4092
4107
|
),
|
|
4093
4108
|
onClick: () => onChange(Math.min(value + clampedStepSize, maxValue)),
|
|
4094
|
-
disabled: disabled || value >= maxValue
|
|
4095
|
-
id: value >= maxValue ? void 0 : idProperty
|
|
4109
|
+
disabled: disabled || value >= maxValue
|
|
4096
4110
|
}
|
|
4097
4111
|
)
|
|
4098
4112
|
]
|
|
@@ -4297,6 +4311,7 @@ var CountryCodeSelect = React20.forwardRef((props, ref) => {
|
|
|
4297
4311
|
lazyMount: true,
|
|
4298
4312
|
"aria-label": t(texts17.countryCode),
|
|
4299
4313
|
sideRadiusVariant: "rightSideSquare",
|
|
4314
|
+
role: "combobox",
|
|
4300
4315
|
children: filteredCallingCodes.items.map((code) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { item: code, children: code.label }, code.label))
|
|
4301
4316
|
}
|
|
4302
4317
|
);
|
|
@@ -4651,7 +4666,7 @@ var Textarea = React20.forwardRef(
|
|
|
4651
4666
|
errorText,
|
|
4652
4667
|
readOnly,
|
|
4653
4668
|
helperText,
|
|
4654
|
-
floatingLabel,
|
|
4669
|
+
floatingLabel = true,
|
|
4655
4670
|
...restProps
|
|
4656
4671
|
} = props;
|
|
4657
4672
|
const recipe = react.useRecipe({ key: "textarea" });
|
|
@@ -4667,7 +4682,8 @@ var Textarea = React20.forwardRef(
|
|
|
4667
4682
|
onChange: props.onChange,
|
|
4668
4683
|
inputRef
|
|
4669
4684
|
});
|
|
4670
|
-
|
|
4685
|
+
const labelId = React20.useId();
|
|
4686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4671
4687
|
Field3,
|
|
4672
4688
|
{
|
|
4673
4689
|
errorText,
|
|
@@ -4678,31 +4694,24 @@ var Textarea = React20.forwardRef(
|
|
|
4678
4694
|
floatingLabel,
|
|
4679
4695
|
shouldFloat,
|
|
4680
4696
|
position: "relative",
|
|
4681
|
-
children:
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
{
|
|
4700
|
-
ref: labelRef,
|
|
4701
|
-
"data-float": shouldFloat ? true : void 0,
|
|
4702
|
-
children: label
|
|
4703
|
-
}
|
|
4704
|
-
)
|
|
4705
|
-
]
|
|
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
|
+
)
|
|
4706
4715
|
}
|
|
4707
4716
|
);
|
|
4708
4717
|
}
|
|
@@ -6272,24 +6281,121 @@ var TabsList = react.Tabs.List;
|
|
|
6272
6281
|
var TabsTrigger = react.Tabs.Trigger;
|
|
6273
6282
|
var TabsIndicator = react.Tabs.Indicator;
|
|
6274
6283
|
var TabsContent = react.Tabs.Content;
|
|
6275
|
-
var
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
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;
|
|
6279
6364
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6280
|
-
react.Table.
|
|
6365
|
+
react.Table.ColumnHeader,
|
|
6281
6366
|
{
|
|
6282
|
-
variant,
|
|
6283
|
-
size,
|
|
6284
|
-
colorPalette,
|
|
6285
|
-
css: styles,
|
|
6286
6367
|
ref,
|
|
6287
|
-
|
|
6288
|
-
|
|
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
|
+
] })
|
|
6289
6380
|
}
|
|
6290
6381
|
);
|
|
6291
6382
|
});
|
|
6292
|
-
|
|
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";
|
|
6293
6399
|
var attachedInputsRecipe = react.defineRecipe({
|
|
6294
6400
|
base: {
|
|
6295
6401
|
display: "flex",
|
|
@@ -6300,10 +6406,10 @@ var attachedInputsRecipe = react.defineRecipe({
|
|
|
6300
6406
|
},
|
|
6301
6407
|
"& > *": {
|
|
6302
6408
|
position: "relative",
|
|
6303
|
-
zIndex:
|
|
6409
|
+
zIndex: 100
|
|
6304
6410
|
},
|
|
6305
6411
|
"& > *:focus-within": {
|
|
6306
|
-
zIndex:
|
|
6412
|
+
zIndex: 101
|
|
6307
6413
|
}
|
|
6308
6414
|
},
|
|
6309
6415
|
variants: {
|
|
@@ -7695,8 +7801,7 @@ var comboboxSlotRecipe = react.defineSlotRecipe({
|
|
|
7695
7801
|
},
|
|
7696
7802
|
label: {
|
|
7697
7803
|
fontWeight: "medium",
|
|
7698
|
-
userSelect: "none"
|
|
7699
|
-
textStyle: "sm"
|
|
7804
|
+
userSelect: "none"
|
|
7700
7805
|
},
|
|
7701
7806
|
input: {
|
|
7702
7807
|
transition: "border-radius",
|
|
@@ -11616,8 +11721,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11616
11721
|
value: {
|
|
11617
11722
|
fontSize: [
|
|
11618
11723
|
tokens23__namespace.default.font.style.xxl["font-size"].mobile,
|
|
11619
|
-
null,
|
|
11620
|
-
null,
|
|
11621
11724
|
tokens23__namespace.default.font.style.xxl["font-size"].desktop
|
|
11622
11725
|
],
|
|
11623
11726
|
fontFamily: tokens23__namespace.default.font.style.xxl["font-family"],
|
|
@@ -11628,8 +11731,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11628
11731
|
value: {
|
|
11629
11732
|
fontSize: [
|
|
11630
11733
|
tokens23__namespace.default.font.style["xl-display"]["font-size"].mobile,
|
|
11631
|
-
null,
|
|
11632
|
-
null,
|
|
11633
11734
|
tokens23__namespace.default.font.style["xl-display"]["font-size"].desktop
|
|
11634
11735
|
],
|
|
11635
11736
|
fontFamily: tokens23__namespace.default.font.style["xl-display"]["font-family"],
|
|
@@ -11640,8 +11741,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11640
11741
|
value: {
|
|
11641
11742
|
fontSize: [
|
|
11642
11743
|
tokens23__namespace.default.font.style["xl-sans"]["font-size"].mobile,
|
|
11643
|
-
null,
|
|
11644
|
-
null,
|
|
11645
11744
|
tokens23__namespace.default.font.style["xl-sans"]["font-size"].desktop
|
|
11646
11745
|
],
|
|
11647
11746
|
fontFamily: tokens23__namespace.default.font.style["xl-sans"]["font-family"],
|
|
@@ -11652,8 +11751,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11652
11751
|
value: {
|
|
11653
11752
|
fontSize: [
|
|
11654
11753
|
tokens23__namespace.default.font.style.lg["font-size"].mobile,
|
|
11655
|
-
null,
|
|
11656
|
-
null,
|
|
11657
11754
|
tokens23__namespace.default.font.style.lg["font-size"].desktop
|
|
11658
11755
|
],
|
|
11659
11756
|
fontFamily: tokens23__namespace.default.font.style.lg["font-family"],
|
|
@@ -11664,8 +11761,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11664
11761
|
value: {
|
|
11665
11762
|
fontSize: [
|
|
11666
11763
|
tokens23__namespace.default.font.style["md-lg"]["font-size"].mobile,
|
|
11667
|
-
null,
|
|
11668
|
-
null,
|
|
11669
11764
|
tokens23__namespace.default.font.style["md-lg"]["font-size"].desktop
|
|
11670
11765
|
],
|
|
11671
11766
|
fontFamily: tokens23__namespace.default.font.style["md-lg"]["font-family"],
|
|
@@ -11676,8 +11771,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11676
11771
|
value: {
|
|
11677
11772
|
fontSize: [
|
|
11678
11773
|
tokens23__namespace.default.font.style.md["font-size"].mobile,
|
|
11679
|
-
null,
|
|
11680
|
-
null,
|
|
11681
11774
|
tokens23__namespace.default.font.style.md["font-size"].desktop
|
|
11682
11775
|
],
|
|
11683
11776
|
fontFamily: tokens23__namespace.default.font.style.md["font-family"],
|
|
@@ -11688,8 +11781,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11688
11781
|
value: {
|
|
11689
11782
|
fontSize: [
|
|
11690
11783
|
tokens23__namespace.default.font.style.sm["font-size"].mobile,
|
|
11691
|
-
null,
|
|
11692
|
-
null,
|
|
11693
11784
|
tokens23__namespace.default.font.style.sm["font-size"].desktop
|
|
11694
11785
|
],
|
|
11695
11786
|
fontFamily: tokens23__namespace.default.font.style.sm["font-family"],
|
|
@@ -11700,8 +11791,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11700
11791
|
value: {
|
|
11701
11792
|
fontSize: [
|
|
11702
11793
|
tokens23__namespace.default.font.style.xs["font-size"].mobile,
|
|
11703
|
-
null,
|
|
11704
|
-
null,
|
|
11705
11794
|
tokens23__namespace.default.font.style.xs["font-size"].desktop
|
|
11706
11795
|
],
|
|
11707
11796
|
fontFamily: tokens23__namespace.default.font.style.xs["font-family"],
|
|
@@ -11712,8 +11801,6 @@ var textStyles = react.defineTextStyles({
|
|
|
11712
11801
|
value: {
|
|
11713
11802
|
fontSize: [
|
|
11714
11803
|
tokens23__namespace.default.font.style["2xs"]["font-size"].mobile,
|
|
11715
|
-
null,
|
|
11716
|
-
null,
|
|
11717
11804
|
tokens23__namespace.default.font.style["2xs"]["font-size"].desktop
|
|
11718
11805
|
],
|
|
11719
11806
|
fontFamily: tokens23__namespace.default.font.style["2xs"]["font-family"],
|
|
@@ -11876,10 +11963,6 @@ Object.defineProperty(exports, "Stack", {
|
|
|
11876
11963
|
enumerable: true,
|
|
11877
11964
|
get: function () { return react.Stack; }
|
|
11878
11965
|
});
|
|
11879
|
-
Object.defineProperty(exports, "TableBody", {
|
|
11880
|
-
enumerable: true,
|
|
11881
|
-
get: function () { return react.TableBody; }
|
|
11882
|
-
});
|
|
11883
11966
|
Object.defineProperty(exports, "TableCaption", {
|
|
11884
11967
|
enumerable: true,
|
|
11885
11968
|
get: function () { return react.TableCaption; }
|
|
@@ -11896,10 +11979,6 @@ Object.defineProperty(exports, "TableColumnGroup", {
|
|
|
11896
11979
|
enumerable: true,
|
|
11897
11980
|
get: function () { return react.TableColumnGroup; }
|
|
11898
11981
|
});
|
|
11899
|
-
Object.defineProperty(exports, "TableColumnHeader", {
|
|
11900
|
-
enumerable: true,
|
|
11901
|
-
get: function () { return react.TableColumnHeader; }
|
|
11902
|
-
});
|
|
11903
11982
|
Object.defineProperty(exports, "TableFooter", {
|
|
11904
11983
|
enumerable: true,
|
|
11905
11984
|
get: function () { return react.TableFooter; }
|
|
@@ -11912,10 +11991,6 @@ Object.defineProperty(exports, "TableRoot", {
|
|
|
11912
11991
|
enumerable: true,
|
|
11913
11992
|
get: function () { return react.TableRoot; }
|
|
11914
11993
|
});
|
|
11915
|
-
Object.defineProperty(exports, "TableRow", {
|
|
11916
|
-
enumerable: true,
|
|
11917
|
-
get: function () { return react.TableRow; }
|
|
11918
|
-
});
|
|
11919
11994
|
Object.defineProperty(exports, "VStack", {
|
|
11920
11995
|
enumerable: true,
|
|
11921
11996
|
get: function () { return react.VStack; }
|
|
@@ -12167,6 +12242,9 @@ exports.StepperStep = StepperStep;
|
|
|
12167
12242
|
exports.SvgBox = SvgBox;
|
|
12168
12243
|
exports.Switch = Switch;
|
|
12169
12244
|
exports.Table = Table;
|
|
12245
|
+
exports.TableBody = TableBody;
|
|
12246
|
+
exports.TableColumnHeader = TableColumnHeader;
|
|
12247
|
+
exports.TableRow = TableRow;
|
|
12170
12248
|
exports.Tabs = Tabs;
|
|
12171
12249
|
exports.TabsContent = TabsContent;
|
|
12172
12250
|
exports.TabsIndicator = TabsIndicator;
|
|
@@ -12191,6 +12269,7 @@ exports.themes = themes;
|
|
|
12191
12269
|
exports.useCalendar = useCalendar;
|
|
12192
12270
|
exports.useColorMode = useColorMode;
|
|
12193
12271
|
exports.useColorModeValue = useColorModeValue;
|
|
12272
|
+
exports.useTableSort = useTableSort;
|
|
12194
12273
|
exports.useTranslation = useTranslation;
|
|
12195
12274
|
//# sourceMappingURL=out.js.map
|
|
12196
12275
|
//# sourceMappingURL=index.cjs.map
|