@flightlesslabs/dodo-ui 0.22.0 โ†’ 0.22.2

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 (61) hide show
  1. package/dist/Home.mdx +25 -36
  2. package/dist/components/Form/Button/Button.stories.svelte +33 -23
  3. package/dist/components/Form/Button/Button.svelte +0 -25
  4. package/dist/components/Form/Button/Button.svelte.d.ts +0 -16
  5. package/dist/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
  6. package/dist/components/Form/Checkbox/Checkbox.svelte +0 -3
  7. package/dist/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
  8. package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
  9. package/dist/components/Form/FormField/FormField.stories.svelte +15 -10
  10. package/dist/components/Form/FormField/FormField.svelte +0 -3
  11. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
  12. package/dist/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
  13. package/dist/components/Form/InputEnclosure/InputEnclosure.svelte.d.ts +0 -12
  14. package/dist/components/Form/Select/Select.stories.svelte +18 -3
  15. package/dist/components/Form/Select/Select.svelte +0 -6
  16. package/dist/components/Form/Select/Select.svelte.d.ts +0 -6
  17. package/dist/components/Form/Switch/Switch.stories.svelte +17 -8
  18. package/dist/components/Form/TextInput/TextInput.stories.svelte +19 -16
  19. package/dist/components/Form/TextInput/TextInput.svelte +0 -3
  20. package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
  21. package/dist/components/Form/UtilityButton/UtilityButton.svelte +0 -36
  22. package/dist/components/Form/UtilityButton/UtilityButton.svelte.d.ts +0 -27
  23. package/dist/components/Info/Calendar/Calendar.scss +20 -10
  24. package/dist/components/Info/Calendar/Calendar.stories.svelte +22 -1
  25. package/dist/components/Layout/Card/Card.stories.svelte +17 -2
  26. package/dist/components/Layout/Grid/Grid.stories.svelte +15 -0
  27. package/dist/components/Layout/Theme/Theme.stories.svelte +16 -2
  28. package/dist/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
  29. package/dist/styles/components.css +13 -6
  30. package/dist/styles/components.css.map +1 -1
  31. package/dist/utils/time/date-creator/createDate/createDate.mdx +13 -38
  32. package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
  33. package/dist/utils/time/timeout/timeout.mdx +19 -39
  34. package/package.json +6 -2
  35. package/src/lib/Home.mdx +25 -36
  36. package/src/lib/components/Form/Button/Button.stories.svelte +33 -23
  37. package/src/lib/components/Form/Button/Button.svelte +0 -25
  38. package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
  39. package/src/lib/components/Form/Checkbox/Checkbox.svelte +0 -3
  40. package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
  41. package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
  42. package/src/lib/components/Form/FormField/FormField.stories.svelte +15 -10
  43. package/src/lib/components/Form/FormField/FormField.svelte +0 -3
  44. package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
  45. package/src/lib/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
  46. package/src/lib/components/Form/Select/Select.stories.svelte +18 -3
  47. package/src/lib/components/Form/Select/Select.svelte +0 -6
  48. package/src/lib/components/Form/Switch/Switch.stories.svelte +17 -8
  49. package/src/lib/components/Form/TextInput/TextInput.stories.svelte +19 -16
  50. package/src/lib/components/Form/TextInput/TextInput.svelte +0 -3
  51. package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
  52. package/src/lib/components/Form/UtilityButton/UtilityButton.svelte +0 -36
  53. package/src/lib/components/Info/Calendar/Calendar.scss +20 -10
  54. package/src/lib/components/Info/Calendar/Calendar.stories.svelte +22 -1
  55. package/src/lib/components/Layout/Card/Card.stories.svelte +17 -2
  56. package/src/lib/components/Layout/Grid/Grid.stories.svelte +15 -0
  57. package/src/lib/components/Layout/Theme/Theme.stories.svelte +16 -2
  58. package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
  59. package/src/lib/utils/time/date-creator/createDate/createDate.mdx +13 -38
  60. package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
  61. package/src/lib/utils/time/timeout/timeout.mdx +19 -39
@@ -1,11 +1,6 @@
1
1
  <script lang="ts" module>
