@vygruppen/spor-react 8.2.1 → 8.3.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@8.2.1 build
2
+ > @vygruppen/spor-react@8.3.0 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -10,13 +10,13 @@
10
10
  ESM Build start
11
11
  "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/index.js".
12
12
  DTS Build start
13
- "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-AKOJGLTQ.mjs".
14
- CJS dist/index.js 504.49 KB
15
- CJS ⚡️ Build success in 2019ms
13
+ "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-42ZK3WXN.mjs".
14
+ CJS dist/index.js 504.82 KB
15
+ CJS ⚡️ Build success in 2190ms
16
16
  ESM dist/index.mjs 2.01 KB
17
- ESM dist/CountryCodeSelect-NEASN3EC.mjs 1.19 KB
18
- ESM dist/chunk-AKOJGLTQ.mjs 396.46 KB
19
- ESM ⚡️ Build success in 2021ms
20
- DTS ⚡️ Build success in 10225ms
21
- DTS dist/index.d.ts 271.48 KB
22
- DTS dist/index.d.mts 271.48 KB
17
+ ESM dist/CountryCodeSelect-DYAFPSID.mjs 1.19 KB
18
+ ESM dist/chunk-42ZK3WXN.mjs 396.72 KB
19
+ ESM ⚡️ Build success in 2192ms
20
+ DTS ⚡️ Build success in 10757ms
21
+ DTS dist/index.d.ts 271.82 KB
22
+ DTS dist/index.d.mts 271.82 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 8.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f984752: Expandable: Add defaultOpen, isOpen and onChange props, and remove undocumented defaultIndex and index props.
8
+
9
+ This might be breaking if you were using these props, so make sure to double check while updating.
10
+
3
11
  ## 8.2.1
4
12
 
5
13
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-AKOJGLTQ.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-42ZK3WXN.mjs';
2
2
  import React from 'react';
3
3
  import { getSupportedCallingCodes } from 'awesome-phonenumber';
4
4
 
@@ -814,17 +814,32 @@ var Expandable = ({
814
814
  title,
815
815
  leftIcon,
816
816
  size: size2 = "md",
817
+ defaultOpen,
818
+ isOpen,
819
+ onChange = () => {
820
+ },
817
821
  ...rest
818
822
  }) => {
819
- return /* @__PURE__ */ React69__default.createElement(Accordion, { ...rest, size: size2 }, /* @__PURE__ */ React69__default.createElement(
820
- ExpandableItem,
823
+ return /* @__PURE__ */ React69__default.createElement(
824
+ Accordion,
821
825
  {
822
- headingLevel,
823
- title,
824
- leftIcon
826
+ ...rest,
827
+ index: isOpen ? 0 : void 0,
828
+ defaultIndex: defaultOpen ? 0 : void 0,
829
+ allowMultiple: true,
830
+ size: size2,
831
+ onChange: (expandedIndex) => onChange(expandedIndex === 0)
825
832
  },
826
- children
827
- ));
833
+ /* @__PURE__ */ React69__default.createElement(
834
+ ExpandableItem,
835
+ {
836
+ headingLevel,
837
+ title,
838
+ leftIcon
839
+ },
840
+ children
841
+ )
842
+ );
828
843
  };
