paris 0.17.1 → 0.17.4
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,19 @@
|
|
|
1
1
|
# paris
|
|
2
2
|
|
|
3
|
+
## 0.17.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 693a687: fix(combobox): revert close icon to FontAwesomeIcon
|
|
8
|
+
- 12331bd: Theme: fix dark theme color value for `overlayWhiteUltrastrong`
|
|
9
|
+
- 9774b0e: Field's container `onClick` called `input.click()` even when the click originated from the button itself, causing a double toggle on touch devices. This broke Headless UI Select/Menu/Combobox on iOS Safari since HUI 2.2+ toggles on `onClick` for touch (unlike mouse, which toggles on `pointerDown`).
|
|
10
|
+
|
|
11
|
+
## 0.17.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 1f67456: chore: add typecheck script and PR check CI workflow
|
|
16
|
+
|
|
3
17
|
## 0.17.1
|
|
4
18
|
|
|
5
19
|
### 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.17.
|
|
5
|
+
"version": "0.17.4",
|
|
6
6
|
"homepage": "https://paris.slingshot.fm",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@ariakit/react": "^0.4.20",
|
|
66
66
|
"@emotion/is-prop-valid": "^1.4.0",
|
|
67
|
-
"@fortawesome/fontawesome-svg-core": "^6.
|
|
68
|
-
"@fortawesome/free-regular-svg-icons": "^6.
|
|
69
|
-
"@fortawesome/free-solid-svg-icons": "^6.
|
|
67
|
+
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
68
|
+
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|
|
69
|
+
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
70
70
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
71
71
|
"@headlessui/react": "^2.2.4",
|
|
72
72
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
@@ -81,6 +81,8 @@
|
|
|
81
81
|
"ts-deepmerge": "^6.0.3"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
+
"@types/react": "^19",
|
|
85
|
+
"@types/react-dom": "^19",
|
|
84
86
|
"react": "^19.x",
|
|
85
87
|
"react-dom": "^19.x",
|
|
86
88
|
"sass": "^1.x",
|
|
@@ -144,6 +146,7 @@
|
|
|
144
146
|
"generate:theme": "pte export ./src/stories/theme/themes.ts LightTheme -o ./public/pte.css",
|
|
145
147
|
"generate:text": "ts-node --esm ./scripts/text.ts",
|
|
146
148
|
"release": "pnpm generate:exports && pnpm changeset publish",
|
|
149
|
+
"typecheck": "tsc --noEmit",
|
|
147
150
|
"lint": "eslint ."
|
|
148
151
|
}
|
|
149
152
|
}
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
Combobox as HCombobox, ComboboxInput, ComboboxOptions, ComboboxOption, Transition,
|
|
9
9
|
} from '@headlessui/react';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
12
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
11
13
|
import inputStyles from '../input/Input.module.scss';
|
|
12
14
|
import dropdownStyles from '../utility/Dropdown.module.scss';
|
|
13
15
|
import styles from '../select/Select.module.scss';
|
|
@@ -21,7 +23,7 @@ import { Field } from '../field';
|
|
|
21
23
|
import type { ButtonProps } from '../button';
|
|
22
24
|
import { Button } from '../button';
|
|
23
25
|
import { TextWhenString } from '../utility';
|
|
24
|
-
import { Check,
|
|
26
|
+
import { Check, Icon } from '../icon';
|
|
25
27
|
|
|
26
28
|
export type Option<T extends Record<string, any> = Record<string, any>> = {
|
|
27
29
|
id: string,
|
|
@@ -262,7 +264,7 @@ export function Combobox<T extends Record<string, any> = Record<string, any>>({
|
|
|
262
264
|
<Button
|
|
263
265
|
size="xs"
|
|
264
266
|
shape="circle"
|
|
265
|
-
startEnhancer={<
|
|
267
|
+
startEnhancer={<FontAwesomeIcon icon={faClose} fontSize="10px" />}
|
|
266
268
|
onClick={() => {
|
|
267
269
|
if (onChange) {
|
|
268
270
|
onChange(null);
|
|
@@ -124,7 +124,7 @@ export const Field: FC<PropsWithChildren<FieldProps>> = ({
|
|
|
124
124
|
onClick={(e) => {
|
|
125
125
|
if (typeof window !== 'undefined' && htmlFor) {
|
|
126
126
|
const input = document.getElementById(htmlFor);
|
|
127
|
-
if (input && !disabled) {
|
|
127
|
+
if (input && !disabled && !input.contains(e.target as Node)) {
|
|
128
128
|
if (input.tagName === 'BUTTON') input.click();
|
|
129
129
|
else input.focus();
|
|
130
130
|
}
|
|
@@ -151,6 +151,14 @@ export const Select = forwardRef(<T = Record<string, any>>({
|
|
|
151
151
|
}: SelectProps<T>, ref: ForwardedRef<any>) => {
|
|
152
152
|
const inputID = useId();
|
|
153
153
|
const multiItems = multipleItemsName || 'items';
|
|
154
|
+
|
|
155
|
+
// TypeScript can't track discriminated union correlation through destructuring and JSX conditionals.
|
|
156
|
+
// For Listbox: supports both single and multi via overloads, needs explicit union types
|
|
157
|
+
// For RadioGroup: only supports single-select, needs narrowed types
|
|
158
|
+
const listboxValue = value as string | string[] | null | undefined;
|
|
159
|
+
const listboxOnChange = onChange as ((value: string | string[] | null) => void) | undefined;
|
|
160
|
+
const singleValue = value as string | null | undefined;
|
|
161
|
+
const singleOnChange = onChange as ((value: string | null) => void) | undefined;
|
|
154
162
|
const buttonText = () => {
|
|
155
163
|
if (!value || value.length === 0) {
|
|
156
164
|
return placeholder || 'Select an option';
|
|
@@ -182,8 +190,8 @@ export const Select = forwardRef(<T = Record<string, any>>({
|
|
|
182
190
|
<Listbox
|
|
183
191
|
as="div"
|
|
184
192
|
ref={ref}
|
|
185
|
-
value={
|
|
186
|
-
onChange={
|
|
193
|
+
value={listboxValue}
|
|
194
|
+
onChange={listboxOnChange}
|
|
187
195
|
multiple={multiple}
|
|
188
196
|
>
|
|
189
197
|
<ListboxButton
|
|
@@ -273,7 +281,7 @@ export const Select = forwardRef(<T = Record<string, any>>({
|
|
|
273
281
|
</Listbox>
|
|
274
282
|
)}
|
|
275
283
|
{kind === 'radio' && (
|
|
276
|
-
<RadioGroup ref={ref} as="div" className={styles.radioContainer} value={
|
|
284
|
+
<RadioGroup ref={ref} as="div" className={styles.radioContainer} value={singleValue} onChange={singleOnChange}>
|
|
277
285
|
{options.map((option) => (
|
|
278
286
|
<Radio
|
|
279
287
|
as="div"
|
|
@@ -294,7 +302,7 @@ export const Select = forwardRef(<T = Record<string, any>>({
|
|
|
294
302
|
</RadioGroup>
|
|
295
303
|
)}
|
|
296
304
|
{kind === 'card' && (
|
|
297
|
-
<RadioGroup ref={ref} as="div" className={styles.cardContainer} value={
|
|
305
|
+
<RadioGroup ref={ref} as="div" className={styles.cardContainer} value={singleValue} onChange={singleOnChange}>
|
|
298
306
|
{options.map((option) => (
|
|
299
307
|
<Radio
|
|
300
308
|
as="div"
|
|
@@ -316,7 +324,7 @@ export const Select = forwardRef(<T = Record<string, any>>({
|
|
|
316
324
|
</RadioGroup>
|
|
317
325
|
)}
|
|
318
326
|
{kind === 'segmented' && (
|
|
319
|
-
<RadioGroup ref={ref} as="div" className={styles.segmentedContainer} value={
|
|
327
|
+
<RadioGroup ref={ref} as="div" className={styles.segmentedContainer} value={singleValue || options[0].id} onChange={singleOnChange}>
|
|
320
328
|
{options.map((option) => (
|
|
321
329
|
<Radio
|
|
322
330
|
as="div"
|
|
@@ -1380,7 +1380,7 @@ export const DarkTheme: Theme = merge(LightTheme, {
|
|
|
1380
1380
|
overlayStrong: 'rgba(255, 255, 255, 0.09)',
|
|
1381
1381
|
overlayInverseSubtle: 'rgba(0, 0, 0, 0.02)',
|
|
1382
1382
|
overlayInverseMedium: 'rgba(0, 0, 0, 0.05)',
|
|
1383
|
-
overlayWhiteUltrastrong: 'rgba(
|
|
1383
|
+
overlayWhiteUltrastrong: 'rgba(255, 255, 255, 0.18)',
|
|
1384
1384
|
overlayBlackSubtle: 'rgba(0, 0, 0, 0.2)',
|
|
1385
1385
|
overlayBlackMedium: 'rgba(0, 0, 0, 0.3)',
|
|
1386
1386
|
overlayBlackStrong: 'rgba(0, 0, 0, 0.4)',
|