@vygruppen/spor-react 12.14.1 → 12.15.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 +18 -0
- package/dist/index.cjs +91 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +93 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/AlertIcon.tsx +30 -15
- package/src/button/ResponsiveButton.tsx +27 -0
- package/src/datepicker/CalendarCell.tsx +5 -3
- package/src/dialog/Drawer.tsx +38 -30
- package/src/dialog/types.ts +5 -0
- package/src/input/Switch.tsx +1 -1
- package/src/theme/slot-recipes/drawer.ts +2 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @vygruppen/spor-react@12.
|
2
|
+
> @vygruppen/spor-react@12.15.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
|
-
CJS dist/index.cjs 320.36 KB
|
15
14
|
CJS dist/icons/index.cjs 381.00 B
|
16
|
-
CJS dist/index.cjs.
|
15
|
+
CJS dist/index.cjs 321.40 KB
|
17
16
|
CJS dist/icons/index.cjs.map 157.00 B
|
18
|
-
CJS
|
19
|
-
|
17
|
+
CJS dist/index.cjs.map 639.88 KB
|
18
|
+
CJS ⚡️ Build success in 2787ms
|
19
|
+
ESM dist/index.mjs 299.67 KB
|
20
20
|
ESM dist/icons/index.mjs 110.00 B
|
21
|
-
ESM dist/index.mjs.map 637.96 KB
|
22
21
|
ESM dist/icons/index.mjs.map 157.00 B
|
23
|
-
ESM
|
24
|
-
|
22
|
+
ESM dist/index.mjs.map 639.88 KB
|
23
|
+
ESM ⚡️ Build success in 2787ms
|
24
|
+
DTS ⚡️ Build success in 19000ms
|
25
25
|
DTS dist/icons/index.d.ts 44.00 B
|
26
|
-
DTS dist/index.d.ts 157.
|
26
|
+
DTS dist/index.d.ts 157.14 KB
|
27
27
|
DTS dist/icons/index.d.cts 44.00 B
|
28
|
-
DTS dist/index.d.cts 157.
|
28
|
+
DTS dist/index.d.cts 157.14 KB
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
> @vygruppen/spor-react@12.
|
2
|
+
> @vygruppen/spor-react@12.15.0 postinstall /home/runner/work/spor/spor/packages/spor-react
|
3
3
|
> chakra typegen src/theme/index.ts
|
4
4
|
|
5
|
-
[dotenv@17.2.2] injecting env (0) from .env -- tip: ⚙️
|
5
|
+
[dotenv@17.2.2] injecting env (0) from .env -- tip: ⚙️ enable debug logging with { debug: 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,23 @@
|
|
1
1
|
# @vygruppen/spor-react
|
2
2
|
|
3
|
+
## 12.15.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- a07b8f6: Prevent calendar cell button from performing form submittion by setting type to button.
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- 181fdcd: Update design of Alerts to support darkmode.
|
12
|
+
- b422895: Add props showText to DrawerCloseTrigger and hideHandle to DrawerContent
|
13
|
+
|
14
|
+
## 12.14.2
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- 02bdd99: Fix issue where switch without label has empty space on right
|
19
|
+
- 2b611fa: Fix layout on full screen drawer header.
|
20
|
+
|
3
21
|
## 12.14.1
|
4
22
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -962,46 +962,56 @@ var useScrollDirection = () => {
|
|
962
962
|
return scrollDirection;
|
963
963
|
};
|
964
964
|
var AlertIcon = React27.forwardRef(
|
965
|
-
({ variant, customIcon }, ref) => {
|
965
|
+
({ variant, customIcon: CustomAlertIcon }, ref) => {
|
966
966
|
const { t } = useTranslation();
|
967
|
-
const Icon3 = customIcon ?? getIcon(variant);
|
968
967
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
969
968
|
react.Box,
|
970
969
|
{
|
971
|
-
|
970
|
+
asChild: true,
|
972
971
|
ref,
|
973
972
|
"aria-label": t(texts5[variant]),
|
974
|
-
|
973
|
+
children: CustomAlertIcon ? /* @__PURE__ */ jsxRuntime.jsx(CustomAlertIcon, { color: `alert.${variant}.icon` }) : /* @__PURE__ */ jsxRuntime.jsx(BaseAlertIcon, { variant })
|
975
974
|
}
|
976
975
|
);
|
977
976
|
}
|
978
977
|
);
|
979
978
|
AlertIcon.displayName = "AlertIcon";
|
980
|
-
var
|
979
|
+
var BaseAlertIcon = ({ variant }) => {
|
980
|
+
const css = {
|
981
|
+
"& path:first-of-type": {
|
982
|
+
fill: `alert.${variant}.icon`
|
983
|
+
},
|
984
|
+
"& path:not(:first-of-type)": {
|
985
|
+
fill: `alert.${variant}.surface`
|
986
|
+
}
|
987
|
+
};
|
981
988
|
switch (variant) {
|
982
989
|
case "info": {
|
983
|
-
return sporIconReact.InformationFill24Icon;
|
990
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.InformationFill24Icon, { css });
|
984
991
|
}
|
985
992
|
case "success": {
|
986
|
-
return sporIconReact.SuccessFill24Icon;
|
993
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.SuccessFill24Icon, { css });
|
987
994
|
}
|
988
995
|
case "important": {
|
989
|
-
return sporIconReact.WarningFill24Icon;
|
996
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.WarningFill24Icon, {});
|
990
997
|
}
|
991
998
|
case "alt": {
|
992
|
-
return sporIconReact.AltTransportFill24Icon;
|
999
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.AltTransportFill24Icon, { css });
|
993
1000
|
}
|
994
1001
|
case "error": {
|
995
|
-
return sporIconReact.ErrorFill24Icon;
|
1002
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.ErrorFill24Icon, { css });
|
996
1003
|
}
|
997
1004
|
case "error-secondary": {
|
998
|
-
return sporIconReact.ErrorOutline24Icon;
|
1005
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.ErrorOutline24Icon, { css });
|
999
1006
|
}
|
1000
1007
|
case "neutral": {
|
1001
|
-
return sporIconReact.QuestionFill24Icon;
|
1008
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.QuestionFill24Icon, { css });
|
1002
1009
|
}
|
1003
1010
|
case "service": {
|
1004
|
-
return sporIconReact.ServiceFill24Icon;
|
1011
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.ServiceFill24Icon, {});
|
1012
|
+
}
|
1013
|
+
default: {
|
1014
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.InformationFill24Icon, { css });
|
1005
1015
|
}
|
1006
1016
|
}
|
1007
1017
|
};
|
@@ -1406,6 +1416,20 @@ var FieldErrorText = React27__namespace.forwardRef((props, ref) => {
|
|
1406
1416
|
});
|
1407
1417
|
FieldErrorText.displayName = "FieldErrorText";
|
1408
1418
|
var FieldLabel = react.Field.Label;
|
1419
|
+
|
1420
|
+
// src/util/slugify.tsx
|
1421
|
+
function slugify(text, maxLength = 50) {
|
1422
|
+
if (!text) {
|
1423
|
+
return text;
|
1424
|
+
}
|
1425
|
+
if (Array.isArray(text)) {
|
1426
|
+
text = text.join(" ");
|
1427
|
+
}
|
1428
|
+
if (maxLength < 1) {
|
1429
|
+
throw new Error("The maxLength parameter must be a positive number");
|
1430
|
+
}
|
1431
|
+
return text.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[\u00C6\u00E6]/g, "ae").replaceAll(/[\u00D8\u00F8]/g, "oe").replaceAll(/[\u00C5\u00E5]/g, "aa").toLowerCase().replaceAll(/\s+/g, "-").replaceAll(/[^\w-]+/g, "").replaceAll(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "").slice(0, Math.max(0, maxLength));
|
1432
|
+
}
|
1409
1433
|
function CalendarCell({
|
1410
1434
|
state,
|
1411
1435
|
date: date$1,
|
@@ -1450,9 +1474,9 @@ function CalendarCell({
|
|
1450
1474
|
);
|
1451
1475
|
}, []);
|
1452
1476
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { as: "td", ...cellProps, textAlign: "center", css: styles.cell, children: /* @__PURE__ */ jsxRuntime.jsx(
|
1453
|
-
react.
|
1477
|
+
react.chakra.button,
|
1454
1478
|
{
|
1455
|
-
|
1479
|
+
type: "button",
|
1456
1480
|
...buttonProps,
|
1457
1481
|
...stateProps,
|
1458
1482
|
ref,
|
@@ -2159,20 +2183,6 @@ function DateRangePicker({
|
|
2159
2183
|
] })
|
2160
2184
|
] }) });
|
2161
2185
|
}
|
2162
|
-
|
2163
|
-
// src/util/slugify.tsx
|
2164
|
-
function slugify(text, maxLength = 50) {
|
2165
|
-
if (!text) {
|
2166
|
-
return text;
|
2167
|
-
}
|
2168
|
-
if (Array.isArray(text)) {
|
2169
|
-
text = text.join(" ");
|
2170
|
-
}
|
2171
|
-
if (maxLength < 1) {
|
2172
|
-
throw new Error("The maxLength parameter must be a positive number");
|
2173
|
-
}
|
2174
|
-
return text.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[\u00C6\u00E6]/g, "ae").replaceAll(/[\u00D8\u00F8]/g, "oe").replaceAll(/[\u00C5\u00E5]/g, "aa").toLowerCase().replaceAll(/\s+/g, "-").replaceAll(/[^\w-]+/g, "").replaceAll(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "").slice(0, Math.max(0, maxLength));
|
2175
|
-
}
|
2176
2186
|
var TimeField = ({ state, ...props }) => {
|
2177
2187
|
const ref = React27.useRef(null);
|
2178
2188
|
const { labelProps, fieldProps } = reactAria.useTimeField(props, state, ref);
|
@@ -2375,12 +2385,32 @@ var DialogTitle = react.Dialog.Title;
|
|
2375
2385
|
var DialogDescription = react.Dialog.Description;
|
2376
2386
|
var DialogTrigger = react.Dialog.Trigger;
|
2377
2387
|
var DialogActionTrigger = react.Dialog.ActionTrigger;
|
2388
|
+
var ResponsiveButton = ({ label, icon, ...props }) => {
|
2389
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
2390
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { display: ["none", "flex"], leftIcon: icon, ...props, children: label }),
|
2391
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2392
|
+
IconButton,
|
2393
|
+
{
|
2394
|
+
display: ["flex", "none"],
|
2395
|
+
"aria-label": label,
|
2396
|
+
icon,
|
2397
|
+
...props
|
2398
|
+
}
|
2399
|
+
)
|
2400
|
+
] });
|
2401
|
+
};
|
2378
2402
|
var [RootDrawerProvider, useRootDrawerProps] = react.createContext({
|
2379
2403
|
name: "RootDrawerProvider"
|
2380
2404
|
});
|
2381
2405
|
var DrawerContent = React27.forwardRef(
|
2382
2406
|
(props, ref) => {
|
2383
|
-
const {
|
2407
|
+
const {
|
2408
|
+
children,
|
2409
|
+
portalled = true,
|
2410
|
+
portalRef,
|
2411
|
+
hideHandle = false,
|
2412
|
+
...rest
|
2413
|
+
} = props;
|
2384
2414
|
const { size, placement } = useRootDrawerProps();
|
2385
2415
|
const { setOpen } = react.useDialogContext();
|
2386
2416
|
const handlers = reactSwipeable.useSwipeable({
|
@@ -2393,10 +2423,11 @@ var DrawerContent = React27.forwardRef(
|
|
2393
2423
|
swipeDuration: 250
|
2394
2424
|
});
|
2395
2425
|
const sizeNotFull = size !== "full";
|
2426
|
+
const showHandle = !hideHandle;
|
2396
2427
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.Positioner, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { ...handlers, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Content, { ref, ...rest, children: [
|
2397
|
-
sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {}),
|
2428
|
+
showHandle && sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {}),
|
2398
2429
|
children,
|
2399
|
-
sizeNotFull && placement === "top" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {})
|
2430
|
+
showHandle && sizeNotFull && placement === "top" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {})
|
2400
2431
|
] }) }) }) });
|
2401
2432
|
}
|
2402
2433
|
);
|
@@ -2419,22 +2450,40 @@ var CloseDrawerLine = React27.forwardRef((props, ref) => {
|
|
2419
2450
|
});
|
2420
2451
|
CloseDrawerLine.displayName = "CloseDrawerLine";
|
2421
2452
|
var DrawerCloseTrigger = React27.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
2453
|
+
const { showText = false, ...rest } = props;
|
2422
2454
|
const { size } = useRootDrawerProps();
|
2423
2455
|
const { t } = useTranslation();
|
2424
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { ref, ...
|
2456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { ref, ...rest, asChild: true, children: showText || size === "full" ? /* @__PURE__ */ jsxRuntime.jsx(
|
2457
|
+
ResponsiveButton,
|
2458
|
+
{
|
2459
|
+
variant: "ghost",
|
2460
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.CloseFill24Icon, {}),
|
2461
|
+
label: t(texts12.close)
|
2462
|
+
}
|
2463
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { size: "md" }) });
|
2425
2464
|
});
|
2426
2465
|
var DrawerBackTrigger = React27.forwardRef((props, ref) => {
|
2427
2466
|
const { t } = useTranslation();
|
2428
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { asChild: true, ...props, ref,
|
2467
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ jsxRuntime.jsx(
|
2468
|
+
ResponsiveButton,
|
2469
|
+
{
|
2470
|
+
variant: "ghost",
|
2471
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.ArrowLeftFill24Icon, {}),
|
2472
|
+
label: t(texts12.back)
|
2473
|
+
}
|
2474
|
+
) });
|
2429
2475
|
});
|
2430
2476
|
DrawerBackTrigger.displayName = "DrawerBackTrigger";
|
2431
2477
|
var DrawerFullScreenHeader = React27.forwardRef((props, ref) => {
|
2432
2478
|
const { backTrigger = true, closeTrigger = true, children } = props;
|
2433
|
-
return /* @__PURE__ */ jsxRuntime.
|
2434
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.
|
2435
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2436
|
-
|
2437
|
-
|
2479
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Header, { ...props, ref, children: [
|
2480
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { children: backTrigger && /* @__PURE__ */ jsxRuntime.jsx(DrawerBackTrigger, {}) }),
|
2481
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children }),
|
2482
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
2483
|
+
" ",
|
2484
|
+
closeTrigger && /* @__PURE__ */ jsxRuntime.jsx(DrawerCloseTrigger, {})
|
2485
|
+
] })
|
2486
|
+
] });
|
2438
2487
|
});
|
2439
2488
|
DrawerFullScreenHeader.displayName = "DrawerFullScreenHeader";
|
2440
2489
|
var Drawer = (props) => {
|
@@ -3691,7 +3740,7 @@ var Switch = React27.forwardRef(
|
|
3691
3740
|
children: [
|
3692
3741
|
/* @__PURE__ */ jsxRuntime.jsx(react.Switch.HiddenInput, { ref }),
|
3693
3742
|
/* @__PURE__ */ jsxRuntime.jsx(react.Switch.Control, { css: styles.control, children: /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Thumb, {}) }),
|
3694
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Switch.Label, { children: label })
|
3743
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Label, { children: label })
|
3695
3744
|
]
|
3696
3745
|
}
|
3697
3746
|
)
|
@@ -7681,7 +7730,8 @@ var drawerSlotRecipe = react.defineSlotRecipe({
|
|
7681
7730
|
display: "flex",
|
7682
7731
|
alignItems: "center",
|
7683
7732
|
justifyContent: "space-between",
|
7684
|
-
paddingX: ["
|
7733
|
+
paddingX: ["2", null, null, "5"],
|
7734
|
+
gap: "1",
|
7685
7735
|
paddingBottom: "1"
|
7686
7736
|
},
|
7687
7737
|
body: {
|