@vygruppen/spor-react 9.8.3 → 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/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: "floating" | "accent" | "base";
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, width, height, onChange, value, isLabelSrOnly, defaultValue, variant, ...props }: InfoSelectProps<T>): React.JSX.Element;
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?: {
@@ -7224,25 +7241,39 @@ declare const theme: {
7224
7241
  };
7225
7242
  PressableCard: {
7226
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
+ };
7227
7261
  _disabled: {
7228
7262
  outline: string;
7229
7263
  pointerEvents: string;
7230
7264
  color: string;
7231
- backgroundColor: string;
7232
- };
7233
- _focusVisible: {
7234
7265
  outlineWidth: string;
7235
7266
  outlineColor: string;
7236
7267
  outlineStyle: string;
7237
7268
  outlineOffset: string;
7269
+ backgroundColor: string;
7270
+ } | {
7271
+ outline: string;
7272
+ pointerEvents: string;
7273
+ color: string;
7274
+ outlineColor: string;
7275
+ backgroundColor: string;
7238
7276
  };
7239
- appearance: string;
7240
- border: string;
7241
- overflow: string;
7242
- fontSize: string;
7243
- display: string;
7244
- borderRadius: string;
7245
- cursor: string;
7246
7277
  }) | undefined;
7247
7278
  sizes?: {
7248
7279
  [key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
package/dist/index.js CHANGED
@@ -933,7 +933,7 @@ var init_StaticCard = __esm({
933
933
  const styles3 = react.useStyleConfig("StaticCard", {
934
934
  colorScheme
935
935
  });
936
- return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { __css: styles3, ...props, ref }, children, /* @__PURE__ */ React73__namespace.default.createElement(react.Card, null));
936
+ return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { __css: styles3, ...props, ref }, children);
937
937
  }
938
938
  );
939
939
  }