2
2
  import type { Snippet } from 'svelte';
3
3
 
4
- /**
5
- * Shared base props for the UtilityButton component.
6
- *
7
- * These props apply to both the <UtilityButton> and <a> render modes.
8
- */
9
4
  interface UtilityButtonBaseProps {
10
5
  /** UtilityButton contents */
11
6
  children?: Snippet;
@@ -32,32 +27,10 @@
32
27
  'aria-label'?: string;
33
28
  }
34
29
 
35
- /**
36
- * UtilityButton component props (UtilityButton variant).
37
- *
38
- * Renders a semantic <UtilityButton> element when `href` is not provided.
39
- * Inherits all native HTML UtilityButton attributes.
40
- */
41
30
  export type UtilityButtonAsButtonProps = UtilityButtonBaseProps & ButtonAsButtonPropsBase;
42
31
 
43
- /**
44
- * UtilityButton component props (anchor variant).
45
- *
46
- * Renders an <a> element when `href` is provided.
47
- * Inherits all native HTML anchor attributes, except `type`.
48
- */
49
32
  export type UtilityButtonAsAnchorProps = UtilityButtonBaseProps & ButtonAsAnchorPropsBase;
50
33
 
51
- /**
52
- * UtilityButton component props.
53
- *
54
- * Renders a semantic <UtilityButton> by default, or an <a> element when `href` is provided.
55
- * Supports design-system tokens for size, color, variant, and roundness.
56
- *
57
- * This type is a discriminated union:
58
- * - When `href` is present, anchor props are enabled and UtilityButton-only props are disabled.
59
- * - When `href` is absent, UtilityButton props are enabled and anchor-only props are disabled.
60
- */
61
34
  export type UtilityButtonProps = UtilityButtonAsButtonProps | UtilityButtonAsAnchorProps;
62
35
  </script>
63
36
 
@@ -70,12 +43,6 @@
70
43
  import ButtonAsButton from '../Button/ButtonAsButton.svelte';
71
44
  import type { ButtonAsButtonProps as ButtonAsButtonPropsBase } from '../Button/ButtonAsButton.svelte';
72
45
 
73
- /**
74
- * UtilityButton component runtime props.
75
- *
76
- * These props are destructured from `$props()` and mapped to the underlying
77
- * Bits UI UtilityButton root component, with semantic rendering based on `href`.
78
- */
79
46
  let {
80
47
  size = 'normal',
81
48
  color = 'primary',
@@ -91,9 +58,6 @@
91
58
  ...restProps
92
59
  }: UtilityButtonProps = $props();
93
60
 
94
- /**
95
- * Computed class list for the UtilityButton component.
96
- */
97
61
  const classes = $derived(
98
62
  [
99
63
  'dodo-ui-UtilityButton',
@@ -1,3 +1,5 @@
1
+ @use '../../../styles/global/breakpoints' as breakpoints;
2
+
1
3
  // ----------------------------------------
2
4
  // Theme tokens (global CSS variables)
3
5
  // ----------------------------------------
@@ -13,11 +15,14 @@
13
15
 
14
16
  .dodo-ui-Calendar {
15
17
  font-size: 1rem;
16
- padding: var(--dodo-ui-space);
17
18
  color: var(--dodo-color-neutral-900);
18
19
  display: inline-flex;
19
20
  flex-direction: column;
20
21
 
22
+ @include breakpoints.up('sm') {
23
+ padding: var(--dodo-ui-space);
24
+ }
25
+
21
26
  [data-calendar-header] {
22
27
  display: flex;
23
28
  justify-content: space-between;
@@ -32,9 +37,9 @@
32
37
  font-weight: 500;
33
38
  }
34
39
 
35
- [data-calendar-next-button],
36
- [data-calendar-prev-button] {
37
- font-size: 1.45rem;
40
+ button[data-calendar-next-button],
41
+ button[data-calendar-prev-button] {
42
+ font-size: 1.4em;
38
43
  }
39
44
 
40
45
  [data-calendar-grid] {
@@ -124,14 +129,19 @@
124
129
  bottom: 0.2em;
125
130
  }
126
131
  }
127
- }
128
132
 
129
- [data-outside-month] {
130
- color: var(--dodo-color-neutral-400);
133
+ &[data-outside-month],
134
+ &[data-disabled] {
135
+ color: var(--dodo-color-neutral-400);
131
136
 
132
- &:hover {
133
- background-color: initial;
134
- border-color: transparent;
137
+ &:hover {
138
+ background-color: initial;
139
+ border-color: transparent;
140
+ }
141
+
142
+ &[data-today] {
143
+ background-color: initial;
144
+ }
135
145
  }
136
146
  }
137
147
  }
@@ -11,6 +11,14 @@
11
11
  import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
12
12
  import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
13
13
 
14
+ const description = `
15
+ a plug and play Calendar component based on bits-ui [calendar](https://bits-ui.com/docs/components/calendar).
16
+
17
+ \`\`\`ts
18
+ import { Calendar } from '@flightlesslabs/dodo-ui';
19
+ \`\`\`
20
+ `;
21
+
14
22
  // ------------------------------
15
23
  // Storybook ArgTypes
16
24
  // ------------------------------
@@ -85,6 +93,13 @@
85
93
  component: Calendar,
86
94
  tags: ['autodocs'],
87
95
  argTypes: storyCalendarArgTypes,
96
+ parameters: {
97
+ docs: {
98
+ description: {
99
+ component: description,
100
+ },
101
+ },
102
+ },
88
103
  });
