paris 0.3.0 → 0.4.1
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 +26 -0
- package/package.json +14 -12
- package/src/pages/_app.tsx +1 -1
- package/src/pages/index.tsx +1 -1
- package/src/stories/Pagination.mdx +73 -0
- package/src/stories/button/Button.module.scss +11 -1
- package/src/stories/button/Button.tsx +40 -17
- package/src/stories/card/Card.module.scss +14 -0
- package/src/stories/card/Card.stories.ts +33 -0
- package/src/stories/card/Card.tsx +55 -0
- package/src/stories/card/index.ts +1 -0
- package/src/stories/checkbox/Checkbox.module.scss +57 -0
- package/src/stories/checkbox/Checkbox.stories.ts +27 -0
- package/src/stories/checkbox/Checkbox.tsx +58 -0
- package/src/stories/checkbox/index.ts +1 -0
- package/src/stories/combobox/Combobox.module.scss +5 -0
- package/src/stories/combobox/Combobox.stories.ts +84 -0
- package/src/stories/combobox/Combobox.tsx +264 -0
- package/src/stories/combobox/index.ts +1 -0
- package/src/stories/dialog/Dialog.module.scss +187 -0
- package/src/stories/dialog/Dialog.stories.tsx +70 -0
- package/src/stories/dialog/Dialog.tsx +279 -0
- package/src/stories/dialog/index.ts +1 -0
- package/src/stories/drawer/Drawer.module.scss +284 -0
- package/src/stories/drawer/Drawer.stories.tsx +94 -0
- package/src/stories/drawer/Drawer.tsx +339 -0
- package/src/stories/drawer/index.ts +1 -0
- package/src/stories/field/Field.module.scss +5 -0
- package/src/stories/field/Field.stories.ts +32 -0
- package/src/stories/field/Field.tsx +106 -0
- package/src/stories/field/index.ts +1 -0
- package/src/stories/icon/ChevronLeft.tsx +11 -0
- package/src/stories/icon/ChevronRight.tsx +11 -0
- package/src/stories/icon/Close.tsx +11 -0
- package/src/stories/icon/Icon.module.scss +5 -0
- package/src/stories/icon/Icon.stories.ts +28 -0
- package/src/stories/icon/Icon.tsx +46 -0
- package/src/stories/icon/index.ts +4 -0
- package/src/stories/input/Input.module.scss +3 -2
- package/src/stories/input/Input.stories.ts +2 -0
- package/src/stories/input/Input.tsx +38 -73
- package/src/stories/pagination/index.ts +1 -0
- package/src/stories/pagination/usePagination.ts +106 -0
- package/src/stories/select/Select.module.scss +8 -4
- package/src/stories/select/Select.stories.ts +5 -3
- package/src/stories/select/Select.tsx +80 -7
- package/src/stories/theme/themes.ts +75 -2
- package/src/stories/theme/tw-preflight.css +3 -1
- package/src/stories/tilt/Tilt.module.scss +1 -0
- package/src/stories/tilt/Tilt.stories.tsx +43 -0
- package/src/stories/tilt/Tilt.tsx +65 -0
- package/src/stories/tilt/index.ts +1 -0
- package/src/stories/utility/RemoveFromDOM.tsx +19 -0
- package/src/stories/utility/TextWhenString.tsx +28 -0
- package/src/stories/utility/VisuallyHidden.tsx +25 -0
|
@@ -9,6 +9,8 @@ import { Text } from '../text';
|
|
|
9
9
|
import type { Enhancer } from '../../types/Enhancer';
|
|
10
10
|
import { pget, theme } from '../theme';
|
|
11
11
|
import { MemoizedEnhancer } from '../../helpers/renderEnhancer';
|
|
12
|
+
import type { FieldProps } from '../field';
|
|
13
|
+
import { Field } from '../field';
|
|
12
14
|
|
|
13
15
|
export type InputProps = {
|
|
14
16
|
/**
|
|
@@ -25,20 +27,6 @@ export type InputProps = {
|
|
|
25
27
|
* @default text
|
|
26
28
|
*/
|
|
27
29
|
type?: 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
28
|
-
/**
|
|
29
|
-
* Visually hide the label (while keeping it accessible to screen readers).
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
hideLabel?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* A description of the input field. Can be visually hidden using the `hideDescription` prop.
|
|
35
|
-
*/
|
|
36
|
-
description?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Visually hide the description while keeping it accessible to screen readers.
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
hideDescription?: boolean;
|
|
42
30
|
/**
|
|
43
31
|
* The placeholder for the input.
|
|
44
32
|
*/
|
|
@@ -51,10 +39,6 @@ export type InputProps = {
|
|
|
51
39
|
* An icon or other element to render after the Input element. A `{ size }` argument is passed that should be used to determine the width & height of the content displayed.
|
|
52
40
|
*/
|
|
53
41
|
endEnhancer?: Enhancer;
|
|
54
|
-
/**
|
|
55
|
-
* Disables the input, disallowing user interaction.
|
|
56
|
-
*/
|
|
57
|
-
disabled?: boolean;
|
|
58
42
|
/**
|
|
59
43
|
* Prop overrides for other rendered elements. Overrides for the input itself should be passed directly to the component.
|
|
60
44
|
*/
|
|
@@ -65,7 +49,7 @@ export type InputProps = {
|
|
|
65
49
|
startEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
66
50
|
endEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
67
51
|
}
|
|
68
|
-
};
|
|
52
|
+
} & FieldProps;
|
|
69
53
|
|
|
70
54
|
/**
|
|
71
55
|
* An `Input` is used to collect user input, such as text, numbers, or dates.
|
|
@@ -81,50 +65,44 @@ export type InputProps = {
|
|
|
81
65
|
* ```
|
|
82
66
|
* @constructor
|
|
83
67
|
*/
|
|
84
|
-
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
68
|
+
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({
|
|
69
|
+
label,
|
|
70
|
+
status,
|
|
71
|
+
type,
|
|
72
|
+
hideLabel,
|
|
73
|
+
description,
|
|
74
|
+
hideDescription,
|
|
75
|
+
startEnhancer,
|
|
76
|
+
endEnhancer,
|
|
77
|
+
disabled,
|
|
78
|
+
overrides,
|
|
79
|
+
...props
|
|
80
|
+
}) => {
|
|
85
81
|
const inputID = useId();
|
|
86
82
|
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (typeof window !== 'undefined') {
|
|
99
|
-
const input = document.getElementById(inputID);
|
|
100
|
-
if (input && !disabled) {
|
|
101
|
-
input.focus();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
83
|
+
<Field
|
|
84
|
+
htmlFor={inputID}
|
|
85
|
+
label={label}
|
|
86
|
+
hideLabel={hideLabel}
|
|
87
|
+
description={description}
|
|
88
|
+
hideDescription={hideDescription}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
overrides={{
|
|
91
|
+
container: overrides?.container,
|
|
92
|
+
label: overrides?.label,
|
|
93
|
+
description: overrides?.description,
|
|
104
94
|
}}
|
|
105
95
|
>
|
|
106
|
-
<Text
|
|
107
|
-
{...props.overrides?.label}
|
|
108
|
-
as="label"
|
|
109
|
-
kind="paragraphSmall"
|
|
110
|
-
htmlFor={inputID}
|
|
111
|
-
className={clsx(
|
|
112
|
-
styles.label,
|
|
113
|
-
{ [styles.hidden]: props.hideLabel },
|
|
114
|
-
)}
|
|
115
|
-
>
|
|
116
|
-
{props.label}
|
|
117
|
-
</Text>
|
|
118
96
|
<div
|
|
119
97
|
className={styles.inputContainer}
|
|
120
98
|
data-status={status}
|
|
121
99
|
data-disabled={disabled}
|
|
122
100
|
>
|
|
123
|
-
{!!
|
|
124
|
-
<div {...
|
|
125
|
-
{!!
|
|
101
|
+
{!!startEnhancer && (
|
|
102
|
+
<div {...overrides?.startEnhancerContainer} className={clsx(styles.enhancer, overrides?.startEnhancerContainer?.className)}>
|
|
103
|
+
{!!startEnhancer && (
|
|
126
104
|
<MemoizedEnhancer
|
|
127
|
-
enhancer={
|
|
105
|
+
enhancer={startEnhancer}
|
|
128
106
|
size={parseInt(pget('typography.styles.paragraphSmall.fontSize') || theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
129
107
|
/>
|
|
130
108
|
)}
|
|
@@ -133,8 +111,8 @@ export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({ stat
|
|
|
133
111
|
<input
|
|
134
112
|
{...props}
|
|
135
113
|
id={inputID}
|
|
136
|
-
type={
|
|
137
|
-
aria-label={
|
|
114
|
+
type={type || 'text'}
|
|
115
|
+
aria-label={label}
|
|
138
116
|
aria-describedby={`${inputID}-description`}
|
|
139
117
|
aria-disabled={disabled}
|
|
140
118
|
readOnly={disabled}
|
|
@@ -143,30 +121,17 @@ export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = ({ stat
|
|
|
143
121
|
styles.input,
|
|
144
122
|
)}
|
|
145
123
|
/>
|
|
146
|
-
{!!
|
|
147
|
-
<div {...
|
|
148
|
-
{!!
|
|
124
|
+
{!!endEnhancer && (
|
|
125
|
+
<div {...overrides?.endEnhancerContainer} className={clsx(styles.enhancer, overrides?.endEnhancerContainer?.className)}>
|
|
126
|
+
{!!endEnhancer && (
|
|
149
127
|
<MemoizedEnhancer
|
|
150
|
-
enhancer={
|
|
128
|
+
enhancer={endEnhancer}
|
|
151
129
|
size={parseInt(pget('typography.styles.paragraphSmall.fontSize') || theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
152
130
|
/>
|
|
153
131
|
)}
|
|
154
132
|
</div>
|
|
155
133
|
)}
|
|
156
134
|
</div>
|
|
157
|
-
|
|
158
|
-
id={`${inputID}-description`}
|
|
159
|
-
{...props.overrides?.description}
|
|
160
|
-
as="p"
|
|
161
|
-
kind="paragraphXSmall"
|
|
162
|
-
className={clsx(
|
|
163
|
-
styles.description,
|
|
164
|
-
{ [styles.hidden]: !props.description || props.hideDescription },
|
|
165
|
-
props.overrides?.description?.className,
|
|
166
|
-
)}
|
|
167
|
-
>
|
|
168
|
-
{props.description}
|
|
169
|
-
</Text>
|
|
170
|
-
</div>
|
|
135
|
+
</Field>
|
|
171
136
|
);
|
|
172
137
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usePagination';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export type PaginationState<T extends string[] | readonly string[] = string[]> = {
|
|
4
|
+
/**
|
|
5
|
+
* The current page key.
|
|
6
|
+
*/
|
|
7
|
+
currentPage: T[number],
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Open a page and add it to the history.
|
|
11
|
+
* @param page - The page's unique key.
|
|
12
|
+
*/
|
|
13
|
+
open: (page: T[number]) => void,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Check if the current page can go back.
|
|
17
|
+
*/
|
|
18
|
+
canGoBack: () => boolean,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Go back to the previous page.
|
|
22
|
+
*
|
|
23
|
+
* If the current page is the first page, nothing happens.
|
|
24
|
+
*/
|
|
25
|
+
back: () => void,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if the current page can go forward.
|
|
29
|
+
*/
|
|
30
|
+
canGoForward: () => boolean,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Go forward to the next page.
|
|
34
|
+
*
|
|
35
|
+
* If there is no next page, nothing happens.
|
|
36
|
+
*/
|
|
37
|
+
forward: () => void,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The page history.
|
|
41
|
+
*/
|
|
42
|
+
history: T[number][],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A hook to create a page history and navigate between pages.
|
|
47
|
+
*
|
|
48
|
+
* In TypeScript, you can pass in a string array to the generic type to explicitly define the page keys, which will add type safety and auto-completion for each method.
|
|
49
|
+
*
|
|
50
|
+
* @param initialPage - The initial page key.
|
|
51
|
+
*/
|
|
52
|
+
export const usePagination = <T extends string[] | readonly string[] = string[]>(
|
|
53
|
+
initialPage: T[number],
|
|
54
|
+
): PaginationState<T> => {
|
|
55
|
+
// The current page.
|
|
56
|
+
const [currentPage, setCurrentPage] = useState<T[number]>(initialPage);
|
|
57
|
+
|
|
58
|
+
// The page history.
|
|
59
|
+
const [history, setHistory] = useState<T[number][]>([initialPage]);
|
|
60
|
+
|
|
61
|
+
const open = (page: T[number]): void => {
|
|
62
|
+
// Do nothing if the page is already open.
|
|
63
|
+
if (page === currentPage) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Open the page and add it to the history, removing all pages after it.
|
|
68
|
+
const index = history.indexOf(currentPage);
|
|
69
|
+
setCurrentPage(page);
|
|
70
|
+
setHistory((hist) => hist.slice(0, index + 1).concat(page));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const canGoBack = (): boolean => {
|
|
74
|
+
const index = history.indexOf(currentPage);
|
|
75
|
+
return index > 0;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const back = (): void => {
|
|
79
|
+
if (canGoBack()) {
|
|
80
|
+
const index = history.indexOf(currentPage);
|
|
81
|
+
setCurrentPage(history[index - 1]);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const canGoForward = (): boolean => {
|
|
86
|
+
const index = history.indexOf(currentPage);
|
|
87
|
+
return index < history.length - 1;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const forward = (): void => {
|
|
91
|
+
if (canGoForward()) {
|
|
92
|
+
const index = history.indexOf(currentPage);
|
|
93
|
+
setCurrentPage(history[index + 1]);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
currentPage,
|
|
99
|
+
open,
|
|
100
|
+
canGoBack,
|
|
101
|
+
back,
|
|
102
|
+
canGoForward,
|
|
103
|
+
forward,
|
|
104
|
+
history,
|
|
105
|
+
} as PaginationState<T>;
|
|
106
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
position: relative;
|
|
3
|
-
user-select:
|
|
3
|
+
user-select: var(--pte-utils-defaultUserSelect);
|
|
4
4
|
|
|
5
5
|
& > * {
|
|
6
6
|
cursor: default;
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
gap: 8px;
|
|
48
48
|
|
|
49
49
|
padding: 8px 16px;
|
|
50
|
-
margin:
|
|
50
|
+
margin: -1px;
|
|
51
51
|
|
|
52
|
-
border
|
|
53
|
-
border-right: 1px solid var(--pte-borders-dropdown-color);
|
|
52
|
+
border: 1px solid var(--pte-borders-dropdown-color);
|
|
53
|
+
//border-right: 1px solid var(--pte-borders-dropdown-color);
|
|
54
54
|
|
|
55
55
|
transition: var(--pte-animations-interaction);
|
|
56
56
|
|
|
@@ -68,3 +68,7 @@
|
|
|
68
68
|
cursor: default;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
.content {
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
@@ -26,10 +26,12 @@ const render: Story['render'] = (args) => {
|
|
|
26
26
|
|
|
27
27
|
export const Default: Story = {
|
|
28
28
|
args: {
|
|
29
|
+
label: 'Release type',
|
|
30
|
+
description: 'Select the type of release you want to create.',
|
|
29
31
|
options: [
|
|
30
|
-
{ id: '1', node: '
|
|
31
|
-
{ id: '2', node: '
|
|
32
|
-
{ id: '3', node: '
|
|
32
|
+
{ id: '1', node: 'Single' },
|
|
33
|
+
{ id: '2', node: 'EP' },
|
|
34
|
+
{ id: '3', node: 'Album (LP)' },
|
|
33
35
|
],
|
|
34
36
|
},
|
|
35
37
|
render,
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
import { Listbox, Transition } from '@headlessui/react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
7
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import { useId } from 'react';
|
|
8
9
|
import inputStyles from '../input/Input.module.scss';
|
|
9
10
|
import dropdownStyles from '../dropdown/Dropdown.module.scss';
|
|
10
11
|
import styles from './Select.module.scss';
|
|
12
|
+
import type { TextProps } from '../text';
|
|
11
13
|
import { Text } from '../text';
|
|
14
|
+
import type { InputProps } from '../input';
|
|
15
|
+
import { MemoizedEnhancer } from '../../helpers/renderEnhancer';
|
|
16
|
+
import { pget, theme } from '../theme';
|
|
17
|
+
import { Field } from '../field';
|
|
12
18
|
|
|
13
19
|
export type Option<T = Record<string, any>> = {
|
|
14
20
|
id: string,
|
|
@@ -34,7 +40,20 @@ export type SelectProps<T = Record<string, any>> = {
|
|
|
34
40
|
* The interaction handler for the Select.
|
|
35
41
|
*/
|
|
36
42
|
onChange?: (value: string | null) => void | Promise<void>;
|
|
37
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Prop overrides for other rendered elements. Overrides for the input itself should be passed directly to the component.
|
|
45
|
+
*/
|
|
46
|
+
overrides?: {
|
|
47
|
+
container?: ComponentPropsWithoutRef<'div'>;
|
|
48
|
+
selectInput?: ComponentPropsWithoutRef<'button'>;
|
|
49
|
+
optionsContainer?: ComponentPropsWithoutRef<'div'>;
|
|
50
|
+
option?: ComponentPropsWithoutRef<'div'>;
|
|
51
|
+
label?: TextProps<'label'>;
|
|
52
|
+
description?: TextProps<'p'>;
|
|
53
|
+
startEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
54
|
+
endEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
55
|
+
}
|
|
56
|
+
} & Omit<InputProps, 'type' | 'overrides'>;
|
|
38
57
|
|
|
39
58
|
/**
|
|
40
59
|
* A Select component is used to render a `select` box.
|
|
@@ -52,21 +71,71 @@ export function Select<T = Record<string, any>>({
|
|
|
52
71
|
options,
|
|
53
72
|
value,
|
|
54
73
|
onChange,
|
|
74
|
+
label,
|
|
75
|
+
status,
|
|
76
|
+
hideLabel,
|
|
77
|
+
description,
|
|
78
|
+
hideDescription,
|
|
79
|
+
placeholder,
|
|
80
|
+
startEnhancer,
|
|
81
|
+
endEnhancer,
|
|
82
|
+
disabled,
|
|
83
|
+
overrides,
|
|
55
84
|
}: SelectProps<T>) {
|
|
85
|
+
const inputID = useId();
|
|
56
86
|
return (
|
|
57
|
-
<
|
|
87
|
+
<Field
|
|
88
|
+
htmlFor={inputID}
|
|
89
|
+
label={label}
|
|
90
|
+
hideLabel={hideLabel}
|
|
91
|
+
description={description}
|
|
92
|
+
hideDescription={hideDescription}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
overrides={{
|
|
95
|
+
container: overrides?.container,
|
|
96
|
+
label: overrides?.label,
|
|
97
|
+
description: overrides?.description,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
58
100
|
<Listbox
|
|
101
|
+
as="div"
|
|
59
102
|
value={value}
|
|
60
103
|
onChange={onChange}
|
|
61
104
|
>
|
|
62
105
|
<Listbox.Button
|
|
106
|
+
id={inputID}
|
|
107
|
+
{...overrides?.selectInput}
|
|
108
|
+
aria-disabled={disabled}
|
|
109
|
+
data-status={disabled ? 'disabled' : (status || 'default')}
|
|
63
110
|
className={clsx(
|
|
111
|
+
overrides?.selectInput?.className,
|
|
64
112
|
inputStyles.inputContainer,
|
|
65
113
|
styles.field,
|
|
66
114
|
)}
|
|
67
115
|
>
|
|
68
|
-
{
|
|
69
|
-
|
|
116
|
+
{!!startEnhancer && (
|
|
117
|
+
<div {...overrides?.startEnhancerContainer} className={clsx(inputStyles.enhancer, overrides?.startEnhancerContainer?.className)}>
|
|
118
|
+
{!!startEnhancer && (
|
|
119
|
+
<MemoizedEnhancer
|
|
120
|
+
enhancer={startEnhancer}
|
|
121
|
+
size={parseInt(pget('typography.styles.paragraphSmall.fontSize') || theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
{options?.find((o) => o.id === value)?.node || placeholder || 'Select an option'}
|
|
127
|
+
{endEnhancer ? (
|
|
128
|
+
<div {...overrides?.endEnhancerContainer} className={clsx(inputStyles.enhancer, overrides?.endEnhancerContainer?.className)}>
|
|
129
|
+
{!!endEnhancer && (
|
|
130
|
+
<MemoizedEnhancer
|
|
131
|
+
enhancer={endEnhancer}
|
|
132
|
+
size={parseInt(pget('typography.styles.paragraphSmall.fontSize') || theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
) : (
|
|
137
|
+
<FontAwesomeIcon className={inputStyles.enhancer} width="10px" icon={faChevronDown} />
|
|
138
|
+
)}
|
|
70
139
|
</Listbox.Button>
|
|
71
140
|
<Transition
|
|
72
141
|
enter={dropdownStyles.transition}
|
|
@@ -78,6 +147,7 @@ export function Select<T = Record<string, any>>({
|
|
|
78
147
|
>
|
|
79
148
|
<Listbox.Options
|
|
80
149
|
className={clsx(
|
|
150
|
+
overrides?.optionsContainer,
|
|
81
151
|
styles.options,
|
|
82
152
|
)}
|
|
83
153
|
>
|
|
@@ -87,17 +157,20 @@ export function Select<T = Record<string, any>>({
|
|
|
87
157
|
value={option.id}
|
|
88
158
|
data-selected={option.id === value}
|
|
89
159
|
className={clsx(
|
|
160
|
+
overrides?.option,
|
|
90
161
|
styles.option,
|
|
91
162
|
)}
|
|
92
163
|
>
|
|
93
164
|
{typeof option.node === 'string' ? (
|
|
94
|
-
<Text as="span" kind="paragraphSmall">
|
|
165
|
+
<Text as="span" kind="paragraphSmall">
|
|
166
|
+
{option.node}
|
|
167
|
+
</Text>
|
|
95
168
|
) : option.node}
|
|
96
169
|
</Listbox.Option>
|
|
97
170
|
))}
|
|
98
171
|
</Listbox.Options>
|
|
99
172
|
</Transition>
|
|
100
173
|
</Listbox>
|
|
101
|
-
</
|
|
174
|
+
</Field>
|
|
102
175
|
);
|
|
103
176
|
}
|
|
@@ -31,8 +31,22 @@ const Shadows = {
|
|
|
31
31
|
shallowRight: '20px 0px 40px rgba(0, 0, 0, 0.1)',
|
|
32
32
|
} as const;
|
|
33
33
|
|
|
34
|
+
export type TimingFunction = `cubic-bezier(${number}, ${number}, ${number}, ${number})` | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
|
|
35
|
+
export type Duration = `${number}ms` | `${number}s`;
|
|
36
|
+
|
|
37
|
+
const TimingFunctions: Omit<Theme['animations']['timing'], 'default'> = {
|
|
38
|
+
easeInOut: 'cubic-bezier(0.42, 0.0, 0.58, 1.0)',
|
|
39
|
+
easeOut: 'cubic-bezier(0.0, 0.0, 0.58, 1.0)',
|
|
40
|
+
easeIn: 'cubic-bezier(0.42, 0.0, 1.0, 1.0)',
|
|
41
|
+
easeOutQuad: 'cubic-bezier(0.5, 1, 0.89, 1)',
|
|
42
|
+
easeInQuad: 'cubic-bezier(0.11, 0, 0.5, 0)',
|
|
43
|
+
};
|
|
44
|
+
|
|
34
45
|
export type Theme = {
|
|
35
46
|
tokens: TokensT,
|
|
47
|
+
utils: {
|
|
48
|
+
defaultUserSelect: Property.UserSelect,
|
|
49
|
+
}
|
|
36
50
|
colors: {
|
|
37
51
|
// Primary
|
|
38
52
|
|
|
@@ -86,6 +100,7 @@ export type Theme = {
|
|
|
86
100
|
backgroundOverlayLight: CSSColor,
|
|
87
101
|
backgroundOverlayXLight: CSSColor,
|
|
88
102
|
backgroundOverlayGrey: CSSColor,
|
|
103
|
+
backgroundOverlayDark: CSSColor,
|
|
89
104
|
backgroundOverlayTeal: CSSColor,
|
|
90
105
|
|
|
91
106
|
// Border
|
|
@@ -160,6 +175,7 @@ export type Theme = {
|
|
|
160
175
|
rounded: CSSLength,
|
|
161
176
|
roundedSmall: CSSLength,
|
|
162
177
|
roundedLarge: CSSLength,
|
|
178
|
+
roundedXL: CSSLength,
|
|
163
179
|
},
|
|
164
180
|
|
|
165
181
|
// Dropdowns (Select, Menu, Popovers, etc.)
|
|
@@ -167,10 +183,34 @@ export type Theme = {
|
|
|
167
183
|
dropdown: {
|
|
168
184
|
color: CSSColor,
|
|
169
185
|
shadow: ShadowDefinition,
|
|
170
|
-
}
|
|
186
|
+
},
|
|
171
187
|
},
|
|
188
|
+
surfaces: {
|
|
189
|
+
dialog: {
|
|
190
|
+
border: `${number}px ${string} ${CSSColor}`,
|
|
191
|
+
outline: `${number}px ${string} ${CSSColor}`,
|
|
192
|
+
background: CSSColor,
|
|
193
|
+
backdropFilter: string,
|
|
194
|
+
},
|
|
195
|
+
}
|
|
172
196
|
animations: {
|
|
173
197
|
interaction: string,
|
|
198
|
+
timing: {
|
|
199
|
+
easeInOut: TimingFunction,
|
|
200
|
+
easeOut: TimingFunction,
|
|
201
|
+
easeIn: TimingFunction,
|
|
202
|
+
easeOutQuad: TimingFunction,
|
|
203
|
+
easeInQuad: TimingFunction,
|
|
204
|
+
default: TimingFunction,
|
|
205
|
+
},
|
|
206
|
+
duration: {
|
|
207
|
+
rapid: Duration,
|
|
208
|
+
fast: Duration,
|
|
209
|
+
normal: Duration,
|
|
210
|
+
relaxed: Duration,
|
|
211
|
+
slow: Duration,
|
|
212
|
+
gradual: Duration,
|
|
213
|
+
},
|
|
174
214
|
}
|
|
175
215
|
};
|
|
176
216
|
|
|
@@ -206,6 +246,9 @@ export const ParagraphFontClass: FontClassDefinition = {
|
|
|
206
246
|
|
|
207
247
|
export const LightTheme: Theme = {
|
|
208
248
|
tokens: T,
|
|
249
|
+
utils: {
|
|
250
|
+
defaultUserSelect: 'none',
|
|
251
|
+
},
|
|
209
252
|
colors: {
|
|
210
253
|
// Primary
|
|
211
254
|
|
|
@@ -259,6 +302,7 @@ export const LightTheme: Theme = {
|
|
|
259
302
|
backgroundOverlayLight: 'rgba(255, 255, 255, 0.07)',
|
|
260
303
|
backgroundOverlayXLight: 'rgba(255, 255, 255, 0.1)',
|
|
261
304
|
backgroundOverlayGrey: 'rgba(175, 175, 175, 0.8)',
|
|
305
|
+
backgroundOverlayDark: 'rgba(0, 0, 0, 0.1)',
|
|
262
306
|
backgroundOverlayTeal: 'rgba(29, 238, 205, 0.1)',
|
|
263
307
|
|
|
264
308
|
// Border
|
|
@@ -396,6 +440,7 @@ export const LightTheme: Theme = {
|
|
|
396
440
|
rounded: '8px',
|
|
397
441
|
roundedSmall: '4px',
|
|
398
442
|
roundedLarge: '12px',
|
|
443
|
+
roundedXL: '16px',
|
|
399
444
|
},
|
|
400
445
|
|
|
401
446
|
dropdown: {
|
|
@@ -403,8 +448,28 @@ export const LightTheme: Theme = {
|
|
|
403
448
|
color: 'transparent',
|
|
404
449
|
},
|
|
405
450
|
},
|
|
451
|
+
surfaces: {
|
|
452
|
+
dialog: {
|
|
453
|
+
border: '8px solid rgba(0, 0, 0, 0.2)',
|
|
454
|
+
outline: '1px solid rgba(0, 0, 0, 0.25)',
|
|
455
|
+
background: 'rgba(255, 255, 255, 0.9)',
|
|
456
|
+
backdropFilter: 'blur(6px)',
|
|
457
|
+
},
|
|
458
|
+
},
|
|
406
459
|
animations: {
|
|
407
460
|
interaction: '200ms cubic-bezier(0.5, 1, 0.89, 1)',
|
|
461
|
+
timing: {
|
|
462
|
+
...TimingFunctions,
|
|
463
|
+
default: TimingFunctions.easeOut,
|
|
464
|
+
},
|
|
465
|
+
duration: {
|
|
466
|
+
rapid: '50ms',
|
|
467
|
+
fast: '100ms',
|
|
468
|
+
normal: '200ms',
|
|
469
|
+
relaxed: '300ms',
|
|
470
|
+
slow: '400ms',
|
|
471
|
+
gradual: '600ms',
|
|
472
|
+
},
|
|
408
473
|
},
|
|
409
474
|
};
|
|
410
475
|
|
|
@@ -443,6 +508,14 @@ export const DarkTheme: Theme = merge(LightTheme, {
|
|
|
443
508
|
color: T.colors.grey600,
|
|
444
509
|
},
|
|
445
510
|
},
|
|
511
|
+
surfaces: {
|
|
512
|
+
dialog: {
|
|
513
|
+
border: '8px solid rgba(255, 255, 255, 0.2)',
|
|
514
|
+
outline: '1px solid rgba(255, 255, 255, 0.25)',
|
|
515
|
+
background: 'rgba(0, 0, 0, 0.6)',
|
|
516
|
+
backdropFilter: 'blur(6px)',
|
|
517
|
+
},
|
|
518
|
+
},
|
|
446
519
|
} as PartialDeep<Theme>) as Theme;
|
|
447
520
|
|
|
448
521
|
export const {
|
|
@@ -452,4 +525,4 @@ export const {
|
|
|
452
525
|
updateTheme,
|
|
453
526
|
injectTheme,
|
|
454
527
|
generateThemeInjection,
|
|
455
|
-
} = createTheme(LightTheme);
|
|
528
|
+
} = createTheme<Theme>(LightTheme);
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
border-width: 0; /* 2 */
|
|
16
16
|
border-style: solid; /* 2 */
|
|
17
17
|
border-color: var(--pte-colors-borderSelected); /* 2 */
|
|
18
|
+
|
|
19
|
+
-webkit-tap-highlight-color: transparent;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/*
|
|
@@ -325,7 +327,7 @@ Set the default cursor for buttons.
|
|
|
325
327
|
|
|
326
328
|
button,
|
|
327
329
|
[role="button"] {
|
|
328
|
-
cursor:
|
|
330
|
+
cursor: default;
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
/*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.container {}
|