paris 0.17.10 → 0.18.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +139 -150
  3. package/src/helpers/renderEnhancer.tsx +4 -5
  4. package/src/helpers/useResizeObserver.ts +17 -23
  5. package/src/pages/_document.tsx +1 -3
  6. package/src/pages/index.tsx +8 -24
  7. package/src/stories/Pagination.mdx +1 -1
  8. package/src/stories/Tokens.mdx +1 -1
  9. package/src/stories/Welcome.mdx +1 -1
  10. package/src/stories/accordion/Accordion.stories.ts +1 -1
  11. package/src/stories/accordion/Accordion.tsx +14 -35
  12. package/src/stories/accordionselect/AccordionSelect.stories.ts +2 -5
  13. package/src/stories/accordionselect/AccordionSelect.tsx +26 -50
  14. package/src/stories/avatar/Avatar.stories.ts +1 -1
  15. package/src/stories/avatar/Avatar.tsx +14 -13
  16. package/src/stories/button/Button.stories.ts +18 -15
  17. package/src/stories/button/Button.tsx +44 -48
  18. package/src/stories/callout/Callout.stories.ts +3 -7
  19. package/src/stories/callout/Callout.tsx +4 -8
  20. package/src/stories/card/Card.stories.ts +1 -1
  21. package/src/stories/card/Card.tsx +4 -11
  22. package/src/stories/cardbutton/CardButton.stories.tsx +1 -1
  23. package/src/stories/cardbutton/CardButton.tsx +16 -18
  24. package/src/stories/checkbox/Checkbox.stories.ts +1 -1
  25. package/src/stories/checkbox/Checkbox.tsx +37 -49
  26. package/src/stories/combobox/Combobox.stories.ts +65 -71
  27. package/src/stories/combobox/Combobox.tsx +80 -89
  28. package/src/stories/dialog/Dialog.stories.tsx +2 -2
  29. package/src/stories/dialog/Dialog.tsx +45 -68
  30. package/src/stories/drawer/Drawer.stories.tsx +63 -105
  31. package/src/stories/drawer/Drawer.tsx +93 -90
  32. package/src/stories/field/Field.stories.ts +1 -1
  33. package/src/stories/field/Field.tsx +25 -30
  34. package/src/stories/icon/Ellipsis.tsx +4 -1
  35. package/src/stories/icon/Icon.stories.ts +2 -2
  36. package/src/stories/icon/Icon.tsx +16 -26
  37. package/src/stories/icon/Info.tsx +4 -1
  38. package/src/stories/icon/Spinner.tsx +4 -2
  39. package/src/stories/icon/index.ts +6 -6
  40. package/src/stories/informationaltooltip/InformationalTooltip.stories.tsx +12 -11
  41. package/src/stories/informationaltooltip/InformationalTooltip.tsx +23 -28
  42. package/src/stories/input/Input.stories.ts +14 -15
  43. package/src/stories/input/Input.tsx +119 -95
  44. package/src/stories/markdown/Markdown.module.scss +384 -0
  45. package/src/stories/markdown/Markdown.stories.ts +203 -0
  46. package/src/stories/markdown/Markdown.tsx +293 -0
  47. package/src/stories/markdown/index.ts +1 -0
  48. package/src/stories/menu/Menu.stories.tsx +4 -10
  49. package/src/stories/menu/Menu.tsx +22 -16
  50. package/src/stories/pagination/usePagination.ts +8 -8
  51. package/src/stories/popover/Popover.stories.ts +2 -2
  52. package/src/stories/popover/Popover.tsx +4 -10
  53. package/src/stories/select/Select.stories.ts +10 -10
  54. package/src/stories/select/Select.tsx +268 -240
  55. package/src/stories/styledlink/StyledLink.stories.ts +1 -1
  56. package/src/stories/styledlink/StyledLink.tsx +11 -17
  57. package/src/stories/table/Table.stories.ts +1 -1
  58. package/src/stories/table/Table.tsx +55 -65
  59. package/src/stories/tabs/Tabs.module.scss +10 -68
  60. package/src/stories/tabs/Tabs.stories.tsx +83 -4
  61. package/src/stories/tabs/Tabs.tsx +15 -27
  62. package/src/stories/tag/Tag.stories.ts +1 -4
  63. package/src/stories/tag/Tag.tsx +9 -17
  64. package/src/stories/text/Text.stories.ts +1 -1
  65. package/src/stories/text/Text.tsx +49 -31
  66. package/src/stories/text/Typography.module.css +120 -120
  67. package/src/stories/textarea/TextArea.stories.ts +2 -5
  68. package/src/stories/textarea/TextArea.tsx +91 -84
  69. package/src/stories/theme/index.ts +1 -1
  70. package/src/stories/theme/themes.ts +423 -424
  71. package/src/stories/theme/tokens.ts +3 -3
  72. package/src/stories/theme/tw-preflight.css +4 -3
  73. package/src/stories/tilt/Tilt.stories.tsx +3 -6
  74. package/src/stories/tilt/Tilt.tsx +160 -126
  75. package/src/stories/toast/Toast.stories.tsx +2 -2
  76. package/src/stories/toast/Toast.tsx +3 -6
  77. package/src/stories/utility/RemoveFromDOM.tsx +9 -13
  78. package/src/stories/utility/TextWhenString.tsx +3 -16
  79. package/src/stories/utility/VisuallyHidden.tsx +10 -17
  80. package/src/styles/Home.module.css +185 -195
  81. package/src/styles/globals.css +0 -2