89
104
 
90
105
  let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
@@ -96,10 +111,16 @@
96
111
 
97
112
  <Story name="Default" />
98
113
 
99
- <Story name="Selected" asChild>
114
+ <Story name="Controlled" asChild>
100
115
  <Calendar bind:value={myValue} />
101
116
  </Story>
102
117
 
118
+ <Story name="Starts On Sunday" args={{ weekStartsOn: 0 }} />
119
+
120
+ <Story name="Min Date" args={{ minValue: new CalendarDate(2026, 4, 7) }} />
121
+
122
+ <Story name="Max Date" args={{ maxValue: new CalendarDate(2026, 4, 7) }} />
123
+
103
124
  <Story name="Light Theme" asChild>
104
125
  <Theme type="light">
105
126
  <Calendar />
@@ -8,6 +8,14 @@
8
8
  import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
9
9
  import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
10
10
 
11
+ const description = `
12
+ a simple, customizable, and re-usable card component
13
+
14
+ \`\`\`ts
15
+ import { Card } from '@flightlesslabs/dodo-ui';
16
+ \`\`\`
17
+ `;
18
+
11
19
  // ------------------------------
12
20
  // Storybook ArgTypes
13
21
  // ------------------------------
@@ -70,6 +78,13 @@
70
78
  component: Card,
71
79
  tags: ['autodocs'],
72
80
  argTypes: storyCardArgTypes,
81
+ parameters: {
82
+ docs: {
83
+ description: {
84
+ component: description,
85
+ },
86
+ },
87
+ },
73
88
  });
74
89
  </script>
75
90
 
@@ -79,7 +94,7 @@
79
94
 
80
95
  <Story name="Default"><p>Hello there</p></Story>
81
96
 
82
- <Story name="Primary" args={{ color: 'primary' }}><p>Hello there</p></Story>
97
+ <Story name="Color" args={{ color: 'safe' }}><p>Hello there</p></Story>
83
98
 
84
99
  <Story name="Active" args={{ color: 'primary', active: true }}><p>Hello there</p></Story>
85
100
 
@@ -87,7 +102,7 @@
87
102
 
88
103
  <Story name="Outline" args={{ outline: true, shadow: 0 }}><p>Hello there</p></Story>
89
104
 
90
- <Story name="FixedSize" args={{ height: '200px', width: '250px' }}><p>Hello there</p></Story>
105
+ <Story name="Fixed Size" args={{ height: '200px', width: '250px' }}><p>Hello there</p></Story>
91
106
 
92
107
  <Story name="Light Theme" args={{ theme: 'light' }}>
93
108
  <p>Hello there</p>
@@ -7,6 +7,14 @@
7
7
  import Card from '../Card/Card.svelte';
8
8
  import Row from './Row/Row.svelte';
9
9
 
