paris 0.2.2 → 0.4.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 (72) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +61 -5
  3. package/package.json +27 -15
  4. package/src/helpers/renderEnhancer.tsx +21 -0
  5. package/src/pages/_app.tsx +1 -1
  6. package/src/pages/index.tsx +1 -1
  7. package/src/stories/Pagination.mdx +73 -0
  8. package/src/stories/Tokens.mdx +0 -8
  9. package/src/stories/button/Button.module.scss +23 -7
  10. package/src/stories/button/Button.stories.ts +17 -0
  11. package/src/stories/button/Button.tsx +80 -20
  12. package/src/stories/card/Card.module.scss +14 -0
  13. package/src/stories/card/Card.stories.ts +33 -0
  14. package/src/stories/card/Card.tsx +60 -0
  15. package/src/stories/card/index.ts +1 -0
  16. package/src/stories/checkbox/Checkbox.module.scss +57 -0
  17. package/src/stories/checkbox/Checkbox.stories.ts +27 -0
  18. package/src/stories/checkbox/Checkbox.tsx +58 -0
  19. package/src/stories/checkbox/index.ts +1 -0
  20. package/src/stories/combobox/Combobox.module.scss +5 -0
  21. package/src/stories/combobox/Combobox.stories.ts +84 -0
  22. package/src/stories/combobox/Combobox.tsx +264 -0
  23. package/src/stories/combobox/index.ts +1 -0
  24. package/src/stories/dialog/Dialog.module.scss +187 -0
  25. package/src/stories/dialog/Dialog.stories.tsx +70 -0
  26. package/src/stories/dialog/Dialog.tsx +279 -0
  27. package/src/stories/dialog/index.ts +1 -0
  28. package/src/stories/drawer/Drawer.module.scss +284 -0
  29. package/src/stories/drawer/Drawer.stories.tsx +94 -0
  30. package/src/stories/drawer/Drawer.tsx +339 -0
  31. package/src/stories/drawer/index.ts +1 -0
  32. package/src/stories/dropdown/Dropdown.module.scss +23 -0
  33. package/src/stories/field/Field.module.scss +5 -0
  34. package/src/stories/field/Field.stories.ts +32 -0
  35. package/src/stories/field/Field.tsx +106 -0
  36. package/src/stories/field/index.ts +1 -0
  37. package/src/stories/icon/ChevronLeft.tsx +11 -0
  38. package/src/stories/icon/ChevronRight.tsx +11 -0
  39. package/src/stories/icon/Close.tsx +11 -0
  40. package/src/stories/icon/Icon.module.scss +5 -0
  41. package/src/stories/icon/Icon.stories.ts +28 -0
  42. package/src/stories/icon/Icon.tsx +46 -0
  43. package/src/stories/icon/index.ts +4 -0
  44. package/src/stories/input/Input.module.scss +135 -0
  45. package/src/stories/input/Input.stories.ts +89 -0
  46. package/src/stories/input/Input.tsx +137 -0
  47. package/src/stories/input/index.ts +1 -0
  48. package/src/stories/pagination/index.ts +1 -0
  49. package/src/stories/pagination/usePagination.ts +106 -0
  50. package/src/stories/select/Select.module.scss +74 -0
  51. package/src/stories/select/Select.stories.ts +73 -0
  52. package/src/stories/select/Select.tsx +176 -0
  53. package/src/stories/select/index.ts +1 -0
  54. package/src/stories/text/Text.module.scss +1 -1
  55. package/src/stories/text/Text.tsx +36 -14
  56. package/src/stories/textarea/TextArea.stories.ts +19 -0
  57. package/src/stories/textarea/TextArea.tsx +120 -0
  58. package/src/stories/textarea/index.ts +1 -0
  59. package/src/stories/theme/global.scss +2 -0
  60. package/src/stories/theme/index.ts +1 -0
  61. package/src/stories/theme/themes.ts +126 -7
  62. package/src/{styles → stories/theme}/tw-preflight.css +3 -1
  63. package/src/stories/theme/util.scss +8 -0
  64. package/src/stories/tilt/Tilt.module.scss +1 -0
  65. package/src/stories/tilt/Tilt.stories.tsx +43 -0
  66. package/src/stories/tilt/Tilt.tsx +63 -0
  67. package/src/stories/tilt/index.ts +1 -0
  68. package/src/stories/utility/RemoveFromDOM.tsx +19 -0
  69. package/src/stories/utility/TextWhenString.tsx +28 -0
  70. package/src/stories/utility/VisuallyHidden.tsx +25 -0
  71. package/src/types/Enhancer.ts +3 -0
  72. package/src/styles/util.scss +0 -4
