@vygruppen/spor-react 9.8.2 → 9.9.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 +9 -9
- package/CHANGELOG.md +18 -0
- package/dist/{CountryCodeSelect-46ZPAYGJ.mjs → CountryCodeSelect-U25NF65N.mjs} +1 -1
- package/dist/{chunk-4QF4PJTK.mjs → chunk-TEDOVPXZ.mjs} +112 -37
- package/dist/index.d.mts +56 -27
- package/dist/index.d.ts +56 -27
- package/dist/index.js +110 -34
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/alert/BaseAlert.tsx +2 -0
- package/src/alert/ClosableAlert.tsx +11 -2
- package/src/alert/ExpandableAlert.tsx +3 -1
- package/src/alert/StaticAlert.tsx +10 -2
- package/src/input/InfoSelect.tsx +33 -14
- package/src/input/ListBox.tsx +1 -0
- package/src/layout/PressableCard.tsx +2 -2
- package/src/layout/RadioCard.tsx +1 -1
- package/src/layout/RadioCardGroup.tsx +32 -6
- package/src/layout/StaticCard.tsx +0 -1
- package/src/theme/components/alert.ts +1 -0
- package/src/theme/components/info-select.ts +12 -1
- package/src/theme/components/listbox.ts +5 -5
- package/src/theme/components/pressable-card.ts +6 -1
- package/src/theme/components/table.ts +0 -2
- package/src/theme/utils/floating-utils.ts +3 -3
- package/src/theme/utils/ghost-utils.ts +19 -1
package/dist/index.d.ts
CHANGED
@@ -211,7 +211,7 @@ declare const StaticCard: _chakra_ui_system_dist_system_types.ComponentWithAs<As
|
|
211
211
|
|
212
212
|
type PressableCardProps = BoxProps & {
|
213
213
|
/** Defaults to "base" */
|
214
|
-
variant
|
214
|
+
variant?: "floating" | "accent" | "base";
|
215
215
|
};
|
216
216
|
/**
|
217
217
|
* `PressableCard` is a component that renders a pressable card.
|
@@ -333,6 +333,8 @@ type BaseAlertProps = BoxProps & {
|
|
333
333
|
variant: "info" | "success" | "warning" | "alt-transport" | "error";
|
334
334
|
/** The body content of the alert */
|
335
335
|
children: React.ReactNode;
|
336
|
+
/** The title of the alert */
|
337
|
+
title?: string;
|
336
338
|
};
|
337
339
|
|
338
340
|
type ClosableAlertProps = BaseAlertProps & {
|
@@ -361,7 +363,7 @@ type ClosableAlertProps = BaseAlertProps & {
|
|
361
363
|
* <Text>Some info here</Text>
|
362
364
|
* </ClosableAlert>
|
363
365
|
*/
|
364
|
-
declare const ClosableAlert: ({ variant, children, onClose: externalOnClose, }: ClosableAlertProps) => React.JSX.Element | null;
|
366
|
+
declare const ClosableAlert: ({ variant, title, children, onClose: externalOnClose, }: ClosableAlertProps) => React.JSX.Element | null;
|
365
367
|
|
366
368
|
type ExpandableAlertProps = BaseAlertProps & {
|
367
369
|
/** The title string */
|
@@ -401,7 +403,7 @@ type StaticAlertProps = BaseAlertProps;
|
|
401
403
|
* </StaticAlert>
|
402
404
|
* ```
|
403
405
|
*/
|
404
|
-
declare const StaticAlert: ({ children, ...props }: StaticAlertProps) => React.JSX.Element;
|
406
|
+
declare const StaticAlert: ({ children, title, ...props }: StaticAlertProps) => React.JSX.Element;
|
405
407
|
|
406
408
|
type BreadcrumbProps = Omit<BreadcrumbProps$1, "variant"> & {
|
407
409
|
variant?: "base" | "ghost";
|
@@ -1174,7 +1176,7 @@ type InfoSelectProps<T extends object> = {
|
|
1174
1176
|
*
|
1175
1177
|
* @see https://spor.vy.no/components/info-select
|
1176
1178
|
*/
|
1177
|
-
declare function InfoSelect<T extends object>({ placeholder,
|
1179
|
+
declare function InfoSelect<T extends object>({ placeholder, onChange, value, isLabelSrOnly, defaultValue, variant, ...props }: InfoSelectProps<T>): React.JSX.Element;
|
1178
1180
|
|
1179
1181
|
type InputProps = Omit<InputProps$1, "variant" | "size"> & {
|
1180
1182
|
/** The input's label */
|
@@ -2534,6 +2536,7 @@ declare const theme: {
|
|
2534
2536
|
position: string;
|
2535
2537
|
top: number;
|
2536
2538
|
right: number;
|
2539
|
+
color: string;
|
2537
2540
|
};
|
2538
2541
|
} | undefined;
|
2539
2542
|
sizes?: {
|
@@ -4619,6 +4622,13 @@ declare const theme: {
|
|
4619
4622
|
position: string;
|
4620
4623
|
width?: string | undefined;
|
4621
4624
|
whiteSpace?: string | undefined;
|
4625
|
+
fontSize: ("desktop.sm" | "mobile.xs")[];
|
4626
|
+
};
|
4627
|
+
innerButton: {
|
4628
|
+
display: string;
|
4629
|
+
flexDir: string;
|
4630
|
+
alignItems: string;
|
4631
|
+
justifyContent: string;
|
4622
4632
|
};
|
4623
4633
|
button: {
|
4624
4634
|
_disabled: {
|
@@ -4657,15 +4667,18 @@ declare const theme: {
|
|
4657
4667
|
outlineColor: string;
|
4658
4668
|
outlineStyle: string;
|
4659
4669
|
outlineOffset: string;
|
4670
|
+
display: string;
|
4660
4671
|
appearance: string;
|
4672
|
+
width: string;
|
4673
|
+
height: string;
|
4661
4674
|
borderTopRadius: string;
|
4662
4675
|
borderBottomRadius: string | number;
|
4663
4676
|
paddingY: number;
|
4664
4677
|
paddingX: number;
|
4665
|
-
display: string;
|
4666
4678
|
justifyContent: string;
|
4667
4679
|
alignItems: string;
|
4668
4680
|
fontSize: string;
|
4681
|
+
h: number;
|
4669
4682
|
} | {
|
4670
4683
|
_disabled: {
|
4671
4684
|
backgroundColor: string;
|
@@ -4701,16 +4714,20 @@ declare const theme: {
|
|
4701
4714
|
};
|
4702
4715
|
outline: string;
|
4703
4716
|
outlineColor: string;
|
4717
|
+
display: string;
|
4704
4718
|
appearance: string;
|
4719
|
+
width: string;
|
4720
|
+
height: string;
|
4705
4721
|
borderTopRadius: string;
|
4706
4722
|
borderBottomRadius: string | number;
|
4707
4723
|
paddingY: number;
|
4708
4724
|
paddingX: number;
|
4709
|
-
display: string;
|
4710
4725
|
justifyContent: string;
|
4711
4726
|
alignItems: string;
|
4712
4727
|
fontSize: string;
|
4728
|
+
h: number;
|
4713
4729
|
};
|
4730
|
+
placeholder: {};
|
4714
4731
|
arrowIcon: {};
|
4715
4732
|
}) | undefined;
|
4716
4733
|
sizes?: {
|
@@ -5369,12 +5386,6 @@ declare const theme: {
|
|
5369
5386
|
backgroundColor: string;
|
5370
5387
|
};
|
5371
5388
|
item: {
|
5372
|
-
paddingX: number;
|
5373
|
-
paddingY: number;
|
5374
|
-
marginY: number;
|
5375
|
-
marginX: number;
|
5376
|
-
borderRadius: string;
|
5377
|
-
color: string;
|
5378
5389
|
cursor: string;
|
5379
5390
|
outline: string;
|
5380
5391
|
_active: {
|
@@ -5389,14 +5400,20 @@ declare const theme: {
|
|
5389
5400
|
_selected: {
|
5390
5401
|
backgroundColor: string;
|
5391
5402
|
};
|
5403
|
+
color: string;
|
5404
|
+
paddingX: number;
|
5405
|
+
paddingY: number;
|
5406
|
+
marginY: number;
|
5407
|
+
marginX: number;
|
5408
|
+
borderRadius: string;
|
5392
5409
|
};
|
5393
5410
|
label: {};
|
5394
5411
|
description: {
|
5395
|
-
fontSize: ("mobile.xs" | "desktop.xs")[];
|
5396
|
-
color: string;
|
5397
5412
|
"[aria-selected='true'] &": {
|
5398
5413
|
color: string;
|
5399
5414
|
};
|
5415
|
+
color: string;
|
5416
|
+
fontSize: ("mobile.xs" | "desktop.xs")[];
|
5400
5417
|
};
|
5401
5418
|
}) | undefined;
|
5402
5419
|
sizes?: {
|
@@ -6627,14 +6644,12 @@ declare const theme: {
|
|
6627
6644
|
baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
|
6628
6645
|
table: {
|
6629
6646
|
width: string;
|
6630
|
-
minWidth: string;
|
6631
6647
|
color: string;
|
6632
6648
|
borderCollapse: string;
|
6633
6649
|
};
|
6634
6650
|
th: {
|
6635
6651
|
fontWeight: string;
|
6636
6652
|
textAlign: string;
|
6637
|
-
minWidth: string;
|
6638
6653
|
};
|
6639
6654
|
td: {
|
6640
6655
|
textAlign: string;
|
@@ -7226,25 +7241,39 @@ declare const theme: {
|
|
7226
7241
|
};
|
7227
7242
|
PressableCard: {
|
7228
7243
|
baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
|
7244
|
+
appearance: string;
|
7245
|
+
border: string;
|
7246
|
+
overflow: string;
|
7247
|
+
fontSize: string;
|
7248
|
+
display: string;
|
7249
|
+
borderRadius: string;
|
7250
|
+
cursor: string;
|
7251
|
+
transitionProperty: string;
|
7252
|
+
transitionDuration: string;
|
7253
|
+
"button&, a&, label&, &.is-clickable": {
|
7254
|
+
_focusVisible: {
|
7255
|
+
outlineWidth: string;
|
7256
|
+
outlineColor: string;
|
7257
|
+
outlineStyle: string;
|
7258
|
+
outlineOffset: string;
|
7259
|
+
};
|
7260
|
+
};
|
7229
7261
|
_disabled: {
|
7230
7262
|
outline: string;
|
7231
7263
|
pointerEvents: string;
|
7232
7264
|
color: string;
|
7233
|
-
backgroundColor: string;
|
7234
|
-
};
|
7235
|
-
_focusVisible: {
|
7236
7265
|
outlineWidth: string;
|
7237
7266
|
outlineColor: string;
|
7238
7267
|
outlineStyle: string;
|
7239
7268
|
outlineOffset: string;
|
7269
|
+
backgroundColor: string;
|
7270
|
+
} | {
|
7271
|
+
outline: string;
|
7272
|
+
pointerEvents: string;
|
7273
|
+
color: string;
|
7274
|
+
outlineColor: string;
|
7275
|
+
backgroundColor: string;
|
7240
7276
|
};
|
7241
|
-
appearance: string;
|
7242
|
-
border: string;
|
7243
|
-
overflow: string;
|
7244
|
-
fontSize: string;
|
7245
|
-
display: string;
|
7246
|
-
borderRadius: string;
|
7247
|
-
cursor: string;
|
7248
7277
|
}) | undefined;
|
7249
7278
|
sizes?: {
|
7250
7279
|
[key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
|
@@ -9417,4 +9446,4 @@ declare const Text: _chakra_ui_system_dist_system_types.ComponentWithAs<"p", Tex
|
|
9417
9446
|
**/
|
9418
9447
|
declare function slugify(text: string | string[], maxLength?: number): string;
|
9419
9448
|
|
9420
|
-
export { Accordion, AccordionProps, AttachedInputs, Badge, BadgeProps, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Card, CardProps, CardSelect, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChoiceChip, ChoiceChipProps, ClosableAlert, CloseButton, CloseButtonProps, Code, CodeProps, ColorInlineLoader, ColorInlineLoaderProps, ColorSpinner, ColorSpinnerProps, Combobox, ComboboxProps, ContentLoader, ContentLoaderProps, DarkFullScreenLoader, DarkInlineLoader, DarkInlineLoaderProps, DarkSpinner, DarkSpinnerProps, DatePicker, DateRangePicker, Divider, DividerProps, Drawer, DrawerContent, ModalHeader as DrawerHeader, Expandable, ExpandableAlert, ExpandableItem, ExpandableItemProps, FloatingActionButton, FormControl, FormControlProps, FormErrorMessage, FormErrorMessageProps, FormLabel, FormLabelProps, FullScreenDrawer, Heading, HeadingProps, IconButton, IconButtonProps, InfoSelect, InfoTag, InfoTagProps, Input, InputElementProps, InputLeftElement, InputProps, InputRightElement, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightInlineLoaderProps, LightSpinner, LightSpinnerProps, LineIcon, LineIconProps, ListBox, ModalHeader, ModalHeaderProps, NativeSelect, NativeSelectProps, Nudge, NudgeProps, NumericStepper, Pagination, PasswordInput, PasswordInputProps, PhoneNumberInput, PlayPauseButton, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioGroup, RadioGroupProps, RadioProps, SearchInput, SearchInputProps, SimpleDrawer, SimpleDrawerProps, Skeleton, SkeletonCircle, SkeletonCircleProps, SkeletonProps, SkeletonText, SkeletonTextProps, SkipButton, SpinnerProps, SporProvider, Stack, StackProps, StaticAlert, StaticCard, StaticCardProps, Stepper, StepperStep, Switch, SwitchProps, Table, TableProps, Tabs, TabsProps, Text, TextLink, TextProps, Textarea, TextareaProps, TimePicker, ToastOptions, Tooltip, TooltipProps, Translations, TravelTag, TravelTagProps, VyLogo, VyLogoProps, WizardNudge, WizardNudgeProps, brandTheme, createTexts, fontFaces, slugify, theme, useToast, useTranslation };
|
9449
|
+
export { Accordion, AccordionProps, AttachedInputs, Badge, BadgeProps, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Card, CardProps, CardSelect, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChoiceChip, ChoiceChipProps, ClosableAlert, CloseButton, CloseButtonProps, Code, CodeProps, ColorInlineLoader, ColorInlineLoaderProps, ColorSpinner, ColorSpinnerProps, Combobox, ComboboxProps, ContentLoader, ContentLoaderProps, DarkFullScreenLoader, DarkInlineLoader, DarkInlineLoaderProps, DarkSpinner, DarkSpinnerProps, DatePicker, DateRangePicker, Divider, DividerProps, Drawer, DrawerContent, ModalHeader as DrawerHeader, Expandable, ExpandableAlert, ExpandableItem, ExpandableItemProps, FloatingActionButton, FormControl, FormControlProps, FormErrorMessage, FormErrorMessageProps, FormLabel, FormLabelProps, FullScreenDrawer, Heading, HeadingProps, IconButton, IconButtonProps, InfoSelect, InfoTag, InfoTagProps, Input, InputElementProps, InputLeftElement, InputProps, InputRightElement, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightInlineLoaderProps, LightSpinner, LightSpinnerProps, LineIcon, LineIconProps, ListBox, ModalHeader, ModalHeaderProps, NativeSelect, NativeSelectProps, Nudge, NudgeProps, NumericStepper, Pagination, PasswordInput, PasswordInputProps, PhoneNumberInput, PlayPauseButton, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, SearchInput, SearchInputProps, SimpleDrawer, SimpleDrawerProps, Skeleton, SkeletonCircle, SkeletonCircleProps, SkeletonProps, SkeletonText, SkeletonTextProps, SkipButton, SpinnerProps, SporProvider, Stack, StackProps, StaticAlert, StaticCard, StaticCardProps, Stepper, StepperStep, Switch, SwitchProps, Table, TableProps, Tabs, TabsProps, Text, TextLink, TextProps, Textarea, TextareaProps, TimePicker, ToastOptions, Tooltip, TooltipProps, Translations, TravelTag, TravelTagProps, VyLogo, VyLogoProps, WizardNudge, WizardNudgeProps, brandTheme, createTexts, fontFaces, slugify, theme, useToast, useTranslation };
|
package/dist/index.js
CHANGED
@@ -878,9 +878,23 @@ var init_RadioCard = __esm({
|
|
878
878
|
);
|
879
879
|
}
|
880
880
|
});
|
881
|
+
function recursiveMap(children, fn) {
|
882
|
+
return React73__namespace.default.Children.map(children, (child) => {
|
883
|
+
if (React73__namespace.default.isValidElement(child) && child.props.children) {
|
884
|
+
child = React73__namespace.default.cloneElement(child, {
|
885
|
+
children: recursiveMap(child.props.children, fn)
|
886
|
+
});
|
887
|
+
}
|
888
|
+
if (React73__namespace.default.isValidElement(child)) {
|
889
|
+
return fn(child);
|
890
|
+
}
|
891
|
+
return child;
|
892
|
+
});
|
893
|
+
}
|
881
894
|
exports.RadioCardGroup = void 0;
|
882
895
|
var init_RadioCardGroup = __esm({
|
883
896
|
"src/layout/RadioCardGroup.tsx"() {
|
897
|
+
init_RadioCard();
|
884
898
|
exports.RadioCardGroup = ({
|
885
899
|
children,
|
886
900
|
name,
|
@@ -897,13 +911,17 @@ var init_RadioCardGroup = __esm({
|
|
897
911
|
...props
|
898
912
|
});
|
899
913
|
const group = getRootProps();
|
900
|
-
return /* @__PURE__ */ React73__namespace.default.createElement(react.Stack, { direction: direction2, ...group },
|
901
|
-
|
902
|
-
(child) => {
|
914
|
+
return /* @__PURE__ */ React73__namespace.default.createElement(react.Stack, { direction: direction2, ...group }, recursiveMap(children, (child) => {
|
915
|
+
if (child.type === exports.RadioCard) {
|
903
916
|
const radio = getRadioProps({ value: child.props.value });
|
904
|
-
|
917
|
+
const variantValue = variant;
|
918
|
+
return React73__namespace.default.cloneElement(
|
919
|
+
child,
|
920
|
+
{ ...radio, variant: variantValue, ...props }
|
921
|
+
);
|
905
922
|
}
|
906
|
-
|
923
|
+
return child;
|
924
|
+
}));
|
907
925
|
};
|
908
926
|
}
|
909
927
|
});
|
@@ -915,7 +933,7 @@ var init_StaticCard = __esm({
|
|
915
933
|
const styles3 = react.useStyleConfig("StaticCard", {
|
916
934
|
colorScheme
|
917
935
|
});
|
918
|
-
return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { __css: styles3, ...props, ref }, children
|
936
|
+
return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { __css: styles3, ...props, ref }, children);
|
919
937
|
}
|
920
938
|
);
|
921
939
|
}
|
@@ -924,7 +942,7 @@ exports.PressableCard = void 0;
|
|
924
942
|
var init_PressableCard = __esm({
|
925
943
|
"src/layout/PressableCard.tsx"() {
|
926
944
|
exports.PressableCard = react.forwardRef(
|
927
|
-
({ children, variant = "
|
945
|
+
({ children, variant = "floating", ...props }, ref) => {
|
928
946
|
const styles3 = react.useStyleConfig("PressableCard", {
|
929
947
|
variant
|
930
948
|
});
|
@@ -1831,6 +1849,7 @@ var init_ClosableAlert = __esm({
|
|
1831
1849
|
init_BaseAlert();
|
1832
1850
|
exports.ClosableAlert = ({
|
1833
1851
|
variant,
|
1852
|
+
title,
|
1834
1853
|
children,
|
1835
1854
|
onClose: externalOnClose = () => {
|
1836
1855
|
}
|
@@ -1855,7 +1874,7 @@ var init_ClosableAlert = __esm({
|
|
1855
1874
|
"aria-label": t2(texts6.close),
|
1856
1875
|
sx: styles3.closeButton
|
1857
1876
|
}
|
1858
|
-
), /* @__PURE__ */ React73__namespace.default.createElement(AlertIcon, { variant }), children);
|
1877
|
+
), /* @__PURE__ */ React73__namespace.default.createElement(AlertIcon, { variant }), /* @__PURE__ */ React73__namespace.default.createElement(react.Flex, { direction: "column", gap: title ? 2 : void 0, textAlign: "left" }, title && /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { fontWeight: "bold" }, title), /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { marginRight: 1 }, children)));
|
1859
1878
|
};
|
1860
1879
|
texts6 = createTexts({
|
1861
1880
|
close: {
|
@@ -1908,11 +1927,12 @@ var init_ExpandableAlert = __esm({
|
|
1908
1927
|
overflow: "hidden",
|
1909
1928
|
"-webkit-line-clamp": "1",
|
1910
1929
|
"-webkit-box-orient": "vertical"
|
1911
|
-
}
|
1930
|
+
},
|
1931
|
+
color: "darkGrey"
|
1912
1932
|
},
|
1913
1933
|
title
|
1914
1934
|
)),
|
1915
|
-
/* @__PURE__ */ React73__namespace.default.createElement(react.AccordionIcon,
|
1935
|
+
/* @__PURE__ */ React73__namespace.default.createElement(react.AccordionIcon, { color: "darkGrey" })
|
1916
1936
|
)), /* @__PURE__ */ React73__namespace.default.createElement(react.AccordionPanel, null, children))
|
1917
1937
|
));
|
1918
1938
|
};
|
@@ -1923,8 +1943,12 @@ var init_StaticAlert = __esm({
|
|
1923
1943
|
"src/alert/StaticAlert.tsx"() {
|
1924
1944
|
init_AlertIcon();
|
1925
1945
|
init_BaseAlert();
|
1926
|
-
exports.StaticAlert = ({
|
1927
|
-
|
1946
|
+
exports.StaticAlert = ({
|
1947
|
+
children,
|
1948
|
+
title,
|
1949
|
+
...props
|
1950
|
+
}) => {
|
1951
|
+
return /* @__PURE__ */ React73__namespace.default.createElement(BaseAlert, { ...props }, /* @__PURE__ */ React73__namespace.default.createElement(AlertIcon, { variant: props.variant }), /* @__PURE__ */ React73__namespace.default.createElement(react.Flex, { direction: "column", gap: title ? 2 : void 0, textAlign: "left" }, title && /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { fontWeight: "bold" }, title), /* @__PURE__ */ React73__namespace.default.createElement(react.Box, null, children)));
|
1928
1952
|
};
|
1929
1953
|
}
|
1930
1954
|
});
|
@@ -3582,13 +3606,11 @@ var init_ListBox = __esm({
|
|
3582
3606
|
});
|
3583
3607
|
function InfoSelect({
|
3584
3608
|
placeholder,
|
3585
|
-
width = "100%",
|
3586
|
-
height = "auto",
|
3587
3609
|
onChange,
|
3588
3610
|
value,
|
3589
3611
|
isLabelSrOnly,
|
3590
3612
|
defaultValue,
|
3591
|
-
variant
|
3613
|
+
variant,
|
3592
3614
|
...props
|
3593
3615
|
}) {
|
3594
3616
|
const renamedProps = {
|
@@ -3615,7 +3637,8 @@ function InfoSelect({
|
|
3615
3637
|
const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
|
3616
3638
|
const { t: t2 } = useTranslation();
|
3617
3639
|
const formControl = react.useFormControlProps(props);
|
3618
|
-
|
3640
|
+
const hasChosenValue = state2.selectedItem !== null;
|
3641
|
+
return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { sx: styles3.container }, /* @__PURE__ */ React73__namespace.default.createElement(
|
3619
3642
|
reactAria.HiddenSelect,
|
3620
3643
|
{
|
3621
3644
|
state: state2,
|
@@ -3630,13 +3653,36 @@ function InfoSelect({
|
|
3630
3653
|
ref: triggerRef,
|
3631
3654
|
sx: styles3.button,
|
3632
3655
|
...buttonProps,
|
3633
|
-
width,
|
3634
|
-
height,
|
3635
3656
|
"data-attachable": true,
|
3636
3657
|
"aria-invalid": formControl.isInvalid,
|
3637
3658
|
"aria-describedby": formControl["aria-describedby"]
|
3638
3659
|
},
|
3639
|
-
/* @__PURE__ */ React73__namespace.default.createElement(react.
|
3660
|
+
/* @__PURE__ */ React73__namespace.default.createElement(react.chakra.div, { sx: styles3.innerButton }, /* @__PURE__ */ React73__namespace.default.createElement(
|
3661
|
+
react.chakra.div,
|
3662
|
+
{
|
3663
|
+
...labelProps,
|
3664
|
+
sx: {
|
3665
|
+
...styles3.label,
|
3666
|
+
...hasChosenValue && {
|
3667
|
+
transform: "scale(0.825) translateY(-10px) translateX(-10%)",
|
3668
|
+
transitionProperty: "var(--spor-transition-property-common)",
|
3669
|
+
transitionDuration: "var(--spor-transition-duration-normal)"
|
3670
|
+
}
|
3671
|
+
}
|
3672
|
+
},
|
3673
|
+
props.label
|
3674
|
+
), /* @__PURE__ */ React73__namespace.default.createElement(
|
3675
|
+
react.Box,
|
3676
|
+
{
|
3677
|
+
...valueProps,
|
3678
|
+
h: !hasChosenValue ? "0px" : "18px",
|
3679
|
+
hidden: !hasChosenValue,
|
3680
|
+
transform: "scale(1) translateY(-10px)",
|
3681
|
+
transitionProperty: "var(--spor-transition-property-common)",
|
3682
|
+
transitionDuration: "var(--spor-transition-duration-normal)"
|
3683
|
+
},
|
3684
|
+
state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)
|
3685
|
+
)),
|
3640
3686
|
/* @__PURE__ */ React73__namespace.default.createElement(react.Box, { sx: styles3.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React73__namespace.default.createElement(sporIconReact.DropdownUpFill24Icon, null) : /* @__PURE__ */ React73__namespace.default.createElement(sporIconReact.DropdownDownFill24Icon, null))
|
3641
3687
|
), state2.isOpen && /* @__PURE__ */ React73__namespace.default.createElement(
|
3642
3688
|
Popover3,
|
@@ -11299,14 +11345,14 @@ function floatingBackground(state2, props) {
|
|
11299
11345
|
return {
|
11300
11346
|
backgroundColor: themeTools.mode(
|
11301
11347
|
"floating.surface.hover.light",
|
11302
|
-
|
11348
|
+
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`
|
11303
11349
|
)(props)
|
11304
11350
|
};
|
11305
11351
|
case "default":
|
11306
11352
|
return {
|
11307
11353
|
backgroundColor: themeTools.mode(
|
11308
|
-
"
|
11309
|
-
|
11354
|
+
"white",
|
11355
|
+
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`
|
11310
11356
|
)(props)
|
11311
11357
|
};
|
11312
11358
|
}
|
@@ -11368,7 +11414,10 @@ function ghostBackground(state2, props) {
|
|
11368
11414
|
};
|
11369
11415
|
case "selected": {
|
11370
11416
|
return {
|
11371
|
-
backgroundColor: themeTools.mode(
|
11417
|
+
backgroundColor: themeTools.mode(
|
11418
|
+
"ghost.surface.selected.light",
|
11419
|
+
"ghost.surface.selected.dark"
|
11420
|
+
)(props)
|
11372
11421
|
};
|
11373
11422
|
}
|
11374
11423
|
case "default":
|
@@ -11377,6 +11426,18 @@ function ghostBackground(state2, props) {
|
|
11377
11426
|
};
|
11378
11427
|
}
|
11379
11428
|
}
|
11429
|
+
function ghostText(state2, props) {
|
11430
|
+
switch (state2) {
|
11431
|
+
case "selected":
|
11432
|
+
return {
|
11433
|
+
color: themeTools.mode("ghost.text.light", "ghost.text.dark")(props)
|
11434
|
+
};
|
11435
|
+
default:
|
11436
|
+
return {
|
11437
|
+
color: themeTools.mode("ghost.text.light", "ghost.text.dark")(props)
|
11438
|
+
};
|
11439
|
+
}
|
11440
|
+
}
|
11380
11441
|
var init_ghost_utils = __esm({
|
11381
11442
|
"src/theme/utils/ghost-utils.ts"() {
|
11382
11443
|
}
|
@@ -11546,7 +11607,8 @@ var init_alert2 = __esm({
|
|
11546
11607
|
closeButton: {
|
11547
11608
|
position: "absolute",
|
11548
11609
|
top: 1,
|
11549
|
-
right: 1
|
11610
|
+
right: 1,
|
11611
|
+
color: "darkGrey"
|
11550
11612
|
}
|
11551
11613
|
},
|
11552
11614
|
variants: {
|
@@ -13477,18 +13539,28 @@ var init_info_select = __esm({
|
|
13477
13539
|
container: {},
|
13478
13540
|
label: {
|
13479
13541
|
position: "relative",
|
13542
|
+
fontSize: ["mobile.xs", "desktop.sm"],
|
13480
13543
|
...props.isLabelSrOnly ? srOnly2 : {}
|
13481
13544
|
},
|
13545
|
+
innerButton: {
|
13546
|
+
display: "flex",
|
13547
|
+
flexDir: "column",
|
13548
|
+
alignItems: "start",
|
13549
|
+
justifyContent: "start"
|
13550
|
+
},
|
13482
13551
|
button: {
|
13552
|
+
display: "flex",
|
13483
13553
|
appearance: "none",
|
13554
|
+
width: "100%",
|
13555
|
+
height: "54px",
|
13484
13556
|
borderTopRadius: "sm",
|
13485
13557
|
borderBottomRadius: props.isOpen ? 0 : "sm",
|
13486
13558
|
paddingY: 1.5,
|
13487
13559
|
paddingX: 3,
|
13488
|
-
display: "flex",
|
13489
13560
|
justifyContent: "space-between",
|
13490
13561
|
alignItems: "center",
|
13491
13562
|
fontSize: "mobile.md",
|
13563
|
+
h: 8,
|
13492
13564
|
...baseBorder("default", props),
|
13493
13565
|
_hover: {
|
13494
13566
|
...baseBorder("hover", props)
|
@@ -13506,6 +13578,7 @@ var init_info_select = __esm({
|
|
13506
13578
|
...baseBorder("invalid", props)
|
13507
13579
|
}
|
13508
13580
|
},
|
13581
|
+
placeholder: {},
|
13509
13582
|
arrowIcon: {}
|
13510
13583
|
}),
|
13511
13584
|
variants: {
|
@@ -14183,7 +14256,7 @@ var init_listbox = __esm({
|
|
14183
14256
|
marginY: 1,
|
14184
14257
|
marginX: 1,
|
14185
14258
|
borderRadius: "sm",
|
14186
|
-
|
14259
|
+
...ghostText("default", props),
|
14187
14260
|
cursor: "pointer",
|
14188
14261
|
outline: "none",
|
14189
14262
|
_active: {
|
@@ -14196,15 +14269,15 @@ var init_listbox = __esm({
|
|
14196
14269
|
...ghostBackground("selected", props)
|
14197
14270
|
},
|
14198
14271
|
_selected: {
|
14199
|
-
...ghostBackground("
|
14272
|
+
...ghostBackground("active", props)
|
14200
14273
|
}
|
14201
14274
|
},
|
14202
14275
|
label: {},
|
14203
14276
|
description: {
|
14204
14277
|
fontSize: ["mobile.xs", "desktop.xs"],
|
14205
|
-
|
14278
|
+
...ghostText("default", props),
|
14206
14279
|
"[aria-selected='true'] &": {
|
14207
|
-
|
14280
|
+
...ghostText("selected", props)
|
14208
14281
|
}
|
14209
14282
|
}
|
14210
14283
|
})
|
@@ -15123,13 +15196,11 @@ var init_table2 = __esm({
|
|
15123
15196
|
table: {
|
15124
15197
|
borderCollapse: "collapse",
|
15125
15198
|
...baseText("default", props),
|
15126
|
-
width: "100%"
|
15127
|
-
minWidth: "600px"
|
15199
|
+
width: "100%"
|
15128
15200
|
},
|
15129
15201
|
th: {
|
15130
15202
|
fontWeight: "bold",
|
15131
|
-
textAlign: "start"
|
15132
|
-
minWidth: "68px"
|
15203
|
+
textAlign: "start"
|
15133
15204
|
},
|
15134
15205
|
td: {
|
15135
15206
|
textAlign: "start"
|
@@ -15541,9 +15612,14 @@ var init_pressable_card = __esm({
|
|
15541
15612
|
display: "block",
|
15542
15613
|
borderRadius: "md",
|
15543
15614
|
cursor: "pointer",
|
15544
|
-
|
15615
|
+
transitionProperty: "common",
|
15616
|
+
transitionDuration: "fast",
|
15617
|
+
"button&, a&, label&, &.is-clickable": {
|
15618
|
+
...focusVisibleStyles(props)
|
15619
|
+
},
|
15545
15620
|
_disabled: {
|
15546
15621
|
...baseBackground("disabled", props),
|
15622
|
+
...baseBorder("disabled", props),
|
15547
15623
|
...baseText("disabled", props),
|
15548
15624
|
outline: "none",
|
15549
15625
|
pointerEvents: "none"
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, FullScreenDrawer, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-
|
1
|
+
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, FullScreenDrawer, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-TEDOVPXZ.mjs';
|
package/package.json
CHANGED
package/src/alert/BaseAlert.tsx
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
Box,
|
3
|
+
Flex,
|
4
|
+
useDisclosure,
|
5
|
+
useMultiStyleConfig,
|
6
|
+
} from "@chakra-ui/react";
|
2
7
|
import { CloseFill18Icon } from "@vygruppen/spor-icon-react";
|
3
8
|
import React from "react";
|
4
9
|
import { IconButton } from "../button";
|
@@ -34,6 +39,7 @@ type ClosableAlertProps = BaseAlertProps & {
|
|
34
39
|
*/
|
35
40
|
export const ClosableAlert = ({
|
36
41
|
variant,
|
42
|
+
title,
|
37
43
|
children,
|
38
44
|
onClose: externalOnClose = () => {},
|
39
45
|
}: ClosableAlertProps) => {
|
@@ -60,7 +66,10 @@ export const ClosableAlert = ({
|
|
60
66
|
sx={styles.closeButton}
|
61
67
|
/>
|
62
68
|
<AlertIcon variant={variant} />
|
63
|
-
{
|
69
|
+
<Flex direction="column" gap={title ? 2 : undefined} textAlign="left">
|
70
|
+
{title && <Box fontWeight="bold">{title}</Box>}
|
71
|
+
<Box marginRight={1}>{children}</Box>
|
72
|
+
</Flex>
|
64
73
|
</BaseAlert>
|
65
74
|
);
|
66
75
|
};
|
@@ -63,6 +63,7 @@ export const ExpandableAlert = ({
|
|
63
63
|
>
|
64
64
|
<Flex as={headingLevel} alignItems="center">
|
65
65
|
<AlertIcon variant={variant} />
|
66
|
+
|
66
67
|
<Box
|
67
68
|
as="span"
|
68
69
|
sx={{
|
@@ -72,11 +73,12 @@ export const ExpandableAlert = ({
|
|
72
73
|
"-webkit-line-clamp": "1",
|
73
74
|
"-webkit-box-orient": "vertical",
|
74
75
|
}}
|
76
|
+
color="darkGrey"
|
75
77
|
>
|
76
78
|
{title}
|
77
79
|
</Box>
|
78
80
|
</Flex>
|
79
|
-
<AccordionIcon />
|
81
|
+
<AccordionIcon color="darkGrey" />
|
80
82
|
</Flex>
|
81
83
|
</AccordionButton>
|
82
84
|
<AccordionPanel>{children}</AccordionPanel>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { AlertIcon } from "./AlertIcon";
|
3
3
|
import { BaseAlert, BaseAlertProps } from "./BaseAlert";
|
4
|
+
import { Box, Flex } from "@chakra-ui/react";
|
4
5
|
|
5
6
|
type StaticAlertProps = BaseAlertProps;
|
6
7
|
|
@@ -15,11 +16,18 @@ type StaticAlertProps = BaseAlertProps;
|
|
15
16
|
* </StaticAlert>
|
16
17
|
* ```
|
17
18
|
*/
|
18
|
-
export const StaticAlert = ({
|
19
|
+
export const StaticAlert = ({
|
20
|
+
children,
|
21
|
+
title,
|
22
|
+
...props
|
23
|
+
}: StaticAlertProps) => {
|
19
24
|
return (
|
20
25
|
<BaseAlert {...props}>
|
21
26
|
<AlertIcon variant={props.variant} />
|
22
|
-
{
|
27
|
+
<Flex direction="column" gap={title ? 2 : undefined} textAlign="left">
|
28
|
+
{title && <Box fontWeight="bold">{title}</Box>}
|
29
|
+
<Box>{children}</Box>
|
30
|
+
</Flex>
|
23
31
|
</BaseAlert>
|
24
32
|
);
|
25
33
|
};
|