@@ -942,7 +942,7 @@ exports.PressableCard = void 0;
942
942
  var init_PressableCard = __esm({
943
943
  "src/layout/PressableCard.tsx"() {
944
944
  exports.PressableCard = react.forwardRef(
945
- ({ children, variant = "base", ...props }, ref) => {
945
+ ({ children, variant = "floating", ...props }, ref) => {
946
946
  const styles3 = react.useStyleConfig("PressableCard", {
947
947
  variant
948
948
  });
@@ -1849,6 +1849,7 @@ var init_ClosableAlert = __esm({
1849
1849
  init_BaseAlert();
1850
1850
  exports.ClosableAlert = ({
1851
1851
  variant,
1852
+ title,
1852
1853
  children,
1853
1854
  onClose: externalOnClose = () => {
1854
1855
  }
@@ -1873,7 +1874,7 @@ var init_ClosableAlert = __esm({
1873
1874
  "aria-label": t2(texts6.close),
1874
1875
  sx: styles3.closeButton
1875
1876
  }
1876
- ), /* @__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)));
1877
1878
  };
1878
1879
  texts6 = createTexts({
1879
1880
  close: {
@@ -1926,11 +1927,12 @@ var init_ExpandableAlert = __esm({
1926
1927
  overflow: "hidden",
1927
1928
  "-webkit-line-clamp": "1",
1928
1929
  "-webkit-box-orient": "vertical"
1929
- }
1930
+ },
1931
+ color: "darkGrey"
1930
1932
  },
1931
1933
  title
1932
1934
  )),
1933
- /* @__PURE__ */ React73__namespace.default.createElement(react.AccordionIcon, null)
1935
+ /* @__PURE__ */ React73__namespace.default.createElement(react.AccordionIcon, { color: "darkGrey" })
1934
1936
  )), /* @__PURE__ */ React73__namespace.default.createElement(react.AccordionPanel, null, children))
1935
1937
  ));
1936
1938
  };
@@ -1941,8 +1943,12 @@ var init_StaticAlert = __esm({
1941
1943
  "src/alert/StaticAlert.tsx"() {
1942
1944
  init_AlertIcon();
1943
1945
  init_BaseAlert();
1944
- exports.StaticAlert = ({ children, ...props }) => {
1945
- return /* @__PURE__ */ React73__namespace.default.createElement(BaseAlert, { ...props }, /* @__PURE__ */ React73__namespace.default.createElement(AlertIcon, { variant: props.variant }), children);
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)));
1946
1952
  };
1947
1953
  }
1948
1954
  });
@@ -3600,13 +3606,11 @@ var init_ListBox = __esm({
3600
3606
  });
3601
3607
  function InfoSelect({
3602
3608
  placeholder,
3603
- width = "100%",
3604
- height = "auto",
3605
3609
  onChange,
3606
3610
  value,
3607
3611
  isLabelSrOnly,
3608
3612
  defaultValue,
3609
- variant = "base",
3613
+ variant,
3610
3614
  ...props
3611
3615
  }) {
3612
3616
  const renamedProps = {
@@ -3633,7 +3637,8 @@ function InfoSelect({
3633
3637
  const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
3634
3638
  const { t: t2 } = useTranslation();
3635
3639
  const formControl = react.useFormControlProps(props);
3636
- return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { sx: styles3.container }, /* @__PURE__ */ React73__namespace.default.createElement(react.chakra.div, { ...labelProps, sx: styles3.label }, props.label), /* @__PURE__ */ React73__namespace.default.createElement(
3640
+ const hasChosenValue = state2.selectedItem !== null;
3641
+ return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { sx: styles3.container }, /* @__PURE__ */ React73__namespace.default.createElement(
3637
3642
  reactAria.HiddenSelect,
3638
3643
  {
3639
3644
  state: state2,
@@ -3648,13 +3653,36 @@ function InfoSelect({
3648
3653
  ref: triggerRef,
3649
3654
  sx: styles3.button,
3650
3655
  ...buttonProps,
3651
- width,
3652
- height,
3653
3656
  "data-attachable": true,
3654
3657
  "aria-invalid": formControl.isInvalid,
3655
3658
  "aria-describedby": formControl["aria-describedby"]
3656
3659
  },
3657
- /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)),
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
+ )),
3658
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))
3659
3687
  ), state2.isOpen && /* @__PURE__ */ React73__namespace.default.createElement(
3660
3688
  Popover3,
@@ -11317,14 +11345,14 @@ function floatingBackground(state2, props) {
11317
11345
  return {
11318
11346
  backgroundColor: themeTools.mode(
11319
11347
  "floating.surface.hover.light",
11320
- "floating.surface.hover.dark"
11348
+ `color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`
11321
11349
  )(props)
11322
11350
  };
11323
11351
  case "default":
11324
11352
  return {
11325
11353
  backgroundColor: themeTools.mode(
11326
- "floating.surface.default.light",
11327
- "floating.surface.default.dark"
11354
+ "white",
11355
+ `color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`
11328
11356
  )(props)
11329
11357
  };
11330
11358
  }
@@ -11386,7 +11414,10 @@ function ghostBackground(state2, props) {
11386
11414
  };
11387
11415
  case "selected": {
11388
11416
  return {
11389
- backgroundColor: themeTools.mode("mint", "whiteAlpha.200")(props)
11417
+ backgroundColor: themeTools.mode(
11418
+ "ghost.surface.selected.light",
11419
+ "ghost.surface.selected.dark"
11420
+ )(props)
11390
11421
  };
11391
11422
  }
11392
11423
  case "default":
@@ -11395,6 +11426,18 @@ function ghostBackground(state2, props) {
11395
11426
  };
11396
11427
  }
11397
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
+ }
11398
11441
  var init_ghost_utils = __esm({
11399
11442
  "src/theme/utils/ghost-utils.ts"() {
11400
11443
  }
@@ -11564,7 +11607,8 @@ var init_alert2 = __esm({
11564
11607
  closeButton: {
11565
11608
  position: "absolute",
11566
11609
  top: 1,
11567
- right: 1
11610
+ right: 1,
11611
+ color: "darkGrey"
11568
11612
  }
11569
11613
  },
11570
11614
  variants: {
@@ -13495,18 +13539,28 @@ var init_info_select = __esm({
13495
13539
  container: {},
13496
13540
  label: {
13497
13541
  position: "relative",
13542
+ fontSize: ["mobile.xs", "desktop.sm"],
13498
13543
  ...props.isLabelSrOnly ? srOnly2 : {}
13499
13544
  },
13545
+ innerButton: {
13546
+ display: "flex",
13547
+ flexDir: "column",
13548
+ alignItems: "start",
13549
+ justifyContent: "start"
13550
+ },
13500
13551
  button: {
13552
+ display: "flex",
13501
13553
  appearance: "none",
13554
+ width: "100%",
13555
+ height: "54px",
13502
13556
  borderTopRadius: "sm",
13503
13557
  borderBottomRadius: props.isOpen ? 0 : "sm",
13504
13558
  paddingY: 1.5,
13505
13559
  paddingX: 3,
13506
- display: "flex",
13507
13560
  justifyContent: "space-between",
13508
13561
  alignItems: "center",
13509
13562
  fontSize: "mobile.md",
13563
+ h: 8,
13510
13564
  ...baseBorder("default", props),
13511
13565
  _hover: {
13512
13566
  ...baseBorder("hover", props)
@@ -13524,6 +13578,7 @@ var init_info_select = __esm({
13524
13578
  ...baseBorder("invalid", props)
13525
13579
  }
13526
13580
  },
13581
+ placeholder: {},
13527
13582
  arrowIcon: {}
13528
13583
  }),
13529
13584
  variants: {
@@ -14201,7 +14256,7 @@ var init_listbox = __esm({
14201
14256
  marginY: 1,
14202
14257
  marginX: 1,
14203
14258
  borderRadius: "sm",
14204
- color: themeTools.mode("darkGrey", "white")(props),
14259
+ ...ghostText("default", props),
14205
14260
  cursor: "pointer",
14206
14261
  outline: "none",
14207
14262
  _active: {
@@ -14214,15 +14269,15 @@ var init_listbox = __esm({
14214
14269
  ...ghostBackground("selected", props)
14215
14270
  },
14216
14271
  _selected: {
14217
- ...ghostBackground("selected", props)
14272
+ ...ghostBackground("active", props)
14218
14273
  }
14219
14274
  },
14220
14275
  label: {},
14221
14276
  description: {
14222
14277
  fontSize: ["mobile.xs", "desktop.xs"],
14223
- color: themeTools.mode("dimGrey", "silver")(props),
14278
+ ...ghostText("default", props),
14224
14279
  "[aria-selected='true'] &": {
14225
- color: themeTools.mode("lightGrey", "platinum")(props)
14280
+ ...ghostText("selected", props)
14226
14281
  }
14227
14282
  }
14228
14283
  })
@@ -15557,9 +15612,14 @@ var init_pressable_card = __esm({
15557
15612
  display: "block",
15558
15613
  borderRadius: "md",
15559
15614
  cursor: "pointer",
15560
- ...focusVisibleStyles(props),
15615
+ transitionProperty: "common",
15616
+ transitionDuration: "fast",
15617
+ "button&, a&, label&, &.is-clickable": {
15618
+ ...focusVisibleStyles(props)
15619
+ },
15561
15620
  _disabled: {
15562
15621
  ...baseBackground("disabled", props),
15622
+ ...baseBorder("disabled", props),
15563
15623
  ...baseText("disabled", props),
15564
15624
  outline: "none",
15565
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-ZDOSE4VD.mjs';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "9.8.3",
3
+ "version": "9.9.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -6,6 +6,8 @@ export type BaseAlertProps = BoxProps & {
6
6
  variant: "info" | "success" | "warning" | "alt-transport" | "error";
7
7
  /** The body content of the alert */
8
8
  children: React.ReactNode;
9
+ /** The title of the alert */
10
+ title?: string;
9
11
  };
10
12
 
11
13
  /**
@@ -1,4 +1,9 @@
1
- import { useDisclosure, useMultiStyleConfig } from "@chakra-ui/react";
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
- {children}
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 = ({ children, ...props }: StaticAlertProps) => {
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
- {children}
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
  };
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  Box,
3
3
  chakra,
4
+ Flex,
5
+ FormLabel,
4
6
  ResponsiveValue,
5
7
  useFormControlProps,
6
8
  useMultiStyleConfig,
@@ -11,7 +13,7 @@ import {
11
13
  } from "@vygruppen/spor-icon-react";
12
14
  import React, { useRef } from "react";
13
15
  import { HiddenSelect, useButton, useSelect } from "react-aria";
14
- import { useSelectState } from "react-stately";
16
+ import { Column, useSelectState } from "react-stately";
15
17
  import { createTexts, useTranslation } from "../";
16
18
  import { ListBox } from "./ListBox";
17
19
  import { Popover } from "./Popover";
@@ -152,13 +154,11 @@ type InfoSelectProps<T extends object> = {
152
154
  */
153
155
  export function InfoSelect<T extends object>({
154
156
  placeholder,
155
- width = "100%",
156
- height = "auto",
157
157
  onChange,
158
158
  value,
159
159
  isLabelSrOnly,
160
160
  defaultValue,
161
- variant = "base",
161
+ variant,
162
162
  ...props
163
163
  }: InfoSelectProps<T>) {
164
164
  const renamedProps = {
@@ -188,11 +188,10 @@ export function InfoSelect<T extends object>({
188
188
  const { t } = useTranslation();
189
189
  const formControl = useFormControlProps(props);
190
190
 
191
+ const hasChosenValue = state.selectedItem !== null;
192
+
191
193
  return (
192
194
  <Box sx={styles.container}>
193
- <chakra.div {...labelProps} sx={styles.label}>
194
- {props.label}
195
- </chakra.div>
196
195
  <HiddenSelect
197
196
  state={state}
198
197
  triggerRef={triggerRef}
@@ -205,17 +204,37 @@ export function InfoSelect<T extends object>({
205
204
  ref={triggerRef}
206
205
  sx={styles.button}
207
206
  {...buttonProps}
208
- width={width}
209
- height={height}
210
207
  data-attachable
211
208
  aria-invalid={formControl.isInvalid}
212
209
  aria-describedby={formControl["aria-describedby"]}
213
210
  >
214
- <Box {...valueProps}>
215
- {state.selectedItem
216
- ? state.selectedItem.textValue ?? state.selectedItem.rendered
217
- : placeholder ?? t(texts.selectAnOption)}
218
- </Box>
211
+ <chakra.div sx={styles.innerButton}>
212
+ <chakra.div
213
+ {...labelProps}
214
+ sx={{
215
+ ...styles.label,
216
+ ...(hasChosenValue && {
217
+ transform: "scale(0.825) translateY(-10px) translateX(-10%)",
218
+ transitionProperty: "var(--spor-transition-property-common)",
219
+ transitionDuration: "var(--spor-transition-duration-normal)",
220
+ }),
221
+ }}
222
+ >
223
+ {props.label}
224
+ </chakra.div>
225
+ <Box
226
+ {...valueProps}
227
+ h={!hasChosenValue ? "0px" : "18px"}
228
+ hidden={!hasChosenValue}
229
+ transform={"scale(1) translateY(-10px)"}
230
+ transitionProperty={"var(--spor-transition-property-common)"}
231
+ transitionDuration={"var(--spor-transition-duration-normal)"}
232
+ >
233
+ {state.selectedItem
234
+ ? state.selectedItem.textValue ?? state.selectedItem.rendered
235
+ : placeholder ?? t(texts.selectAnOption)}
236
+ </Box>
237
+ </chakra.div>
219
238
  <Box sx={styles.arrowIcon}>
220
239
  {state.isOpen ? <DropdownUpFill24Icon /> : <DropdownDownFill24Icon />}
221
240
  </Box>
@@ -185,6 +185,7 @@ const OptionContext = React.createContext<OptionContextValue>({
185
185
  labelProps: {},
186
186
  descriptionProps: {},
187
187
  });
188
+
188
189
  const useOptionContext = () => {
189
190
  return useContext(OptionContext);
190
191
  };