10
+ const description = `
11
+ a set of components for your basic "12 column grid" needs
12
+
13
+ \`\`\`ts
14
+ import { Grid, Column, Row } from '@flightlesslabs/dodo-ui';
15
+ \`\`\`
16
+ `;
17
+
10
18
  // ------------------------------
11
19
  // Storybook ArgTypes
12
20
  // ------------------------------
@@ -26,6 +34,13 @@
26
34
  component: Grid,
27
35
  tags: ['autodocs'],
28
36
  argTypes: storyGridArgTypes,
37
+ parameters: {
38
+ docs: {
39
+ description: {
40
+ component: description,
41
+ },
42
+ },
43
+ },
29
44
  });
30
45
  </script>
31
46
 
@@ -5,6 +5,14 @@
5
5
  import type { ArgTypes } from 'storybook/internal/csf';
6
6
  import { componentThemeOptions } from '$lib/attributes/theme.js';
7
7
 
8
+ const description = `
9
+ Wrap your app at the root with Theme to provide a consistent light or dark class (based on system or override) to all child components
10
+
11
+ \`\`\`ts
12
+ import { Theme } from '@flightlesslabs/dodo-ui';
13
+ \`\`\`
14
+ `;
15
+
8
16
  /**
9
17
  * Storybook controls for Theme
10
18
  */
@@ -25,6 +33,13 @@
25
33
  component: Theme,
26
34
  tags: ['autodocs'],
27
35
  argTypes: ThemeArgTypes,
36
+ parameters: {
37
+ docs: {
38
+ description: {
39
+ component: description,
40
+ },
41
+ },
42
+ },
28
43
  });
29
44
  </script>
30
45
 
@@ -32,8 +47,7 @@
32
47
  <!-- Stories -->
33
48
  <!-- ------------------------------ -->
34
49
 
35
- <!-- Wrap your app at the root with Theme to provide a consistent light or dark class (based on system or override) to all child components. -->
36
- <Story name="Auto"></Story>
50
+ <Story name="Default"></Story>
37
51
 
38
52
  <Story name="Light" args={{ type: 'light' }}></Story>
39
53
 
@@ -1,5 +1,3 @@
1
- import { Source } from '@storybook/addon-docs/blocks';
2
-
3
1
  # ๐ŸŽจ Theme System
4
2
 
5
3
  A lightweight theme system built using context + local store.
@@ -8,25 +6,17 @@ A lightweight theme system built using context + local store.
8
6
 
9
7
  ### ๐Ÿ“ฆ Import
10
8
 
