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,25 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
useMemo, useState,
|
|
6
|
-
} from 'react';
|
|
7
|
-
import {
|
|
8
|
-
Dialog, DialogPanel, DialogTitle, Transition, TransitionChild,
|
|
9
|
-
} from '@headlessui/react';
|
|
10
|
-
import { clsx } from 'clsx';
|
|
3
|
+
import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react';
|
|
11
4
|
import type { CSSLength } from '@ssh/csstypes';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { TextWhenString } from '../utility/TextWhenString';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
7
|
+
import { useMemo, useState } from 'react';
|
|
16
8
|
import { Button } from '../button';
|
|
17
|
-
import {
|
|
9
|
+
import { ChevronLeft, ChevronRight, Close, Icon } from '../icon';
|
|
18
10
|
import type { PaginationState } from '../pagination';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
} from '../
|
|
22
|
-
import {
|
|
11
|
+
import { Text } from '../text';
|
|
12
|
+
import { RemoveFromDOM } from '../utility/RemoveFromDOM';
|
|
13
|
+
import { TextWhenString } from '../utility/TextWhenString';
|
|
14
|
+
import { VisuallyHidden } from '../utility/VisuallyHidden';
|
|
15
|
+
import styles from './Drawer.module.scss';
|
|
23
16
|
|
|
24
17
|
export const DrawerSizePresets = ['content', 'default', 'full', 'fullWithMargin', 'fullOnMobile'] as const;
|
|
25
18
|
|
|
@@ -89,7 +82,7 @@ export type DrawerProps<T extends string[] | readonly string[] = string[]> = {
|
|
|
89
82
|
* @see DrawerSizePresets
|
|
90
83
|
* @default 'default'
|
|
91
84
|
*/
|
|
92
|
-
size?: typeof DrawerSizePresets[number] | CSSLength;
|
|
85
|
+
size?: (typeof DrawerSizePresets)[number] | CSSLength;
|
|
93
86
|
/**
|
|
94
87
|
* An optional pagination state. If provided, each child of the Drawer will be rendered in its own page, and the Drawer will contain back and next buttons that will be used to navigate between pages.
|
|
95
88
|
*
|
|
@@ -137,20 +130,20 @@ export type DrawerProps<T extends string[] | readonly string[] = string[]> = {
|
|
|
137
130
|
};
|
|
138
131
|
|
|
139
132
|
/**
|
|
140
|
-
* Drawers are panels that slide in from the edge of the screen to reveal additional content.
|
|
141
|
-
*
|
|
142
|
-
* <hr />
|
|
143
|
-
*
|
|
144
|
-
* To use this component, import it as follows:
|
|
145
|
-
*
|
|
146
|
-
* ```js
|
|
147
|
-
* import { Drawer } from 'paris/drawer';
|
|
148
|
-
* ```
|
|
149
|
-
* @constructor
|
|
150
|
-
*/
|
|
133
|
+
* Drawers are panels that slide in from the edge of the screen to reveal additional content.
|
|
134
|
+
*
|
|
135
|
+
* <hr />
|
|
136
|
+
*
|
|
137
|
+
* To use this component, import it as follows:
|
|
138
|
+
*
|
|
139
|
+
* ```js
|
|
140
|
+
* import { Drawer } from 'paris/drawer';
|
|
141
|
+
* ```
|
|
142
|
+
* @constructor
|
|
143
|
+
*/
|
|
151
144
|
export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
152
145
|
isOpen = false,
|
|
153
|
-
onClose = () => {
|
|
146
|
+
onClose = () => {},
|
|
154
147
|
title,
|
|
155
148
|
hideTitle = false,
|
|
156
149
|
hideCloseButton = false,
|
|
@@ -191,14 +184,17 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
191
184
|
const currentChild: ReactNode = useMemo(() => {
|
|
192
185
|
// If no children are provided, render nothing.
|
|
193
186
|
if (!children) {
|
|
194
|
-
return
|
|
187
|
+
return <></>;
|
|
195
188
|
}
|
|
196
189
|
|
|
197
190
|
// If pagination is enabled, and multiple children are provided, render the currently active child by matching its key against `pagination.currentPage`.
|
|
198
191
|
if (pagination && Array.isArray(children) && children.length > 0) {
|
|
199
192
|
const found = children.find((child) => {
|
|
200
193
|
if (!(child && typeof child === 'object' && 'key' in child)) {
|
|
201
|
-
console.warn(
|
|
194
|
+
console.warn(
|
|
195
|
+
'Drawer: Pagination is enabled, but the following child is missing a `key` prop. Pagination will likely not work as expected and this child will never be rendered.',
|
|
196
|
+
child,
|
|
197
|
+
);
|
|
202
198
|
return false;
|
|
203
199
|
}
|
|
204
200
|
return child.key === pagination.currentPage;
|
|
@@ -216,10 +212,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
216
212
|
<Transition show={isOpen}>
|
|
217
213
|
<Dialog
|
|
218
214
|
as="div"
|
|
219
|
-
className={clsx(
|
|
220
|
-
styles.root,
|
|
221
|
-
overrides?.dialog?.className,
|
|
222
|
-
)}
|
|
215
|
+
className={clsx(styles.root, overrides?.dialog?.className)}
|
|
223
216
|
onClose={onClose}
|
|
224
217
|
{...overrides?.dialog}
|
|
225
218
|
role="dialog"
|
|
@@ -256,10 +249,14 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
256
249
|
{ [styles[`size-${size}`]]: sizeIsPreset },
|
|
257
250
|
overrides?.panelContainer?.className,
|
|
258
251
|
)}
|
|
259
|
-
style={
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
style={
|
|
253
|
+
!sizeIsPreset
|
|
254
|
+
? {
|
|
255
|
+
[xAxisDrawer ? 'width' : 'height']: size,
|
|
256
|
+
...overrides?.panelContainer?.style,
|
|
257
|
+
}
|
|
258
|
+
: overrides?.panelContainer?.style
|
|
259
|
+
}
|
|
263
260
|
{...overrides?.panelContainer}
|
|
264
261
|
>
|
|
265
262
|
<TransitionChild
|
|
@@ -271,49 +268,35 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
271
268
|
leaveTo={styles.leaveTo}
|
|
272
269
|
>
|
|
273
270
|
<DialogPanel
|
|
274
|
-
className={clsx(
|
|
275
|
-
styles.panel,
|
|
276
|
-
styles[`from-${from}`],
|
|
277
|
-
overrides?.panel?.className,
|
|
278
|
-
)}
|
|
271
|
+
className={clsx(styles.panel, styles[`from-${from}`], overrides?.panel?.className)}
|
|
279
272
|
>
|
|
280
273
|
{/* Dialog title bar */}
|
|
281
274
|
<div className={clsx(styles.titleBar, overrides?.titleBar?.className)}>
|
|
282
|
-
<div
|
|
283
|
-
className={clsx(styles.titleArea, overrides?.titleArea?.className)}
|
|
284
|
-
>
|
|
275
|
+
<div className={clsx(styles.titleArea, overrides?.titleArea?.className)}>
|
|
285
276
|
<RemoveFromDOM
|
|
286
277
|
// Hide when pagination is not enabled.
|
|
287
278
|
when={!isPaginated}
|
|
288
279
|
>
|
|
289
280
|
<div className={clsx(styles.paginationButtons)}>
|
|
290
281
|
<Button
|
|
291
|
-
className={clsx(
|
|
292
|
-
styles.navButton,
|
|
293
|
-
)}
|
|
282
|
+
className={clsx(styles.navButton)}
|
|
294
283
|
size="medium"
|
|
295
284
|
kind="tertiary"
|
|
296
285
|
shape="circle"
|
|
297
286
|
onClick={() => pagination?.back()}
|
|
298
287
|
disabled={!pagination?.canGoBack()}
|
|
299
|
-
startEnhancer={
|
|
300
|
-
<Icon icon={ChevronLeft} size={16} />
|
|
301
|
-
)}
|
|
288
|
+
startEnhancer={<Icon icon={ChevronLeft} size={16} />}
|
|
302
289
|
>
|
|
303
290
|
Go to previous page in this modal
|
|
304
291
|
</Button>
|
|
305
292
|
<Button
|
|
306
|
-
className={clsx(
|
|
307
|
-
styles.navButton,
|
|
308
|
-
)}
|
|
293
|
+
className={clsx(styles.navButton)}
|
|
309
294
|
size="medium"
|
|
310
295
|
kind="tertiary"
|
|
311
296
|
shape="circle"
|
|
312
297
|
onClick={() => pagination?.forward()}
|
|
313
298
|
disabled={!pagination?.canGoForward()}
|
|
314
|
-
startEnhancer={
|
|
315
|
-
<Icon icon={ChevronRight} size={16} />
|
|
316
|
-
)}
|
|
299
|
+
startEnhancer={<Icon icon={ChevronRight} size={16} />}
|
|
317
300
|
>
|
|
318
301
|
Go to next page in this modal
|
|
319
302
|
</Button>
|
|
@@ -332,9 +315,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
332
315
|
</div>
|
|
333
316
|
<div className={clsx(styles.titleBarButtons, overrides?.titleBarButtons?.className)}>
|
|
334
317
|
{/* Action Menu */}
|
|
335
|
-
<RemoveFromDOM when={!hasAdditionalActions}>
|
|
336
|
-
{additionalActions}
|
|
337
|
-
</RemoveFromDOM>
|
|
318
|
+
<RemoveFromDOM when={!hasAdditionalActions}>{additionalActions}</RemoveFromDOM>
|
|
338
319
|
|
|
339
320
|
{/* Close button */}
|
|
340
321
|
<RemoveFromDOM
|
|
@@ -345,13 +326,9 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
345
326
|
kind="tertiary"
|
|
346
327
|
shape="circle"
|
|
347
328
|
onClick={() => onClose(false)}
|
|
348
|
-
startEnhancer={
|
|
349
|
-
<Icon icon={Close} size={20} />
|
|
350
|
-
)}
|
|
329
|
+
startEnhancer={<Icon icon={Close} size={20} />}
|
|
351
330
|
data-title-hidden={hideTitle}
|
|
352
|
-
className={clsx(
|
|
353
|
-
styles.closeButton,
|
|
354
|
-
)}
|
|
331
|
+
className={clsx(styles.closeButton)}
|
|
355
332
|
>
|
|
356
333
|
Close dialog
|
|
357
334
|
</Button>
|
|
@@ -361,35 +338,61 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
|
|
|
361
338
|
|
|
362
339
|
<div className={clsx(styles.content, overrides?.content?.className)}>
|
|
363
340
|
<div className={clsx(styles.contentChildren, overrides?.contentChildren?.className)}>
|
|
364
|
-
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
341
|
+
{isPaginated && Array.isArray(children)
|
|
342
|
+
? children.map(
|
|
343
|
+
(child) =>
|
|
344
|
+
child &&
|
|
345
|
+
typeof child === 'object' &&
|
|
346
|
+
'key' in child && (
|
|
347
|
+
<Transition
|
|
348
|
+
show={
|
|
349
|
+
child.key === pagination?.currentPage &&
|
|
350
|
+
loadedPage === child.key
|
|
351
|
+
}
|
|
352
|
+
key={`transition_${child.key}`}
|
|
353
|
+
as="div"
|
|
354
|
+
enter={styles.paginationEnter}
|
|
355
|
+
enterFrom={styles.enterFromOpacity}
|
|
356
|
+
enterTo={styles.enterToOpacity}
|
|
357
|
+
leave={styles.paginationLeave}
|
|
358
|
+
leaveFrom={styles.leaveFromOpacity}
|
|
359
|
+
leaveTo={styles.leaveToOpacity}
|
|
360
|
+
afterLeave={() => {
|
|
361
|
+
setLoadedPage(pagination?.currentPage || null);
|
|
362
|
+
}}
|
|
363
|
+
className={clsx(
|
|
364
|
+
overrides?.contentChildrenChildren?.className,
|
|
365
|
+
)}
|
|
366
|
+
>
|
|
367
|
+
{child}
|
|
368
|
+
</Transition>
|
|
369
|
+
),
|
|
370
|
+
)
|
|
371
|
+
: children}
|
|
383
372
|
</div>
|
|
384
373
|
{bottomPanel && (
|
|
385
374
|
<>
|
|
386
|
-
<div
|
|
375
|
+
<div
|
|
376
|
+
tabIndex={-1}
|
|
377
|
+
aria-hidden="true"
|
|
378
|
+
className={clsx(
|
|
379
|
+
styles.bottomPanelSpacer,
|
|
380
|
+
{ [styles.noPadding]: !bottomPanelPadding },
|
|
381
|
+
overrides?.bottomPanelSpacer?.className,
|
|
382
|
+
)}
|
|
383
|
+
>
|
|
387
384
|
{bottomPanel}
|
|
388
385
|
</div>
|
|
389
386
|
<div className={clsx(styles.bottomPanel, overrides?.bottomPanel?.className)}>
|
|
390
387
|
<div className={styles.glassOpacity} />
|
|
391
388
|
<div className={styles.glassBlend} />
|
|
392
|
-
<div
|
|
389
|
+
<div
|
|
390
|
+
className={clsx(
|
|
391
|
+
styles.bottomPanelContent,
|
|
392
|
+
{ [styles.noPadding]: !bottomPanelPadding },
|
|
393
|
+
overrides?.bottomPanelContent?.className,
|
|
394
|
+
)}
|
|
395
|
+
>
|
|
393
396
|
{bottomPanel}
|
|
394
397
|
</div>
|
|
395
398
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { type ComponentPropsWithoutRef, type FC, type PropsWithChildren } from 'react';
|
|
2
1
|
import { clsx } from 'clsx';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { ComponentPropsWithoutRef, FC, PropsWithChildren } from 'react';
|
|
3
4
|
import styles from '../input/Input.module.scss';
|
|
4
5
|
import type { TextProps } from '../text';
|
|
5
6
|
import { Text } from '../text';
|
|
@@ -41,21 +42,21 @@ export type FieldProps = {
|
|
|
41
42
|
label?: TextProps<'label'>;
|
|
42
43
|
description?: TextProps<'p'>;
|
|
43
44
|
labelContainer?: ComponentPropsWithoutRef<'div'>;
|
|
44
|
-
}
|
|
45
|
+
};
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
|
-
* A Field component wraps a form input component with an accessible label and description.
|
|
49
|
-
*
|
|
50
|
-
* <hr />
|
|
51
|
-
*
|
|
52
|
-
* To use this component, import it as follows:
|
|
53
|
-
*
|
|
54
|
-
* ```js
|
|
55
|
-
* import { Field } from 'paris/field';
|
|
56
|
-
* ```
|
|
57
|
-
* @constructor
|
|
58
|
-
*/
|
|
49
|
+
* A Field component wraps a form input component with an accessible label and description.
|
|
50
|
+
*
|
|
51
|
+
* <hr />
|
|
52
|
+
*
|
|
53
|
+
* To use this component, import it as follows:
|
|
54
|
+
*
|
|
55
|
+
* ```js
|
|
56
|
+
* import { Field } from 'paris/field';
|
|
57
|
+
* ```
|
|
58
|
+
* @constructor
|
|
59
|
+
*/
|
|
59
60
|
export const Field: FC<PropsWithChildren<FieldProps>> = ({
|
|
60
61
|
htmlFor,
|
|
61
62
|
disabled,
|
|
@@ -64,29 +65,25 @@ export const Field: FC<PropsWithChildren<FieldProps>> = ({
|
|
|
64
65
|
// className,
|
|
65
66
|
...props
|
|
66
67
|
}) => {
|
|
67
|
-
const label =
|
|
68
|
-
? (
|
|
68
|
+
const label =
|
|
69
|
+
typeof props.label === 'string' ? (
|
|
69
70
|
<Text
|
|
70
71
|
{...props.overrides?.label}
|
|
71
72
|
as="label"
|
|
72
73
|
kind="paragraphSmall"
|
|
73
74
|
htmlFor={htmlFor}
|
|
74
|
-
className={clsx(
|
|
75
|
-
styles.label,
|
|
76
|
-
{ [styles.hidden]: props.hideLabel },
|
|
77
|
-
)}
|
|
75
|
+
className={clsx(styles.label, { [styles.hidden]: props.hideLabel })}
|
|
78
76
|
>
|
|
79
77
|
{props.label}
|
|
80
78
|
</Text>
|
|
81
|
-
)
|
|
82
|
-
: (
|
|
79
|
+
) : (
|
|
83
80
|
<label htmlFor={htmlFor} className={clsx(styles.label, { [styles.hidden]: props.hideLabel })}>
|
|
84
81
|
{props.label}
|
|
85
82
|
</label>
|
|
86
83
|
);
|
|
87
84
|
|
|
88
|
-
const description =
|
|
89
|
-
? (
|
|
85
|
+
const description =
|
|
86
|
+
typeof props.description === 'string' ? (
|
|
90
87
|
<Text
|
|
91
88
|
id={`${htmlFor}-description`}
|
|
92
89
|
{...props.overrides?.description}
|
|
@@ -100,8 +97,7 @@ export const Field: FC<PropsWithChildren<FieldProps>> = ({
|
|
|
100
97
|
>
|
|
101
98
|
{props.description}
|
|
102
99
|
</Text>
|
|
103
|
-
)
|
|
104
|
-
: (
|
|
100
|
+
) : (
|
|
105
101
|
<div
|
|
106
102
|
id={`${htmlFor}-description`}
|
|
107
103
|
className={clsx({ [styles.hidden]: !props.description || props.hideDescription })}
|
|
@@ -134,15 +130,14 @@ export const Field: FC<PropsWithChildren<FieldProps>> = ({
|
|
|
134
130
|
{descriptionPosition === 'top' ? (
|
|
135
131
|
<div
|
|
136
132
|
{...props.overrides?.labelContainer}
|
|
137
|
-
className={clsx(
|
|
138
|
-
styles.labelContainer,
|
|
139
|
-
props.overrides?.labelContainer?.className,
|
|
140
|
-
)}
|
|
133
|
+
className={clsx(styles.labelContainer, props.overrides?.labelContainer?.className)}
|
|
141
134
|
>
|
|
142
135
|
{label}
|
|
143
136
|
{description}
|
|
144
137
|
</div>
|
|
145
|
-
) :
|
|
138
|
+
) : (
|
|
139
|
+
label
|
|
140
|
+
)}
|
|
146
141
|
{children}
|
|
147
142
|
{descriptionPosition === 'bottom' ? description : <></>}
|
|
148
143
|
</div>
|
|
@@ -3,6 +3,9 @@ import type { IconDefinition } from './Icon';
|
|
|
3
3
|
|
|
4
4
|
export const Ellipsis: IconDefinition = memo(({ size }) => (
|
|
5
5
|
<svg width={size} height={size} viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<path
|
|
6
|
+
<path
|
|
7
|
+
d="M13.5 10C13.5 9.1875 14.1562 8.5 15 8.5C15.8125 8.5 16.5 9.1875 16.5 10C16.5 10.8438 15.8125 11.5 15 11.5C14.1562 11.5 13.5 10.8438 13.5 10ZM8.5 10C8.5 9.1875 9.15625 8.5 10 8.5C10.8125 8.5 11.5 9.1875 11.5 10C11.5 10.8438 10.8125 11.5 10 11.5C9.15625 11.5 8.5 10.8438 8.5 10ZM6.5 10C6.5 10.8438 5.8125 11.5 5 11.5C4.15625 11.5 3.5 10.8438 3.5 10C3.5 9.1875 4.15625 8.5 5 8.5C5.8125 8.5 6.5 9.1875 6.5 10Z"
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
/>
|
|
7
10
|
</svg>
|
|
8
11
|
));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { pvar } from '../theme';
|
|
2
3
|
import type { IconDefinition } from './Icon';
|
|
3
4
|
import { Icon } from './Icon';
|
|
4
5
|
import * as Icons from './index';
|
|
5
|
-
import { pvar } from '../theme';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof Icon> = {
|
|
8
8
|
title: 'Content/Icon',
|
|
@@ -13,34 +13,24 @@ export type IconProps<T extends ElementType = 'span'> = IconDefinitionProps & {
|
|
|
13
13
|
icon: IconDefinition;
|
|
14
14
|
as?: T;
|
|
15
15
|
overrides?: {
|
|
16
|
-
icon?: ComponentPropsWithoutRef<'svg'
|
|
17
|
-
}
|
|
16
|
+
icon?: ComponentPropsWithoutRef<'svg'>;
|
|
17
|
+
};
|
|
18
18
|
} & ComponentPropsWithoutRef<T>;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Paris comes with a set of simple UI icons that can be used in your application. Icons are MIT-licensed and can be used in any project.
|
|
22
|
-
*
|
|
23
|
-
* <hr />
|
|
24
|
-
*
|
|
25
|
-
* To use this component, import the parent `Icon` component and the icon you want to use:
|
|
26
|
-
*
|
|
27
|
-
* ```tsx
|
|
28
|
-
* import { Icon, Close } from 'paris/icon';
|
|
21
|
+
* Paris comes with a set of simple UI icons that can be used in your application. Icons are MIT-licensed and can be used in any project.
|
|
22
|
+
*
|
|
23
|
+
* <hr />
|
|
24
|
+
*
|
|
25
|
+
* To use this component, import the parent `Icon` component and the icon you want to use:
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { Icon, Close } from 'paris/icon';
|
|
29
29
|
*
|
|
30
30
|
* <Icon icon={Close} size={20} />
|
|
31
|
-
* ```
|
|
32
|
-
* @constructor
|
|
33
|
-
*/
|
|
34
|
-
export const Icon = memo<IconProps<ElementType>>(({
|
|
35
|
-
as
|
|
36
|
-
|
|
37
|
-
size,
|
|
38
|
-
overrides = { icon: {} },
|
|
39
|
-
...props
|
|
40
|
-
}) => (
|
|
41
|
-
createElement(
|
|
42
|
-
as,
|
|
43
|
-
props,
|
|
44
|
-
createElement(icon, { size, ...overrides.icon }),
|
|
45
|
-
)
|
|
46
|
-
));
|
|
31
|
+
* ```
|
|
32
|
+
* @constructor
|
|
33
|
+
*/
|
|
34
|
+
export const Icon = memo<IconProps<ElementType>>(({ as = 'span', icon, size, overrides = { icon: {} }, ...props }) =>
|
|
35
|
+
createElement(as, props, createElement(icon, { size, ...overrides.icon })),
|
|
36
|
+
);
|
|
@@ -3,6 +3,9 @@ import type { IconDefinition } from './Icon';
|
|
|
3
3
|
|
|
4
4
|
export const Info: IconDefinition = memo(({ size }) => (
|
|
5
5
|
<svg width={size} height={size} viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<path
|
|
6
|
+
<path
|
|
7
|
+
d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V248c0-13.3-10.7-24-24-24H216c-13.3 0-24 10.7-24 24s10.7 24 24 24h24v64H216zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
/>
|
|
7
10
|
</svg>
|
|
8
11
|
));
|
|
@@ -4,12 +4,14 @@ import type { IconDefinition } from './Icon';
|
|
|
4
4
|
export const Spinner: IconDefinition = memo(({ size }) => (
|
|
5
5
|
<svg width={size} height={size} viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
6
6
|
<style
|
|
7
|
-
|
|
8
7
|
dangerouslySetInnerHTML={{
|
|
9
8
|
__html: '.spinner_ajPY{transform-origin:center;animation:spinner_AtaB .75s infinite linear}@keyframes spinner_AtaB{100%{transform:rotate(360deg)}}',
|
|
10
9
|
}}
|
|
11
10
|
/>
|
|
12
11
|
<path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25" />
|
|
13
|
-
<path
|
|
12
|
+
<path
|
|
13
|
+
d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
|
|
14
|
+
className="spinner_ajPY"
|
|
15
|
+
/>
|
|
14
16
|
</svg>
|
|
15
17
|
));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
export { ArrowRight } from './ArrowRight';
|
|
2
|
+
export { Check } from './Check';
|
|
3
3
|
export { ChevronLeft } from './ChevronLeft';
|
|
4
4
|
export { ChevronRight } from './ChevronRight';
|
|
5
|
+
export { Close } from './Close';
|
|
5
6
|
export { Ellipsis } from './Ellipsis';
|
|
6
|
-
export
|
|
7
|
-
export { NotificationDot } from './NotificationDot';
|
|
8
|
-
export { Check } from './Check';
|
|
9
|
-
export { ArrowRight } from './ArrowRight';
|
|
7
|
+
export * from './Icon';
|
|
10
8
|
export { Info } from './Info';
|
|
9
|
+
export { NotificationDot } from './NotificationDot';
|
|
10
|
+
export { Spinner } from './Spinner';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { InformationalTooltip } from './InformationalTooltip';
|
|
4
4
|
|
|
@@ -11,20 +11,21 @@ const meta: Meta<typeof InformationalTooltip> = {
|
|
|
11
11
|
export default meta;
|
|
12
12
|
type Story = StoryObj<typeof InformationalTooltip>;
|
|
13
13
|
|
|
14
|
-
const render: Story['render'] = (args) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
14
|
+
const render: Story['render'] = (args) =>
|
|
15
|
+
createElement(
|
|
16
|
+
'div',
|
|
17
|
+
{
|
|
18
|
+
style: { minHeight: '200px' },
|
|
19
|
+
},
|
|
20
|
+
createElement(InformationalTooltip, {
|
|
21
|
+
...args,
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
23
24
|
|
|
24
25
|
export const Default: Story = {
|
|
25
26
|
args: {
|
|
26
27
|
children:
|
|
27
|
-
|
|
28
|
+
'If you are being paid on 1099s (through transfer outs) you need to pay taxes quarterly. The amount you pay each quarter is a portion of your estimated tax burden for the year, based on your anticipated income amount. If you over/underpay, you will be refunded/owe the difference at the end of the year. ',
|
|
28
29
|
heading: 'Quarterly taxes',
|
|
29
30
|
},
|
|
30
31
|
render,
|