paris 0.17.9 → 0.18.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 +16 -0
- package/package.json +139 -150
- package/src/helpers/renderEnhancer.tsx +4 -5
- package/src/helpers/useResizeObserver.ts +17 -23
- package/src/pages/_document.tsx +1 -3
- package/src/pages/index.tsx +8 -24
- package/src/stories/Pagination.mdx +1 -1
- package/src/stories/Tokens.mdx +1 -1
- package/src/stories/Welcome.mdx +1 -1
- package/src/stories/accordion/Accordion.stories.ts +1 -1
- package/src/stories/accordion/Accordion.tsx +14 -35
- package/src/stories/accordionselect/AccordionSelect.stories.ts +2 -5
- package/src/stories/accordionselect/AccordionSelect.tsx +26 -50
- package/src/stories/avatar/Avatar.stories.ts +1 -1
- package/src/stories/avatar/Avatar.tsx +14 -13
- package/src/stories/button/Button.stories.ts +18 -15
- package/src/stories/button/Button.tsx +44 -48
- package/src/stories/callout/Callout.stories.ts +3 -7
- package/src/stories/callout/Callout.tsx +4 -8
- package/src/stories/card/Card.stories.ts +1 -1
- package/src/stories/card/Card.tsx +4 -11
- package/src/stories/cardbutton/CardButton.stories.tsx +1 -1
- package/src/stories/cardbutton/CardButton.tsx +16 -18
- package/src/stories/checkbox/Checkbox.stories.ts +1 -1
- package/src/stories/checkbox/Checkbox.tsx +37 -49
- package/src/stories/combobox/Combobox.stories.ts +65 -71
- package/src/stories/combobox/Combobox.tsx +80 -89
- package/src/stories/dialog/Dialog.stories.tsx +2 -2
- package/src/stories/dialog/Dialog.tsx +45 -68
- package/src/stories/drawer/Drawer.stories.tsx +63 -105
- package/src/stories/drawer/Drawer.tsx +93 -90
- package/src/stories/field/Field.stories.ts +1 -1
- package/src/stories/field/Field.tsx +25 -30
- package/src/stories/icon/Ellipsis.tsx +4 -1
- package/src/stories/icon/Icon.stories.ts +2 -2
- package/src/stories/icon/Icon.tsx +16 -26
- package/src/stories/icon/Info.tsx +4 -1
- package/src/stories/icon/Spinner.tsx +4 -2
- package/src/stories/icon/index.ts +6 -6
- package/src/stories/informationaltooltip/InformationalTooltip.stories.tsx +12 -11
- package/src/stories/informationaltooltip/InformationalTooltip.tsx +23 -28
- package/src/stories/input/Input.stories.ts +14 -15
- package/src/stories/input/Input.tsx +119 -95
- package/src/stories/markdown/Markdown.module.scss +384 -0
- package/src/stories/markdown/Markdown.stories.ts +203 -0
- package/src/stories/markdown/Markdown.tsx +293 -0
- package/src/stories/markdown/index.ts +1 -0
- package/src/stories/menu/Menu.module.scss +9 -0
- package/src/stories/menu/Menu.stories.tsx +4 -10
- package/src/stories/menu/Menu.tsx +27 -29
- package/src/stories/pagination/usePagination.ts +8 -8
- package/src/stories/popover/Popover.stories.ts +2 -2
- package/src/stories/popover/Popover.tsx +4 -10
- package/src/stories/select/Select.stories.ts +10 -10
- package/src/stories/select/Select.tsx +268 -240
- package/src/stories/styledlink/StyledLink.stories.ts +1 -1
- package/src/stories/styledlink/StyledLink.tsx +11 -17
- package/src/stories/table/Table.stories.ts +1 -1
- package/src/stories/table/Table.tsx +55 -65
- package/src/stories/tabs/Tabs.stories.tsx +2 -2
- package/src/stories/tabs/Tabs.tsx +15 -21
- package/src/stories/tag/Tag.stories.ts +1 -4
- package/src/stories/tag/Tag.tsx +9 -17
- package/src/stories/text/Text.stories.ts +1 -1
- package/src/stories/text/Text.tsx +49 -31
- package/src/stories/text/Typography.module.css +120 -120
- package/src/stories/textarea/TextArea.stories.ts +2 -5
- package/src/stories/textarea/TextArea.tsx +91 -84
- package/src/stories/theme/index.ts +1 -1
- package/src/stories/theme/themes.ts +423 -424
- package/src/stories/theme/tokens.ts +3 -3
- package/src/stories/theme/tw-preflight.css +4 -3
- package/src/stories/tilt/Tilt.stories.tsx +3 -6
- package/src/stories/tilt/Tilt.tsx +160 -126
- package/src/stories/toast/Toast.stories.tsx +2 -2
- package/src/stories/toast/Toast.tsx +3 -6
- package/src/stories/utility/RemoveFromDOM.tsx +9 -13
- package/src/stories/utility/TextWhenString.tsx +3 -16
- package/src/stories/utility/VisuallyHidden.tsx +10 -17
- package/src/styles/Home.module.css +185 -195
- package/src/styles/globals.css +0 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
1
|
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
5
3
|
import type { HTMLMotionProps } from 'framer-motion';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
4
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
5
|
+
import type { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
6
|
+
import { useState } from 'react';
|
|
9
7
|
import { Icon, Info } from '../icon';
|
|
10
|
-
import {
|
|
8
|
+
import { pget, pvar } from '../theme';
|
|
9
|
+
import { TextWhenString } from '../utility';
|
|
10
|
+
import styles from './InformationalTooltip.module.scss';
|
|
11
11
|
|
|
12
12
|
export type InformationalTooltipProps = {
|
|
13
13
|
/**
|
|
@@ -57,10 +57,10 @@ export type InformationalTooltipProps = {
|
|
|
57
57
|
*/
|
|
58
58
|
overrides?: {
|
|
59
59
|
/** The main tooltip element */
|
|
60
|
-
tooltip?: HTMLMotionProps<'div'
|
|
60
|
+
tooltip?: HTMLMotionProps<'div'>;
|
|
61
61
|
/** The heading element */
|
|
62
|
-
heading?: ComponentPropsWithoutRef<'div'
|
|
63
|
-
}
|
|
62
|
+
heading?: ComponentPropsWithoutRef<'div'>;
|
|
63
|
+
};
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -112,13 +112,8 @@ export const InformationalTooltip: FC<InformationalTooltipProps> = ({
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
return (
|
|
115
|
-
<RadixTooltip.Provider
|
|
116
|
-
|
|
117
|
-
>
|
|
118
|
-
<RadixTooltip.Root
|
|
119
|
-
open={isOpen}
|
|
120
|
-
onOpenChange={setOpen}
|
|
121
|
-
>
|
|
115
|
+
<RadixTooltip.Provider delayDuration={parseCSSTime(pget('new.animations.duration.normal'))}>
|
|
116
|
+
<RadixTooltip.Root open={isOpen} onOpenChange={setOpen}>
|
|
122
117
|
<RadixTooltip.Trigger
|
|
123
118
|
onClick={() => {
|
|
124
119
|
if (!disableClick) {
|
|
@@ -127,27 +122,27 @@ export const InformationalTooltip: FC<InformationalTooltipProps> = ({
|
|
|
127
122
|
}}
|
|
128
123
|
>
|
|
129
124
|
{!trigger ? (
|
|
130
|
-
<Icon
|
|
125
|
+
<Icon
|
|
126
|
+
icon={Info}
|
|
127
|
+
size={14}
|
|
128
|
+
className={styles.icon}
|
|
129
|
+
style={{ color: pvar('new.colors.contentSecondary') }}
|
|
130
|
+
/>
|
|
131
131
|
) : (
|
|
132
|
-
|
|
133
|
-
{trigger}
|
|
134
|
-
</>
|
|
132
|
+
trigger
|
|
135
133
|
)}
|
|
136
134
|
</RadixTooltip.Trigger>
|
|
137
135
|
<AnimatePresence>
|
|
138
136
|
{isOpen && (
|
|
139
137
|
<RadixTooltip.Portal forceMount>
|
|
140
|
-
<RadixTooltip.Content
|
|
141
|
-
side={side}
|
|
142
|
-
sideOffset={sideOffset}
|
|
143
|
-
align={align}
|
|
144
|
-
asChild
|
|
145
|
-
>
|
|
138
|
+
<RadixTooltip.Content side={side} sideOffset={sideOffset} align={align} asChild>
|
|
146
139
|
<motion.div
|
|
147
140
|
initial={{ opacity: 0, y: 3 }}
|
|
148
141
|
animate={{ opacity: 1, y: 0 }}
|
|
149
142
|
exit={{ opacity: 0, y: 3 }}
|
|
150
|
-
transition={{
|
|
143
|
+
transition={{
|
|
144
|
+
duration: parseCSSTime(pget('new.animations.duration.normal')) / 1000,
|
|
145
|
+
}}
|
|
151
146
|
{...overrides?.tooltip}
|
|
152
147
|
className={clsx(styles.tooltip, styles[size], overrides?.tooltip?.className)}
|
|
153
148
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { createElement } from 'react';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
1
|
import { faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
4
|
+
import { createElement } from 'react';
|
|
5
5
|
import { Input } from './Input';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof Input> = {
|
|
@@ -69,10 +69,11 @@ export const WithEnhancer: Story = {
|
|
|
69
69
|
placeholder: 'Mia Dolan',
|
|
70
70
|
label: 'Name',
|
|
71
71
|
description: 'Type your full name here.',
|
|
72
|
-
startEnhancer: ({ size }) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
startEnhancer: ({ size }) =>
|
|
73
|
+
createElement(FontAwesomeIcon, {
|
|
74
|
+
icon: faSearch,
|
|
75
|
+
width: `${size}px`,
|
|
76
|
+
}),
|
|
76
77
|
},
|
|
77
78
|
};
|
|
78
79
|
|
|
@@ -81,20 +82,18 @@ export const WithEndEnhancer: Story = {
|
|
|
81
82
|
placeholder: 'Mia Dolan',
|
|
82
83
|
label: 'Name',
|
|
83
84
|
description: 'Type your full name here.',
|
|
84
|
-
endEnhancer: ({ size }) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
endEnhancer: ({ size }) =>
|
|
86
|
+
createElement(FontAwesomeIcon, {
|
|
87
|
+
icon: faSearch,
|
|
88
|
+
width: `${size}px`,
|
|
89
|
+
}),
|
|
88
90
|
},
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
export const WithCustomLabel: Story = {
|
|
92
94
|
args: {
|
|
93
95
|
placeholder: 'Mia Dolan',
|
|
94
|
-
label: createElement('span', null, [
|
|
95
|
-
createElement('b', null, 'Name'),
|
|
96
|
-
createElement('i', null, ' (optional)'),
|
|
97
|
-
]),
|
|
96
|
+
label: createElement('span', null, [createElement('b', null, 'Name'), createElement('i', null, ' (optional)')]),
|
|
98
97
|
'aria-label': 'Name (optional)',
|
|
99
98
|
description: createElement('span', null, [
|
|
100
99
|
createElement(
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { clsx } from 'clsx';
|
|
3
4
|
import type { ComponentPropsWithoutRef, FC, ForwardedRef } from 'react';
|
|
4
5
|
import { forwardRef, useId } from 'react';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
import styles from './Input.module.scss';
|
|
7
|
-
import type { TextProps } from '../text';
|
|
8
|
-
import type { Enhancer } from '../../types/Enhancer';
|
|
9
|
-
import { theme } from '../theme';
|
|
10
6
|
import { MemoizedEnhancer } from '../../helpers/renderEnhancer';
|
|
7
|
+
import type { Enhancer } from '../../types/Enhancer';
|
|
11
8
|
import type { FieldProps } from '../field';
|
|
12
9
|
import { Field } from '../field';
|
|
10
|
+
import type { TextProps } from '../text';
|
|
11
|
+
import { theme } from '../theme';
|
|
12
|
+
import styles from './Input.module.scss';
|
|
13
13
|
|
|
14
14
|
export type InputProps = {
|
|
15
15
|
/**
|
|
@@ -25,7 +25,29 @@ export type InputProps = {
|
|
|
25
25
|
* The input type. All HTML5 input types are supported, but some may require additional props to be set for full accessibility or aesthetic.
|
|
26
26
|
* @default text
|
|
27
27
|
*/
|
|
28
|
-
type?:
|
|
28
|
+
type?:
|
|
29
|
+
| 'button'
|
|
30
|
+
| 'checkbox'
|
|
31
|
+
| 'color'
|
|
32
|
+
| 'date'
|
|
33
|
+
| 'datetime-local'
|
|
34
|
+
| 'email'
|
|
35
|
+
| 'file'
|
|
36
|
+
| 'hidden'
|
|
37
|
+
| 'image'
|
|
38
|
+
| 'month'
|
|
39
|
+
| 'number'
|
|
40
|
+
| 'password'
|
|
41
|
+
| 'radio'
|
|
42
|
+
| 'range'
|
|
43
|
+
| 'reset'
|
|
44
|
+
| 'search'
|
|
45
|
+
| 'submit'
|
|
46
|
+
| 'tel'
|
|
47
|
+
| 'text'
|
|
48
|
+
| 'time'
|
|
49
|
+
| 'url'
|
|
50
|
+
| 'week';
|
|
29
51
|
/**
|
|
30
52
|
* The placeholder for the input.
|
|
31
53
|
*/
|
|
@@ -47,7 +69,7 @@ export type InputProps = {
|
|
|
47
69
|
description?: TextProps<'p'>;
|
|
48
70
|
startEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
49
71
|
endEnhancerContainer?: ComponentPropsWithoutRef<'div'>;
|
|
50
|
-
}
|
|
72
|
+
};
|
|
51
73
|
} & FieldProps;
|
|
52
74
|
|
|
53
75
|
/**
|
|
@@ -64,94 +86,96 @@ export type InputProps = {
|
|
|
64
86
|
* ```
|
|
65
87
|
* @constructor
|
|
66
88
|
*/
|
|
67
|
-
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = forwardRef(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// data-disabled={disabled}
|
|
107
|
-
data-status={disabled ? 'disabled' : (status || 'default')}
|
|
89
|
+
export const Input: FC<InputProps & ComponentPropsWithoutRef<'input'>> = forwardRef(
|
|
90
|
+
(
|
|
91
|
+
{
|
|
92
|
+
label,
|
|
93
|
+
status,
|
|
94
|
+
type,
|
|
95
|
+
hideLabel,
|
|
96
|
+
description,
|
|
97
|
+
hideDescription,
|
|
98
|
+
descriptionPosition,
|
|
99
|
+
startEnhancer,
|
|
100
|
+
endEnhancer,
|
|
101
|
+
disabled,
|
|
102
|
+
overrides,
|
|
103
|
+
...props
|
|
104
|
+
},
|
|
105
|
+
ref: ForwardedRef<HTMLInputElement>,
|
|
106
|
+
) => {
|
|
107
|
+
const inputID = useId();
|
|
108
|
+
return (
|
|
109
|
+
<Field
|
|
110
|
+
htmlFor={inputID}
|
|
111
|
+
label={label}
|
|
112
|
+
hideLabel={hideLabel}
|
|
113
|
+
description={description}
|
|
114
|
+
hideDescription={hideDescription}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
descriptionPosition={descriptionPosition}
|
|
117
|
+
overrides={{
|
|
118
|
+
container: {
|
|
119
|
+
...overrides?.container,
|
|
120
|
+
className: clsx(
|
|
121
|
+
// styles.fieldContainer,
|
|
122
|
+
overrides?.container?.className,
|
|
123
|
+
),
|
|
124
|
+
},
|
|
125
|
+
label: overrides?.label,
|
|
126
|
+
description: overrides?.description,
|
|
127
|
+
}}
|
|
108
128
|
>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
<div
|
|
130
|
+
className={styles.inputContainer}
|
|
131
|
+
// data-status={status}
|
|
132
|
+
// data-disabled={disabled}
|
|
133
|
+
data-status={disabled ? 'disabled' : status || 'default'}
|
|
134
|
+
>
|
|
135
|
+
{!!startEnhancer && (
|
|
136
|
+
<div
|
|
137
|
+
{...overrides?.startEnhancerContainer}
|
|
138
|
+
className={clsx(styles.enhancer, overrides?.startEnhancerContainer?.className)}
|
|
139
|
+
data-status={disabled ? 'disabled' : status || 'default'}
|
|
140
|
+
>
|
|
141
|
+
{!!startEnhancer && (
|
|
142
|
+
<MemoizedEnhancer
|
|
143
|
+
enhancer={startEnhancer}
|
|
144
|
+
size={parseInt(theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
<div className={styles.inputScaleWrapper}>
|
|
150
|
+
<input
|
|
151
|
+
{...props}
|
|
152
|
+
id={inputID}
|
|
153
|
+
ref={ref}
|
|
154
|
+
type={type || 'text'}
|
|
155
|
+
aria-label={typeof label === 'string' ? label : props['aria-label']}
|
|
156
|
+
aria-describedby={`${inputID}-description`}
|
|
157
|
+
aria-disabled={disabled}
|
|
158
|
+
data-status={disabled ? 'disabled' : status || 'default'}
|
|
159
|
+
readOnly={disabled}
|
|
160
|
+
className={clsx(props.className, styles.input)}
|
|
161
|
+
/>
|
|
121
162
|
</div>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
styles.input,
|
|
137
|
-
)}
|
|
138
|
-
/>
|
|
163
|
+
{!!endEnhancer && (
|
|
164
|
+
<div
|
|
165
|
+
{...overrides?.endEnhancerContainer}
|
|
166
|
+
className={clsx(styles.enhancer, overrides?.endEnhancerContainer?.className)}
|
|
167
|
+
data-status={disabled ? 'disabled' : status || 'default'}
|
|
168
|
+
>
|
|
169
|
+
{!!endEnhancer && (
|
|
170
|
+
<MemoizedEnhancer
|
|
171
|
+
enhancer={endEnhancer}
|
|
172
|
+
size={parseInt(theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
)}
|
|
139
177
|
</div>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
data-status={disabled ? 'disabled' : (status || 'default')}
|
|
145
|
-
>
|
|
146
|
-
{!!endEnhancer && (
|
|
147
|
-
<MemoizedEnhancer
|
|
148
|
-
enhancer={endEnhancer}
|
|
149
|
-
size={parseInt(theme.typography.styles.paragraphSmall.fontSize, 10)}
|
|
150
|
-
/>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
153
|
-
)}
|
|
154
|
-
</div>
|
|
155
|
-
</Field>
|
|
156
|
-
);
|
|
157
|
-
});
|
|
178
|
+
</Field>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
);
|