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.
Files changed (81) hide show
  1. package/CHANGELOG.md +16 -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.module.scss +9 -0
  49. package/src/stories/menu/Menu.stories.tsx +4 -10
  50. package/src/stories/menu/Menu.tsx +27 -29
  51. package/src/stories/pagination/usePagination.ts +8 -8
  52. package/src/stories/popover/Popover.stories.ts +2 -2
  53. package/src/stories/popover/Popover.tsx +4 -10
  54. package/src/stories/select/Select.stories.ts +10 -10
  55. package/src/stories/select/Select.tsx +268 -240
  56. package/src/stories/styledlink/StyledLink.stories.ts +1 -1
  57. package/src/stories/styledlink/StyledLink.tsx +11 -17
  58. package/src/stories/table/Table.stories.ts +1 -1
  59. package/src/stories/table/Table.tsx +55 -65
  60. package/src/stories/tabs/Tabs.stories.tsx +2 -2
  61. package/src/stories/tabs/Tabs.tsx +15 -21
  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
@@ -0,0 +1,384 @@
1
+ /* ── Markdown renderer styles ─────────────────────────────────
2
+ * Uses Paris design tokens (--pte-*) for consistent theming.
3
+ * All styles are scoped via CSS modules.
4
+ * ──────────────────────────────────────────────────────────── */
5
+
6
+ .markdown {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 0;
10
+ width: 100%;
11
+ line-height: 1.7;
12
+ color: var(--pte-new-colors-contentPrimary);
13
+
14
+ // ── Headings ──────────────────────────────────────────
15
+ .heading {
16
+ margin-top: 1.5em;
17
+ margin-bottom: 0.6em;
18
+
19
+ &:first-child {
20
+ margin-top: 0;
21
+ }
22
+ }
23
+
24
+ // ── Paragraphs ────────────────────────────────────────
25
+ .paragraph {
26
+ margin-bottom: 1em;
27
+ line-height: 1.7;
28
+
29
+ &:last-child {
30
+ margin-bottom: 0;
31
+ }
32
+ }
33
+
34
+ // ── Strikethrough ─────────────────────────────────────
35
+ .strikethrough {
36
+ text-decoration: line-through;
37
+ text-decoration-color: var(--pte-new-colors-contentTertiary);
38
+ }
39
+
40
+ // ── Images ────────────────────────────────────────────
41
+ .imageWrapper {
42
+ display: flex;
43
+ flex-direction: column;
44
+ gap: 8px;
45
+ margin: 1em 0;
46
+ }
47
+
48
+ .image {
49
+ max-width: 100%;
50
+ height: auto;
51
+ border-radius: var(--pte-new-borders-radius-rounded);
52
+ border: 1px solid var(--pte-new-colors-borderSubtle);
53
+ }
54
+
55
+ // ── Blockquotes (Callout base styles + overrides) ─────
56
+ .blockquote {
57
+ margin: 1em 0;
58
+ .blockquote {
59
+ margin: 0.5em 0;
60
+ }
61
+
62
+ .paragraph {
63
+ margin-bottom: 0.5em;
64
+
65
+ &:last-child {
66
+ margin-bottom: 0;
67
+ }
68
+ }
69
+ }
70
+
71
+ // ── Horizontal rules ──────────────────────────────────
72
+ .hr {
73
+ border: none;
74
+ border-top: 1px solid var(--pte-new-colors-borderMedium);
75
+ margin: 1.5em 0;
76
+ }
77
+
78
+ // ── Lists ─────────────────────────────────────────────
79
+ .list {
80
+ margin: 0.5em 0 1em;
81
+ padding-left: 1.5em;
82
+ }
83
+
84
+ .unorderedList {
85
+ list-style-type: disc;
86
+
87
+ .unorderedList {
88
+ list-style-type: circle;
89
+ margin: 0.25em 0;
90
+
91
+ .unorderedList {
92
+ list-style-type: square;
93
+ }
94
+ }
95
+ }
96
+
97
+ .orderedList {
98
+ list-style-type: decimal;
99
+
100
+ .orderedList {
101
+ list-style-type: lower-alpha;
102
+ margin: 0.25em 0;
103
+
104
+ .orderedList {
105
+ list-style-type: lower-roman;
106
+ }
107
+ }
108
+ }
109
+
110
+ .listItem {
111
+ margin-bottom: 0.25em;
112
+ line-height: 1.7;
113
+ font-size: var(--markdown-base-font-size, 14px);
114
+
115
+ .paragraph {
116
+ margin-bottom: 0.25em;
117
+ }
118
+ }
119
+
120
+ // ── Task lists ────────────────────────────────────────
121
+ .taskList {
122
+ list-style: none;
123
+ padding-left: 0;
124
+ }
125
+
126
+ .taskListItem {
127
+ display: flex;
128
+ flex-direction: row;
129
+ align-items: baseline;
130
+ gap: 8px;
131
+
132
+ input[type='checkbox'] {
133
+ appearance: none;
134
+ width: 16px;
135
+ height: 16px;
136
+ border: 1.5px solid var(--pte-new-colors-borderStrong);
137
+ border-radius: 4px;
138
+ background: transparent;
139
+ cursor: default;
140
+ flex-shrink: 0;
141
+ position: relative;
142
+ top: 2px;
143
+
144
+ &:checked {
145
+ background-color: var(--pte-new-colors-contentAccent);
146
+ border-color: var(--pte-new-colors-contentAccent);
147
+
148
+ &::after {
149
+ content: '✓';
150
+ position: absolute;
151
+ top: 50%;
152
+ left: 50%;
153
+ transform: translate(-50%, -50%);
154
+ font-size: 11px;
155
+ font-weight: 700;
156
+ color: white;
157
+ }
158
+ }
159
+ }
160
+ }
161
+
162
+ // ── Inline code ───────────────────────────────────────
163
+ .inlineCode {
164
+ font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
165
+ font-size: 0.875em;
166
+ padding: 2px 6px;
167
+ border-radius: 6px;
168
+ background-color: var(--pte-new-colors-backgroundSecondary);
169
+ border: 1px solid var(--pte-new-colors-borderSubtle);
170
+ color: var(--pte-new-colors-contentPrimary);
171
+ word-break: break-word;
172
+ }
173
+
174
+ // ── Code blocks ───────────────────────────────────────
175
+ .pre {
176
+ margin: 1em 0;
177
+ padding: 0;
178
+ background: transparent;
179
+ overflow: visible;
180
+ }
181
+
182
+ .codeBlockWrapper {
183
+ position: relative;
184
+ border-radius: var(--pte-new-borders-radius-rounded, 8px);
185
+ background-color: var(--pte-new-colors-backgroundSecondary);
186
+ border: 1px solid var(--pte-new-colors-borderSubtle);
187
+ overflow: hidden;
188
+ }
189
+
190
+ .codeLanguage {
191
+ display: flex;
192
+ align-items: center;
193
+ padding: 6px 16px;
194
+ border-bottom: 1px solid var(--pte-new-colors-borderSubtle);
195
+ background-color: var(--pte-new-colors-backgroundSecondary);
196
+ color: var(--pte-new-colors-contentTertiary);
197
+ text-transform: uppercase;
198
+ letter-spacing: 0.05em;
199
+ }
200
+
201
+ .codeBlock {
202
+ display: block;
203
+ padding: 16px;
204
+ overflow-x: auto;
205
+ font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
206
+ font-size: 13px;
207
+ line-height: 1.6;
208
+ tab-size: 4;
209
+ white-space: pre;
210
+ color: var(--pte-new-colors-contentPrimary);
211
+
212
+ &::-webkit-scrollbar {
213
+ height: 6px;
214
+ }
215
+
216
+ &::-webkit-scrollbar-track {
217
+ background: transparent;
218
+ }
219
+
220
+ &::-webkit-scrollbar-thumb {
221
+ background-color: var(--pte-new-colors-borderMedium);
222
+ border-radius: 3px;
223
+ }
224
+ }
225
+
226
+ // ── Tables ────────────────────────────────────────────
227
+ .tableWrapper {
228
+ margin: 1em 0;
229
+ overflow-x: auto;
230
+ border-radius: var(--pte-new-borders-radius-rounded, 8px);
231
+ border: 1px solid var(--pte-new-colors-borderSubtle);
232
+
233
+ &::-webkit-scrollbar {
234
+ height: 6px;
235
+ }
236
+
237
+ &::-webkit-scrollbar-track {
238
+ background: transparent;
239
+ }
240
+
241
+ &::-webkit-scrollbar-thumb {
242
+ background-color: var(--pte-new-colors-borderMedium);
243
+ border-radius: 3px;
244
+ }
245
+ }
246
+
247
+ .table {
248
+ width: 100%;
249
+ border-collapse: collapse;
250
+ font-size: var(--pte-new-typography-paragraphSmall-fontSize, 13px);
251
+ }
252
+
253
+ .thead {
254
+ background-color: var(--pte-new-colors-backgroundSecondary);
255
+ }
256
+
257
+ .th {
258
+ padding: 10px 16px;
259
+ text-align: left;
260
+ border-bottom: 1px solid var(--pte-new-colors-borderMedium);
261
+ white-space: nowrap;
262
+ color: var(--pte-new-colors-contentSecondary);
263
+ }
264
+
265
+ .td {
266
+ padding: 10px 16px;
267
+ border-bottom: 1px solid var(--pte-new-colors-borderSubtle);
268
+ color: var(--pte-new-colors-contentPrimary);
269
+ }
270
+
271
+ .tr {
272
+ &:last-child .td {
273
+ border-bottom: none;
274
+ }
275
+ }
276
+
277
+ .tbody .tr {
278
+ transition: background-color 0.15s ease;
279
+
280
+ &:hover {
281
+ background-color: var(--pte-new-colors-backgroundSecondary);
282
+ }
283
+ }
284
+
285
+ // ── Accordion body (details/summary) ──────────────────
286
+ .accordionBody {
287
+ padding: 4px 0;
288
+
289
+ .paragraph {
290
+ margin-bottom: 0.5em;
291
+ }
292
+ }
293
+
294
+ // ── Keyboard keys ─────────────────────────────────────
295
+ .kbd {
296
+ display: inline-block;
297
+ font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
298
+ font-size: 0.8em;
299
+ padding: 2px 8px;
300
+ border-radius: 6px;
301
+ border: 1px solid var(--pte-new-colors-borderMedium);
302
+ background: linear-gradient(
303
+ 180deg,
304
+ var(--pte-new-colors-backgroundPrimary) 0%,
305
+ var(--pte-new-colors-backgroundSecondary) 100%
306
+ );
307
+ box-shadow: 0 1px 0 1px var(--pte-new-colors-borderSubtle);
308
+ color: var(--pte-new-colors-contentSecondary);
309
+ line-height: 1.6;
310
+ white-space: nowrap;
311
+ }
312
+
313
+ // ── Superscript & subscript ───────────────────────────
314
+ .sup,
315
+ .sub {
316
+ font-size: 0.75em;
317
+ line-height: 0;
318
+ position: relative;
319
+ vertical-align: baseline;
320
+ }
321
+
322
+ .sup {
323
+ top: -0.5em;
324
+ }
325
+
326
+ .sub {
327
+ bottom: -0.25em;
328
+ }
329
+
330
+ // ── Highlight / mark ──────────────────────────────────
331
+ .mark {
332
+ background-color: var(--pte-new-colors-backgroundWarningMedium, #fef3c7);
333
+ color: inherit;
334
+ padding: 1px 4px;
335
+ border-radius: 3px;
336
+ }
337
+
338
+ // ── Definition lists ──────────────────────────────────
339
+ .dl {
340
+ margin: 1em 0;
341
+ }
342
+
343
+ .dt {
344
+ margin-top: 1em;
345
+
346
+ &:first-child {
347
+ margin-top: 0;
348
+ }
349
+ }
350
+
351
+ .dd {
352
+ margin-left: 1.5em;
353
+ margin-top: 0.25em;
354
+ padding-left: 1em;
355
+ border-left: 2px solid var(--pte-new-colors-borderSubtle);
356
+ }
357
+
358
+ // ── Footnotes (generated by remark-gfm) ───────────────
359
+ section[data-footnotes] {
360
+ margin-top: 2em;
361
+ padding-top: 1em;
362
+ border-top: 1px solid var(--pte-new-colors-borderMedium);
363
+ font-size: 0.875em;
364
+ color: var(--pte-new-colors-contentSecondary);
365
+
366
+ h2 {
367
+ font-size: 0.875em;
368
+ font-weight: 600;
369
+ margin-bottom: 0.5em;
370
+ }
371
+
372
+ ol {
373
+ padding-left: 1.5em;
374
+ }
375
+
376
+ li {
377
+ margin-bottom: 0.25em;
378
+ }
379
+
380
+ a {
381
+ color: var(--pte-new-colors-contentAccent);
382
+ }
383
+ }
384
+ }
@@ -0,0 +1,203 @@
1
+ import type { Meta, StoryObj } from '@storybook/nextjs-vite';
2
+ import { Markdown } from './Markdown';
3
+
4
+ const meta: Meta<typeof Markdown> = {
5
+ title: 'Content/Markdown',
6
+ component: Markdown,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ size: {
10
+ control: 'select',
11
+ options: ['paragraphLarge', 'paragraphMedium', 'paragraphSmall', 'paragraphXSmall', 'paragraphXXSmall'],
12
+ },
13
+ },
14
+ };
15
+
16
+ export default meta;
17
+ type Story = StoryObj<typeof Markdown>;
18
+
19
+ export const Default: Story = {
20
+ args: {
21
+ children: `# Heading 1
22
+
23
+ ## Heading 2
24
+
25
+ ### Heading 3
26
+
27
+ #### Heading 4
28
+
29
+ ##### Heading 5
30
+
31
+ ###### Heading 6
32
+
33
+ This is a paragraph with **bold text**, *italic text*, and ~~strikethrough~~.
34
+
35
+ Here is a [link to Paris](https://paris.slingshot.fm) and some \`inline code\`.
36
+
37
+ ---
38
+
39
+ > This is a blockquote. It can contain **bold** and *italic* text.
40
+
41
+ - Unordered list item 1
42
+ - Unordered list item 2
43
+ - Nested item A
44
+ - Nested item B
45
+ - Deeply nested item
46
+ - Unordered list item 3
47
+
48
+ 1. Ordered list item 1
49
+ 2. Ordered list item 2
50
+ 1. Nested ordered item
51
+ 2. Another nested item
52
+ 3. Ordered list item 3`,
53
+ },
54
+ };
55
+
56
+ export const CodeBlocks: Story = {
57
+ args: {
58
+ children: `## Code Examples
59
+
60
+ Inline code: \`const x = 42;\`
61
+
62
+ \`\`\`typescript
63
+ interface User {
64
+ id: string;
65
+ name: string;
66
+ email: string;
67
+ }
68
+
69
+ function getUser(id: string): Promise<User> {
70
+ return fetch(\`/api/users/\${id}\`).then(res => res.json());
71
+ }
72
+ \`\`\`
73
+
74
+ \`\`\`css
75
+ .container {
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: 1rem;
79
+ padding: 2rem;
80
+ }
81
+ \`\`\`
82
+
83
+ \`\`\`bash
84
+ bun install paris
85
+ bun run storybook
86
+ \`\`\``,
87
+ },
88
+ };
89
+
90
+ export const Tables: Story = {
91
+ args: {
92
+ children: `## Table Example
93
+
94
+ | Component | Description | Status |
95
+ |-----------|-------------|--------|
96
+ | Text | Typography rendering | Stable |
97
+ | Button | Interactive button | Stable |
98
+ | Markdown | Markdown renderer | New |
99
+ | Dialog | Modal dialog | Stable |
100
+
101
+ ## Alignment
102
+
103
+ | Left | Center | Right |
104
+ |:-----|:------:|------:|
105
+ | A | B | C |
106
+ | D | E | F |`,
107
+ },
108
+ };
109
+
110
+ export const RichContent: Story = {
111
+ args: {
112
+ children: `## Task Lists
113
+
114
+ - [x] Design Markdown component
115
+ - [x] Implement parser with react-markdown
116
+ - [ ] Add syntax highlighting
117
+ - [ ] Write documentation
118
+
119
+ ## Blockquotes
120
+
121
+ > **Note:** This is an important callout rendered using the Paris Callout component.
122
+
123
+ > Nested blockquotes work too.
124
+ >
125
+ > > This is a nested blockquote.
126
+
127
+ ## Horizontal Rule
128
+
129
+ Content above the rule.
130
+
131
+ ---
132
+
133
+ Content below the rule.
134
+
135
+ ## Images
136
+
137
+ ![Placeholder](https://placehold.co/600x200/1a1a2e/e0e0e0?text=Paris+Design+System)`,
138
+ },
139
+ };
140
+
141
+ export const HTMLPassthrough: Story = {
142
+ args: {
143
+ children: `## Keyboard Shortcuts
144
+
145
+ Press <kbd>Cmd</kbd> + <kbd>K</kbd> to open the command palette.
146
+
147
+ ## Highlighted Text
148
+
149
+ This is <mark>highlighted text</mark> within a paragraph.
150
+
151
+ ## Superscript and Subscript
152
+
153
+ E = mc<sup>2</sup> and H<sub>2</sub>O
154
+
155
+ ## Details / Summary
156
+
157
+ <details>
158
+ <summary>Click to expand</summary>
159
+
160
+ This content is hidden by default and rendered inside a Paris Accordion component.
161
+
162
+ - Item one
163
+ - Item two
164
+ - Item three
165
+
166
+ </details>
167
+
168
+ ## Definition Lists
169
+
170
+ <dl>
171
+ <dt>Paris</dt>
172
+ <dd>Slingshot's React design system</dd>
173
+ <dt>PTE</dt>
174
+ <dd>Property Token Engine — generates CSS variables from TypeScript theme definitions</dd>
175
+ </dl>`,
176
+ },
177
+ };
178
+
179
+ const sampleMarkdown = `## The Markdown Component
180
+
181
+ This is a paragraph demonstrating the **size** prop. It controls the base font size for all body text — paragraphs, list items, bold, italic, and definition list terms.
182
+
183
+ - List items follow the base size
184
+ - So do **bold** and *italic* inline text
185
+ - Headings and labels are unaffected
186
+
187
+ > Blockquote content also inherits the base size.
188
+
189
+ Here is some \`inline code\` within a paragraph.`;
190
+
191
+ export const Large: Story = {
192
+ args: {
193
+ size: 'paragraphLarge',
194
+ children: sampleMarkdown,
195
+ },
196
+ };
197
+
198
+ export const Small: Story = {
199
+ args: {
200
+ size: 'paragraphSmall',
201
+ children: sampleMarkdown,
202
+ },
203
+ };