@vygruppen/spor-react 12.14.2 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@12.14.2 build /home/runner/work/spor/spor/packages/spor-react
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
- ESM dist/index.mjs 298.93 KB
15
- ESM dist/icons/index.mjs 110.00 B
16
- ESM dist/icons/index.mjs.map 157.00 B
17
- ESM dist/index.mjs.map 638.54 KB
18
- ESM ⚡️ Build success in 2541ms
19
- CJS dist/index.cjs 320.53 KB
20
14
  CJS dist/icons/index.cjs 381.00 B
15
+ CJS dist/index.cjs 321.40 KB
21
16
  CJS dist/icons/index.cjs.map 157.00 B
22
- CJS dist/index.cjs.map 638.54 KB
23
- CJS ⚡️ Build success in 2541ms
24
- DTS ⚡️ Build success in 18296ms
17
+ CJS dist/index.cjs.map 639.88 KB
18
+ CJS ⚡️ Build success in 2787ms
19
+ ESM dist/index.mjs 299.67 KB
20
+ ESM dist/icons/index.mjs 110.00 B
21
+ ESM dist/icons/index.mjs.map 157.00 B
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.08 KB
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.08 KB
28
+ DTS dist/index.d.cts 157.14 KB
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@12.14.2 postinstall /home/runner/work/spor/spor/packages/spor-react
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
5
  [dotenv@17.2.2] injecting env (0) from .env -- tip: ⚙️ enable debug logging with { debug: true }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## 12.14.2
4
15
 
5
16
  ### 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
- as: Icon3,
970
+ asChild: true,
972
971
  ref,
973
972
  "aria-label": t(texts5[variant]),
974
- color: customIcon ? `alert.${variant}.icon` : void 0
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 getIcon = (variant) => {
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.Box,
1477
+ react.chakra.button,
1454
1478
  {
1455
- as: "button",
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);
@@ -2394,7 +2404,13 @@ var [RootDrawerProvider, useRootDrawerProps] = react.createContext({
2394
2404
  });
2395
2405
  var DrawerContent = React27.forwardRef(
2396
2406
  (props, ref) => {
2397
- const { children, portalled = true, portalRef, ...rest } = props;
2407
+ const {
2408
+ children,
2409
+ portalled = true,
2410
+ portalRef,
2411
+ hideHandle = false,
2412
+ ...rest
2413
+ } = props;
2398
2414
  const { size, placement } = useRootDrawerProps();
2399
2415
  const { setOpen } = react.useDialogContext();
2400
2416
  const handlers = reactSwipeable.useSwipeable({
@@ -2407,10 +2423,11 @@ var DrawerContent = React27.forwardRef(
2407
2423
  swipeDuration: 250
2408
2424
  });
2409
2425
  const sizeNotFull = size !== "full";
2426
+ const showHandle = !hideHandle;
2410
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: [
2411
- sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {}),
2428
+ showHandle && sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {}),
2412
2429
  children,
2413
- sizeNotFull && placement === "top" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {})
2430
+ showHandle && sizeNotFull && placement === "top" && /* @__PURE__ */ jsxRuntime.jsx(CloseDrawerLine, {})
2414
2431
  ] }) }) }) });
2415
2432
  }
2416
2433
  );
@@ -2433,9 +2450,10 @@ var CloseDrawerLine = React27.forwardRef((props, ref) => {
2433
2450
  });
2434
2451
  CloseDrawerLine.displayName = "CloseDrawerLine";
2435
2452
  var DrawerCloseTrigger = React27.forwardRef(function DrawerCloseTrigger2(props, ref) {
2453
+ const { showText = false, ...rest } = props;
2436
2454
  const { size } = useRootDrawerProps();
2437
2455
  const { t } = useTranslation();
2438
- return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { ref, ...props, asChild: true, children: size === "full" ? /* @__PURE__ */ jsxRuntime.jsx(
2456
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { ref, ...rest, asChild: true, children: showText || size === "full" ? /* @__PURE__ */ jsxRuntime.jsx(
2439
2457
  ResponsiveButton,
2440
2458
  {
2441
2459
  variant: "ghost",