@vygruppen/spor-react 9.8.1 → 9.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@9.8.1 build
2
+ > @vygruppen/spor-react@9.8.3 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,12 +9,12 @@
9
9
  CJS Build start
10
10
  ESM Build start
11
11
  DTS Build start
12
- CJS dist/index.js 508.25 KB
13
- CJS ⚡️ Build success in 2175ms
12
+ CJS dist/index.js 509.04 KB
13
+ CJS ⚡️ Build success in 2230ms
14
14
  ESM dist/index.mjs 2.11 KB
15
- ESM dist/chunk-S335RZ6M.mjs 397.76 KB
16
- ESM dist/CountryCodeSelect-FODJ4ZSF.mjs 1.19 KB
17
- ESM ⚡️ Build success in 2175ms
18
- DTS ⚡️ Build success in 11477ms
19
- DTS dist/index.d.ts 337.73 KB
20
- DTS dist/index.d.mts 337.73 KB
15
+ ESM dist/CountryCodeSelect-C2XKHNTP.mjs 1.19 KB
16
+ ESM dist/chunk-ZDOSE4VD.mjs 398.42 KB
17
+ ESM ⚡️ Build success in 2232ms
18
+ DTS ⚡️ Build success in 11754ms
19
+ DTS dist/index.d.ts 337.67 KB
20
+ DTS dist/index.d.mts 337.67 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 9.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 50a42b2: Fix render of RadioCardGroup and RadioCard
8
+ - 72afbd7: Removed static values Table styles
9
+
10
+ ## 9.8.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 5503c91: Fixes on new Cards
15
+ - Make PressableCard more scalable (removed as)
16
+ - Edit "white" colorScheme on StaticCard to support darkmode
17
+
3
18
  ## 9.8.1
4
19
 
5
20
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-S335RZ6M.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-ZDOSE4VD.mjs';
2
2
  import React from 'react';
3
3
  import { getSupportedCallingCodes } from 'awesome-phonenumber';
4
4
 
@@ -4,7 +4,7 @@ export { tokens11 as tokens };
4
4
  import { forwardRef, Divider as Divider$1, Stack as Stack$1, useRadio, useStyleConfig, chakra, Box, Card, Accordion as Accordion$1, Skeleton as Skeleton$1, useButtonGroup, Center, Flex, ButtonGroup as ButtonGroup$1, IconButton as IconButton$1, useMultiStyleConfig, Badge as Badge$1, Code as Code$1, Text, PopoverAnchor, FormLabel, useFormControlContext, PopoverContent, PopoverArrow, PopoverBody, FocusLock, Popover, InputGroup, PopoverTrigger, Portal, Checkbox as Checkbox$1, useCheckbox, FormControl as FormControl$1, InputLeftElement, Input as Input$1, InputRightElement, Select, useDisclosure, Button as Button$1, useControllableState, Radio as Radio$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Textarea as Textarea$1, Link, ModalHeader as ModalHeader$1, useModalContext, DrawerContent as DrawerContent$1, Tabs as Tabs$1, Table as Table$1, defineStyleConfig as defineStyleConfig$1, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, useRadioGroup, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, useColorMode, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, useColorModeValue, Breadcrumb as Breadcrumb$1, BreadcrumbItem as BreadcrumbItem$1, BreadcrumbLink as BreadcrumbLink$1, Heading as Heading$1, CheckboxGroup as CheckboxGroup$1, List, ListItem, useFormControlProps, useFormControl, Drawer as Drawer$1, DrawerOverlay, DrawerBody, DrawerHeader, useMediaQuery, DrawerCloseButton, DarkMode, PopoverCloseButton, usePopoverContext, UnorderedList, ChakraProvider, useToast as useToast$1, useInterval } from '@chakra-ui/react';
5
5
  export { AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Center, Collapse, Container, DarkMode, DrawerBody, DrawerCloseButton, DrawerFooter, DrawerOverlay, Fade, Flex, FormHelperText, Grid, GridItem, HStack, Image, Img, InputGroup, LightMode, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalOverlay, OrderedList, Portal, ScaleFade, SimpleGrid, Slide, SlideFade, Spacer, Tab, TabList, TabPanel, TabPanels, TableCaption, Tbody, Td, Tfoot, Th, Thead, Tr, UnorderedList, VStack, Wrap, WrapItem, defineStyleConfig, extendTheme, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToken } from '@chakra-ui/react';
6
6
  import * as React73 from 'react';
