paris 0.7.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # paris
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9192ce2: Button: rename `hrefTarget` prop to `hreftarget` for React compatibility
8
+
9
+ ### Patch Changes
10
+
11
+ - 30bb138: Accordion: allow uncontrolled state management
12
+
3
13
  ## 0.7.0
4
14
 
5
15
  ### Minor Changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "paris",
3
3
  "author": "Sanil Chawla <sanil@slingshot.fm> (https://sanil.co)",
4
4
  "description": "Paris is Slingshot's React design system. It's a collection of reusable components, design tokens, and guidelines that help us build consistent, accessible, and performant user interfaces.",
5
- "version": "0.7.0",
5
+ "version": "0.8.0",
6
6
  "homepage": "https://paris.slingshot.fm",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -10,6 +10,10 @@ import { TextWhenString } from '../utility';
10
10
  export type AccordionProps = {
11
11
  /** The title of the Accordion. */
12
12
  title?: ReactNode;
13
+ /** Whether the Accordion is open. If provided, the Accordion will be a controlled component. */
14
+ isOpen?: boolean;
15
+ /** A handler for when the Accordion state changes. */
16
+ onOpenChange?: (open: boolean) => void | Promise<void>;
13
17
  /** The collapsible contents of the Accordion. */
14
18
  children?: ReactNode;
15
19
  };
@@ -28,9 +32,11 @@ export type AccordionProps = {
28
32
  */
29
33
  export const Accordion: FC<AccordionProps> = ({
30
34
  title,
35
+ isOpen,
36
+ onOpenChange,
31
37
  children,
32
38
  }) => {
33
- const [open, setOpen] = useState(false);
39
+ const [open, setOpen] = useState(isOpen ?? false);
34
40
 
35
41
  return (
36
42
  <div
@@ -43,6 +49,7 @@ export const Accordion: FC<AccordionProps> = ({
43
49
  if (e.key === 'Enter' || e.key === ' ') {
44
50
  e.preventDefault();
45
51
  setOpen((o) => !o);
52
+ onOpenChange?.(!open);
46
53
  }
47
54
  }}
48
55
  role="button"
@@ -98,7 +98,7 @@ export type ButtonProps = {
98
98
  /**
99
99
  * Optionally, the target of the anchor element can be specified (defaults to `_self`).
100
100
  */
101
- hrefTarget?: HTMLAttributeAnchorTarget;
101
+ hreftarget?: HTMLAttributeAnchorTarget;
102
102
  /**
103
103
  * The contents of the Button.
104
104
  *
@@ -163,8 +163,8 @@ export const Button: FC<ButtonProps> = ({
163
163
  <a
164
164
  {...properties}
165
165
  href={href}
166
- target={props.hrefTarget ?? '_self'}
167
- rel={props.hrefTarget === '_self' ? undefined : 'noreferrer'}
166
+ target={props.hreftarget ?? '_self'}
167
+ rel={props.hreftarget === '_self' ? undefined : 'noreferrer'}
168
168
  />
169
169
  ),
170
170
  } : {}}