@acusti/uikit-docs 0.1.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 (45) hide show
  1. package/.storybook/main.ts +28 -0
  2. package/.storybook/manager.ts +8 -0
  3. package/.storybook/preview.ts +19 -0
  4. package/README.md +6 -0
  5. package/package.json +26 -0
  6. package/stories/Button.stories.ts +50 -0
  7. package/stories/Button.tsx +48 -0
  8. package/stories/CSSValueInput.css +38 -0
  9. package/stories/CSSValueInput.stories.tsx +171 -0
  10. package/stories/DatePicker.css +3 -0
  11. package/stories/DatePicker.stories.tsx +99 -0
  12. package/stories/Dropdown.css +149 -0
  13. package/stories/Dropdown.stories.tsx +446 -0
  14. package/stories/Header.stories.ts +27 -0
  15. package/stories/Header.tsx +66 -0
  16. package/stories/InputText.css +15 -0
  17. package/stories/InputText.stories.tsx +152 -0
  18. package/stories/Introduction.mdx +388 -0
  19. package/stories/MonthCalendar.css +3 -0
  20. package/stories/MonthCalendar.stories.ts +57 -0
  21. package/stories/Page.stories.ts +29 -0
  22. package/stories/Page.tsx +91 -0
  23. package/stories/assets/accessibility.png +0 -0
  24. package/stories/assets/accessibility.svg +5 -0
  25. package/stories/assets/addon-library.png +0 -0
  26. package/stories/assets/assets.png +0 -0
  27. package/stories/assets/context.png +0 -0
  28. package/stories/assets/discord.svg +15 -0
  29. package/stories/assets/docs.png +0 -0
  30. package/stories/assets/figma-plugin.png +0 -0
  31. package/stories/assets/github.svg +3 -0
  32. package/stories/assets/share.png +0 -0
  33. package/stories/assets/styling.png +0 -0
  34. package/stories/assets/testing.png +0 -0
  35. package/stories/assets/theming.png +0 -0
  36. package/stories/assets/tutorials.svg +12 -0
  37. package/stories/assets/youtube.svg +4 -0
  38. package/stories/button.css +30 -0
  39. package/stories/header.css +32 -0
  40. package/stories/page.css +69 -0
  41. package/stories/useIsOutOfBounds.css +16 -0
  42. package/stories/useIsOutOfBounds.stories.tsx +164 -0
  43. package/stories/useKeyboardEvents.css +19 -0
  44. package/stories/useKeyboardEvents.stories.tsx +104 -0
  45. package/tsconfig.json +3 -0