7
- import React73__default, { useId, createContext, useEffect, forwardRef as forwardRef$1, useRef, useState, Suspense, Children, useContext, useCallback, useMemo, useLayoutEffect } from 'react';
7
+ import React73__default, { useId, createContext, useEffect, forwardRef as forwardRef$1, useRef, useState, Suspense, useContext, useCallback, useMemo, useLayoutEffect } from 'react';
8
8
  import { CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CalendarOutline24Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon, DropdownRightFill18Icon, DropdownLeftFill18Icon, DropdownDownFill18Icon, DropdownDownFill24Icon, DropdownUpFill24Icon, ArrowRightFill18Icon, ArrowLeftFill24Icon, ArrowLeftOutline24Icon, ArrowRightOutline24Icon, ErrorOutline24Icon, AltTransportOutline24Icon, WarningOutline24Icon, SuccessOutline24Icon, InformationOutline24Icon, TrainFill18Icon, TrainFill24Icon, TrainFill30Icon, ExpressBusFill18Icon, ExpressBusFill24Icon, ExpressBusFill30Icon, BusFill18Icon, BusFill24Icon, BusFill30Icon, FerryFill18Icon, FerryFill24Icon, FerryFill30Icon, SubwayFill18Icon, SubwayFill24Icon, SubwayFill30Icon, TramFill18Icon, TramFill24Icon, TramFill30Icon, AltTransportFill18Icon, AltTransportFill24Icon, AltTransportFill30Icon, WalkFill18Icon, WalkFill24Icon, WalkFill30Icon } from '@vygruppen/spor-icon-react';
9
9
  import { inlineLoaderColorData, spinnerColorData, contentLoaderData, fullScreenLoaderWhiteData, inlineLoaderDarkData, fullScreenLoaderBlackData, inlineLoaderLightData, spinnerLightData, spinnerDarkData } from '@vygruppen/spor-loader';
10
10
  import { useLottie } from 'lottie-react';
@@ -829,14 +829,31 @@ var RadioCardGroup = ({
829
829
  ...props
830
830
  });
831
831
  const group = getRootProps();
832
- return /* @__PURE__ */ React73__default.createElement(Stack$1, { direction: direction2, ...group }, Children.map(
833
- children,
834
- (child) => {
832
+ return /* @__PURE__ */ React73__default.createElement(Stack$1, { direction: direction2, ...group }, recursiveMap(children, (child) => {
833
+ if (child.type === RadioCard) {
835
834
  const radio = getRadioProps({ value: child.props.value });
836
- return React73__default.cloneElement(child, { ...radio, variant, ...props });
835
+ const variantValue = variant;
836
+ return React73__default.cloneElement(
837
+ child,
838
+ { ...radio, variant: variantValue, ...props }
839
+ );
837
840
  }
838
- ));
841
+ return child;
842
+ }));
839
843
  };
