@vygruppen/spor-react 12.1.1 → 12.2.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 +11 -11
- package/.turbo/turbo-typegen.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +151 -190
- package/dist/index.d.ts +151 -190
- package/dist/index.js +2327 -1915
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2214 -1811
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +2 -1
- package/src/accordion/Expandable.tsx +3 -1
- package/src/accordion/helpers.ts +2 -1
- package/src/alert/Alert.tsx +3 -1
- package/src/alert/AlertIcon.tsx +17 -10
- package/src/alert/ExpandableAlert.tsx +3 -2
- package/src/alert/ServiceAlert.tsx +2 -1
- package/src/breadcrumb/Breadcrumb.tsx +9 -8
- package/src/button/Button.tsx +65 -52
- package/src/button/ButtonGroup.tsx +2 -1
- package/src/button/Clipboard.tsx +3 -0
- package/src/button/CloseButton.tsx +8 -4
- package/src/button/FloatingActionButton.tsx +5 -5
- package/src/button/IconButton.tsx +1 -0
- package/src/color-mode/color-mode.tsx +2 -2
- package/src/datepicker/Calendar.tsx +0 -1
- package/src/datepicker/CalendarCell.tsx +5 -5
- package/src/datepicker/CalendarGrid.tsx +3 -2
- package/src/datepicker/CalendarHeader.tsx +1 -4
- package/src/datepicker/CalendarTriggerButton.tsx +3 -4
- package/src/datepicker/DateField.tsx +13 -6
- package/src/datepicker/DatePicker.tsx +2 -1
- package/src/datepicker/DateRangePicker.tsx +1 -1
- package/src/datepicker/DateTimeSegment.tsx +2 -1
- package/src/datepicker/RangeCalendar.tsx +1 -1
- package/src/datepicker/StyledField.tsx +1 -1
- package/src/datepicker/TimeField.tsx +3 -3
- package/src/datepicker/TimePicker.tsx +4 -2
- package/src/datepicker/utils.ts +10 -5
- package/src/dialog/Dialog.tsx +1 -0
- package/src/dialog/Drawer.tsx +28 -26
- package/src/i18n/index.tsx +1 -0
- package/src/input/AttachedInputs.tsx +6 -3
- package/src/input/CardSelect.tsx +3 -1
- package/src/input/Checkbox.tsx +1 -0
- package/src/input/CheckboxGroup.tsx +3 -1
- package/src/input/ChoiceChip.tsx +1 -1
- package/src/input/Combobox.tsx +6 -4
- package/src/input/CountryCodeSelect.tsx +10 -4
- package/src/input/Field.tsx +2 -0
- package/src/input/Input.tsx +2 -3
- package/src/input/InputGroup.tsx +1 -1
- package/src/input/ListBox.tsx +9 -8
- package/src/input/NativeSelect.tsx +1 -2
- package/src/input/NumericStepper.tsx +22 -23
- package/src/input/PasswordInput.tsx +2 -1
- package/src/input/PhoneNumberInput.tsx +6 -2
- package/src/input/Popover.tsx +2 -0
- package/src/input/Radio.tsx +2 -0
- package/src/input/SearchInput.tsx +2 -1
- package/src/input/Select.tsx +8 -2
- package/src/input/Switch.tsx +22 -34
- package/src/input/Textarea.tsx +6 -4
- package/src/input/index.ts +1 -1
- package/src/layout/PressableCard.tsx +5 -2
- package/src/layout/RadioCard.tsx +3 -1
- package/src/layout/Separator.tsx +2 -1
- package/src/layout/StaticCard.tsx +6 -3
- package/src/linjetag/InfoTag.tsx +3 -2
- package/src/linjetag/LineIcon.tsx +5 -4
- package/src/linjetag/TravelTag.tsx +12 -8
- package/src/link/TextLink.tsx +44 -9
- package/src/loader/ColorInlineLoader.tsx +0 -1
- package/src/loader/ColorSpinner.tsx +0 -1
- package/src/loader/ContentLoader.tsx +0 -1
- package/src/loader/DarkFullScreenLoader.tsx +0 -1
- package/src/loader/DarkInlineLoader.tsx +0 -1
- package/src/loader/DarkSpinner.tsx +0 -1
- package/src/loader/LightFullScreenLoader.tsx +0 -1
- package/src/loader/LightInlineLoader.tsx +0 -1
- package/src/loader/LightSpinner.tsx +0 -1
- package/src/loader/Lottie.tsx +1 -2
- package/src/loader/ProgressBar.tsx +1 -2
- package/src/loader/ProgressLoader.tsx +2 -7
- package/src/logo/CargonetLogo.tsx +2 -1
- package/src/logo/VyLogo.tsx +3 -4
- package/src/logo/VyLogoPride.tsx +4 -1
- package/src/media-controller/JumpButton.tsx +2 -1
- package/src/media-controller/PlayPauseButton.tsx +2 -1
- package/src/media-controller/SkipButton.tsx +2 -1
- package/src/nudge/Nudge.tsx +7 -14
- package/src/pagination/Pagination.tsx +5 -0
- package/src/popover/index.tsx +2 -0
- package/src/progress-indicator/ProgressDot.tsx +1 -1
- package/src/progress-indicator/ProgressIndicator.tsx +4 -2
- package/src/provider/SporProvider.tsx +0 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/tab/Tabs.tsx +1 -1
- package/src/table/Table.tsx +2 -1
- package/src/theme/recipes/button.ts +5 -0
- package/src/theme/slot-recipes/alert-expandable.ts +0 -4
- package/src/theme/slot-recipes/info-tag.ts +0 -1
- package/src/theme/slot-recipes/popover.ts +0 -1
- package/src/theme/slot-recipes/radio-card.ts +0 -3
- package/src/theme/utils/accent-utils.ts +12 -6
- package/src/theme/utils/bg-utils.ts +6 -3
- package/src/theme/utils/brand-utils.ts +7 -7
- package/src/theme/utils/core-utils.ts +23 -13
- package/src/theme/utils/floating-utils.ts +16 -8
- package/src/theme/utils/ghost-utils.ts +8 -4
- package/src/theme/utils/input-utils.ts +7 -4
- package/src/theme/utils/outline-utils.ts +6 -3
- package/src/theme/utils/surface-utils.ts +8 -4
- package/src/toast/toast.tsx +0 -1
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Text.tsx +1 -1
- package/src/util/slugify.tsx +8 -8
- package/tsconfig.json +1 -0
@@ -3,17 +3,20 @@ import { State, Subset } from "./types";
|
|
3
3
|
type OutlineBorderState = Subset<State, "default" | "error" | "focus">;
|
4
4
|
export function outlineBorder(state: OutlineBorderState) {
|
5
5
|
switch (state) {
|
6
|
-
case "error":
|
6
|
+
case "error": {
|
7
7
|
return {
|
8
8
|
outlineColor: "outline.error",
|
9
9
|
};
|
10
|
-
|
10
|
+
}
|
11
|
+
case "focus": {
|
11
12
|
return {
|
12
13
|
outlineColor: "outline.focus",
|
13
14
|
};
|
14
|
-
|
15
|
+
}
|
16
|
+
default: {
|
15
17
|
return {
|
16
18
|
outlineColor: "outline",
|
17
19
|
};
|
20
|
+
}
|
18
21
|
}
|
19
22
|
}
|
@@ -1,21 +1,25 @@
|
|
1
1
|
type Surface = "default" | "secondary" | "tertiary" | "disabled";
|
2
2
|
export const surface = (surface: Surface) => {
|
3
3
|
switch (surface) {
|
4
|
-
case "default":
|
4
|
+
case "default": {
|
5
5
|
return {
|
6
6
|
backgroundColor: "surface",
|
7
7
|
};
|
8
|
-
|
8
|
+
}
|
9
|
+
case "secondary": {
|
9
10
|
return {
|
10
11
|
backgroundColor: "surface.secondary",
|
11
12
|
};
|
12
|
-
|
13
|
+
}
|
14
|
+
case "tertiary": {
|
13
15
|
return {
|
14
16
|
backgroundColor: "surface.tertiary",
|
15
17
|
};
|
16
|
-
|
18
|
+
}
|
19
|
+
case "disabled": {
|
17
20
|
return {
|
18
21
|
backgroundColor: "surface.disabled",
|
19
22
|
};
|
23
|
+
}
|
20
24
|
}
|
21
25
|
};
|
package/src/toast/toast.tsx
CHANGED
package/src/typography/Badge.tsx
CHANGED
@@ -5,17 +5,20 @@ import {
|
|
5
5
|
Box,
|
6
6
|
} from "@chakra-ui/react";
|
7
7
|
import { IconComponent } from "@vygruppen/spor-icon-react";
|
8
|
-
import
|
8
|
+
import { forwardRef } from "react";
|
9
9
|
|
10
10
|
export type BadgeProps = ChakraBadgeProps & {
|
11
11
|
icon?: IconComponent;
|
12
12
|
};
|
13
13
|
|
14
|
-
export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(
|
15
|
-
|
14
|
+
export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(
|
15
|
+
{ icon, children, ...props },
|
16
|
+
ref,
|
17
|
+
) {
|
18
|
+
return (
|
16
19
|
<ChakraBadge ref={ref} {...props}>
|
17
20
|
{children}
|
18
21
|
{icon && <Box as={icon} />}
|
19
22
|
</ChakraBadge>
|
20
|
-
)
|
21
|
-
);
|
23
|
+
);
|
24
|
+
});
|
package/src/typography/Text.tsx
CHANGED
@@ -3,7 +3,7 @@ import {
|
|
3
3
|
Text as ChakraText,
|
4
4
|
TextProps as ChakraTextProps,
|
5
5
|
} from "@chakra-ui/react";
|
6
|
-
import
|
6
|
+
import { forwardRef } from "react";
|
7
7
|
|
8
8
|
export type TextProps = Omit<ChakraTextProps, "textStyle"> & {
|
9
9
|
/** The size and style of the text.
|
package/src/util/slugify.tsx
CHANGED
@@ -20,17 +20,17 @@ export function slugify(text: string | string[], maxLength = 50): string {
|
|
20
20
|
return (
|
21
21
|
text
|
22
22
|
.normalize("NFD") // Normalize to NFD Unicode form
|
23
|
-
.
|
24
|
-
.
|
25
|
-
.
|
26
|
-
.
|
23
|
+
.replaceAll(/[\u0300-\u036F]/g, "") // Remove diacritics
|
24
|
+
.replaceAll(/[\u00C6\u00E6]/g, "ae") // Replace Æ, æ
|
25
|
+
.replaceAll(/[\u00D8\u00F8]/g, "oe") // Replace Ø, ø
|
26
|
+
.replaceAll(/[\u00C5\u00E5]/g, "aa") // Replace Å, å
|
27
27
|
// Extend the replacement rules as needed
|
28
28
|
.toLowerCase()
|
29
|
-
.
|
30
|
-
.
|
31
|
-
.
|
29
|
+
.replaceAll(/\s+/g, "-") // Replace spaces with -
|
30
|
+
.replaceAll(/[^\w-]+/g, "") // Remove all non-word chars
|
31
|
+
.replaceAll(/--+/g, "-") // Replace multiple - with single -
|
32
32
|
.replace(/^-+/, "") // Trim - from start of text
|
33
33
|
.replace(/-+$/, "")
|
34
|
-
.
|
34
|
+
.slice(0, Math.max(0, maxLength))
|
35
35
|
);
|
36
36
|
}
|