@@ -1,15 +1,15 @@
1
1
  'use client';
2
2
 
3
+ import { clsx } from 'clsx';
3
4
  import type { ComponentPropsWithoutRef, ReactNode } from 'react';
4
5
  import { useId, useMemo } from 'react';
5
- import { clsx } from 'clsx';
6
- import styles from './Table.module.scss';
7
6
  import typography from '../text/Typography.module.css';
7
+ import styles from './Table.module.scss';
8
8
 
9
9
  export type TableLineData = [NonNullable<ReactNode>, ...ReactNode[]];
10
10
  export type RowRenderData = {
11
- key: string,
12
- cells: TableLineData,
11
+ key: string;
12
+ cells: TableLineData;
13
13
  };
14
14
  /**
15
15
  * The data for a column in a table.
@@ -71,7 +71,7 @@ export type TableProps<
71
71
  th?: ComponentPropsWithoutRef<'th'>;
72
72
  trBody?: ComponentPropsWithoutRef<'tr'>;
73
73
  td?: ComponentPropsWithoutRef<'td'>;
74
- }
74
+ };
75
75
  };
76
76
 
77
77
  /**
@@ -96,68 +96,60 @@ export function Table<RowData extends Record<string, any>[]>({
96
96
  overrides,
97
97
  }: TableProps<RowData>) {
98
98
  const id = useId();
99
- const rowsRenderData = useMemo(() => (
100
- rows.map(
101
- rowRenderFn
102
- ?? ((row) => ({
103
- key: Object.values(row).join('-'),
104
- cells: Object.values(row),
105
- })),
106
- )
107
- ), [rows, rowRenderFn]);
99
+ const rowsRenderData = useMemo(
100
+ () =>
101
+ rows.map(
102
+ rowRenderFn ??
103
+ ((row) => ({
104
+ key: Object.values(row).join('-'),
105
+ cells: Object.values(row),
106
+ })),
107
+ ),
108
+ [rows, rowRenderFn],
109
+ );
108
110
 
109
- const renderedRows = useMemo(() => (
110
- rowsRenderData.map(({ key, cells }, index) => (
111
- <tr
112
- key={`${id}-row-${key}`}
113
- onClick={() => {
114
- if (clickableRows) onRowClick?.(rows[index]);
115
- }}
116
- onKeyDown={(e) => {
117
- if (clickableRows && (e.key === 'Enter' || e.key === ' ')) onRowClick?.(rows[index]);
118
- }}
119
- tabIndex={clickableRows ? 0 : undefined}
120
- {...overrides?.trBody}
121
- className={clsx(
122
- clickableRows && styles.clickable,
123
- overrides?.trBody?.className,
124
- )}
125
- >
126
- {cells.map((cell, i) => (
127
- <td
128
- key={`${id}-cell-${key}-${columns[i].title}`}
129
- {...overrides?.td}
130
- className={clsx(
131
- typography.paragraphXSmall,
132
- styles[columns[i].hideBelow ?? ''],
133
- overrides?.td?.className,
134
- )}
135
- >
136
- {cell}
137
- </td>
138
- ))}
139
- </tr>
140
- ))
141
- ), [clickableRows, columns, id, onRowClick, overrides?.td, overrides?.trBody, rows, rowsRenderData]);
111
+ const renderedRows = useMemo(
112
+ () =>
113
+ rowsRenderData.map(({ key, cells }, index) => (
114
+ <tr
115
+ key={`${id}-row-${key}`}
116
+ onClick={() => {
117
+ if (clickableRows) onRowClick?.(rows[index]);
118
+ }}
119
+ onKeyDown={(e) => {
120
+ if (clickableRows && (e.key === 'Enter' || e.key === ' ')) onRowClick?.(rows[index]);
121
+ }}
122
+ tabIndex={clickableRows ? 0 : undefined}
123
+ {...overrides?.trBody}
124
+ className={clsx(clickableRows && styles.clickable, overrides?.trBody?.className)}
125
+ >
126
+ {cells.map((cell, i) => (
127
+ <td
128
+ key={`${id}-cell-${key}-${columns[i].title}`}
129
+ {...overrides?.td}
130
+ className={clsx(
131
+ typography.paragraphXSmall,
132
+ styles[columns[i].hideBelow ?? ''],
133
+ overrides?.td?.className,
134
+ )}
135
+ >
136
+ {cell}
137
+ </td>
138
+ ))}
139
+ </tr>
140
+ )),
141
+ [clickableRows, columns, id, onRowClick, overrides?.td, overrides?.trBody, rows, rowsRenderData],
142
+ );
142
143
 
143
144
  return (
144
145
  <table
145
146
  {...{
146
147
  ...overrides?.table,
147
- className: clsx(
148
- styles.table,
149
- overrides?.table?.className,
150
- ),
148
+ className: clsx(styles.table, overrides?.table?.className),
151
149
  }}
152
150
  >
153
151
  <thead {...overrides?.thead}>
154
- <tr
155
- {...overrides?.trHead}
156
- className={clsx(
157
- styles.tableHeader,
158
- overrides?.trHead?.className,
159
- )}
160
- >
152
+ <tr {...overrides?.trHead} className={clsx(styles.tableHeader, overrides?.trHead?.className)}>
161
153
  {columns.map((column) => (
162
154
  <th
163
155
  {...{
@@ -177,13 +169,11 @@ export function Table<RowData extends Record<string, any>[]>({
177
169
  </thead>
178
170
  <tbody {...overrides?.tbody}>
179
171
  {renderedRows.length === 0 && emptyState && (
180
- <>
181
- <tr className={styles.empty}>
182
- <td colSpan={columns.length} className={styles.emptyState}>
183
- {emptyState}
184
- </td>
185
- </tr>
186
- </>
172
+ <tr className={styles.empty}>
173
+ <td colSpan={columns.length} className={styles.emptyState}>
174
+ {emptyState}
175
+ </td>
176
+ </tr>
187
177
  )}
188
178
  {renderedRows}
189
179
  </tbody>
@@ -32,8 +32,13 @@
32
32
 
33
33
  .tabBackground {
34
34
  &.glass {
35
- position: absolute;
35
+ position: sticky;
36
+ top: 0;
36
37
  width: 100%;
38
+ z-index: 1;
39
+ backdrop-filter: var(--pte-new-blurs-strong);
40
+ -webkit-backdrop-filter: var(--pte-new-blurs-strong);
41
+ background: var(--pte-new-materials-primaryThin-background);
37
42
  }
38
43
  }
39
44
 
@@ -44,32 +49,11 @@
44
49
 
45
50
  &.glass {
46
51
  position: relative;
47
- overflow: hidden;
48
- display: flex;
52
+ overflow-y: auto;
53
+ overflow-x: hidden;
49
54
  }
50
55
  }
51
56
 
52
- .glassContainer {
53
- position: absolute;
54
- width: 100%;
55
- height: 100%;
56
- }
57
-
58
- .glassBlend {
59
- position: absolute;
60
- width: 100%;
61
- height: 100%;
62
- background: var(--pte-new-materials-secondaryRegular-backgroundBlend);
63
- mix-blend-mode: var(--pte-new-materials-secondaryRegular-mixBlendMode);
64
- }
65
-
66
- .glassOpacity {
67
- position: absolute;
68
- width: 100%;
69
- height: 100%;
70
- background: var(--pte-new-materials-secondaryRegular-background);
71
- backdrop-filter: var(--pte-new-blurs-strong);
72
- }
73
57
 
74
58
  .tabListBorder {
75
59
  width: 100%;
@@ -197,49 +181,7 @@
197
181
  width: 100%;
198
182
 
199
183
  &.glass {
200
- &.full {
201
- &.thick {
202
- padding-top: 64px;
203
- }
204
- &.thin {
205
- padding-top: 61px;
206
- }
207
- }
208
- &.fixed {
209
- &.thick {
210
- padding-top: 56px;
211
- }
212
- &.thin {
213
- padding-top: 53px;
214
- }
215
- }
216
- &.compact {
217
- &.thick {
218
- padding-top: 48px;
219
- }
220
- &.thin {
221
- padding-top: 45px;
222
- }
223
- }
224
- @container (min-width: 641px) {
225
- &.auto {
226
- &.thick {
227
- padding-top: 56px;
228
- }
229
- &.thin {
230
- padding-top: 53px;
231
- }
232
- }
233
- }
234
- @container (max-width: 640px) {
235
- &.auto {
236
- &.thick {
237
- padding-top: 48px;
238
- }
239
- &.thin {
240
- padding-top: 45px;
241
- }
242
- }
243
- }
184
+ overflow-y: visible;
185
+ height: auto;
244
186
  }
245
187
  }
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/nextjs-vite';
2
2
  import { Tabs } from './Tabs';
3
3
 
4
4
  const meta: Meta<typeof Tabs> = {
@@ -71,11 +71,90 @@ export const Glass: Story = {
71
71
  barStyle: 'thin',
72
72
  backgroundStyle: 'glass',
73
73
  tabs: [
74
- { title: 'Albums', content: 'Tab 1 content' },
74
+ {
75
+ title: 'Albums',
76
+ content: (
77
+ <div style={{ padding: '16px', display: 'flex', flexDirection: 'column', gap: '12px' }}>
78
+ <p>Scroll down to see the glass blur effect on the tab bar.</p>
79
+ <div
80
+ style={{
81
+ padding: '12px',
82
+ background: 'var(--pte-new-colors-overlayMedium)',
83
+ borderRadius: '8px',
84
+ }}
85
+ >
86
+ Item 1
87
+ </div>
88
+ <div
89
+ style={{
90
+ padding: '12px',
91
+ background: 'var(--pte-new-colors-overlayMedium)',
92
+ borderRadius: '8px',
93
+ }}
94
+ >
95
+ Item 2
96
+ </div>
97
+ <div
98
+ style={{
99
+ padding: '12px',
100
+ background: 'var(--pte-new-colors-overlayMedium)',
101
+ borderRadius: '8px',
102
+ }}
103
+ >
104
+ Item 3
105
+ </div>
106
+ <div
107
+ style={{
108
+ padding: '12px',
109
+ background: 'var(--pte-new-colors-overlayMedium)',
110
+ borderRadius: '8px',
111
+ }}
112
+ >
113
+ Item 4
114
+ </div>
115
+ <div
116
+ style={{
117
+ padding: '12px',
118
+ background: 'var(--pte-new-colors-overlayMedium)',
119
+ borderRadius: '8px',
120
+ }}
121
+ >
122
+ Item 5
123
+ </div>
124
+ <div
125
+ style={{
126
+ padding: '12px',
127
+ background: 'var(--pte-new-colors-overlayMedium)',
128
+ borderRadius: '8px',
129
+ }}
130
+ >
131
+ Item 6
132
+ </div>
133
+ <div
134
+ style={{
135
+ padding: '12px',
136
+ background: 'var(--pte-new-colors-overlayMedium)',
137
+ borderRadius: '8px',
138
+ }}
139
+ >
140
+ Item 7
141
+ </div>
142
+ <div
143
+ style={{
144
+ padding: '12px',
145
+ background: 'var(--pte-new-colors-overlayMedium)',
146
+ borderRadius: '8px',
147
+ }}
148
+ >
149
+ Item 8
150
+ </div>
151
+ </div>
152
+ ),
153
+ },
75
154
  {
76
155
  title: 'EPs',
77
156
  content:
78
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim bibendum gravida. Donec pharetra, erat et semper luctus, dolor enim elementum est, eget cursus nisi libero sit amet purus. Fusce blandit leo in lectus blandit, sed elementum enim accumsan. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Pellentesque pretium erat at lacus ultricies tincidunt. Praesent non luctus magna, ac efficitur ligula. Sed a justo fermentum, feugiat mauris vel, ultrices turpis. Ut interdum malesuada lacus, ac posuere sapien feugiat et. Nulla dignissim bibendum gravida. Donec pharetra, erat et semper luctus, dolor enim elementum est, eget cursus nisi libero sit amet purus.',
157
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim bibendum gravida. Donec pharetra, erat et semper luctus, dolor enim elementum est, eget cursus nisi libero sit amet purus. Fusce blandit leo in lectus blandit, sed elementum enim accumsan. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Pellentesque pretium erat at lacus ultricies tincidunt. Praesent non luctus magna, ac efficitur ligula. Sed a justo fermentum, feugiat mauris vel, ultrices turpis. Ut interdum malesuada lacus, ac posuere sapien feugiat et. Nulla dignissim bibendum gravida. Donec pharetra, erat et semper luctus, dolor enim elementum est, eget cursus nisi libero sit amet purus.',
79
158
  },
80
159
  {
81
160
  title: 'Singles',
@@ -101,7 +180,7 @@ export const Glass: Story = {
101
180
  },
102
181
  render: (args) => (
103
182
  <div style={{ background: 'var(--pte-new-colors-backgroundPrimary)' }}>
104
- <div style={{ height: '120px' }}>
183
+ <div style={{ height: '300px' }}>
105
184
  <Tabs {...args} />
106
185
  </div>
107
186
  </div>
@@ -1,20 +1,16 @@
1
1
  'use client';
2
2
 
3
- import type {
4
- ComponentPropsWithoutRef, CSSProperties, FC, ReactNode,
5
- } from 'react';
6
- import { useId, useState } from 'react';
3
+ import type { TabListProps } from '@ariakit/react';
7
4
  import type { TabGroupProps, TabPanelProps, TabProps } from '@headlessui/react';
8
- import {
9
- Tab, TabGroup, TabList, TabPanels, TabPanel,
10
- } from '@headlessui/react';
11
- import { clsx } from 'clsx';
5
+ import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/react';
12
6
  import type { CSSLength } from '@ssh/csstypes';
7
+ import { clsx } from 'clsx';
13
8
  import { motion } from 'framer-motion';
14
- import type { TabListProps } from '@ariakit/react';
15
- import styles from './Tabs.module.scss';
9
+ import type { ComponentPropsWithoutRef, CSSProperties, FC, ReactNode } from 'react';
10
+ import { useId, useState } from 'react';
16
11
  import typography from '../text/Typography.module.css';
17
12
  import { easeInOutExpo } from '../utility';
13
+ import styles from './Tabs.module.scss';
18
14
 
19
15
  export type TabsProps = {
20
16
  /**
@@ -71,7 +67,7 @@ export type TabsProps = {
71
67
  tabListBorder?: ComponentPropsWithoutRef<'div'>;
72
68
  tabBackground?: ComponentPropsWithoutRef<'div'>;
73
69
  tab?: TabProps<'div'>;
74
- }
70
+ };
75
71
  };
76
72
 
77
73
  /**
@@ -117,19 +113,15 @@ export const Tabs: FC<TabsProps> = ({
117
113
  {...overrides?.tabBackground}
118
114
  className={clsx(styles.tabBackground, styles[backgroundStyle], overrides?.tabBackground?.className)}
119
115
  >
120
- {backgroundStyle === 'glass' && (
121
- <div className={styles.glassContainer}>
122
- <div className={styles.glassOpacity} />
123
- <div className={styles.glassBlend} />
124
- </div>
125
- )}
126
116
  <TabList
127
117
  {...overrides?.tabList}
128
- style={{
129
- '--tab-width': tabWidth,
130
- '--tab-index': `${index ?? selectedIndex}`,
131
- ...(overrides?.tabList?.style || {}),
132
- } as CSSProperties}
118
+ style={
119
+ {
120
+ '--tab-width': tabWidth,
121
+ '--tab-index': `${index ?? selectedIndex}`,
122
+ ...(overrides?.tabList?.style || {}),
123
+ } as CSSProperties
124
+ }
133
125
  className={clsx(
134
126
  styles.tabList,
135
127
  styles[barStyle],
@@ -141,11 +133,7 @@ export const Tabs: FC<TabsProps> = ({
141
133
  <Tab
142
134
  key={`${id}-tab-${title}`}
143
135
  {...overrides?.tab}
144
- className={clsx(
145
- typography.paragraphXSmall,
146
- styles.tab,
147
- styles[kind],
148
- )}
136
+ className={clsx(typography.paragraphXSmall, styles.tab, styles[kind])}
149
137
  >
150
138
  {title}
151
139
  {i === (index ?? selectedIndex) && (
@@ -1,7 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { createElement } from 'react';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import { faPlus } from '@fortawesome/free-solid-svg-icons';
1
+ import type { Meta, StoryObj } from '@storybook/nextjs-vite';
5
2
  import { Tag } from './Tag';
6
3
 
7
4
  const meta: Meta<typeof Tag> = {
@@ -1,15 +1,13 @@
1
1
  'use client';
2
2
 
3
- import type {
4
- ComponentPropsWithoutRef, FC, ReactElement, ReactNode,
5
- } from 'react';
6
- import { useMemo } from 'react';
7
- import { clsx } from 'clsx';
8
3
  import type { CSSLength } from '@ssh/csstypes';
9
- import styles from './Tag.module.scss';
4
+ import { clsx } from 'clsx';
5
+ import type { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';
6
+ import { useMemo } from 'react';
7
+ import { Check, Icon } from '../icon';
10
8
  import typography from '../text/Typography.module.css';
11
- import { Icon, Check } from '../icon';
12
9
  import { VisuallyHidden } from '../utility';
10
+ import styles from './Tag.module.scss';
13
11
 
14
12
  export const CornerPresets = ['sharp', 'rounded', 'roundedXL'] as const;
15
13
 
@@ -23,7 +21,7 @@ export type TagProps = {
23
21
  * `sharp` will have no rounding, `rounded` will have a slight rounding, and `roundedXL` will have a large rounding.
24
22
  * @see CornerPresets
25
23
  */
