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,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
2
|
import { AccordionSelect } from './AccordionSelect';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof AccordionSelect> = {
|
|
@@ -32,10 +32,7 @@ export const NoSelection: Story = {
|
|
|
32
32
|
|
|
33
33
|
export const WithDisabledOption: Story = {
|
|
34
34
|
args: {
|
|
35
|
-
options: [
|
|
36
|
-
...options,
|
|
37
|
-
{ id: 'nowhere', node: 'Nowhere, it was all a dream', disabled: true },
|
|
38
|
-
],
|
|
35
|
+
options: [...options, { id: 'nowhere', node: 'Nowhere, it was all a dream', disabled: true }],
|
|
39
36
|
value: 'champagne',
|
|
40
37
|
},
|
|
41
38
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
useCallback, useEffect, useRef, useState,
|
|
6
|
-
} from 'react';
|
|
7
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
8
3
|
import { clsx } from 'clsx';
|
|
4
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
5
|
+
import type { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
7
|
import { Check, ChevronRight, Icon } from '../icon';
|
|
10
8
|
import { TextWhenString } from '../utility';
|
|
11
9
|
import styles from './AccordionSelect.module.scss';
|
|
@@ -127,16 +125,19 @@ export const AccordionSelect: FC<AccordionSelectProps> = ({
|
|
|
127
125
|
const open = controlledOpen ?? internalOpen;
|
|
128
126
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
129
127
|
|
|
130
|
-
const setOpen = useCallback(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
const setOpen = useCallback(
|
|
129
|
+
(nextOpen: boolean) => {
|
|
130
|
+
setInternalOpen(nextOpen);
|
|
131
|
+
onOpenChange?.(nextOpen);
|
|
132
|
+
},
|
|
133
|
+
[onOpenChange],
|
|
134
|
+
);
|
|
134
135
|
|
|
135
136
|
const selectedOption = options.find((o) => o.id === value);
|
|
136
137
|
|
|
137
138
|
useEffect(() => {
|
|
138
139
|
if (!closeOnClickOutside || !open) {
|
|
139
|
-
return () => {
|
|
140
|
+
return () => {};
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
const handleClickOutside = (e: MouseEvent) => {
|
|
@@ -151,28 +152,18 @@ export const AccordionSelect: FC<AccordionSelectProps> = ({
|
|
|
151
152
|
|
|
152
153
|
let headerContent: ReactNode = placeholder;
|
|
153
154
|
if (selectedOption) {
|
|
154
|
-
headerContent = renderSelected
|
|
155
|
-
? renderSelected(selectedOption)
|
|
156
|
-
: selectedOption.node;
|
|
155
|
+
headerContent = renderSelected ? renderSelected(selectedOption) : selectedOption.node;
|
|
157
156
|
}
|
|
158
157
|
|
|
159
158
|
return (
|
|
160
159
|
<div
|
|
161
160
|
ref={rootRef}
|
|
162
161
|
{...overrides?.root}
|
|
163
|
-
className={clsx(
|
|
164
|
-
styles.root,
|
|
165
|
-
open && styles.open,
|
|
166
|
-
overrides?.root?.className,
|
|
167
|
-
)}
|
|
162
|
+
className={clsx(styles.root, open && styles.open, overrides?.root?.className)}
|
|
168
163
|
>
|
|
169
164
|
<div
|
|
170
165
|
{...overrides?.header}
|
|
171
|
-
className={clsx(
|
|
172
|
-
styles.header,
|
|
173
|
-
open && styles.open,
|
|
174
|
-
overrides?.header?.className,
|
|
175
|
-
)}
|
|
166
|
+
className={clsx(styles.header, open && styles.open, overrides?.header?.className)}
|
|
176
167
|
onClick={() => setOpen(!open)}
|
|
177
168
|
onKeyDown={(e) => {
|
|
178
169
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -190,11 +181,7 @@ export const AccordionSelect: FC<AccordionSelectProps> = ({
|
|
|
190
181
|
</div>
|
|
191
182
|
<div className={styles.headerEnd}>
|
|
192
183
|
{label}
|
|
193
|
-
<Icon
|
|
194
|
-
icon={ChevronRight}
|
|
195
|
-
size={16}
|
|
196
|
-
className={clsx(styles.chevron, open && styles.open)}
|
|
197
|
-
/>
|
|
184
|
+
<Icon icon={ChevronRight} size={16} className={clsx(styles.chevron, open && styles.open)} />
|
|
198
185
|
</div>
|
|
199
186
|
</div>
|
|
200
187
|
|
|
@@ -213,17 +200,11 @@ export const AccordionSelect: FC<AccordionSelectProps> = ({
|
|
|
213
200
|
duration: 0.8,
|
|
214
201
|
ease: [0.87, 0, 0.13, 1],
|
|
215
202
|
}}
|
|
216
|
-
className={clsx(
|
|
217
|
-
styles.dropdown,
|
|
218
|
-
overrides?.dropdown?.className,
|
|
219
|
-
)}
|
|
203
|
+
className={clsx(styles.dropdown, overrides?.dropdown?.className)}
|
|
220
204
|
>
|
|
221
205
|
<div
|
|
222
206
|
{...overrides?.dropdownContent}
|
|
223
|
-
className={clsx(
|
|
224
|
-
styles.dropdownContent,
|
|
225
|
-
overrides?.dropdownContent?.className,
|
|
226
|
-
)}
|
|
207
|
+
className={clsx(styles.dropdownContent, overrides?.dropdownContent?.className)}
|
|
227
208
|
>
|
|
228
209
|
{options.map((option) => {
|
|
229
210
|
const isOptionSelected = option.id === value;
|
|
@@ -234,27 +215,22 @@ export const AccordionSelect: FC<AccordionSelectProps> = ({
|
|
|
234
215
|
disabled={option.disabled}
|
|
235
216
|
data-selected={isOptionSelected}
|
|
236
217
|
{...overrides?.option}
|
|
237
|
-
className={clsx(
|
|
238
|
-
styles.option,
|
|
239
|
-
overrides?.option?.className,
|
|
240
|
-
)}
|
|
218
|
+
className={clsx(styles.option, overrides?.option?.className)}
|
|
241
219
|
onClick={() => {
|
|
242
220
|
onChange?.(option);
|
|
243
221
|
if (closeOnSelect) setOpen(false);
|
|
244
222
|
}}
|
|
245
223
|
>
|
|
246
224
|
<div className={styles.optionContent}>
|
|
247
|
-
{renderOption
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
225
|
+
{renderOption ? (
|
|
226
|
+
renderOption(option, isOptionSelected)
|
|
227
|
+
) : (
|
|
228
|
+
<TextWhenString kind="paragraphXSmall" weight="medium">
|
|
229
|
+
{option.node}
|
|
230
|
+
</TextWhenString>
|
|
231
|
+
)}
|
|
254
232
|
</div>
|
|
255
|
-
{isOptionSelected &&
|
|
256
|
-
<Icon icon={Check} size={13} className={styles.check} />
|
|
257
|
-
)}
|
|
233
|
+
{isOptionSelected && <Icon icon={Check} size={13} className={styles.check} />}
|
|
258
234
|
</button>
|
|
259
235
|
);
|
|
260
236
|
})}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ComponentPropsWithoutRef, CSSProperties, FC, ReactNode,
|
|
3
|
-
} from 'react';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
1
|
import type { CSSLength } from '@ssh/csstypes';
|
|
6
2
|
import { clsx } from 'clsx';
|
|
7
|
-
import
|
|
3
|
+
import type { ComponentPropsWithoutRef, CSSProperties, FC, ReactNode } from 'react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
8
5
|
import { pvar } from '../theme';
|
|
6
|
+
import styles from './Avatar.module.scss';
|
|
9
7
|
|
|
10
8
|
export type AvatarProps = {
|
|
11
9
|
frameColor?: string;
|
|
@@ -35,17 +33,20 @@ export const Avatar: FC<AvatarProps> = ({
|
|
|
35
33
|
style,
|
|
36
34
|
...props
|
|
37
35
|
}) => {
|
|
38
|
-
const widthMemoized = useMemo(
|
|
39
|
-
typeof width === 'number' ? `${width}px` : width
|
|
40
|
-
|
|
36
|
+
const widthMemoized = useMemo(
|
|
37
|
+
() => (typeof width === 'number' ? `${width}px` : width) as CSSProperties['width'],
|
|
38
|
+
[width],
|
|
39
|
+
);
|
|
41
40
|
return (
|
|
42
41
|
<div
|
|
43
42
|
{...props}
|
|
44
|
-
style={
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
style={
|
|
44
|
+
{
|
|
45
|
+
width: widthMemoized,
|
|
46
|
+
'--frame-color': frameColor,
|
|
47
|
+
...style,
|
|
48
|
+
} as CSSProperties
|
|
49
|
+
}
|
|
49
50
|
className={clsx(styles.content, className)}
|
|
50
51
|
>
|
|
51
52
|
{children}
|
|
@@ -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 { faPlus } 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 { Button } from './Button';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof Button> = {
|
|
@@ -51,10 +51,11 @@ export const WithEnhancer: Story = {
|
|
|
51
51
|
args: {
|
|
52
52
|
children: 'Button',
|
|
53
53
|
kind: 'primary',
|
|
54
|
-
startEnhancer: ({ size }) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
startEnhancer: ({ size }) =>
|
|
55
|
+
createElement(FontAwesomeIcon, {
|
|
56
|
+
icon: faPlus,
|
|
57
|
+
width: `${size}px`,
|
|
58
|
+
}),
|
|
58
59
|
},
|
|
59
60
|
};
|
|
60
61
|
|
|
@@ -63,10 +64,11 @@ export const Circle: Story = {
|
|
|
63
64
|
children: 'Button',
|
|
64
65
|
shape: 'circle',
|
|
65
66
|
kind: 'tertiary',
|
|
66
|
-
startEnhancer: ({ size }) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
startEnhancer: ({ size }) =>
|
|
68
|
+
createElement(FontAwesomeIcon, {
|
|
69
|
+
icon: faPlus,
|
|
70
|
+
width: `${size}px`,
|
|
71
|
+
}),
|
|
70
72
|
},
|
|
71
73
|
};
|
|
72
74
|
|
|
@@ -75,10 +77,11 @@ export const Rounded: Story = {
|
|
|
75
77
|
children: 'Button',
|
|
76
78
|
shape: 'rectangle',
|
|
77
79
|
corners: 'rounded',
|
|
78
|
-
startEnhancer: ({ size }) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
startEnhancer: ({ size }) =>
|
|
81
|
+
createElement(FontAwesomeIcon, {
|
|
82
|
+
icon: faPlus,
|
|
83
|
+
width: `${size}px`,
|
|
84
|
+
}),
|
|
82
85
|
},
|
|
83
86
|
};
|
|
84
87
|
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
CSSProperties, FC, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode,
|
|
5
|
-
} from 'react';
|
|
6
|
-
import { useMemo } from 'react';
|
|
7
3
|
import type { ButtonProps as AriaButtonProps } from '@ariakit/react';
|
|
8
4
|
import { Button as AriaButton } from '@ariakit/react';
|
|
5
|
+
import type { CSSLength } from '@ssh/csstypes';
|
|
9
6
|
import { clsx } from 'clsx';
|
|
10
7
|
import fontColorContrast from 'font-color-contrast';
|
|
11
|
-
import type {
|
|
12
|
-
import
|
|
13
|
-
import { Text } from '../text';
|
|
14
|
-
import type { Enhancer } from '../../types/Enhancer';
|
|
8
|
+
import type { CSSProperties, FC, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode } from 'react';
|
|
9
|
+
import { useMemo } from 'react';
|
|
15
10
|
import { MemoizedEnhancer } from '../../helpers/renderEnhancer';
|
|
11
|
+
import type { Enhancer } from '../../types/Enhancer';
|
|
12
|
+
import { NotificationDot, Spinner } from '../icon';
|
|
13
|
+
import { Text } from '../text';
|
|
16
14
|
import { pvar } from '../theme';
|
|
17
|
-
import
|
|
15
|
+
import styles from './Button.module.scss';
|
|
18
16
|
|
|
19
17
|
const EnhancerSizes = {
|
|
20
18
|
large: 13,
|
|
@@ -68,7 +66,7 @@ export type ButtonProps = {
|
|
|
68
66
|
* @see CornerPresets
|
|
69
67
|
* @default rounded
|
|
70
68
|
*/
|
|
71
|
-
corners?: typeof CornerPresets[number] | CSSLength;
|
|
69
|
+
corners?: (typeof CornerPresets)[number] | CSSLength;
|
|
72
70
|
/**
|
|
73
71
|
* A color to apply for the Button. Provide an object with `primary` and `secondary` properties to set the primary and hover colors.
|
|
74
72
|
*/
|
|
@@ -164,16 +162,26 @@ export const Button: FC<ButtonProps> = ({
|
|
|
164
162
|
return (
|
|
165
163
|
<AriaButton
|
|
166
164
|
{...props}
|
|
167
|
-
style={
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
style={
|
|
166
|
+
theme || colors
|
|
167
|
+
? ({
|
|
168
|
+
'--pte-new-colors-contentInversePrimary': fontColorContrast(
|
|
169
|
+
theme
|
|
170
|
+
? ButtonThemes[theme].primary
|
|
171
|
+
: colors?.primary || pvar('new.colors.contentPrimary'),
|
|
172
|
+
), // text for primary
|
|
173
|
+
'--pte-new-colors-buttonFill': theme ? ButtonThemes[theme].primaryAlt : colors?.primary, // background for primary
|
|
174
|
+
'--pte-new-colors-buttonFillHover': theme
|
|
175
|
+
? ButtonThemes[theme].secondaryAlt
|
|
176
|
+
: colors?.secondary, // hover background for primary
|
|
177
|
+
'--pte-new-colors-contentPrimary': theme ? ButtonThemes[theme].primary : colors?.primary, // text for secondary/tertiary
|
|
178
|
+
'--pte-new-colors-buttonBorder': theme ? ButtonThemes[theme].primary : colors?.primary, // border for secondary/tertiary
|
|
179
|
+
'--pte-new-colors-overlayMedium': theme ? ButtonThemes[theme].secondary : colors?.secondary, // hover background for secondary/tertiary
|
|
180
|
+
borderRadius: !cornersIsPreset ? corners : '',
|
|
181
|
+
...style,
|
|
182
|
+
} as CSSProperties)
|
|
183
|
+
: { borderRadius: !cornersIsPreset ? corners : '', ...style }
|
|
184
|
+
}
|
|
177
185
|
className={clsx(
|
|
178
186
|
styles.button,
|
|
179
187
|
styles[kind],
|
|
@@ -187,39 +195,27 @@ export const Button: FC<ButtonProps> = ({
|
|
|
187
195
|
aria-details={typeof children === 'string' ? children : undefined}
|
|
188
196
|
onClick={!disabled && !href && !loading ? onClick : () => {}}
|
|
189
197
|
disabled={false}
|
|
190
|
-
{...href
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
{...(href
|
|
199
|
+
? {
|
|
200
|
+
render: (properties) => (
|
|
201
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
202
|
+
<a
|
|
203
|
+
{...properties}
|
|
204
|
+
href={href}
|
|
205
|
+
target={props.hreftarget ?? '_self'}
|
|
206
|
+
rel={props.hreftarget === '_self' ? undefined : 'noreferrer'}
|
|
207
|
+
/>
|
|
208
|
+
),
|
|
209
|
+
}
|
|
210
|
+
: {})}
|
|
201
211
|
>
|
|
202
|
-
{!!(startEnhancer && !loading) &&
|
|
203
|
-
<MemoizedEnhancer
|
|
204
|
-
enhancer={startEnhancer}
|
|
205
|
-
size={EnhancerSizes[size]}
|
|
206
|
-
/>
|
|
207
|
-
)}
|
|
212
|
+
{!!(startEnhancer && !loading) && <MemoizedEnhancer enhancer={startEnhancer} size={EnhancerSizes[size]} />}
|
|
208
213
|
{!['circle', 'square'].includes(shape) && (
|
|
209
214
|
<Text kind="labelXSmall">
|
|
210
|
-
{!loading ?
|
|
211
|
-
children || 'Button'
|
|
212
|
-
) : (
|
|
213
|
-
<Spinner size={EnhancerSizes[size]} />
|
|
214
|
-
)}
|
|
215
|
+
{!loading ? children || 'Button' : <Spinner size={EnhancerSizes[size]} />}
|
|
215
216
|
</Text>
|
|
216
217
|
)}
|
|
217
|
-
{!!(endEnhancer && !loading) &&
|
|
218
|
-
<MemoizedEnhancer
|
|
219
|
-
enhancer={endEnhancer}
|
|
220
|
-
size={EnhancerSizes[size]}
|
|
221
|
-
/>
|
|
222
|
-
)}
|
|
218
|
+
{!!(endEnhancer && !loading) && <MemoizedEnhancer enhancer={endEnhancer} size={EnhancerSizes[size]} />}
|
|
223
219
|
{!!displayNotificationDot && (
|
|
224
220
|
<div className="absolute top-0 right-0">
|
|
225
221
|
<NotificationDot size={8} />
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createElement } from 'react';
|
|
1
|
+
import { faCancel, faCheck, faWarning } from '@fortawesome/free-solid-svg-icons';
|
|
3
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
faCheck,
|
|
7
|
-
faWarning,
|
|
8
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
4
|
+
import { createElement } from 'react';
|
|
9
5
|
import { Callout } from './Callout';
|
|
10
6
|
|
|
11
7
|
const meta: Meta<typeof Callout> = {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ComponentPropsWithoutRef, FC, ReactElement, ReactNode,
|
|
3
|
-
} from 'react';
|
|
4
1
|
import { clsx } from 'clsx';
|
|
5
|
-
import
|
|
2
|
+
import type { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { ArrowRight, Icon } from '../icon';
|
|
6
4
|
import { RemoveFromDOM, TextWhenString } from '../utility';
|
|
7
|
-
import
|
|
5
|
+
import styles from './Callout.module.scss';
|
|
8
6
|
|
|
9
7
|
export type CalloutProps = {
|
|
10
8
|
/** The variant of the Callout. */
|
|
@@ -36,9 +34,7 @@ export const Callout: FC<CalloutProps> = ({
|
|
|
36
34
|
}) => (
|
|
37
35
|
<div className={clsx(styles.content, styles[variant], className)} {...props}>
|
|
38
36
|
<RemoveFromDOM when={!icon}>
|
|
39
|
-
<div className={styles.icon}>
|
|
40
|
-
{icon}
|
|
41
|
-
</div>
|
|
37
|
+
<div className={styles.icon}>{icon}</div>
|
|
42
38
|
</RemoveFromDOM>
|
|
43
39
|
<TextWhenString as="p" kind="paragraphXSmall">
|
|
44
40
|
{children}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
1
|
import { clsx } from 'clsx';
|
|
3
|
-
import
|
|
2
|
+
import type { FC, HTMLAttributes, ReactNode } from 'react';
|
|
4
3
|
import { TextWhenString } from '../utility';
|
|
4
|
+
import styles from './Card.module.scss';
|
|
5
5
|
|
|
6
6
|
export type CardProps = {
|
|
7
7
|
/**
|
|
@@ -38,12 +38,7 @@ export type CardProps = {
|
|
|
38
38
|
* ```
|
|
39
39
|
* @constructor
|
|
40
40
|
*/
|
|
41
|
-
export const Card: FC<CardProps> = ({
|
|
42
|
-
kind = 'raised',
|
|
43
|
-
status = 'default',
|
|
44
|
-
children,
|
|
45
|
-
...props
|
|
46
|
-
}) => (
|
|
41
|
+
export const Card: FC<CardProps> = ({ kind = 'raised', status = 'default', children, ...props }) => (
|
|
47
42
|
<div
|
|
48
43
|
{...props}
|
|
49
44
|
className={clsx(
|
|
@@ -54,8 +49,6 @@ export const Card: FC<CardProps> = ({
|
|
|
54
49
|
props?.className,
|
|
55
50
|
)}
|
|
56
51
|
>
|
|
57
|
-
<TextWhenString kind="paragraphMedium">
|
|
58
|
-
{children}
|
|
59
|
-
</TextWhenString>
|
|
52
|
+
<TextWhenString kind="paragraphMedium">{children}</TextWhenString>
|
|
60
53
|
</div>
|
|
61
54
|
);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
FC, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode,
|
|
5
|
-
} from 'react';
|
|
6
3
|
import type { ButtonProps as AriaButtonProps } from '@ariakit/react';
|
|
7
4
|
import { Button as AriaButton } from '@ariakit/react';
|
|
8
5
|
import { clsx } from 'clsx';
|
|
9
|
-
import
|
|
6
|
+
import type { FC, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode } from 'react';
|
|
10
7
|
import { TextWhenString } from '../utility';
|
|
8
|
+
import styles from './CardButton.module.scss';
|
|
11
9
|
|
|
12
10
|
export type CardButtonProps = {
|
|
13
11
|
/**
|
|
@@ -82,21 +80,21 @@ export const CardButton: FC<CardButtonProps> = ({
|
|
|
82
80
|
aria-details={typeof children === 'string' ? children : undefined}
|
|
83
81
|
onClick={!disabled && !href ? onClick : () => {}}
|
|
84
82
|
disabled={false}
|
|
85
|
-
{...href
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
{...(href
|
|
84
|
+
? {
|
|
85
|
+
render: (properties) => (
|
|
86
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
87
|
+
<a
|
|
88
|
+
{...properties}
|
|
89
|
+
href={href}
|
|
90
|
+
target={props.hreftarget ?? '_self'}
|
|
91
|
+
rel={props.hreftarget === '_self' ? undefined : 'noreferrer'}
|
|
92
|
+
/>
|
|
93
|
+
),
|
|
94
|
+
}
|
|
95
|
+
: {})}
|
|
96
96
|
>
|
|
97
|
-
<TextWhenString kind="paragraphMedium">
|
|
98
|
-
{children}
|
|
99
|
-
</TextWhenString>
|
|
97
|
+
<TextWhenString kind="paragraphMedium">{children}</TextWhenString>
|
|
100
98
|
</AriaButton>
|
|
101
99
|
</div>
|
|
102
100
|
);
|