paris 0.15.1 → 0.15.2

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,11 @@
1
1
  # paris
2
2
 
3
+ ## 0.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 656978c: Checkbox: added `panel` variant
8
+
3
9
  ## 0.15.1
4
10
 
5
11
  ### Patch 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.15.1",
5
+ "version": "0.15.2",
6
6
  "homepage": "https://paris.slingshot.fm",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -93,6 +93,44 @@
93
93
  background-color: var(--pte-new-colors-overlayStrong);
94
94
  }
95
95
  }
96
+
97
+ &.panel {
98
+ width: 100%;
99
+ padding: 8px 10px 8px 8px;
100
+ color: var(--pte-new-colors-contentSecondary);
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: space-between;
104
+ transition: var(--pte-animations-interaction);
105
+
106
+ &:focus-visible {
107
+ outline: 1px solid var(--pte-new-colors-borderUltrastrong);
108
+ }
109
+
110
+ &[data-state="checked"], &[data-state="indeterminate"] {
111
+ color: var(--pte-new-colors-contentPrimary);
112
+ }
113
+
114
+ &[data-disabled=true] {
115
+ color: var(--pte-new-colors-contentDisabled);
116
+ }
117
+
118
+ &:hover {
119
+ background-color: var(--pte-new-colors-overlaySubtle);
120
+ }
121
+
122
+ .box {
123
+ width: 13px;
124
+ height: 13px;
125
+ border: 2px solid var(--pte-new-colors-contentTertiary);
126
+ margin-right: 0.5px;
127
+ }
128
+ &[data-state="checked"], &[data-state="indeterminate"] {
129
+ .box {
130
+ display: none;
131
+ }
132
+ }
133
+ }
96
134
  }
97
135
 
98
136
  .indicator {
@@ -42,6 +42,22 @@ export const Surface: Story = {
42
42
  },
43
43
  };
44
44
 
45
+ export const Panel: Story = {
46
+ args: {
47
+ children: 'Credit/debit card',
48
+ kind: 'panel',
49
+ },
50
+ render: (args) => {
51
+ // eslint-disable-next-line react-hooks/rules-of-hooks
52
+ const [checked, setChecked] = useState(false);
53
+ return createElement(Checkbox, {
54
+ ...args,
55
+ checked,
56
+ onChange: (e) => setChecked(!!e),
57
+ });
58
+ },
59
+ };
60
+
45
61
  export const Switch: Story = {
46
62
  args: {
47
63
  children: 'ACH Bank Transfer',
@@ -8,8 +8,8 @@ import { TextWhenString, VisuallyHidden } from '../utility';
8
8
  import { Check, Icon } from '../icon';
9
9
 
10
10
  export type CheckboxProps = {
11
- /** The visual style of the Checkbox. `default` is a standard checkbox with a label next to it, `surface` is a clickable card that displays a check when selected, `switch` is a switch toggle. */
12
- kind?: 'default' | 'surface' | 'switch'
11
+ /** The visual style of the Checkbox. `default` is a standard checkbox with a label next to it, `surface` is a clickable card that displays a check when selected, `panel` is a clickable card with the checkbox aligned right, `switch` is a switch toggle. */
12
+ kind?: 'default' | 'surface' | 'panel' | 'switch';
13
13
  checked?: boolean;
14
14
  onChange?: (checked: boolean | 'indeterminate') => void;
15
15
  disabled?: boolean;
@@ -52,7 +52,7 @@ export const Checkbox: FC<CheckboxProps> = ({
52
52
  className={clsx(styles.container, disabled && styles.disabled, className, checked && styles.checked)}
53
53
  {...props}
54
54
  >
55
- {(kind === 'default' || kind === 'surface') && (
55
+ {(kind === 'default' || kind === 'surface' || kind === 'panel') && (
56
56
  <RadixCheckbox.Root
57
57
  id={inputID}
58
58
  className={clsx(styles.root, styles[kind])}
@@ -61,13 +61,14 @@ export const Checkbox: FC<CheckboxProps> = ({
61
61
  data-disabled={disabled}
62
62
  aria-details={typeof children === 'string' ? children : undefined}
63
63
  >
64
- {kind === 'surface' && (
64
+ {(kind === 'surface' || kind === 'panel') && (
65
65
  <TextWhenString kind="paragraphXSmall">
66
66
  {children}
67
67
  </TextWhenString>
68
68
  )}
69
+ {kind === 'panel' && <div className={styles.box} />}
69
70
  <RadixCheckbox.Indicator className={styles.indicator}>
70
- {kind === 'default' && (
71
+ {(kind === 'default' || kind === 'panel') && (
71
72
  <svg width={14} height={14} viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
72
73
  <path
73
74
  className={styles.checkSvg}