26
- corners?: typeof CornerPresets[number] | CSSLength;
24
+ corners?: (typeof CornerPresets)[number] | CSSLength;
27
25
  /** The kind of Tag. */
28
26
  kind?: 'default' | 'secondary' | 'positive' | 'warning' | 'negative' | 'new' | 'void' | 'draft';
29
27
  /** The color level of Tag background, applies to the colored states of `positive`, `warning`, and `negative`. */
@@ -72,19 +70,13 @@ export const Tag: FC<TagProps> = ({
72
70
  className,
73
71
  )}
74
72
  data-status={colorLevel}
75
- style={(corners && !cornersIsPreset) ? { borderRadius: corners } : {}}
73
+ style={corners && !cornersIsPreset ? { borderRadius: corners } : {}}
76
74
  >
77
- {shape !== 'square' && (
78
- <div>
79
- {children}
80
- </div>
81
- )}
75
+ {shape !== 'square' && <div>{children}</div>}
82
76
  {shape === 'square' && (
83
77
  <div className={styles.icon}>
84
78
  {icon}
85
- <VisuallyHidden>
86
- {children}
87
- </VisuallyHidden>
79
+ <VisuallyHidden>{children}</VisuallyHidden>
88
80
  </div>
89
81
  )}
90
82
  </div>