@@ -0,0 +1,284 @@
1
+ $translateInX: 30%;
2
+ $translateInY: 100%;
3
+ $translateOutX: 20%;
4
+ $translateOutY: 60%;
5
+
6
+ $panelMinMargin: 16px;
7
+ $defaultSize: 360px;
8
+
9
+ $panelPaddingX: 20px;
10
+ $panelPaddingY: 24px;
11
+
12
+ $duration: var(--pte-animations-duration-relaxed);
13
+ $paginationDuration: var(--pte-animations-duration-normal);
14
+ $panelAnimationDelay: var(--pte-animations-duration-fast);
15
+ //$panelAnimationDelay: var(--pte-animations-duration-rapid);
16
+ //$duration: var(--pte-animations-duration-normal);
17
+
18
+ .root {
19
+ position: fixed;
20
+ inset: 0;
21
+ overflow: hidden;
22
+ z-index: 10;
23
+ user-select: var(--pte-utils-defaultUserSelect);
24
+ }
25
+
26
+ .overlay {
27
+ position: absolute;
28
+ inset: 0;
29
+ background-color: var(--pte-colors-backgroundOverlayDark);
30
+ will-change: backdrop-filter, opacity;
31
+ backdrop-filter: blur(0);
32
+ }
33
+
34
+ .overlayContainer {
35
+ .enterFrom {
36
+ backdrop-filter: blur(0);
37
+ }
38
+ .enterTo {
39
+ backdrop-filter: blur(2px);
40
+ }
41
+ .leave {
42
+ transition-delay: $panelAnimationDelay;
43
+ }
44
+ .leaveFrom {
45
+ backdrop-filter: blur(2px);
46
+ }
47
+ .leaveTo {
48
+ backdrop-filter: blur(0);
49
+ }
50
+ }
51
+
52
+ .panelContainer {
53
+ position: fixed;
54
+
55
+ justify-self: flex-end;
56
+
57
+ z-index: 10;
58
+
59
+ .enter {
60
+ transition: $duration var(--pte-animations-timing-easeOut);
61
+ transition-delay: $panelAnimationDelay;
62
+ //transition-delay: 50ms;
63
+ }
64
+
65
+ .leave {
66
+ transition: $duration var(--pte-animations-timing-easeIn);
67
+ }
68
+
69
+ &.from-right {
70
+ right: 0;
71
+ padding-left: $panelMinMargin;
72
+
73
+ .enterFrom {
74
+ transform: translateX($translateInX);
75
+ }
76
+
77
+ .enterTo, .leaveFrom {
78
+ transform: translateX(0);
79
+ }
80
+
81
+ .leaveTo {
82
+ transform: translateX($translateOutX);
83
+ }
84
+ }
85
+
86
+ &.from-left {
87
+ left: 0;
88
+ padding-right: $panelMinMargin;
89
+
90
+ .enterFrom {
91
+ transform: translateX(-$translateInX);
92
+ }
93
+
94
+ .enterTo, .leaveFrom {
95
+ transform: translateX(0);
96
+ }
97
+
98
+ .leaveTo {
99
+ transform: translateX(-$translateOutX);
100
+
101
+ }
102
+ }
103
+
104
+
105
+ &.from-left, &.from-right {
106
+ height: 100vh;
107
+ top: 0;
108
+ bottom: 0;
109
+
110
+ &.size-default {
111
+ width: min(100vw, $defaultSize);
112
+ }
113
+
114
+ &.size-content {
115
+ width: auto;
116
+ }
117
+
118
+ &.size-full {
119
+ width: 100vw;
120
+ }
121
+ }
122
+
123
+ &.from-top {
124
+ top: 0;
125
+ padding-bottom: $panelMinMargin;
126
+
127
+ .enterFrom {
128
+ transform: translateY(-$translateInY);
129
+ }
130
+
131
+ .enterTo, .leaveFrom {
132
+ transform: translateY(0);
133
+ }
134
+
135
+ .leaveTo {
136
+ transform: translateY(-$translateOutY);
137
+ }
138
+ }
139
+
140
+ &.from-bottom {
141
+ bottom: 0;
142
+ padding: $panelMinMargin 0 0;
143
+
144
+ .enterFrom {
145
+ transform: translateY($translateInY);
146
+ }
147
+
148
+ .enterTo, .leaveFrom {
149
+ transform: translateY(0);
150
+ }
151
+
152
+ .leaveTo {
153
+ transform: translateY($translateOutY);
154
+ }
155
+ }
156
+
157
+ &.from-top, &.from-bottom {
158
+ width: 100vw;
159
+ left: 0;
160
+ right: 0;
161
+
162
+ &.size-default {
163
+ height: min(100vh, $defaultSize);
164
+ }
165
+
166
+ &.size-content {
167
+ height: auto;
168
+ }
169
+
170
+ &.size-full {
171
+ height: 100vh;
172
+ }
173
+ }
174
+ }
175
+
176
+ .panel {
177
+ position: relative;
178
+ height: 100%;
179
+ padding: $panelPaddingY $panelPaddingX;
180
+ background-color: var(--pte-colors-backgroundPrimary);
181
+ overflow: auto;
182
+ border: 1px solid transparent;
183
+
184
+ display: flex;
185
+ flex-direction: column;
186
+ justify-content: flex-start;
187
+ align-items: stretch;
188
+ gap: $panelPaddingY;
189
+
190
+ &.enterFrom {
191
+ box-shadow: none;
192
+ }
193
+
194
+ &.enterTo, &.leaveFrom {
195
+ &.from-right {
196
+ border-left-color: var(--pte-borders-dropdown-color);
197
+ box-shadow: var(--pte-lighting-shallowLeft);
198
+ }
199
+
200
+ &.from-left {
201
+ border-right-color: var(--pte-borders-dropdown-color);
202
+ box-shadow: var(--pte-lighting-shallowRight);
203
+ }
204
+
205
+ &.from-top {
206
+ border-bottom-color: var(--pte-borders-dropdown-color);
207
+ box-shadow: var(--pte-lighting-shallowBottom);
208
+ }
209
+
210
+ &.from-bottom {
211
+ border-top-color: var(--pte-borders-dropdown-color);
212
+ box-shadow: var(--pte-lighting-shallowTop);
213
+ }
214
+ }
215
+
216
+ &.leaveTo {
217
+ box-shadow: none;
218
+ }
219
+ }
220
+
221
+ .closeButton {
222
+ position: absolute;
223
+ right: $panelPaddingX;
224
+ top: $panelPaddingY - 5px;
225
+ }
226
+
227
+ .paginationNav {
228
+ width: 100%;
229
+ display: flex;
230
+ flex-direction: row;
231
+ justify-content: space-between;
232
+ align-items: center;
233
+
234
+ font-size: 16px;
235
+
236
+ .closeButton {
237
+ position: relative;
238
+ right: 0;
239
+ top: 0;
240
+ }
241
+
242
+ .navButton {
243
+ padding: 2px;
244
+ }
245
+ }
246
+
247
+ .paginationButtons {
248
+ display: flex;
249
+ flex-direction: row;
250
+ align-items: center;
251
+ gap: 8px;
252
+ }
253
+
254
+ .enter {
255
+ transition: $duration var(--pte-animations-timing-easeOut);
256
+ }
257
+
258
+ .enterFrom, .enterFromOpacity {
259
+ opacity: 0;
260
+ }
261
+
262
+ .enterTo, .enterToOpacity {
263
+ opacity: 1;
264
+ }
265
+
266
+ .leave {
267
+ transition: $duration var(--pte-animations-timing-easeIn);
268
+ }
269
+
270
+ .leaveFrom, .leaveFromOpacity {
271
+ opacity: 1;
272
+ }
273
+
274
+ .leaveTo, .leaveToOpacity {
275
+ opacity: 0;
276
+ }
277
+
278
+ .paginationEnter {
279
+ transition: $paginationDuration var(--pte-animations-timing-easeInQuad);
280
+ }
281
+
282
+ .paginationLeave {
283
+ transition: $paginationDuration var(--pte-animations-timing-easeOutQuad);
284
+ }
@@ -0,0 +1,94 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { memo, useState } from 'react';
4
+ import { Drawer } from './Drawer';
5
+ import { Button } from '../button';
6
+ import { usePagination } from '../pagination';
7
+
8
+ const meta: Meta<typeof Drawer> = {
9
+ title: 'Surfaces/Drawer',
10
+ component: Drawer,
11
+ tags: ['autodocs'],
12
+ };
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof Drawer>;
16
+
17
+ export const Default: Story = {
18
+ args: {
19
+ title: 'Transaction details',
20
+ children: 'This was a transaction for $22.89 at Il Tramezzino in Beverly Hills, CA.',
21
+ },
22
+ render: (args) => {
23
+ const [isOpen, setIsOpen] = useState(false);
24
+ return (
25
+ <>
26
+ <Button
27
+ onClick={() => setIsOpen(true)}
28
+ >
29
+ View details
30
+ </Button>
31
+ <Drawer
32
+ {...args}
33
+ isOpen={isOpen}
34
+ onClose={setIsOpen}
35
+ >
36
+ {args.children}
37
+ </Drawer>
38
+ </>
39
+ );
40
+ },
41
+ };
42
+
43
+ export const Paginated: Story = {
44
+ args: {
45
+ title: 'Creation process',
46
+ children: [],
47
+ },
48
+ render: (args) => {
49
+ const [isOpen, setIsOpen] = useState(false);
50
+ const pages = ['step1', 'step2', 'step3'] as const;
51
+ const pagination = usePagination<typeof pages>('step1');
52
+
53
+ return (
54
+ <>
55
+ <Button
56
+ onClick={() => setIsOpen(true)}
57
+ >
58
+ Start process
59
+ </Button>
60
+ <Drawer
61
+ {...args}
62
+ isOpen={isOpen}
63
+ onClose={setIsOpen}
64
+ pagination={pagination}
65
+ >
66
+ <div key="step1" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
67
+ Step 1: Enter your name
68
+ <Button
69
+ onClick={() => pagination.open('step2')}
70
+ >
71
+ Go to step 2
72
+ </Button>
73
+ <Button
74
+ onClick={() => pagination.open('step3')}
75
+ >
76
+ Go to step 3
77
+ </Button>
78
+ </div>
79
+ <div key="step2" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
80
+ Step 2: Enter your address
81
+ <Button
82
+ onClick={() => pagination.open('step3')}
83
+ >
84
+ Go to step 3
85
+ </Button>
86
+ </div>
87
+ <div key="step3" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
88
+ Step 3: Enter your credit card information
89
+ </div>
90
+ </Drawer>
91
+ </>
92
+ );
93
+ },
94
+ };