@purpurds/accordion 5.20.0 → 5.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpurds/accordion",
3
- "version": "5.20.0",
3
+ "version": "5.21.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "./dist/accordion.cjs.js",
6
6
  "types": "./dist/accordion.d.ts",
@@ -16,15 +16,15 @@
16
16
  "dependencies": {
17
17
  "classnames": "~2.5.0",
18
18
  "@radix-ui/react-accordion": "~1.1.2",
19
- "@purpurds/tokens": "5.20.0",
20
- "@purpurds/icon": "5.20.0",
21
- "@purpurds/heading": "5.20.0",
22
- "@purpurds/paragraph": "5.20.0"
19
+ "@purpurds/icon": "5.21.0",
20
+ "@purpurds/heading": "5.21.0",
21
+ "@purpurds/paragraph": "5.21.0",
22
+ "@purpurds/tokens": "5.21.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@rushstack/eslint-patch": "~1.10.0",
26
- "@storybook/react": "^8.2.6",
27
- "storybook": "^8.2.6",
26
+ "@storybook/react": "^8.3.5",
27
+ "storybook": "^8.3.5",
28
28
  "@telia/base-rig": "~8.2.0",
29
29
  "@telia/react-rig": "~3.2.0",
30
30
  "@testing-library/dom": "~9.3.3",
@@ -40,9 +40,9 @@
40
40
  "prettier": "~2.8.8",
41
41
  "react-dom": "^18.3.1",
42
42
  "react": "^18.3.1",
43
- "typescript": "^5.5.4",
44
- "vite": "5.3.4",
45
- "vitest": "~1.5.0",
43
+ "typescript": "^5.6.3",
44
+ "vite": "5.4.8",
45
+ "vitest": "^2.1.2",
46
46
  "@purpurds/component-rig": "1.0.0"
47
47
  },
48
48
  "scripts": {
@@ -71,6 +71,7 @@ export const Showcase: Story = {
71
71
  args: {
72
72
  title: "Title goes here",
73
73
  titleVariant: "title-300",
74
+ defaultValue: ["1"],
74
75
  negative: false,
75
76
  },
76
77
  };
package/src/accordion.tsx CHANGED
@@ -20,20 +20,12 @@ export type AccordionProps = {
20
20
  children: ReactNode;
21
21
  className?: string;
22
22
  /**
23
- * Different accordion styling
23
+ * The values of the accordion items that should be open by default
24
24
  * */
25
+ defaultValue?: string[];
25
26
  negative?: boolean;
26
- /**
27
- * Title of the accordion
28
- * */
29
27
  title?: string;
30
- /**
31
- * This is the heading tag used for the accordion title. Defaults to h2.
32
- */
33
28
  titleTag?: HeadingTagType;
34
- /**
35
- * Different variant of sizing the title
36
- * */
37
29
  titleVariant?: TitleVariantType;
38
30
  };
39
31
 
@@ -45,6 +37,7 @@ export const Accordion = ({
45
37
  title,
46
38
  titleTag = "h2",
47
39
  titleVariant = "title-300",
40
+ ...props
48
41
  }: AccordionProps) => {
49
42
  const classes = cx([
50
43
  className,
@@ -63,7 +56,7 @@ export const Accordion = ({
63
56
  });
64
57
 
65
58
  return (
66
- <RadixAccordion.Root className={classes} type="multiple" data-testid={dataTestId}>
59
+ <RadixAccordion.Root className={classes} type="multiple" data-testid={dataTestId} {...props}>
67
60
  {title ? (
68
61
  <Heading tag={titleTag} variant={titleVariant} className={cx(`${rootClassName}__title`)}>
69
62
  {title}