11
- <Source
12
- dark
13
- language="ts"
14
- code={`
9
+ ```ts
15
10
  import { useThemeContext } from '@flightlesslabs/dodo-ui';
16
- `}
17
- />
11
+ ```
18
12
 
19
13
  Provides access to the active theme.
20
14
 
21
15
  ### Usage
22
16
 
23
- <Source
24
- dark
25
- language="ts"
26
- code={`
17
+ ```ts
27
18
  const { theme } = useThemeContext();
28
- `}
29
- />
19
+ ```
30
20
 
31
21
  ## ๐Ÿช Theme Store
32
22
 
@@ -34,20 +24,12 @@ Global theme state.
34
24
 
35
25
  ### ๐Ÿ“ฆ Import
36
26
 
37
- <Source
38
- dark
39
- language="ts"
40
- code={`
27
+ ```ts
41
28
  import { useThemeStore } from '@flightlesslabs/dodo-ui';
42
- `}
43
- />
29
+ ```
44
30
 
45
31
  ### Read
46
32
 
47
- <Source
48
- dark
49
- language="ts"
50
- code={`
33
+ ```ts
51
34
  const theme = useThemeStore.theme;
52
- `}
53
- />
35
+ ```
@@ -1,5 +1,3 @@
1
- import { Source } from '@storybook/addon-docs/blocks';
2
-
3
1
  # createDate
4
2
 
5
3
  A centralized date factory built on top of `dayjs`.
@@ -8,78 +6,55 @@ This utility ensures **consistent parsing, timezone handling, and validation** a
8
6
 
9
7
  ## ๐Ÿ“ฆ Import
10
8
 
11
- <Source
12
- dark
13
- language="ts"
14
- code={`
9
+ ```ts
15
10
  import { createDate } from '@flightlesslabs/dodo-ui';
16
- `}
17
- />
11
+ ```
18
12
 
19
13
  ## ๐Ÿš€ Basic Usage
20
14
 
21
15
  ### Current Date
22
16
 
23
- <Source
24
- dark
25
- language="ts"
26
- code={`
17
+ ```ts
27
18
  const now = createDate();
28
19
  console.log(now.format());
29
- `}
30
- />
20
+ ```
21
+
31
22
 
32
23
  ### Parse a Date
33
24
 
34
- <Source
35
- dark
36
- language="ts"
37
- code={`
25
+ ```ts
38
26
  const date = createDate("01-02-2025", "DD-MM-YYYY");
39
27
  console.log(date.format());
40
- `}
41
- />
28
+ ```
42
29
 
43
30
  ## ๐ŸŒ Timezone & UTC
44
31
 
45
32
  ### UTC Mode
46
33
 
47
- <Source
48
- dark
49
- language="ts"
50
- code={`
34
+ ```ts
51
35
  const utcDate = createDate("2025-01-01T12:00:00Z", undefined, {
52
36
  utc: true,
53
37
  });
54
- `}
55
- />
38
+ ```
56
39
 
57
40
  ### Timezone Conversion
58
41
 
59
- <Source
60
- dark
61
- language="ts"
62
- code={`
42
+ ```ts
63
43
  const indiaTime = createDate("01-01-2025", "DD-MM-YYYY", {
64
44
  timezone: "Asia/Kolkata",
65
45
  });
66
- `}
67
- />
46
+ ```
68
47
 
69
48
  ## โš™๏ธ Options
70
49
 
71
- <Source
72
- dark
73
- language="ts"
74
- code={`
50
+ ```ts
75
51
  interface CreateDateOptions {
76
52
  timezone?: string;
77
53
  utc?: boolean;
78
54
  strict?: boolean;
79
55
  throwOnInvalid?: boolean;
80
56
  }
81
- `}
82
- />
57
+ ```
83
58
 
84
59
  ## ๐Ÿ” Behavior Priority
85
60
 
@@ -1,5 +1,3 @@
1
- import { Source } from '@storybook/addon-docs/blocks';
2
-
3
1
  # createDateFactory
4
2
 
5
3
  A **factory function** that creates a `createDate` utility with an optional custom `dayjs` instance.
@@ -15,13 +13,9 @@ This allows advanced users to:
15
13
 
16
14
  ## ๐Ÿ“ฆ Import
17
15
 
18
- <Source
19
- dark
20
- language="ts"
21
- code={`
16
+ ```ts
22
17
  import { createDateFactory } from '@flightlesslabs/dodo-ui';
23
- `}
24
- />
18
+ ```
25
19
 
26
20
  ---
27
21
 
@@ -29,18 +23,14 @@ import { createDateFactory } from '@flightlesslabs/dodo-ui';
29
23
 
30
24
  ### Default Factory
31
25
 
32
- <Source
33
- dark
34
- language="ts"
35
- code={`
26
+ ```ts
36
27
  import { createDateFactory } from '@flightlesslabs/dodo-ui';
37
28
 
38
29
  const { createDate } = createDateFactory();
39
30
 
40
31
  const now = createDate();
41
32
  console.log(now.format());
42
- `}
43
- />
33
+ ```
44
34
 
45
35
  ---
46
36
 
@@ -59,10 +49,7 @@ Instead of relying on global `dayjs.extend`, you can:
59
49
 
60
50
  ### Inject your own configured instance
61
51
 
62
- <Source
63
- dark
64
- language="ts"
65
- code={`
52
+ ```ts
66
53
  import dayjs from 'dayjs';
67
54
  import utc from 'dayjs/plugin/utc';
68
55
  import timezone from 'dayjs/plugin/timezone';
@@ -73,8 +60,7 @@ dayjs.extend(timezone);
73
60
  const { createDate } = createDateFactory(dayjs);
74
61
 
75
62
  const date = createDate("2025-01-01", "YYYY-MM-DD");
76
- `}
77
- />
63
+ ```
78
64
 
79
65
  ---
80
66
 
@@ -99,29 +85,20 @@ The factory wraps your `dayjs` instance and preserves:
99
85
 
100
86
  ## ๐Ÿ“ฅ Returned API
101
87
 
102
- <Source
103
- dark
104
- language="ts"
105
- code={`
88
+ ```ts
106
89
  {
107
90
  createDate: Function,
108
91
  dayjs: DayjsInstance
109
92
  }
110
- `}
111
- />
112
-
113
- ---
93
+ ```
114
94
 
115
95
  ## ๐Ÿงช Example: Multiple Factories
116
96
 
117
- <Source
118
- dark
119
- language="ts"
120
- code={`
97
+
98
+ ```ts
121
99
  const factoryA = createDateFactory(dayjsA);
122
100
  const factoryB = createDateFactory(dayjsB);
123
101
 
124
102
  factoryA.createDate("2025-01-01");
125
103
  factoryB.createDate("2025-01-01");
126
- `}
127
- />
104
+ ```
@@ -1,5 +1,3 @@
1
- import { Source } from '@storybook/addon-docs/blocks';
2
-
3
1
  # timeout
4
2
 
5
3
  A simple utility to delay execution using Promises.
@@ -10,25 +8,19 @@ Useful for **pausing async workflows**, **simulating delays**, or **controlling
10
8
 
11
9
  ## ๐Ÿ“ฆ Import
12
10
 
13
- <Source
14
- dark
15
- language="ts"
16
- code={`
11
+ ```ts
17
12
  import { timeout } from '@flightlesslabs/dodo-ui';
18
- `}
19
- />
13
+ ```
20
14
 
21
15
  ---
22
16
 
23
17
  ## ๐Ÿš€ Basic Usage
24
18
 
25
- <Source
26
- dark
27
- language="ts"
28
- code={`
19
+
20
+
21
+ ```ts
29
22
  await timeout(1000); // waits 1 second
30
- `}
31
- />
23
+ ```
32
24
 
33
25
  ---
34
26
 
@@ -36,30 +28,22 @@ await timeout(1000); // waits 1 second
36
28
 
37
29
  You can optionally pass a value that will be returned after the delay.
38
30
 
39
- <Source
40
- dark
41
- language="ts"
42
- code={`
31
+ ```ts
43
32
  const result = await timeout(500, "done");
44
33
 
45
34
  console.log(result); // "done"
46
- `}
47
- />
35
+ ```
48
36
 
49
37
  ---
50
38
 
51
39
  ## โš™๏ธ API
52
40
 
53
- <Source
54
- dark
55
- language="ts"
56
- code={`
41
+ ```ts
57
42
  function timeout<T = void>(
58
43
  milliseconds: number,
59
44
  value?: T
60
45
  ): Promise<T>
61
- `}
62
- />
46
+ ```
63
47
 
64
48
  ---
65
49
 
@@ -81,13 +65,9 @@ function timeout<T = void>(
81
65
 
82
66
  If a negative duration is provided, the promise will reject:
83
67
 
84
- <Source
85
- dark
86
- language="ts"
87
- code={`
68
+ ```ts
88
69
  await timeout(-1); // โŒ throws Error
89
- `}
90
- />
70
+ ```
91
71
 
92
72
  ---
93
73
 
@@ -103,10 +83,7 @@ await timeout(-1); // โŒ throws Error
103
83
 
104
84
  ### Async Flow
105
85
 
106
- <Source
107
- dark
108
- language="ts"
109
- code={`
86
+ ```ts
110
87
  async function run() {
111
88
  console.log("Start");
112
89
 
@@ -114,8 +91,7 @@ await timeout(1000);
114
91
 
115
92
  console.log("End");
116
93
  }
117
- `}
118
- />
94
+ ```
119
95
 
120
96
  ---
121
97
 
@@ -131,4 +107,8 @@ console.log(data.success); // true
131
107
  `}
132
108
  />
133
109
 
134
- ---
110
+ ```ts
111
+ const data = await timeout(300, { success: true });
112
+
113
+ console.log(data.success); // true
114
+ ```