@vygruppen/spor-react 6.0.0 → 6.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 +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/{CountryCodeSelect-EM747ZM6.mjs → CountryCodeSelect-QBDQ3HTF.mjs} +1 -1
- package/dist/{chunk-GAHDJA6T.mjs → chunk-UIM4MXLY.mjs} +140 -119
- package/dist/index.d.mts +122 -38
- package/dist/index.d.ts +122 -38
- package/dist/index.js +138 -118
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/button/Button.tsx +44 -43
- package/src/button/IconButton.tsx +4 -0
- package/src/linjetag/InfoTag.tsx +23 -2
- package/src/linjetag/LineIcon.tsx +38 -5
- package/src/linjetag/TravelTag.tsx +21 -1
- package/src/linjetag/types.d.ts +17 -2
- package/src/theme/components/button.ts +47 -74
- package/src/theme/components/card-select.ts +1 -0
- package/src/theme/components/line-icon.ts +5 -0
- package/src/theme/components/travel-tag.ts +5 -0
package/dist/index.js
CHANGED
@@ -662,60 +662,70 @@ var init_Button = __esm({
|
|
662
662
|
init_loader();
|
663
663
|
exports.Button = react.forwardRef((props, ref) => {
|
664
664
|
const {
|
665
|
+
as = "button",
|
666
|
+
fontWeight,
|
665
667
|
size: size2,
|
666
|
-
variant,
|
667
668
|
children,
|
668
669
|
isLoading,
|
669
670
|
isDisabled,
|
670
671
|
leftIcon,
|
671
672
|
rightIcon,
|
673
|
+
sx,
|
672
674
|
...rest
|
673
675
|
} = props;
|
674
676
|
const ariaLabel = useCorrectAriaLabel(props);
|
675
677
|
const buttonGroup = react.useButtonGroup();
|
676
|
-
const finalVariant = variant ?? (buttonGroup == null ? void 0 : buttonGroup.variant) ?? "primary";
|
677
678
|
const finalSize = size2 ?? (buttonGroup == null ? void 0 : buttonGroup.size) ?? "md";
|
679
|
+
const styles3 = react.useStyleConfig("Button", {
|
680
|
+
...buttonGroup,
|
681
|
+
...rest,
|
682
|
+
size: finalSize,
|
683
|
+
leftIcon,
|
684
|
+
rightIcon
|
685
|
+
});
|
686
|
+
if (fontWeight) {
|
687
|
+
styles3.fontWeight = fontWeight;
|
688
|
+
}
|
678
689
|
return /* @__PURE__ */ React69__namespace.default.createElement(
|
679
|
-
react.
|
690
|
+
react.Box,
|
680
691
|
{
|
681
|
-
size: finalSize,
|
682
|
-
variant: finalVariant,
|
683
692
|
...rest,
|
693
|
+
as,
|
694
|
+
sx: { ...styles3, ...sx },
|
684
695
|
ref,
|
685
696
|
"aria-label": ariaLabel,
|
686
697
|
"aria-busy": isLoading,
|
687
|
-
|
688
|
-
leftIcon: isLoading && leftIcon ? /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { visibility: isLoading ? "hidden" : "visible", "aria-hidden": "true" }, leftIcon) : leftIcon,
|
689
|
-
rightIcon: isLoading && rightIcon ? /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { visibility: isLoading ? "hidden" : "visible", "aria-hidden": "true" }, rightIcon) : rightIcon,
|
698
|
+
disabled: isDisabled || isLoading,
|
690
699
|
position: "relative"
|
691
700
|
},
|
692
|
-
isLoading && /* @__PURE__ */ React69__namespace.default.createElement(
|
693
|
-
|
701
|
+
isLoading && /* @__PURE__ */ React69__namespace.default.createElement(react.Center, { position: "absolute", right: 0, left: 0, top: 1, bottom: 0 }, /* @__PURE__ */ React69__namespace.default.createElement(
|
702
|
+
exports.ColorInlineLoader,
|
694
703
|
{
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
/* @__PURE__ */ React69__namespace.default.createElement(
|
702
|
-
exports.ColorInlineLoader,
|
703
|
-
{
|
704
|
-
maxWidth: getLoaderWidth(finalSize),
|
705
|
-
width: "80%",
|
706
|
-
marginX: 2,
|
707
|
-
marginY: 2
|
708
|
-
}
|
709
|
-
)
|
710
|
-
),
|
704
|
+
maxWidth: getLoaderWidth(finalSize),
|
705
|
+
width: "80%",
|
706
|
+
marginX: 2,
|
707
|
+
marginY: 2
|
708
|
+
}
|
709
|
+
)),
|
711
710
|
/* @__PURE__ */ React69__namespace.default.createElement(
|
712
|
-
react.
|
711
|
+
react.Flex,
|
713
712
|
{
|
713
|
+
justifyContent: "space-between",
|
714
|
+
alignItems: "center",
|
715
|
+
gap: 1,
|
714
716
|
visibility: isLoading ? "hidden" : "visible",
|
715
|
-
|
716
|
-
textAlign: "left"
|
717
|
+
"aria-hidden": isLoading
|
717
718
|
},
|
718
|
-
|
719
|
+
/* @__PURE__ */ React69__namespace.default.createElement(react.Flex, { justifyContent: "center", alignItems: "center", gap: 1 }, leftIcon, /* @__PURE__ */ React69__namespace.default.createElement(
|
720
|
+
react.Box,
|
721
|
+
{
|
722
|
+
visibility: isLoading ? "hidden" : "visible",
|
723
|
+
whiteSpace: "normal",
|
724
|
+
textAlign: "left"
|
725
|
+
},
|
726
|
+
children
|
727
|
+
)),
|
728
|
+
rightIcon
|
719
729
|
)
|
720
730
|
);
|
721
731
|
});
|
@@ -4316,8 +4326,11 @@ var init_LineIcon = __esm({
|
|
4316
4326
|
sx,
|
4317
4327
|
...rest
|
4318
4328
|
}) => {
|
4319
|
-
const styles3 = react.useMultiStyleConfig("LineIcon", { variant, size: size2 });
|
4320
|
-
const Icon = getCorrectIcon({
|
4329
|
+
const styles3 = react.useMultiStyleConfig("LineIcon", { variant, size: size2, ...rest });
|
4330
|
+
const Icon = getCorrectIcon({
|
4331
|
+
variant: variant === "custom" && "customIconVariant" in rest ? rest.customIconVariant : variant === "custom" ? "local-train" : variant,
|
4332
|
+
size: size2
|
4333
|
+
});
|
4321
4334
|
if (!Icon) {
|
4322
4335
|
return null;
|
4323
4336
|
}
|
@@ -4333,10 +4346,23 @@ var init_InfoTag = __esm({
|
|
4333
4346
|
variant,
|
4334
4347
|
size: size2 = "md",
|
4335
4348
|
title,
|
4336
|
-
description
|
4349
|
+
description,
|
4350
|
+
...customProps
|
4337
4351
|
}) => {
|
4338
|
-
const styles3 = react.useMultiStyleConfig("InfoTag", {
|
4339
|
-
|
4352
|
+
const styles3 = react.useMultiStyleConfig("InfoTag", {
|
4353
|
+
variant,
|
4354
|
+
size: size2,
|
4355
|
+
...customProps
|
4356
|
+
});
|
4357
|
+
return /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { sx: styles3.container }, /* @__PURE__ */ React69__namespace.default.createElement(
|
4358
|
+
exports.LineIcon,
|
4359
|
+
{
|
4360
|
+
variant,
|
4361
|
+
size: size2,
|
4362
|
+
sx: styles3.iconContainer,
|
4363
|
+
...customProps
|
4364
|
+
}
|
4365
|
+
), /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { sx: styles3.textContainer }, title && /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { as: "span", sx: styles3.title }, title), title && description && " ", description && /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { as: "span", sx: styles3.description }, description)));
|
4340
4366
|
};
|
4341
4367
|
}
|
4342
4368
|
});
|
@@ -4357,10 +4383,20 @@ var init_TravelTag = __esm({
|
|
4357
4383
|
const styles3 = react.useMultiStyleConfig("TravelTag", {
|
4358
4384
|
variant,
|
4359
4385
|
size: size2,
|
4360
|
-
deviationLevel
|
4386
|
+
deviationLevel,
|
4387
|
+
foregroundColor: variant === "custom" ? rest.foregroundColor : void 0,
|
4388
|
+
backgroundColor: variant === "custom" ? rest.backgroundColor : void 0
|
4361
4389
|
});
|
4362
4390
|
const DeviationLevelIcon = getDeviationLevelIcon({ deviationLevel, size: size2 });
|
4363
|
-
return /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { sx: styles3.container, "aria-disabled": isDisabled, ref, ...rest }, /* @__PURE__ */ React69__namespace.default.createElement(
|
4391
|
+
return /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { sx: styles3.container, "aria-disabled": isDisabled, ref, ...rest }, /* @__PURE__ */ React69__namespace.default.createElement(
|
4392
|
+
exports.LineIcon,
|
4393
|
+
{
|
4394
|
+
variant,
|
4395
|
+
size: size2,
|
4396
|
+
sx: styles3.iconContainer,
|
4397
|
+
...rest
|
4398
|
+
}
|
4399
|
+
), /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { sx: styles3.textContainer }, title && /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { as: "span", sx: styles3.title }, title), title && description && " ", description && /* @__PURE__ */ React69__namespace.default.createElement(react.Box, { as: "span", sx: styles3.description }, description)), DeviationLevelIcon && /* @__PURE__ */ React69__namespace.default.createElement(DeviationLevelIcon, { sx: styles3.deviationIcon }));
|
4364
4400
|
}
|
4365
4401
|
);
|
4366
4402
|
getDeviationLevelIcon = ({
|
@@ -11515,12 +11551,10 @@ var init_button2 = __esm({
|
|
11515
11551
|
"src/theme/components/button.ts"() {
|
11516
11552
|
init_foundations();
|
11517
11553
|
init_box_shadow_utils();
|
11518
|
-
init_focus_utils();
|
11519
11554
|
config6 = react.defineStyleConfig({
|
11520
11555
|
baseStyle: {
|
11521
11556
|
border: 0,
|
11522
11557
|
borderRadius: "xl",
|
11523
|
-
fontWeight: "bold",
|
11524
11558
|
transitionProperty: "common",
|
11525
11559
|
transitionDuration: "normal",
|
11526
11560
|
textWrap: "wrap",
|
@@ -11548,18 +11582,15 @@ var init_button2 = __esm({
|
|
11548
11582
|
// hardcoded background color as alpha-"hack" below is not feasible for dark mode with solid background color
|
11549
11583
|
backgroundColor: themeTools.mode("pine", "coralGreen")(props),
|
11550
11584
|
color: themeTools.mode("white", "darkTeal")(props),
|
11551
|
-
|
11552
|
-
|
11553
|
-
|
11554
|
-
|
11555
|
-
|
11556
|
-
|
11557
|
-
|
11558
|
-
|
11559
|
-
|
11560
|
-
},
|
11561
|
-
notFocus: { boxShadow: "none" }
|
11562
|
-
}),
|
11585
|
+
_focusVisible: {
|
11586
|
+
boxShadow: `inset 0 0 0 2px ${themeTools.mode(
|
11587
|
+
colors.greenHaze,
|
11588
|
+
colors.azure
|
11589
|
+
)(props)}, inset 0 0 0 4px ${themeTools.mode(
|
11590
|
+
colors.white,
|
11591
|
+
colors.darkGrey
|
11592
|
+
)(props)}`
|
11593
|
+
},
|
11563
11594
|
_hover: {
|
11564
11595
|
backgroundColor: themeTools.mode("darkTeal", "blueGreen")(props)
|
11565
11596
|
},
|
@@ -11570,34 +11601,29 @@ var init_button2 = __esm({
|
|
11570
11601
|
secondary: (props) => ({
|
11571
11602
|
// FIXME: Update to use global defined background color for darkMode whenever it is available instead of alpha
|
11572
11603
|
backgroundColor: themeTools.mode("seaMist", "primaryGreen")(props),
|
11573
|
-
color: themeTools.mode("darkTeal", "
|
11604
|
+
color: themeTools.mode("darkTeal", "seaMist")(props),
|
11574
11605
|
// order is important here for now while we do not have global defined background color for darkMode
|
11575
11606
|
_hover: {
|
11576
11607
|
backgroundColor: themeTools.mode("coralGreen", "greenHaze")(props)
|
11577
11608
|
},
|
11578
|
-
|
11579
|
-
|
11609
|
+
_focusVisible: {
|
11610
|
+
boxShadow: `inset 0 0 0 2px ${themeTools.mode(
|
11611
|
+
colors.greenHaze,
|
11612
|
+
colors.primaryGreen
|
11613
|
+
)(props)}, inset 0 0 0 4px ${themeTools.mode(
|
11614
|
+
colors.white,
|
11615
|
+
colors.darkTeal
|
11616
|
+
)(props)}`,
|
11617
|
+
_hover: {
|
11580
11618
|
boxShadow: `inset 0 0 0 2px ${themeTools.mode(
|
11581
11619
|
colors.greenHaze,
|
11582
|
-
colors.
|
11620
|
+
colors.azure
|
11583
11621
|
)(props)}, inset 0 0 0 4px ${themeTools.mode(
|
11584
11622
|
colors.white,
|
11585
|
-
colors.
|
11586
|
-
)(props)}
|
11587
|
-
_hover: {
|
11588
|
-
boxShadow: `inset 0 0 0 2px ${themeTools.mode(
|
11589
|
-
colors.greenHaze,
|
11590
|
-
colors.azure
|
11591
|
-
)(props)}, inset 0 0 0 4px ${themeTools.mode(
|
11592
|
-
colors.white,
|
11593
|
-
colors.blackAlpha[500]
|
11594
|
-
)(props)}`
|
11595
|
-
}
|
11596
|
-
},
|
11597
|
-
notFocus: {
|
11598
|
-
boxShadow: "none"
|
11623
|
+
colors.blackAlpha[500]
|
11624
|
+
)(props)}`
|
11599
11625
|
}
|
11600
|
-
}
|
11626
|
+
},
|
11601
11627
|
_active: {
|
11602
11628
|
backgroundColor: themeTools.mode("mint", "darkTeal")(props),
|
11603
11629
|
boxShadow: `inset 0 0 0 2px ${themeTools.mode(
|
@@ -11621,25 +11647,16 @@ var init_button2 = __esm({
|
|
11621
11647
|
tertiary: (props) => ({
|
11622
11648
|
backgroundColor: "transparent",
|
11623
11649
|
color: themeTools.mode("darkGrey", "white")(props),
|
11624
|
-
fontWeight: "normal",
|
11625
11650
|
boxShadow: `inset 0 0 0 1px ${themeTools.mode(
|
11626
11651
|
colors.blackAlpha[400],
|
11627
11652
|
colors.whiteAlpha[400]
|
11628
11653
|
)(props)}`,
|
11629
|
-
|
11630
|
-
|
11631
|
-
|
11632
|
-
|
11633
|
-
|
11634
|
-
|
11635
|
-
},
|
11636
|
-
notFocus: {
|
11637
|
-
boxShadow: `inset 0 0 0 1px ${themeTools.mode(
|
11638
|
-
colors.blackAlpha[400],
|
11639
|
-
colors.whiteAlpha[400]
|
11640
|
-
)(props)}`
|
11641
|
-
}
|
11642
|
-
}),
|
11654
|
+
_focusVisible: {
|
11655
|
+
boxShadow: getBoxShadowString({
|
11656
|
+
borderWidth: 2,
|
11657
|
+
borderColor: "azure"
|
11658
|
+
})
|
11659
|
+
},
|
11643
11660
|
_hover: {
|
11644
11661
|
boxShadow: `inset 0 0 0 2px currentColor`
|
11645
11662
|
},
|
@@ -11654,18 +11671,12 @@ var init_button2 = __esm({
|
|
11654
11671
|
ghost: (props) => ({
|
11655
11672
|
backgroundColor: "transparent",
|
11656
11673
|
color: themeTools.mode("darkGrey", "white")(props),
|
11657
|
-
|
11658
|
-
|
11659
|
-
|
11660
|
-
|
11661
|
-
|
11662
|
-
|
11663
|
-
})
|
11664
|
-
},
|
11665
|
-
notFocus: {
|
11666
|
-
outline: "none"
|
11667
|
-
}
|
11668
|
-
}),
|
11674
|
+
_focusVisible: {
|
11675
|
+
boxShadow: getBoxShadowString({
|
11676
|
+
borderColor: themeTools.mode("greenHaze", "azure")(props),
|
11677
|
+
borderWidth: 2
|
11678
|
+
})
|
11679
|
+
},
|
11669
11680
|
_hover: {
|
11670
11681
|
backgroundColor: themeTools.mode("seaMist", "whiteAlpha.200")(props),
|
11671
11682
|
_disabled: {
|
@@ -11693,49 +11704,47 @@ var init_button2 = __esm({
|
|
11693
11704
|
borderWidth: 2
|
11694
11705
|
})
|
11695
11706
|
},
|
11696
|
-
|
11697
|
-
|
11707
|
+
_focusVisible: {
|
11708
|
+
boxShadow: getBoxShadowString({
|
11709
|
+
borderColor: themeTools.mode("greenHaze", "azure")(props),
|
11710
|
+
borderWidth: 2,
|
11711
|
+
baseShadow: "sm"
|
11712
|
+
}),
|
11713
|
+
_hover: {
|
11698
11714
|
boxShadow: getBoxShadowString({
|
11699
11715
|
borderColor: themeTools.mode("greenHaze", "azure")(props),
|
11700
11716
|
borderWidth: 2,
|
11701
|
-
baseShadow: "
|
11702
|
-
})
|
11703
|
-
_hover: {
|
11704
|
-
boxShadow: getBoxShadowString({
|
11705
|
-
borderColor: themeTools.mode("greenHaze", "azure")(props),
|
11706
|
-
borderWidth: 2,
|
11707
|
-
baseShadow: "md"
|
11708
|
-
})
|
11709
|
-
}
|
11710
|
-
},
|
11711
|
-
notFocus: {
|
11712
|
-
outline: "none",
|
11713
|
-
boxShadow: "sm"
|
11717
|
+
baseShadow: "md"
|
11718
|
+
})
|
11714
11719
|
}
|
11715
|
-
}
|
11720
|
+
}
|
11716
11721
|
})
|
11717
11722
|
},
|
11718
11723
|
sizes: {
|
11719
11724
|
lg: {
|
11720
11725
|
minHeight: 8,
|
11721
11726
|
minWidth: 8,
|
11722
|
-
fontSize: "18px"
|
11727
|
+
fontSize: "18px",
|
11728
|
+
fontWeight: "bold"
|
11723
11729
|
},
|
11724
11730
|
md: {
|
11725
11731
|
minHeight: 7,
|
11726
11732
|
minWidth: 7,
|
11727
|
-
fontSize: "18px"
|
11733
|
+
fontSize: "18px",
|
11734
|
+
fontWeight: "bold"
|
11728
11735
|
},
|
11729
11736
|
sm: {
|
11730
11737
|
minHeight: 6,
|
11731
11738
|
minWidth: 6,
|
11732
|
-
fontSize: "16px"
|
11739
|
+
fontSize: "16px",
|
11740
|
+
fontWeight: "normal"
|
11733
11741
|
},
|
11734
11742
|
xs: {
|
11735
11743
|
minHeight: 5,
|
11736
11744
|
minWidth: 5,
|
11737
11745
|
fontSize: "16px",
|
11738
|
-
paddingX: 2
|
11746
|
+
paddingX: 2,
|
11747
|
+
fontWeight: "normal"
|
11739
11748
|
}
|
11740
11749
|
},
|
11741
11750
|
defaultProps: {
|
@@ -12049,7 +12058,8 @@ var init_card_select = __esm({
|
|
12049
12058
|
borderRadius: "sm",
|
12050
12059
|
boxShadow: "md",
|
12051
12060
|
padding: 3,
|
12052
|
-
color: themeTools.mode("darkGrey", "white")(props)
|
12061
|
+
color: themeTools.mode("darkGrey", "white")(props),
|
12062
|
+
...floatingBackground("default", props)
|
12053
12063
|
}
|
12054
12064
|
}),
|
12055
12065
|
variants: {
|
@@ -13528,6 +13538,11 @@ var init_travel_tag = __esm({
|
|
13528
13538
|
description: {
|
13529
13539
|
display: "none"
|
13530
13540
|
}
|
13541
|
+
}),
|
13542
|
+
custom: (props) => ({
|
13543
|
+
container: {
|
13544
|
+
backgroundColor: props.foregroundColor
|
13545
|
+
}
|
13531
13546
|
})
|
13532
13547
|
},
|
13533
13548
|
sizes: {
|
@@ -13888,6 +13903,11 @@ var init_line_icon = __esm({
|
|
13888
13903
|
color: "osloGrey"
|
13889
13904
|
}
|
13890
13905
|
}
|
13906
|
+
}),
|
13907
|
+
custom: (props) => ({
|
13908
|
+
iconContainer: {
|
13909
|
+
backgroundColor: props.backgroundColor
|
13910
|
+
}
|
13891
13911
|
})
|
13892
13912
|
},
|
13893
13913
|
sizes: {
|
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, 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, 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, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardPopover, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, 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, 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, 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, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardPopover, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-UIM4MXLY.mjs';
|
package/package.json
CHANGED
package/src/button/Button.tsx
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import {
|
2
2
|
Box,
|
3
3
|
Center,
|
4
|
-
Button as ChakraButton,
|
5
4
|
ButtonProps as ChakraButtonProps,
|
5
|
+
Flex,
|
6
6
|
forwardRef,
|
7
7
|
useButtonGroup,
|
8
|
+
useStyleConfig,
|
8
9
|
} from "@chakra-ui/react";
|
9
10
|
import React from "react";
|
10
11
|
import { createTexts, useTranslation } from "../i18n";
|
@@ -22,7 +23,9 @@ export type ButtonProps = Exclude<
|
|
22
23
|
size?: "xs" | "sm" | "md" | "lg";
|
23
24
|
/** The different variants of a button
|
24
25
|
*
|
25
|
-
* Defaults to "primary"
|
26
|
+
* Defaults to "primary".
|
27
|
+
*
|
28
|
+
* "control" is deprecated, and will be removed in a future version
|
26
29
|
*/
|
27
30
|
variant?:
|
28
31
|
| "control"
|
@@ -37,7 +40,6 @@ export type ButtonProps = Exclude<
|
|
37
40
|
*
|
38
41
|
* There are several button variants. You can specify which one you want with the `variant` prop. The available variants are:
|
39
42
|
*
|
40
|
-
* - `control`: This button is used for ticket controls only.
|
41
43
|
* - `primary`: This is our main button. It's used for the main actions in a view, like a call to action. There should only be a single primary button in each view.
|
42
44
|
* - `secondary`: Used for secondary actions in a view, and when you need to make several actions available at the same time.
|
43
45
|
* - `tertiary`: Used for additional choices, like a less important secondary action.
|
@@ -62,61 +64,48 @@ export type ButtonProps = Exclude<
|
|
62
64
|
*/
|
63
65
|
export const Button = forwardRef<ButtonProps, "button">((props, ref) => {
|
64
66
|
const {
|
67
|
+
as = "button",
|
68
|
+
fontWeight,
|
65
69
|
size,
|
66
|
-
variant,
|
67
70
|
children,
|
68
71
|
isLoading,
|
69
72
|
isDisabled,
|
70
73
|
leftIcon,
|
71
74
|
rightIcon,
|
75
|
+
sx,
|
72
76
|
...rest
|
73
77
|
} = props;
|
74
78
|
const ariaLabel = useCorrectAriaLabel(props);
|
75
79
|
const buttonGroup = useButtonGroup();
|
76
|
-
const finalVariant = (variant ??
|
77
|
-
buttonGroup?.variant ??
|
78
|
-
"primary") as Required<ButtonProps["variant"]>;
|
79
80
|
const finalSize = (size ?? buttonGroup?.size ?? "md") as Required<
|
80
81
|
ButtonProps["size"]
|
81
82
|
>;
|
83
|
+
const styles = useStyleConfig("Button", {
|
84
|
+
...buttonGroup,
|
85
|
+
...rest,
|
86
|
+
size: finalSize,
|
87
|
+
leftIcon,
|
88
|
+
rightIcon,
|
89
|
+
});
|
90
|
+
|
91
|
+
// We want to explicitly allow to override the fontWeight prop
|
92
|
+
if (fontWeight) {
|
93
|
+
styles.fontWeight = fontWeight;
|
94
|
+
}
|
82
95
|
|
83
96
|
return (
|
84
|
-
<
|
85
|
-
size={finalSize}
|
86
|
-
variant={finalVariant}
|
97
|
+
<Box
|
87
98
|
{...rest}
|
99
|
+
as={as}
|
100
|
+
sx={{ ...styles, ...sx }}
|
88
101
|
ref={ref}
|
89
102
|
aria-label={ariaLabel}
|
90
103
|
aria-busy={isLoading}
|
91
|
-
|
92
|
-
leftIcon={
|
93
|
-
isLoading && leftIcon ? (
|
94
|
-
<Box visibility={isLoading ? "hidden" : "visible"} aria-hidden="true">
|
95
|
-
{leftIcon}
|
96
|
-
</Box>
|
97
|
-
) : (
|
98
|
-
leftIcon
|
99
|
-
)
|
100
|
-
}
|
101
|
-
rightIcon={
|
102
|
-
isLoading && rightIcon ? (
|
103
|
-
<Box visibility={isLoading ? "hidden" : "visible"} aria-hidden="true">
|
104
|
-
{rightIcon}
|
105
|
-
</Box>
|
106
|
-
) : (
|
107
|
-
rightIcon
|
108
|
-
)
|
109
|
-
}
|
104
|
+
disabled={isDisabled || isLoading}
|
110
105
|
position="relative"
|
111
106
|
>
|
112
107
|
{isLoading && (
|
113
|
-
<Center
|
114
|
-
position="absolute"
|
115
|
-
right="0"
|
116
|
-
paddingBottom={1}
|
117
|
-
left="0"
|
118
|
-
paddingTop={2}
|
119
|
-
>
|
108
|
+
<Center position="absolute" right={0} left={0} top={1} bottom={0}>
|
120
109
|
<ColorInlineLoader
|
121
110
|
maxWidth={getLoaderWidth(finalSize)}
|
122
111
|
width="80%"
|
@@ -125,18 +114,30 @@ export const Button = forwardRef<ButtonProps, "button">((props, ref) => {
|
|
125
114
|
/>
|
126
115
|
</Center>
|
127
116
|
)}
|
128
|
-
<
|
117
|
+
<Flex
|
118
|
+
justifyContent="space-between"
|
119
|
+
alignItems="center"
|
120
|
+
gap={1}
|
129
121
|
visibility={isLoading ? "hidden" : "visible"}
|
130
|
-
|
131
|
-
textAlign="left"
|
122
|
+
aria-hidden={isLoading}
|
132
123
|
>
|
133
|
-
{
|
134
|
-
|
135
|
-
|
124
|
+
<Flex justifyContent="center" alignItems="center" gap={1}>
|
125
|
+
{leftIcon}
|
126
|
+
<Box
|
127
|
+
visibility={isLoading ? "hidden" : "visible"}
|
128
|
+
whiteSpace="normal"
|
129
|
+
textAlign="left"
|
130
|
+
>
|
131
|
+
{children}
|
132
|
+
</Box>
|
133
|
+
</Flex>
|
134
|
+
{rightIcon}
|
135
|
+
</Flex>
|
136
|
+
</Box>
|
136
137
|
);
|
137
138
|
});
|
138
139
|
|
139
|
-
function getLoaderWidth(size:
|
140
|
+
function getLoaderWidth(size: Required<ButtonProps["size"]>) {
|
140
141
|
switch (size) {
|
141
142
|
case "xs":
|
142
143
|
return "4rem";
|
package/src/linjetag/InfoTag.tsx
CHANGED
@@ -24,6 +24,17 @@ export type InfoTagProps = TagProps;
|
|
24
24
|
* />
|
25
25
|
* ```
|
26
26
|
*
|
27
|
+
* If required, you can also override the colors and icons in these line tags:
|
28
|
+
*
|
29
|
+
* ```tsx
|
30
|
+
* <InfoTag
|
31
|
+
* variant="custom"
|
32
|
+
* customIconVariant="ferry"
|
33
|
+
* foregroundColor="#b4da55"
|
34
|
+
* backgroundColor="#c0ffee"
|
35
|
+
* />
|
36
|
+
* ```
|
37
|
+
*
|
27
38
|
* @see https://spor.vy.no/components/line-tags
|
28
39
|
*/
|
29
40
|
export const InfoTag = ({
|
@@ -31,11 +42,21 @@ export const InfoTag = ({
|
|
31
42
|
size = "md",
|
32
43
|
title,
|
33
44
|
description,
|
45
|
+
...customProps
|
34
46
|
}: InfoTagProps) => {
|
35
|
-
const styles = useMultiStyleConfig("InfoTag", {
|
47
|
+
const styles = useMultiStyleConfig("InfoTag", {
|
48
|
+
variant,
|
49
|
+
size,
|
50
|
+
...customProps,
|
51
|
+
});
|
36
52
|
return (
|
37
53
|
<Box sx={styles.container}>
|
38
|
-
<LineIcon
|
54
|
+
<LineIcon
|
55
|
+
variant={variant}
|
56
|
+
size={size}
|
57
|
+
sx={styles.iconContainer}
|
58
|
+
{...(customProps as any)} // TODO: Fix this
|
59
|
+
/>
|
39
60
|
<Box sx={styles.textContainer}>
|
40
61
|
{title && (
|
41
62
|
<Box as="span" sx={styles.title}>
|