829
844
  var ExpandableItem = ({
830
845
  children,
@@ -3435,7 +3450,7 @@ var texts14 = createTexts({
3435
3450
  sv: "Telefonnummer"
3436
3451
  }
3437
3452
  });
3438
- var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-NEASN3EC.mjs'));
3453
+ var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-DYAFPSID.mjs'));
3439
3454
  var Radio = forwardRef((props, ref) => {
3440
3455
  return /* @__PURE__ */ React69__default.createElement(Radio$1, { ...props, ref });
3441
3456
  });
package/dist/index.d.mts CHANGED
@@ -81,7 +81,7 @@ type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
81
81
  declare const Accordion: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", AccordionProps>;
82
82
 
83
83
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
84
- type ExpandableProps = Omit<AccordionProps, "title"> & {
84
+ type ExpandableProps = Omit<AccordionProps, "title" | "index" | "defaultIndex" | "onChange"> & {
85
85
  /** The hidden content */
86
86
  children: React.ReactNode;
87
87
  /** The title that's shown inside the toggle button */
@@ -97,6 +97,12 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
97
97
  * If the size is set to `lg`, the icon should be 30px.
98
98
  */
99
99
  leftIcon?: React.ReactNode;
100
+ /** Controlled value of whether the accordion is open or not */
101
+ isOpen?: boolean;
102
+ /** Default value of when the accordion is open or not */
103
+ defaultOpen?: boolean;
104
+ /** Callback for when the expandable opens or closes */
105
+ onChange?: (isOpen: boolean) => void;
100
106
  };
101
107
  /**
102
108
  * A standalone expandable component.
@@ -110,7 +116,7 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
110
116
  * </Expandable>
111
117
  * ```
112
118
  */
113
- declare const Expandable: ({ children, headingLevel, title, leftIcon, size, ...rest }: ExpandableProps) => React.JSX.Element;
119
+ declare const Expandable: ({ children, headingLevel, title, leftIcon, size, defaultOpen, isOpen, onChange, ...rest }: ExpandableProps) => React.JSX.Element;
114
120
  type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
115
121
  /** The hidden content */
116
122
  children: React.ReactNode;
package/dist/index.d.ts CHANGED
@@ -81,7 +81,7 @@ type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
81
81
  declare const Accordion: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", AccordionProps>;
82
82
 
83
83
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
84
- type ExpandableProps = Omit<AccordionProps, "title"> & {
84
+ type ExpandableProps = Omit<AccordionProps, "title" | "index" | "defaultIndex" | "onChange"> & {
85
85
  /** The hidden content */
86
86
  children: React.ReactNode;
87
87
  /** The title that's shown inside the toggle button */
@@ -97,6 +97,12 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
97
97
  * If the size is set to `lg`, the icon should be 30px.
98
98
  */
99
99
  leftIcon?: React.ReactNode;
100
+ /** Controlled value of whether the accordion is open or not */
101
+ isOpen?: boolean;
102
+ /** Default value of when the accordion is open or not */
103
+ defaultOpen?: boolean;
104
+ /** Callback for when the expandable opens or closes */
105
+ onChange?: (isOpen: boolean) => void;
100
106
  };
101
107
  /**
102
108
  * A standalone expandable component.
@@ -110,7 +116,7 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
110
116
  * </Expandable>
111
117
  * ```
112
118
  */
113
- declare const Expandable: ({ children, headingLevel, title, leftIcon, size, ...rest }: ExpandableProps) => React.JSX.Element;
119
+ declare const Expandable: ({ children, headingLevel, title, leftIcon, size, defaultOpen, isOpen, onChange, ...rest }: ExpandableProps) => React.JSX.Element;
114
120
  type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
115
121
  /** The hidden content */
116
122
  children: React.ReactNode;
package/dist/index.js CHANGED
@@ -149,17 +149,32 @@ var init_Expandable = __esm({
149
149
  title,
150
150
  leftIcon,
151
151
  size: size2 = "md",
152
+ defaultOpen,
153
+ isOpen,
154
+ onChange = () => {
155
+ },
152
156
  ...rest
153
157
  }) => {
154
- return /* @__PURE__ */ React69__namespace.default.createElement(exports.Accordion, { ...rest, size: size2 }, /* @__PURE__ */ React69__namespace.default.createElement(
155
- exports.ExpandableItem,
158
+ return /* @__PURE__ */ React69__namespace.default.createElement(
159
+ exports.Accordion,
156
160
  {
157
- headingLevel,
158
- title,
159
- leftIcon
161
+ ...rest,
162
+ index: isOpen ? 0 : void 0,
163
+ defaultIndex: defaultOpen ? 0 : void 0,
164
+ allowMultiple: true,
165
+ size: size2,
166
+ onChange: (expandedIndex) => onChange(expandedIndex === 0)
160
167
  },
161
- children
162
- ));
168
+ /* @__PURE__ */ React69__namespace.default.createElement(
169
+ exports.ExpandableItem,
170
+ {
171
+ headingLevel,
172
+ title,
173
+ leftIcon
174
+ },
175
+ children
176
+ )
177
+ );
163
178
  };
164
179
  exports.ExpandableItem = ({
165
180
  children,
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, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, 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, 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-AKOJGLTQ.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, 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, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, 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, 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-42ZK3WXN.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "8.2.1",
3
+ "version": "8.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -12,7 +12,10 @@ import { Accordion, AccordionProps } from "./Accordion";
12
12
  import { useAccordionContext } from "./AccordionContext";
13
13
 
14
14
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
15
- type ExpandableProps = Omit<AccordionProps, "title"> & {
15
+ type ExpandableProps = Omit<
16
+ AccordionProps,
17
+ "title" | "index" | "defaultIndex" | "onChange"
18
+ > & {
16
19
  /** The hidden content */
17
20
  children: React.ReactNode;
18
21
  /** The title that's shown inside the toggle button */
@@ -28,6 +31,13 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
28
31
  * If the size is set to `lg`, the icon should be 30px.
29
32
  */
30
33
  leftIcon?: React.ReactNode;
34
+
35
+ /** Controlled value of whether the accordion is open or not */
36
+ isOpen?: boolean;
37
+ /** Default value of when the accordion is open or not */
38
+ defaultOpen?: boolean;
39
+ /** Callback for when the expandable opens or closes */
40
+ onChange?: (isOpen: boolean) => void;
31
41
  };
32
42
  /**
33
43
  * A standalone expandable component.
@@ -47,10 +57,20 @@ export const Expandable = ({
47
57
  title,
48
58
  leftIcon,
49
59
  size = "md",
60
+ defaultOpen,
61
+ isOpen,
62
+ onChange = () => {},
50
63
  ...rest
51
64
  }: ExpandableProps) => {
52
65
  return (
53
- <Accordion {...rest} size={size}>
66
+ <Accordion
67
+ {...rest}
68
+ index={isOpen ? 0 : undefined}
69
+ defaultIndex={defaultOpen ? 0 : undefined}
70
+ allowMultiple={true}
71
+ size={size}
72
+ onChange={(expandedIndex) => onChange(expandedIndex === 0)}
73
+ >
54
74
  <ExpandableItem
55
75
  headingLevel={headingLevel}
56
76
  title={title}