paris 0.8.1 → 0.8.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
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.8.
|
|
5
|
+
"version": "0.8.2",
|
|
6
6
|
"homepage": "https://paris.slingshot.fm",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
import type { FC, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import type { FC, ComponentPropsWithoutRef, ForwardedRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import styles from './Input.module.scss';
|
|
7
7
|
import type { TextProps } from '../text';
|
|
8
|
-
import { Text } from '../text';
|
|
9
8
|
import type { Enhancer } from '../../types/Enhancer';
|
|
10
|
-
import {
|
|
9
|
+
import { theme } from '../theme';
|
|
11
10
|
import { MemoizedEnhancer } from '../../helpers/renderEnhancer';
|
|
12
11
|
import type { FieldProps } from '../field';
|
|
13
12
|
import { Field } from '../field';
|
|
@@ -65,7 +64,7 @@ export type InputProps = {
|
|
|
65
64
|
* ```
|
|
66
65
|
* @constructor
|
|
67
66
|
*/
|
|
68
|
-
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
67
|
+
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = forwardRef(({
|
|
69
68
|
label,
|
|
70
69
|
status,
|
|
71
70
|
type,
|
|
@@ -77,7 +76,7 @@ export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
|
77
76
|
disabled,
|
|
78
77
|
overrides,
|
|
79
78
|
...props
|
|
80
|
-
}) => {
|
|
79
|
+
}, ref: ForwardedRef<HTMLInputElement>) => {
|
|
81
80
|
const inputID = useId();
|
|
82
81
|
return (
|
|
83
82
|
<Field
|
|
@@ -117,6 +116,7 @@ export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
|
117
116
|
<input
|
|
118
117
|
{...props}
|
|
119
118
|
id={inputID}
|
|
119
|
+
ref={ref}
|
|
120
120
|
type={type || 'text'}
|
|
121
121
|
aria-label={typeof label === 'string' ? label : props['aria-label']}
|
|
122
122
|
aria-describedby={`${inputID}-description`}
|
|
@@ -140,4 +140,4 @@ export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
|
140
140
|
</div>
|
|
141
141
|
</Field>
|
|
142
142
|
);
|
|
143
|
-
};
|
|
143
|
+
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
/* eslint-disable prefer-arrow-callback,func-names */
|
|
2
|
+
|
|
1
3
|
'use client';
|
|
2
4
|
|
|
3
|
-
import type { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
5
|
+
import type { ReactNode, ComponentPropsWithoutRef, ForwardedRef } from 'react';
|
|
4
6
|
import { Listbox, RadioGroup, Transition } from '@headlessui/react';
|
|
5
7
|
import clsx from 'clsx';
|
|
6
8
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
9
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
import { useId } from 'react';
|
|
10
|
+
import { forwardRef, useId } from 'react';
|
|
9
11
|
import inputStyles from '../input/Input.module.scss';
|
|
10
12
|
import dropdownStyles from '../utility/Dropdown.module.scss';
|
|
11
13
|
import styles from './Select.module.scss';
|
|
@@ -75,7 +77,7 @@ export type SelectProps<T = Record<string, any>> = {
|
|
|
75
77
|
* ```
|
|
76
78
|
* @constructor
|
|
77
79
|
*/
|
|
78
|
-
export function
|
|
80
|
+
export const Select = forwardRef(function <T = Record<string, any>>({
|
|
79
81
|
options,
|
|
80
82
|
value,
|
|
81
83
|
onChange,
|
|
@@ -90,7 +92,7 @@ export function Select<T = Record<string, any>>({
|
|
|
90
92
|
disabled,
|
|
91
93
|
kind = 'listbox',
|
|
92
94
|
overrides,
|
|
93
|
-
}: SelectProps<T>) {
|
|
95
|
+
}: SelectProps<T>, ref: ForwardedRef<any>) {
|
|
94
96
|
const inputID = useId();
|
|
95
97
|
return (
|
|
96
98
|
<Field
|
|
@@ -109,6 +111,7 @@ export function Select<T = Record<string, any>>({
|
|
|
109
111
|
{kind === 'listbox' && (
|
|
110
112
|
<Listbox
|
|
111
113
|
as="div"
|
|
114
|
+
ref={ref}
|
|
112
115
|
value={value}
|
|
113
116
|
onChange={onChange}
|
|
114
117
|
>
|
|
@@ -184,7 +187,7 @@ export function Select<T = Record<string, any>>({
|
|
|
184
187
|
</Listbox>
|
|
185
188
|
)}
|
|
186
189
|
{kind === 'radio' && (
|
|
187
|
-
<RadioGroup as="div" className={styles.radioContainer} value={value} onChange={onChange}>
|
|
190
|
+
<RadioGroup ref={ref} as="div" className={styles.radioContainer} value={value} onChange={onChange}>
|
|
188
191
|
{options.map((option) => (
|
|
189
192
|
<RadioGroup.Option
|
|
190
193
|
as="div"
|
|
@@ -205,4 +208,4 @@ export function Select<T = Record<string, any>>({
|
|
|
205
208
|
)}
|
|
206
209
|
</Field>
|
|
207
210
|
);
|
|
208
|
-
}
|
|
211
|
+
});
|