@@ -0,0 +1,152 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
3
+ import * as React from 'react';
4
+
5
+ import InputText from '../../input-text/src/InputText.js';
6
+
7
+ import './InputText.css';
8
+
9
+ const meta: Meta<typeof InputText> = {
10
+ component: InputText,
11
+ parameters: {
12
+ docs: {
13
+ description: {
14
+ component:
15
+ '`InputText` is a React component that renders a textual input (`type: "text"|"email"|"number"|"password"|"search"|"tel"|"url"`) that is uncontrolled, but whose value is overwritten whenever `props.initialValue` changes. Also, if `props.selectTextOnFocus` is true, it selects the entire contents of the input whenever the input is focused. And it supports multiline inputs (rendered as a `<textarea>`) that automatically resize vertically to fit their content.',
16
+ },
17
+ },
18
+ },
19
+ //https://storybook.js.org/docs/react/writing-docs/autodocs#setup-automated-documentation
20
+ tags: ['autodocs'],
21
+ title: 'UIKit/Controls/InputText',
22
+ };
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof InputText>;
27
+
28
+ export const EmptyInput: Story = {
29
+ args: {
30
+ className: 'input-text',
31
+ name: 'empty',
32
+ // NOTE spies are a workaround for a bug related to implicit arg detection
33
+ onBlur: fn(),
34
+ onChange: fn(),
35
+ onChangeValue: fn(),
36
+ onFocus: fn(),
37
+ onKeyDown: fn(),
38
+ onKeyUp: fn(),
39
+ placeholder: 'enter text here…',
40
+ },
41
+ };
42
+
43
+ export const InputWithInitialValue: Story = {
44
+ args: {
45
+ className: 'input-text',
46
+ initialValue: 'Bolivia',
47
+ placeholder: 'enter country name',
48
+ },
49
+ };
50
+
51
+ export const InputWithInitialValueAndSelectTextOnFocus: Story = {
52
+ args: {
53
+ className: 'input-text',
54
+ initialValue: 'Bolivia',
55
+ name: 'country',
56
+ placeholder: 'enter country name (selectTextOnFocus)',
57
+ selectTextOnFocus: true,
58
+ },
59
+ };
60
+
61
+ export const MultiLineInputWithInitialValueAndSelectTextOnFocus: Story = {
62
+ args: {
63
+ className: 'multi-line-input-text',
64
+ initialValue:
65
+ 'The Black Hawk War, or, How to Demolish an Entire Civilization and Still Feel Good About Yourself in the Morning, or, We Apologize for the Inconvenience but You’re Going to Have to Leave Now, or, “I have fought the Big Knives and will continue to fight them until they are off our lands!”',
66
+ maxHeight: 600,
67
+ multiLine: true,
68
+ name: 'multi-line-input',
69
+ placeholder: 'enter text of any length',
70
+ selectTextOnFocus: true,
71
+ },
72
+ };
73
+
74
+ const SUBMIT_ON_ENTER_PROPS = {
75
+ className: 'multi-line-input-text',
76
+ maxHeight: 600,
77
+ multiLine: true,
78
+ name: 'multi-line-submit-on-enter-input',
79
+ placeholder: 'enter text of any length',
80
+ submitOnEnter: true,
81
+ };
82
+
83
+ const formatDate = new Intl.DateTimeFormat(undefined, {
84
+ timeStyle: 'medium',
85
+ }).format;
86
+
87
+ export const MultiLineInputWithSubmitOnEnter: Story = {
88
+ args: SUBMIT_ON_ENTER_PROPS,
89
+ render() {
90
+ const [lastSubmitDate, setLastSubmitDate] = React.useState(null);
91
+ const lastSubmit = lastSubmitDate ? formatDate(lastSubmitDate) : 'never';
92
+
93
+ return (
94
+ <form
95
+ onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
96
+ event.preventDefault();
97
+ setLastSubmitDate(new Date());
98
+ }}
99
+ >
100
+ <InputText {...SUBMIT_ON_ENTER_PROPS} />
101
+ <pre>Last submitted: {lastSubmit}</pre>
102
+ </form>
103
+ );
104
+ },
105
+ };
106
+
107
+ export const MultiLineInputWithSubmitOnEnterNoForm: Story = {
108
+ args: {
109
+ ...SUBMIT_ON_ENTER_PROPS,
110
+ name: SUBMIT_ON_ENTER_PROPS.name + '-no-form',
111
+ },
112
+ };
113
+
114
+ export const InputWithDoubleClickToEdit: Story = {
115
+ args: {
116
+ className: 'input-text-double-click-to-edit',
117
+ doubleClickToEdit: true,
118
+ initialValue: 'Lorem ipsum dolor sit amet',
119
+ name: 'double-click-to-edit-input',
120
+ },
121
+ };
122
+
123
+ export const InputWithAutoFocus: Story = {
124
+ args: {
125
+ autoFocus: true,
126
+ name: 'autofocus-input',
127
+ },
128
+ };
129
+
130
+ const MULTI_LINE_INPUT_WITH_AUTO_FOCUS_PROPS = {
131
+ autoFocus: true,
132
+ initialValue: 'This multi-line input should be focused when the popover opens',
133
+ multiLine: true,
134
+ name: 'autofocus-multi-line-input',
135
+ selectTextOnFocus: true,
136
+ };
137
+
138
+ export const MultiLineInputWithAutoFocusInPopover: Story = {
139
+ args: MULTI_LINE_INPUT_WITH_AUTO_FOCUS_PROPS,
140
+ render() {
141
+ return (
142
+ <>
143
+ <button popoverTarget="multi-line-input-with-autofocus-in-popover">
144
+ Open Popover
145
+ </button>
146
+ <div id="multi-line-input-with-autofocus-in-popover" popover="auto">
147
+ <InputText {...MULTI_LINE_INPUT_WITH_AUTO_FOCUS_PROPS} />
148
+ </div>
149
+ </>
150
+ );
151
+ },
152
+ };
@@ -0,0 +1,388 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ import Github from './assets/github.svg';
4
+ import Discord from './assets/discord.svg';
5
+ import Youtube from './assets/youtube.svg';
6
+ import Tutorials from './assets/tutorials.svg';
7
+ import Styling from './assets/styling.png';
8
+ import Context from './assets/context.png';
9
+ import Assets from './assets/assets.png';
10
+ import Docs from './assets/docs.png';
11
+ import Share from './assets/share.png';
12
+ import FigmaPlugin from './assets/figma-plugin.png';
13
+ import Testing from './assets/testing.png';
14
+ import Accessibility from './assets/accessibility.png';
15
+ import Theming from './assets/theming.png';
16
+ import AddonLibrary from './assets/addon-library.png';
17
+
18
+ <Meta title="UIKit/Introduction" />
19
+
20
+ # Welcome to UIKit’s Storybook
21
+
22
+ UIKit provides a collection of UI components and tools for building modern
23
+ web and mobile applications. To see what the components look like and how
24
+ to use them, explore everything under the “Controls” folder in the sidebar.
25
+ The four components currently documented here are:
26
+
27
+ - [InputText](../?path=/docs/uikit-controls-inputtext--docs)
28
+ - [CSSValueInput](../?path=/docs/uikit-controls-CSSValueInput--docs)
29
+ - [Dropdown](../?path=/docs/uikit-controls-Dropdown--docs)
30
+ - [DatePicker](../?path=/docs/uikit-controls-datepicker-datepicker--docs)
31
+
32
+ There are also two custom React hooks available under the “Hooks” folder:
33
+
34
+ - [useIsOutOfBounds](../?path=/docs/uikit-hooks-useisoutofbounds--docs)
35
+ - [useKeyboardEvents](../?path=/docs/uikit-hooks-usekeyboardevents--docs)
36
+
37
+ See below for more about Storybook and how it works.
38
+
39
+ export const RightArrow = () => (
40
+ <svg
41
+ viewBox="0 0 14 14"
42
+ width="8px"
43
+ height="14px"
44
+ style={{
45
+ marginLeft: '4px',
46
+ display: 'inline-block',
47
+ shapeRendering: 'inherit',
48
+ verticalAlign: 'middle',
49
+ fill: 'currentColor',
50
+ 'path fill': 'currentColor',
51
+ }}
52
+ >
53
+ <path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
54
+ </svg>
55
+ );
56
+
57
+ <div className="sb-container">
58
+ <div className='sb-section-title'>
59
+ # Configure your project
60
+
61
+ Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
62
+
63
+ </div>
64
+ <div className="sb-section">
65
+ <div className="sb-section-item">
66
+ <img
67
+ src={Styling}
68
+ alt="A wall of logos representing different styling technologies"
69
+ />
70
+ <h4 className="sb-section-item-heading">Add styling and CSS</h4>
71
+ <p className="sb-section-item-paragraph">Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.</p>
72
+ <a
73
+ href="https://storybook.js.org/docs/react/configure/styling-and-css"
74
+ target="_blank"
75
+ >Learn more<RightArrow /></a>
76
+ </div>
77
+ <div className="sb-section-item">
78
+ <img
79
+ src={Context}
80
+ alt="An abstraction representing the composition of data for a component"
81
+ />
82
+ <h4 className="sb-section-item-heading">Provide context and mocking</h4>
83
+ <p className="sb-section-item-paragraph">Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.</p>
84
+ <a
85
+ href="https://storybook.js.org/docs/react/writing-stories/decorators#context-for-mocking"
86
+ target="_blank"
87
+ >Learn more<RightArrow /></a>
88
+ </div>
89
+ <div className="sb-section-item">
90
+ <img src={Assets} alt="A representation of typography and image assets" />
91
+ <div>
92
+ <h4 className="sb-section-item-heading">Load assets and resources</h4>
93
+ <p className="sb-section-item-paragraph">To link static files (like fonts) to your projects and stories, use the
94
+ `staticDirs` configuration option to specify folders to load when
95
+ starting Storybook.</p>
96
+ <a
97
+ href="https://storybook.js.org/docs/react/configure/images-and-assets"
98
+ target="_blank"
99
+ >Learn more<RightArrow /></a>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ <div className="sb-container">
105
+ <div className='sb-section-title'>
106
+ # Do more with Storybook
107
+
108
+ Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
109
+
110
+ </div>
111
+
112
+ <div className="sb-section">
113
+ <div className="sb-features-grid">
114
+ <div className="sb-grid-item">
115
+ <img src={Docs} alt="A screenshot showing the autodocs tag being set, pointing a docs page being generated" />
116
+ <h4 className="sb-section-item-heading">Autodocs</h4>
117
+ <p className="sb-section-item-paragraph">Auto-generate living,
118
+ interactive reference documentation from your components and stories.</p>
119
+ <a
120
+ href="https://storybook.js.org/docs/react/writing-docs/autodocs"
121
+ target="_blank"
122
+ >Learn more<RightArrow /></a>
123
+ </div>
124
+ <div className="sb-grid-item">
125
+ <img src={Share} alt="A browser window showing a Storybook being published to a chromatic.com URL" />
126
+ <h4 className="sb-section-item-heading">Publish to Chromatic</h4>
127
+ <p className="sb-section-item-paragraph">Publish your Storybook to review and collaborate with your entire team.</p>
128
+ <a
129
+ href="https://storybook.js.org/docs/react/sharing/publish-storybook#publish-storybook-with-chromatic"
130
+ target="_blank"
131
+ >Learn more<RightArrow /></a>
132
+ </div>
133
+ <div className="sb-grid-item">
134
+ <img src={FigmaPlugin} alt="Windows showing the Storybook plugin in Figma" />
135
+ <h4 className="sb-section-item-heading">Figma Plugin</h4>
136
+ <p className="sb-section-item-paragraph">Embed your stories into Figma to cross-reference the design and live
137
+ implementation in one place.</p>
138
+ <a
139
+ href="https://storybook.js.org/docs/react/sharing/design-integrations#embed-storybook-in-figma-with-the-plugin"
140
+ target="_blank"
141
+ >Learn more<RightArrow /></a>
142
+ </div>
143
+ <div className="sb-grid-item">
144
+ <img src={Testing} alt="Screenshot of tests passing and failing" />
145
+ <h4 className="sb-section-item-heading">Testing</h4>
146
+ <p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how
147
+ complex.</p>
148
+ <a
149
+ href="https://storybook.js.org/docs/react/writing-tests/introduction"
150
+ target="_blank"
151
+ >Learn more<RightArrow /></a>
152
+ </div>
153
+ <div className="sb-grid-item">
154
+ <img src={Accessibility} alt="Screenshot of accessibility tests passing and failing" />
155
+ <h4 className="sb-section-item-heading">Accessibility</h4>
156
+ <p className="sb-section-item-paragraph">Automatically test your components for a11y issues as you develop.</p>
157
+ <a
158
+ href="https://storybook.js.org/docs/react/writing-tests/accessibility-testing"
159
+ target="_blank"
160
+ >Learn more<RightArrow /></a>
161
+ </div>
162
+ <div className="sb-grid-item">
163
+ <img src={Theming} alt="Screenshot of Storybook in light and dark mode" />
164
+ <h4 className="sb-section-item-heading">Theming</h4>
165
+ <p className="sb-section-item-paragraph">Theme Storybook's UI to personalize it to your project.</p>
166
+ <a
167
+ href="https://storybook.js.org/docs/react/configure/theming"
168
+ target="_blank"
169
+ >Learn more<RightArrow /></a>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ <div className='sb-addon'>
175
+ <div className='sb-addon-text'>
176
+ <h4>Addons</h4>
177
+ <p className="sb-section-item-paragraph">Integrate your tools with Storybook to connect workflows.</p>
178
+ <a
179
+ href="https://storybook.js.org/integrations/"
180
+ target="_blank"
181
+ >Discover all addons<RightArrow /></a>
182
+ </div>
183
+ <div className='sb-addon-img'>
184
+ <img src={AddonLibrary} alt="Integrate your tools with Storybook to connect workflows." />
185
+ </div>
186
+ </div>
187
+
188
+ <div className="sb-section sb-socials">
189
+ <div className="sb-section-item">
190
+ <img src={Github} alt="Github logo" className="sb-explore-image"/>
191
+ Join our contributors building the future of UI development.
192
+
193
+ <a
194
+ href="https://github.com/storybookjs/storybook"
195
+ target="_blank"
196
+ >Star on GitHub<RightArrow /></a>
197
+ </div>
198
+ <div className="sb-section-item">
199
+ <img src={Discord} alt="Discord logo" className="sb-explore-image"/>
200
+ <div>
201
+ Get support and chat with frontend developers.
202
+
203
+ <a
204
+ href="https://discord.gg/storybook"
205
+ target="_blank"
206
+ >Join Discord server<RightArrow /></a>
207
+ </div>
208
+ </div>
209
+ <div className="sb-section-item">
210
+ <img src={Youtube} alt="Youtube logo" className="sb-explore-image"/>
211
+ <div>
212
+ Watch tutorials, feature previews and interviews.
213
+
214
+ <a
215
+ href="https://www.youtube.com/@chromaticui"
216
+ target="_blank"
217
+ >Watch on YouTube<RightArrow /></a>
218
+ </div>
219
+ </div>
220
+ <div className="sb-section-item">
221
+ <img src={Tutorials} alt="A book" className="sb-explore-image"/>
222
+ <p>Follow guided walkthroughs on for key workflows.</p>
223
+
224
+ <a
225
+ href="https://storybook.js.org/tutorials/"
226
+ target="_blank"
227
+ >Discover tutorials<RightArrow /></a>
228
+ </div>
229
+
230
+ </div>
231
+
232
+ <style>
233
+ {`
234
+ .sb-container {
235
+ margin-bottom: 48px;
236
+ }
237
+
238
+ .sb-section {
239
+ width: 100%;
240
+ display: flex;
241
+ flex-direction: row;
242
+ gap: 20px;
243
+ }
244
+
245
+ img {
246
+ object-fit: cover;
247
+ }
248
+
249
+ .sb-section-title {
250
+ margin-bottom: 32px;
251
+ }
252
+
253
+ .sb-section a:not(h1 a, h2 a, h3 a) {
254
+ font-size: 14px;
255
+ }
256
+
257
+ .sb-section-item, .sb-grid-item {
258
+ flex: 1;
259
+ display: flex;
260
+ flex-direction: column;
261
+ }
262
+
263
+ .sb-section-item-heading {
264
+ padding-top: 20px !important;
265
+ padding-bottom: 5px !important;
266
+ margin: 0 !important;
267
+ }
268
+ .sb-section-item-paragraph {
269
+ margin: 0;
270
+ padding-bottom: 10px;
271
+ }
272
+
273
+ .sb-chevron {
274
+ margin-left: 5px;
275
+ }
276
+
277
+ .sb-features-grid {
278
+ display: grid;
279
+ grid-template-columns: repeat(2, 1fr);
280
+ grid-gap: 32px 20px;
281
+ }
282
+
283
+ .sb-socials {
284
+ display: grid;
285
+ grid-template-columns: repeat(4, 1fr);
286
+ }
287
+
288
+ .sb-socials p {
289
+ margin-bottom: 10px;
290
+ }
291
+
292
+ .sb-explore-image {
293
+ max-height: 32px;
294
+ align-self: flex-start;
295
+ }
296
+
297
+ .sb-addon {
298
+ width: 100%;
299
+ display: flex;
300
+ align-items: center;
301
+ position: relative;
302
+ background-color: #EEF3F8;
303
+ border-radius: 5px;
304
+ border: 1px solid rgba(0, 0, 0, 0.05);
305
+ background: #EEF3F8;
306
+ height: 180px;
307
+ margin-bottom: 48px;
308
+ overflow: hidden;
309
+ }
310
+
311
+ .sb-addon-text {
312
+ padding-left: 48px;
313
+ max-width: 240px;
314
+ }
315
+
316
+ .sb-addon-text h4 {
317
+ padding-top: 0px;
318
+ }
319
+
320
+ .sb-addon-img {
321
+ position: absolute;
322
+ left: 345px;
323
+ top: 0;
324
+ height: 100%;
325
+ width: 200%;
326
+ overflow: hidden;
327
+ }
328
+
329
+ .sb-addon-img img {
330
+ width: 650px;
331
+ transform: rotate(-15deg);
332
+ margin-left: 40px;
333
+ margin-top: -72px;
334
+ box-shadow: 0 0 1px rgba(255, 255, 255, 0);
335
+ backface-visibility: hidden;
336
+ }
337
+
338
+ @media screen and (max-width: 800px) {
339
+ .sb-addon-img {
340
+ left: 300px;
341
+ }
342
+ }
343
+
344
+ @media screen and (max-width: 600px) {
345
+ .sb-section {
346
+ flex-direction: column;
347
+ }
348
+
349
+ .sb-features-grid {
350
+ grid-template-columns: repeat(1, 1fr);
351
+ }
352
+
353
+ .sb-socials {
354
+ grid-template-columns: repeat(2, 1fr);
355
+ }
356
+
357
+ .sb-addon {
358
+ height: 280px;
359
+ align-items: flex-start;
360
+ padding-top: 32px;
361
+ overflow: hidden;
362
+ }
363
+
364
+ .sb-addon-text {
365
+ padding-left: 24px;
366
+ }
367
+
368
+ .sb-addon-img {
369
+ right: 0;
370
+ left: 0;
371
+ top: 130px;
372
+ bottom: 0;
373
+ overflow: hidden;
374
+ height: auto;
375
+ width: 124%;
376
+ }
377
+
378
+ .sb-addon-img img {
379
+ width: 1200px;
380
+ transform: rotate(-12deg);
381
+ margin-left: 0;
382
+ margin-top: 48px;
383
+ margin-bottom: -40px;
384
+ margin-left: -24px;
385
+ }
386
+ }
387
+ `}
388
+ </style>
@@ -0,0 +1,3 @@
1
+ .uktmonthcalendar {
2
+ font-family: system-ui, sans-serif;
3
+ }
@@ -0,0 +1,57 @@
1
+ import { getMonthFromDate, MonthCalendar } from '../../date-picker/src/index.js';
2
+
3
+ import './MonthCalendar.css';
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react';
6
+
7
+ const meta: Meta<typeof MonthCalendar> = {
8
+ argTypes: {
9
+ dateEnd: {
10
+ control: 'date',
11
+ description: '(optional) end date of current date range',
12
+ },
13
+ dateStart: {
14
+ control: 'date',
15
+ description: '(optional) start date of current date range',
16
+ },
17
+ },
18
+ component: MonthCalendar,
19
+ parameters: {
20
+ docs: {
21
+ description: {
22
+ component:
23
+ '`MonthCalendar` is a React component that renders a calendar UI for the given month.',
24
+ },
25
+ },
26
+ },
27
+ //https://storybook.js.org/docs/react/writing-docs/autodocs#setup-automated-documentation
28
+ tags: ['autodocs'],
29
+ title: 'UIKit/Controls/DatePicker/MonthCalendar',
30
+ };
31
+
32
+ export default meta;
33
+
34
+ type Story = StoryObj<typeof MonthCalendar>;
35
+
36
+ export const ThisMonthsCalendar: Story = {
37
+ args: {
38
+ className: 'month-calendar-story',
39
+ month: getMonthFromDate(new Date()),
40
+ },
41
+ };
42
+
43
+ export const February1985Calendar: Story = {
44
+ args: {
45
+ className: 'february-month-calendar-story',
46
+ month: 181,
47
+ },
48
+ };
49
+
50
+ export const DateRangeDiwaliCalendar: Story = {
51
+ args: {
52
+ className: 'date-range-month-calendar-story',
53
+ dateEnd: new Date(2023, 10, 14),
54
+ dateStart: new Date(2023, 10, 9),
55
+ month: getMonthFromDate(new Date(2023, 10, 1)),
56
+ },
57
+ };
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { within, userEvent } from '@storybook/test';
3
+
4
+ import { Page } from './Page';
5
+
6
+ const meta = {
7
+ title: 'Example/Page',
8
+ component: Page,
9
+ parameters: {
10
+ // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
11
+ layout: 'fullscreen',
12
+ },
13
+ } satisfies Meta<typeof Page>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ export const LoggedOut: Story = {};
19
+
20
+ // More on interaction testing: https://storybook.js.org/docs/react/writing-tests/interaction-testing
21
+ export const LoggedIn: Story = {
22
+ play: async ({ canvasElement }) => {
23
+ const canvas = within(canvasElement);
24
+ const loginButton = await canvas.getByRole('button', {
25
+ name: /Log in/i,
26
+ });
27
+ await userEvent.click(loginButton);
28
+ },
29
+ };