844
+ function recursiveMap(children, fn) {
845
+ return React73__default.Children.map(children, (child) => {
846
+ if (React73__default.isValidElement(child) && child.props.children) {
847
+ child = React73__default.cloneElement(child, {
848
+ children: recursiveMap(child.props.children, fn)
849
+ });
850
+ }
851
+ if (React73__default.isValidElement(child)) {
852
+ return fn(child);
853
+ }
854
+ return child;
855
+ });
856
+ }
840
857
  var StaticCard = forwardRef(
841
858
  ({ colorScheme = "white", children, ...props }, ref) => {
842
859
  const styles3 = useStyleConfig("StaticCard", {
@@ -845,15 +862,14 @@ var StaticCard = forwardRef(
845
862
  return /* @__PURE__ */ React73__default.createElement(Box, { __css: styles3, ...props, ref }, children, /* @__PURE__ */ React73__default.createElement(Card, null));
846
863
  }
847
864
  );
848
- var PressableCard = ({
849
- children,
850
- as = "button",
851
- variant = "base",
852
- ...props
853
- }) => {
854
- const styles3 = useStyleConfig("PressableCard", { variant });
855
- return /* @__PURE__ */ React73__default.createElement(Box, { as, __css: styles3, ...props }, children);
856
- };
865
+ var PressableCard = forwardRef(
866
+ ({ children, variant = "base", ...props }, ref) => {
867
+ const styles3 = useStyleConfig("PressableCard", {
868
+ variant
869
+ });
870
+ return /* @__PURE__ */ React73__default.createElement(Box, { __css: styles3, ...props, ref }, children);
871
+ }
872
+ );
857
873
  var AccordionContext = React73__default.createContext(null);
858
874
  var AccordionProvider = ({
859
875
  size: size2,
@@ -2637,10 +2653,12 @@ var CardSelect = forwardRef(
2637
2653
  placement
2638
2654
  },
2639
2655
  /* @__PURE__ */ React73__default.createElement(
2640
- Card2,
2656
+ StaticCard,
2641
2657
  {
2642
2658
  colorScheme: "white",
2643
2659
  size: "lg",
2660
+ border: "sm",
2661
+ borderColor: "grey",
2644
2662
  sx: styles3.card,
2645
2663
  ...overlayProps
2646
2664
  },
@@ -3427,7 +3445,7 @@ var texts14 = createTexts({
3427
3445
  sv: "Telefonnummer"
3428
3446
  }
3429
3447
  });
3430
- var LazyCountryCodeSelect = React73__default.lazy(() => import('./CountryCodeSelect-FODJ4ZSF.mjs'));
3448
+ var LazyCountryCodeSelect = React73__default.lazy(() => import('./CountryCodeSelect-C2XKHNTP.mjs'));
3431
3449
  var Radio = forwardRef((props, ref) => {
3432
3450
  return /* @__PURE__ */ React73__default.createElement(Radio$1, { ...props, ref });
3433
3451
  });
@@ -13329,13 +13347,11 @@ var config39 = helpers28.defineMultiStyleConfig({
13329
13347
  table: {
13330
13348
  borderCollapse: "collapse",
13331
13349
  ...baseText("default", props),
13332
- width: "100%",
13333
- minWidth: "600px"
13350
+ width: "100%"
13334
13351
  },
13335
13352
  th: {
13336
13353
  fontWeight: "bold",
13337
- textAlign: "start",
13338
- minWidth: "68px"
13354
+ textAlign: "start"
13339
13355
  },
13340
13356
  td: {
13341
13357
  textAlign: "start"
@@ -13660,8 +13676,8 @@ var getColorSchemeBaseProps2 = (props) => {
13660
13676
  switch (props.colorScheme) {
13661
13677
  case "white":
13662
13678
  return {
13663
- backgroundColor: "white",
13664
- color: "darkGrey"
13679
+ ...floatingBackground("default", props),
13680
+ color: mode("text.default.light", "text.default.dark")(props)
13665
13681
  };
13666
13682
  case "grey":
13667
13683
  return {
@@ -13708,6 +13724,7 @@ var config44 = defineStyleConfig$1({
13708
13724
  fontSize: "inherit",
13709
13725
  display: "block",
13710
13726
  borderRadius: "md",
13727
+ cursor: "pointer",
13711
13728
  ...focusVisibleStyles(props),
13712
13729
  _disabled: {
13713
13730
  ...baseBackground("disabled", props),
@@ -13744,6 +13761,7 @@ var config44 = defineStyleConfig$1({
13744
13761
  boxShadow: "sm",
13745
13762
  _hover: {
13746
13763
  ...floatingBackground("hover", props),
13764
+ ...floatingBorder("hover", props),
13747
13765
  boxShadow: "md"
13748
13766
  },
13749
13767
  _active: {
package/dist/index.d.mts CHANGED
@@ -58,8 +58,8 @@ type StackProps = Exclude<StackProps$1, "direction"> & {
58
58
  *
59
59
  * ```tsx
60
60
  * <Stack spacing={4}>
61
- * <Card>Here's one card</Card>
62
- * <Card>Here's another card, with a lot of space between it</Card>
61
+ * <StaticCard>Here's one card</StaticCard>
62
+ * <StaticCard>Here's another card, with a lot of space between it</StaticCard>
63
63
  * </Stack>
64
64
  * ```
65
65
  */
@@ -209,11 +209,9 @@ type StaticCardProps = BoxProps & {
209
209
  */
210
210
  declare const StaticCard: _chakra_ui_system_dist_system_types.ComponentWithAs<As, StaticCardProps>;
211
211
 
212
- type PressableCardProps = Omit<BoxProps, "as"> & {
212
+ type PressableCardProps = BoxProps & {
213
213
  /** Defaults to "base" */
214
214
  variant: "floating" | "accent" | "base";
215
- /** Defaults to "button" */
216
- as: "button" | "a" | "label";
217
215
  };
218
216
  /**
219
217
  * `PressableCard` is a component that renders a pressable card.
@@ -222,7 +220,6 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
222
220
  * It can be rendered as a button, link, label, or any other HTML element by specifying the `as` prop.
223
221
  * If no `as` prop is provided, it defaults to a button.
224
222
  *
225
- * The `size` prop can be used to control the size of the card. It defaults to "sm".
226
223
  * The `variant` prop can be used to control the style variant of the card. It defaults to "base".
227
224
  *
228
225
  * Example usage:
@@ -245,7 +242,7 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
245
242
  *
246
243
  * @see StaticCard
247
244
  */
248
- declare const PressableCard: ({ children, as, variant, ...props }: PressableCardProps) => React.JSX.Element;
245
+ declare const PressableCard: _chakra_ui_system_dist_system_types.ComponentWithAs<As, PressableCardProps>;
249
246
 
250
247
  type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
251
248
  /**
@@ -2109,7 +2106,7 @@ type NudgeProps = {
2109
2106
  * name="my-nudge"
2110
2107
  * content="Check out this enormous new feature!"
2111
2108
  * >
2112
- * <Card variant="base" padding={2} width="fit-content">My new feature</Card>
2109
+ * <StaticCard variant="base" padding={2} width="fit-content">My new feature</StaticCard>
2113
2110
  * </Nudge>
2114
2111
  * ```
2115
2112
  */
@@ -2134,9 +2131,9 @@ type WizardNudgeProps = Omit<NudgeProps, "actions" | "content"> & {
2134
2131
  * name="my-wizard-nudge"
2135
2132
  * introducedDate="2024-02-19"
2136
2133
  * >
2137
- * <Card width="fit-content" padding={2}>
2134
+ * <StaticCard width="fit-content" padding={2}>
2138
2135
  * My new feature
2139
- * </Card>
2136
+ * </StaticCard>
2140
2137
  * </WizardNudge>
2141
2138
  * ```
2142
2139
  */
@@ -6630,14 +6627,12 @@ declare const theme: {
6630
6627
  baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
6631
6628
  table: {
6632
6629
  width: string;
6633
- minWidth: string;
6634
6630
  color: string;
6635
6631
  borderCollapse: string;
6636
6632
  };
6637
6633
  th: {
6638
6634
  fontWeight: string;
6639
6635
  textAlign: string;
6640
- minWidth: string;
6641
6636
  };
6642
6637
  td: {
6643
6638
  textAlign: string;
@@ -7185,8 +7180,8 @@ declare const theme: {
7185
7180
  };
7186
7181
  StaticCard: {
7187
7182
  baseStyle?: ((props: any) => {
7188
- backgroundColor: string;
7189
7183
  color: string;
7184
+ backgroundColor: string;
7190
7185
  _focusVisible: {
7191
7186
  outlineWidth: string;
7192
7187
  outlineColor: string;
@@ -7200,8 +7195,7 @@ declare const theme: {
7200
7195
  display: string;
7201
7196
  borderRadius: string;
7202
7197
  } | {
7203
- backgroundColor: string;
7204
- color: string;
7198
+ backgroundColor: any;
7205
7199
  _focusVisible: {
7206
7200
  outlineWidth: string;
7207
7201
  outlineColor: string;
@@ -7214,6 +7208,7 @@ declare const theme: {
7214
7208
  fontSize: string;
7215
7209
  display: string;
7216
7210
  borderRadius: string;
7211
+ color: string;
7217
7212
  }) | undefined;
7218
7213
  sizes?: {
7219
7214
  [key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
@@ -7247,6 +7242,7 @@ declare const theme: {
7247
7242
  fontSize: string;
7248
7243
  display: string;
7249
7244
  borderRadius: string;
7245
+ cursor: string;
7250
7246
  }) | undefined;
7251
7247
  sizes?: {
7252
7248
  [key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
@@ -7317,6 +7313,8 @@ declare const theme: {
7317
7313
  boxShadow: string;
7318
7314
  _hover: {
7319
7315
  boxShadow: string;
7316
+ outline: string;
7317
+ outlineColor: string;
7320
7318
  backgroundColor: string;
7321
7319
  };
7322
7320
  _active: {
@@ -9417,4 +9415,4 @@ declare const Text: _chakra_ui_system_dist_system_types.ComponentWithAs<"p", Tex
9417
9415
  **/
9418
9416
  declare function slugify(text: string | string[], maxLength?: number): string;
9419
9417
 
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 };
9418
+ 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.d.ts CHANGED
@@ -58,8 +58,8 @@ type StackProps = Exclude<StackProps$1, "direction"> & {
58
58
  *
59
59
  * ```tsx
60
60
  * <Stack spacing={4}>
61
- * <Card>Here's one card</Card>
62
- * <Card>Here's another card, with a lot of space between it</Card>
61
+ * <StaticCard>Here's one card</StaticCard>
62
+ * <StaticCard>Here's another card, with a lot of space between it</StaticCard>
63
63
  * </Stack>
64
64
  * ```
65
65
  */
@@ -209,11 +209,9 @@ type StaticCardProps = BoxProps & {
209
209
  */
210
210
  declare const StaticCard: _chakra_ui_system_dist_system_types.ComponentWithAs<As, StaticCardProps>;
211
211
 
212
- type PressableCardProps = Omit<BoxProps, "as"> & {
212
+ type PressableCardProps = BoxProps & {
213
213
  /** Defaults to "base" */
214
214
  variant: "floating" | "accent" | "base";
215
- /** Defaults to "button" */
216
- as: "button" | "a" | "label";
217
215
  };
218
216
  /**
219
217
  * `PressableCard` is a component that renders a pressable card.
@@ -222,7 +220,6 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
222
220
  * It can be rendered as a button, link, label, or any other HTML element by specifying the `as` prop.
223
221
  * If no `as` prop is provided, it defaults to a button.
224
222
  *
225
- * The `size` prop can be used to control the size of the card. It defaults to "sm".
226
223
  * The `variant` prop can be used to control the style variant of the card. It defaults to "base".
227
224
  *
228
225
  * Example usage:
@@ -245,7 +242,7 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
245
242
  *
246
243
  * @see StaticCard
247
244
  */
248
- declare const PressableCard: ({ children, as, variant, ...props }: PressableCardProps) => React.JSX.Element;
245
+ declare const PressableCard: _chakra_ui_system_dist_system_types.ComponentWithAs<As, PressableCardProps>;
249
246
 
250
247
  type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
251
248
  /**
@@ -2109,7 +2106,7 @@ type NudgeProps = {
2109
2106
  * name="my-nudge"
2110
2107
  * content="Check out this enormous new feature!"
2111
2108
  * >
2112
- * <Card variant="base" padding={2} width="fit-content">My new feature</Card>
2109
+ * <StaticCard variant="base" padding={2} width="fit-content">My new feature</StaticCard>
2113
2110
  * </Nudge>
2114
2111
  * ```
2115
2112
  */
@@ -2134,9 +2131,9 @@ type WizardNudgeProps = Omit<NudgeProps, "actions" | "content"> & {
2134
2131
  * name="my-wizard-nudge"
2135
2132
  * introducedDate="2024-02-19"
2136
2133
  * >
2137
- * <Card width="fit-content" padding={2}>
2134
+ * <StaticCard width="fit-content" padding={2}>
2138
2135
  * My new feature
2139
- * </Card>
2136
+ * </StaticCard>
2140
2137
  * </WizardNudge>
2141
2138
  * ```
2142
2139
  */
@@ -6630,14 +6627,12 @@ declare const theme: {
6630
6627
  baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
6631
6628
  table: {
6632
6629
  width: string;
6633
- minWidth: string;
6634
6630
  color: string;
6635
6631
  borderCollapse: string;
6636
6632
  };
6637
6633
  th: {
6638
6634
  fontWeight: string;
6639
6635
  textAlign: string;
6640
- minWidth: string;
6641
6636
  };
6642
6637
  td: {
6643
6638
  textAlign: string;
@@ -7185,8 +7180,8 @@ declare const theme: {
7185
7180
  };
7186
7181
  StaticCard: {
7187
7182
  baseStyle?: ((props: any) => {
7188
- backgroundColor: string;
7189
7183
  color: string;
7184
+ backgroundColor: string;
7190
7185
  _focusVisible: {
7191
7186
  outlineWidth: string;
7192
7187
  outlineColor: string;
@@ -7200,8 +7195,7 @@ declare const theme: {
7200
7195
  display: string;
7201
7196
  borderRadius: string;
7202
7197
  } | {
7203
- backgroundColor: string;
7204
- color: string;
7198
+ backgroundColor: any;
7205
7199
  _focusVisible: {
7206
7200
  outlineWidth: string;
7207
7201
  outlineColor: string;
@@ -7214,6 +7208,7 @@ declare const theme: {
7214
7208
  fontSize: string;
7215
7209
  display: string;
7216
7210
  borderRadius: string;
7211
+ color: string;
7217
7212
  }) | undefined;
7218
7213
  sizes?: {
7219
7214
  [key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
@@ -7247,6 +7242,7 @@ declare const theme: {
7247
7242
  fontSize: string;
7248
7243
  display: string;
7249
7244
  borderRadius: string;
7245
+ cursor: string;
7250
7246
  }) | undefined;
7251
7247
  sizes?: {
7252
7248
  [key: string]: _chakra_ui_styled_system.SystemStyleInterpolation;
@@ -7317,6 +7313,8 @@ declare const theme: {
7317
7313
  boxShadow: string;
7318
7314
  _hover: {
7319
7315
  boxShadow: string;
7316
+ outline: string;
7317
+ outlineColor: string;
7320
7318
  backgroundColor: string;
7321
7319
  };
7322
7320
  _active: {
@@ -9417,4 +9415,4 @@ declare const Text: _chakra_ui_system_dist_system_types.ComponentWithAs<"p", Tex
9417
9415
  **/
9418
9416
  declare function slugify(text: string | string[], maxLength?: number): string;
9419
9417
 
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 };
9418
+ 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 }, React73.Children.map(
901
- children,
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
- return React73__namespace.default.cloneElement(child, { ...radio, variant, ...props });
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
  });
@@ -923,15 +941,14 @@ var init_StaticCard = __esm({
923
941
  exports.PressableCard = void 0;
924
942
  var init_PressableCard = __esm({
925
943
  "src/layout/PressableCard.tsx"() {
926
- exports.PressableCard = ({
927
- children,
928
- as = "button",
929
- variant = "base",
930
- ...props
931
- }) => {
932
- const styles3 = react.useStyleConfig("PressableCard", { variant });
933
- return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { as, __css: styles3, ...props }, children);
934
- };
944
+ exports.PressableCard = react.forwardRef(
945
+ ({ children, variant = "base", ...props }, ref) => {
946
+ const styles3 = react.useStyleConfig("PressableCard", {
947
+ variant
948
+ });
949
+ return /* @__PURE__ */ React73__namespace.default.createElement(react.Box, { __css: styles3, ...props, ref }, children);
950
+ }
951
+ );
935
952
  }
936
953
  });
937
954
  var init_layout = __esm({
@@ -3155,10 +3172,12 @@ var init_CardSelect = __esm({
3155
3172
  placement
3156
3173
  },
3157
3174
  /* @__PURE__ */ React73__namespace.default.createElement(
3158
- exports.Card,
3175
+ exports.StaticCard,
3159
3176
  {
3160
3177
  colorScheme: "white",
3161
3178
  size: "lg",
3179
+ border: "sm",
3180
+ borderColor: "grey",
3162
3181
  sx: styles3.card,
3163
3182
  ...overlayProps
3164
3183
  },
@@ -15122,13 +15141,11 @@ var init_table2 = __esm({
15122
15141
  table: {
15123
15142
  borderCollapse: "collapse",
15124
15143
  ...baseText("default", props),
15125
- width: "100%",
15126
- minWidth: "600px"
15144
+ width: "100%"
15127
15145
  },
15128
15146
  th: {
15129
15147
  fontWeight: "bold",
15130
- textAlign: "start",
15131
- minWidth: "68px"
15148
+ textAlign: "start"
15132
15149
  },
15133
15150
  td: {
15134
15151
  textAlign: "start"
@@ -15462,6 +15479,7 @@ var init_static_card = __esm({
15462
15479
  "src/theme/components/static-card.ts"() {
15463
15480
  init_foundations();
15464
15481
  init_focus_utils();
15482
+ init_floating_utils();
15465
15483
  config43 = react.defineStyleConfig({
15466
15484
  baseStyle: (props) => ({
15467
15485
  appearance: "none",
@@ -15481,8 +15499,8 @@ var init_static_card = __esm({
15481
15499
  switch (props.colorScheme) {
15482
15500
  case "white":
15483
15501
  return {
15484
- backgroundColor: "white",
15485
- color: "darkGrey"
15502
+ ...floatingBackground("default", props),
15503
+ color: themeTools.mode("text.default.light", "text.default.dark")(props)
15486
15504
  };
15487
15505
  case "grey":
15488
15506
  return {
@@ -15538,6 +15556,7 @@ var init_pressable_card = __esm({
15538
15556
  fontSize: "inherit",
15539
15557
  display: "block",
15540
15558
  borderRadius: "md",
15559
+ cursor: "pointer",
15541
15560
  ...focusVisibleStyles(props),
15542
15561
  _disabled: {
15543
15562
  ...baseBackground("disabled", props),
@@ -15574,6 +15593,7 @@ var init_pressable_card = __esm({
15574
15593
  boxShadow: "sm",
15575
15594
  _hover: {
15576
15595
  ...floatingBackground("hover", props),
15596
+ ...floatingBorder("hover", props),
15577
15597
  boxShadow: "md"
15578
15598
  },
15579
15599
  _active: {
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-S335RZ6M.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-ZDOSE4VD.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "9.8.1",
3
+ "version": "9.8.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "@emotion/styled": "^11.10.4",
24
24
  "@internationalized/date": "^3.0.1",
25
25
  "@vygruppen/spor-design-tokens": ">3.4.0",
26
- "@vygruppen/spor-icon-react": ">3.2.3",
26
+ "@vygruppen/spor-icon-react": ">3.6.0",
27
27
  "@vygruppen/spor-loader": ">0.3.1",
28
28
  "awesome-phonenumber": "^5.10.0",
29
29
  "deepmerge": "^4.3.1",
@@ -14,7 +14,7 @@ import {
14
14
  import React, { useEffect, useRef, useState } from "react";
15
15
  import { AriaPositionProps, useButton, useOverlayTrigger } from "react-aria";
16
16
  import { useOverlayTriggerState } from "react-stately";
17
- import { Card } from "..";
17
+ import { StaticCard } from "..";
18
18
  import { Dialog } from "./Dialog";
19
19
  import { Popover } from "./Popover";
20
20
 
@@ -149,14 +149,16 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
149
149
  crossOffset={crossOffset}
150
150
  placement={placement}
151
151
  >
152
- <Card
152
+ <StaticCard
153
153
  colorScheme="white"
154
154
  size="lg"
155
+ border={"sm"}
156
+ borderColor={"grey"}
155
157
  sx={styles.card}
156
158
  {...overlayProps}
157
159
  >
158
160
  <Dialog aria-label={label}>{children}</Dialog>
159
- </Card>
161
+ </StaticCard>
160
162
  </Popover>
161
163
  )}
162
164
  </Box>
@@ -1,11 +1,15 @@
1
1
  import React from "react";
2
- import { Box, BoxProps, useStyleConfig } from "@chakra-ui/react";
2
+ import {
3
+ As,
4
+ Box,
5
+ BoxProps,
6
+ forwardRef,
7
+ useStyleConfig,
8
+ } from "@chakra-ui/react";
3
9
 
4
- type PressableCardProps = Omit<BoxProps, "as"> & {
10
+ type PressableCardProps = BoxProps & {
5
11
  /** Defaults to "base" */
6
12
  variant: "floating" | "accent" | "base";
7
- /** Defaults to "button" */
8
- as: "button" | "a" | "label";
9
13
  };
10
14
 
11
15
  /**
@@ -15,7 +19,6 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
15
19
  * It can be rendered as a button, link, label, or any other HTML element by specifying the `as` prop.
16
20
  * If no `as` prop is provided, it defaults to a button.
17
21
  *
18
- * The `size` prop can be used to control the size of the card. It defaults to "sm".
19
22
  * The `variant` prop can be used to control the style variant of the card. It defaults to "base".
20
23
  *
21
24
  * Example usage:
@@ -39,16 +42,16 @@ type PressableCardProps = Omit<BoxProps, "as"> & {
39
42
  * @see StaticCard
40
43
  */
41
44
 
42
- export const PressableCard = ({
43
- children,
44
- as = "button",
45
- variant = "base",
46
- ...props
47
- }: PressableCardProps) => {
48
- const styles = useStyleConfig("PressableCard", { variant });
49
- return (
50
- <Box as={as} __css={styles} {...props}>
51
- {children}
52
- </Box>
53
- );
54
- };
45
+ export const PressableCard = forwardRef<PressableCardProps, As>(
46
+ ({ children, variant = "base", ...props }, ref) => {
47
+ const styles = useStyleConfig("PressableCard", {
48
+ variant,
49
+ });
50
+
51
+ return (
52
+ <Box __css={styles} {...props} ref={ref}>
53
+ {children}
54
+ </Box>
55
+ );
56
+ },
57
+ );
@@ -9,7 +9,7 @@ import {
9
9
  import { dataAttr } from "@chakra-ui/utils";
10
10
  import React, { useId } from "react";
11
11
 
12
- type RadioCardProps = UseRadioProps &
12
+ export type RadioCardProps = UseRadioProps &
13
13
  BoxProps & {
14
14
  children: React.ReactNode;
15
15
  /** Defaults to "base" */
@@ -5,6 +5,7 @@ import {
5
5
  Stack,
6
6
  } from "@chakra-ui/react";
7
7
  import React, { Children } from "react";
8
+ import { RadioCard, RadioCardProps } from "./RadioCard";
8
9
 
9
10
  type RadioCardGroupProps = RadioGroupProps & {
10
11
  children: React.ReactNode;
@@ -78,13 +79,38 @@ export const RadioCardGroup = ({
78
79
 
79
80
  return (
80
81
  <Stack direction={direction} {...group}>
81
- {Children.map(
82
- children as React.ReactElement[],
83
- (child: React.ReactElement) => {
82
+ {recursiveMap(children, (child: React.ReactElement) => {
83
+ if (child.type === RadioCard) {
84
84
  const radio = getRadioProps({ value: child.props.value });
85
- return React.cloneElement(child, { ...radio, variant, ...props });
86
- },
87
- )}
85
+ const variantValue = variant as "base" | "floating" | undefined;
86
+ return React.cloneElement(
87
+ child as React.ReactElement<RadioCardProps>,
88
+ { ...radio, variant: variantValue, ...props },
89
+ );
90
+ }
91
+ return child;
92
+ })}
88
93
  </Stack>
89
94
  );
90
95
  };
96
+
97
+ function recursiveMap(
98
+ children: React.ReactNode,
99
+ fn: (child: React.ReactElement) => React.ReactElement,
100
+ ): React.ReactNode {
101
+ return React.Children.map(children, (child) => {
102
+ // If this child is a React element and has children, recurse
103
+ if (React.isValidElement(child) && child.props.children) {
104
+ child = React.cloneElement(child as React.ReactElement<any>, {
105
+ children: recursiveMap(child.props.children, fn),
106
+ });
107
+ }
108
+
109
+ // Apply the function to the child (if it's a React element)
110
+ if (React.isValidElement(child)) {
111
+ return fn(child);
112
+ }
113
+
114
+ return child;
115
+ });
116
+ }
@@ -30,8 +30,8 @@ export type StackProps = Exclude<ChakraStackProps, "direction"> & {
30
30
  *
31
31
  * ```tsx
32
32
  * <Stack spacing={4}>
33
- * <Card>Here's one card</Card>
34
- * <Card>Here's another card, with a lot of space between it</Card>
33
+ * <StaticCard>Here's one card</StaticCard>
34
+ * <StaticCard>Here's another card, with a lot of space between it</StaticCard>
35
35
  * </Stack>
36
36
  * ```
37
37
  */
@@ -74,7 +74,7 @@ const EXPIRATION_DELAY = 1000 * 60 * 60 * 24 * 30; // 30 days
74
74
  * name="my-nudge"
75
75
  * content="Check out this enormous new feature!"
76
76
  * >
77
- * <Card variant="base" padding={2} width="fit-content">My new feature</Card>
77
+ * <StaticCard variant="base" padding={2} width="fit-content">My new feature</StaticCard>
78
78
  * </Nudge>
79
79
  * ```
80
80
  */
@@ -30,9 +30,9 @@ export type WizardNudgeProps = Omit<NudgeProps, "actions" | "content"> & {
30
30
  * name="my-wizard-nudge"
31
31
  * introducedDate="2024-02-19"
32
32
  * >
33
- * <Card width="fit-content" padding={2}>
33
+ * <StaticCard width="fit-content" padding={2}>
34
34
  * My new feature
35
- * </Card>
35
+ * </StaticCard>
36
36
  * </WizardNudge>
37
37
  * ```
38
38
  */
@@ -1,6 +1,6 @@
1
1
  import { defineStyleConfig } from "@chakra-ui/react";
2
2
  import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
3
- import { floatingBackground } from "../utils/floating-utils";
3
+ import { floatingBackground, floatingBorder } from "../utils/floating-utils";
4
4
  import { focusVisibleStyles } from "../utils/focus-utils";
5
5
  import { accentBackground } from "../utils/accent-utils";
6
6
 
@@ -12,6 +12,7 @@ const config = defineStyleConfig({
12
12
  fontSize: "inherit",
13
13
  display: "block",
14
14
  borderRadius: "md",
15
+ cursor: "pointer",
15
16
  ...focusVisibleStyles(props),
16
17
  _disabled: {
17
18
  ...baseBackground("disabled", props),
@@ -48,6 +49,7 @@ const config = defineStyleConfig({
48
49
  boxShadow: "sm",
49
50
  _hover: {
50
51
  ...floatingBackground("hover", props),
52
+ ...floatingBorder("hover", props),
51
53
  boxShadow: "md",
52
54
  },
53
55
  _active: {
@@ -1,6 +1,9 @@
1
1
  import { defineStyleConfig } from "@chakra-ui/react";
2
2
  import { colors } from "../foundations";
3
3
  import { focusVisibleStyles } from "../utils/focus-utils";
4
+ import { bg } from "../utils/bg-utils";
5
+ import { floatingBackground } from "../utils/floating-utils";
6
+ import { mode } from "@chakra-ui/theme-tools";
4
7
 
5
8
  const config = defineStyleConfig({
6
9
  baseStyle: (props: any) => ({
@@ -32,12 +35,12 @@ type CardThemeProps = {
32
35
  | "darkYellow";
33
36
  };
34
37
 
35
- const getColorSchemeBaseProps = (props: CardThemeProps) => {
38
+ const getColorSchemeBaseProps = (props: any) => {
36
39
  switch (props.colorScheme) {
37
40
  case "white":
38
41
  return {
39
- backgroundColor: "white",
40
- color: "darkGrey",
42
+ ...floatingBackground("default", props),
43
+ color: mode("text.default.light", "text.default.dark")(props),
41
44
  };
42
45
  case "grey":
43
46
  return {
@@ -17,12 +17,10 @@ const config = helpers.defineMultiStyleConfig({
17
17
  borderCollapse: "collapse",
18
18
  ...baseText("default", props),
19
19
  width: "100%",
20
- minWidth: "600px",
21
20
  },
22
21
  th: {
23
22
  fontWeight: "bold",
24
23
  textAlign: "start",
25
- minWidth: "68px",
26
24
  },
27
25
  td: {
28
26
  textAlign: "start",