@@ -1,6 +1,6 @@
1
1
  // noinspection JSUnusedGlobalSymbols
2
2
 
3
- import type { Meta, StoryObj } from '@storybook/react';
3
+ import type { Meta, StoryObj } from '@storybook/nextjs-vite';
4
4
  import { Text } from './Text';
5
5
 
6
6
  const meta: Meta<typeof Text> = {
@@ -1,12 +1,25 @@
1
+ import type { CSSColor } from '@ssh/csstypes';
2
+ import { clsx } from 'clsx';
1
3
  import type { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react';
2
4
  import { createElement, memo } from 'react';
3
- import { clsx } from 'clsx';
4
- import type { CSSColor } from '@ssh/csstypes';
5
- import typography from './Typography.module.css';
6
- import styles from './Text.module.scss';
7
5
  import type { LightTheme } from '../theme';
6
+ import styles from './Text.module.scss';
7
+ import typography from './Typography.module.css';
8
8
 
9
- export type TextElement = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'legend' | 'caption' | 'small';
9
+ export type TextElement =
10
+ | 'p'
11
+ | 'span'
12
+ | 'div'
13
+ | 'h1'
14
+ | 'h2'
15
+ | 'h3'
16
+ | 'h4'
17
+ | 'h5'
18
+ | 'h6'
19
+ | 'label'
20
+ | 'legend'
21
+ | 'caption'
22
+ | 'small';
10
23
  export type GlobalCSSValues = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
11
24
 
12
25
  export type TextProps<T extends TextElement = TextElement> = {
@@ -61,30 +74,35 @@ export type TextProps<T extends TextElement = TextElement> = {
61
74
  * ```
62
75
  * @constructor
63
76
  */
64
- export const Text = memo(<T extends TextElement = TextElement>({
65
- kind,
66
- as,
67
- weight,
68
- fontStyle,
69
- color,
70
- children,
71
- ...props
72
- }: TextProps<T>): ReactElement => createElement(
73
- as || 'span',
74
- {
75
- ...props,
76
- className: clsx(
77
- styles.text,
78
- typography[kind || 'paragraphMedium'],
79
- weight && styles[`weight-${weight}`],
80
- fontStyle && styles[`fontStyle-${fontStyle}`],
81
- props?.className,
82
- ),
83
- ...(color ? {
84
- style: {
85
- '--text-color': color,
77
+ export const Text = memo(
78
+ <T extends TextElement = TextElement>({
79
+ kind,
80
+ as,
81
+ weight,
82
+ fontStyle,
83
+ color,
84
+ children,
85
+ ...props
86
+ }: TextProps<T>): ReactElement =>
87
+ createElement(
88
+ as || 'span',
89
+ {
90
+ ...props,
91
+ className: clsx(
92
+ styles.text,
93
+ typography[kind || 'paragraphMedium'],
94
+ weight && styles[`weight-${weight}`],
95
+ fontStyle && styles[`fontStyle-${fontStyle}`],
96
+ props?.className,
97
+ ),
98
+ ...(color
99
+ ? {
100
+ style: {
101
+ '--text-color': color,
102
+ },
103
+ }
104
+ : {}),
86
105
  },
87
- } : {}),
88
- },
89
- children,
90
- ));
106
+ children,
107
+ ),
108
+ );