mado-ui 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 (140) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +274 -0
  3. package/css/index.css +5829 -0
  4. package/dist/components/button.d.ts +21 -0
  5. package/dist/components/form/index.d.ts +30 -0
  6. package/dist/components/form/input/index.d.ts +36 -0
  7. package/dist/components/form/submit-button.d.ts +20 -0
  8. package/dist/components/ghost.d.ts +4 -0
  9. package/dist/components/heading.d.ts +11 -0
  10. package/dist/components/index.d.ts +8 -0
  11. package/dist/components/link.d.ts +51 -0
  12. package/dist/components/mado-ui-provider.d.ts +1 -0
  13. package/dist/components/modal.d.ts +19 -0
  14. package/dist/components/time.d.ts +16 -0
  15. package/dist/hooks/create-fast-context.d.ts +7 -0
  16. package/dist/hooks/index.d.ts +4 -0
  17. package/dist/hooks/use-anime-scope.d.ts +15 -0
  18. package/dist/hooks/use-form-context.d.ts +30 -0
  19. package/dist/hooks/use-form-status.d.ts +7 -0
  20. package/dist/icons/3-people.d.ts +2 -0
  21. package/dist/icons/3-rectangles-desktop-fill.d.ts +2 -0
  22. package/dist/icons/3-rectangles-desktop.d.ts +2 -0
  23. package/dist/icons/airplane.d.ts +2 -0
  24. package/dist/icons/arrow-triangle-2-circlepath-circle-fill.d.ts +2 -0
  25. package/dist/icons/arrow-triangle-2-circlepath-circle.d.ts +2 -0
  26. package/dist/icons/bag-fill.d.ts +2 -0
  27. package/dist/icons/banknote.d.ts +2 -0
  28. package/dist/icons/bell-fill.d.ts +2 -0
  29. package/dist/icons/bolt-car.d.ts +2 -0
  30. package/dist/icons/bolt-fill.d.ts +2 -0
  31. package/dist/icons/bolt-ring-closed.d.ts +2 -0
  32. package/dist/icons/bolt-trianglebadge-exclamationmark.d.ts +2 -0
  33. package/dist/icons/book-fill.d.ts +2 -0
  34. package/dist/icons/bookmark-fill.d.ts +2 -0
  35. package/dist/icons/briefcase-fill.d.ts +2 -0
  36. package/dist/icons/bubble-left-fill.d.ts +2 -0
  37. package/dist/icons/building-2-fill.d.ts +2 -0
  38. package/dist/icons/calendar.d.ts +2 -0
  39. package/dist/icons/camera-fill.d.ts +2 -0
  40. package/dist/icons/car-fill.d.ts +2 -0
  41. package/dist/icons/cart-fill.d.ts +2 -0
  42. package/dist/icons/chart-bar-doc-horizontal.d.ts +2 -0
  43. package/dist/icons/checkmark-seal.d.ts +2 -0
  44. package/dist/icons/checkmark.d.ts +2 -0
  45. package/dist/icons/chevron-compact-down.d.ts +2 -0
  46. package/dist/icons/chevron-down.d.ts +2 -0
  47. package/dist/icons/chevron-left-forwardslash-chevron-right.d.ts +2 -0
  48. package/dist/icons/chevron-left.d.ts +2 -0
  49. package/dist/icons/chevron-right.d.ts +2 -0
  50. package/dist/icons/chevron-up-chevron-down.d.ts +2 -0
  51. package/dist/icons/circle-fill.d.ts +2 -0
  52. package/dist/icons/clock-badge-checkmark.d.ts +2 -0
  53. package/dist/icons/clock-fill.d.ts +2 -0
  54. package/dist/icons/cloud-fill.d.ts +2 -0
  55. package/dist/icons/cube-fill.d.ts +2 -0
  56. package/dist/icons/curve-point-left.d.ts +2 -0
  57. package/dist/icons/dial-high.d.ts +2 -0
  58. package/dist/icons/doc-fill.d.ts +2 -0
  59. package/dist/icons/doc-on-clipboard.d.ts +2 -0
  60. package/dist/icons/doc-on-doc-fill.d.ts +2 -0
  61. package/dist/icons/doc-on-doc.d.ts +2 -0
  62. package/dist/icons/doc-text-magnifyingglass.d.ts +2 -0
  63. package/dist/icons/dollar-sign.d.ts +2 -0
  64. package/dist/icons/ellipsis-circle-fill.d.ts +2 -0
  65. package/dist/icons/ellipsis-circle.d.ts +2 -0
  66. package/dist/icons/envelope-fill.d.ts +2 -0
  67. package/dist/icons/envelope.d.ts +2 -0
  68. package/dist/icons/exclamationmark-octagon.d.ts +2 -0
  69. package/dist/icons/eye.d.ts +2 -0
  70. package/dist/icons/figure-water-fitness.d.ts +2 -0
  71. package/dist/icons/flag-fill.d.ts +2 -0
  72. package/dist/icons/flame-fill.d.ts +2 -0
  73. package/dist/icons/folder-fill.d.ts +2 -0
  74. package/dist/icons/folder.d.ts +2 -0
  75. package/dist/icons/gearshape-fill.d.ts +2 -0
  76. package/dist/icons/gearshape.d.ts +2 -0
  77. package/dist/icons/gift-fill.d.ts +2 -0
  78. package/dist/icons/globe-americas-fill.d.ts +2 -0
  79. package/dist/icons/hare-fill.d.ts +2 -0
  80. package/dist/icons/house-deskclock.d.ts +2 -0
  81. package/dist/icons/house-fill.d.ts +2 -0
  82. package/dist/icons/house.d.ts +2 -0
  83. package/dist/icons/index.d.ts +104 -0
  84. package/dist/icons/iphone-house.d.ts +2 -0
  85. package/dist/icons/light-ribbon.d.ts +2 -0
  86. package/dist/icons/lightbulb-fill.d.ts +2 -0
  87. package/dist/icons/lightbulb-led.d.ts +2 -0
  88. package/dist/icons/list-bullet-clipboard-fill.d.ts +2 -0
  89. package/dist/icons/magnifyingglass.d.ts +2 -0
  90. package/dist/icons/map-pin-ellipse.d.ts +2 -0
  91. package/dist/icons/minus-plus-batterblock.d.ts +2 -0
  92. package/dist/icons/network-shield.d.ts +2 -0
  93. package/dist/icons/network.d.ts +2 -0
  94. package/dist/icons/newspaper-fill.d.ts +2 -0
  95. package/dist/icons/number.d.ts +2 -0
  96. package/dist/icons/paperplane-fill.d.ts +2 -0
  97. package/dist/icons/person-crop-square.d.ts +2 -0
  98. package/dist/icons/person-fill-questionmark.d.ts +2 -0
  99. package/dist/icons/person-fill.d.ts +2 -0
  100. package/dist/icons/person.d.ts +2 -0
  101. package/dist/icons/phone-arrow-up-right.d.ts +2 -0
  102. package/dist/icons/phone-fill.d.ts +2 -0
  103. package/dist/icons/phone.d.ts +2 -0
  104. package/dist/icons/play-rectangle-fill.d.ts +2 -0
  105. package/dist/icons/plus.d.ts +2 -0
  106. package/dist/icons/qrcode.d.ts +2 -0
  107. package/dist/icons/rectangle-portrait-and-arrow-left-fill.d.ts +2 -0
  108. package/dist/icons/rectangle-portrait-and-arrow-left.d.ts +2 -0
  109. package/dist/icons/sensor.d.ts +2 -0
  110. package/dist/icons/signature.d.ts +2 -0
  111. package/dist/icons/solar-panel.d.ts +2 -0
  112. package/dist/icons/square-and-arrow-down-fill.d.ts +2 -0
  113. package/dist/icons/square-and-arrow-down.d.ts +2 -0
  114. package/dist/icons/square-and-arrow-up-fill.d.ts +2 -0
  115. package/dist/icons/square-and-arrow-up.d.ts +2 -0
  116. package/dist/icons/square-and-pencil-fill.d.ts +2 -0
  117. package/dist/icons/square-and-pencil.d.ts +2 -0
  118. package/dist/icons/text-bubble.d.ts +2 -0
  119. package/dist/icons/trash-fill.d.ts +2 -0
  120. package/dist/icons/trash.d.ts +2 -0
  121. package/dist/icons/tree.d.ts +2 -0
  122. package/dist/icons/umbrella-fill.d.ts +2 -0
  123. package/dist/icons/xmark.d.ts +2 -0
  124. package/dist/index.d.ts +3 -0
  125. package/dist/index.esm.js +1168 -0
  126. package/dist/index.esm.js.map +1 -0
  127. package/dist/index.js +1186 -0
  128. package/dist/index.js.map +1 -0
  129. package/dist/types/index.d.ts +2 -0
  130. package/dist/types/utils.d.ts +18 -0
  131. package/dist/utils/class-management.d.ts +29 -0
  132. package/dist/utils/custom-tailwind-merge.d.ts +4 -0
  133. package/dist/utils/get-date.d.ts +153 -0
  134. package/dist/utils/helpers.d.ts +2 -0
  135. package/dist/utils/index.d.ts +9 -0
  136. package/dist/utils/math.d.ts +1 -0
  137. package/dist/utils/regex.d.ts +12 -0
  138. package/dist/utils/string-manipulation.d.ts +17 -0
  139. package/dist/utils/tw-sort.d.ts +1 -0
  140. package/package.json +63 -0
package/README.md ADDED
@@ -0,0 +1,274 @@
1
+ # 窓 <sup>(mado)</sup> UI
2
+
3
+ 窓 UI is a collection of opinionated React components built on Tailwind CSS 4. It was originally created for use on websites built by Andrilla, but is now available for anyone.
4
+
5
+ All of the components are built in similar ways, that always allow for customization.
6
+
7
+ ## How to Use
8
+
9
+ In general it's best to download the latest versions of components to your project, rather than using `npm i mado-ui`, so you can modify the colors to fit your branding.
10
+
11
+ ### Install
12
+
13
+ Install or copy and paste the components you with to use.
14
+
15
+ ```bash
16
+ npm i mado-ui
17
+ ```
18
+
19
+ ```bash
20
+ pnpm i mado-ui
21
+ ```
22
+
23
+ ```bash
24
+ yarn add mado-ui
25
+ ```
26
+
27
+ ```bash
28
+ bun i mado-ui
29
+ ```
30
+
31
+ ### Add CSS
32
+
33
+ Import the Tailwind CSS modifications to your `globals.css`, or copy and paste what you need.
34
+
35
+ ```css
36
+ @import 'mado-ui/css';
37
+ ```
38
+
39
+ ## Tailwind Modifications and Additions
40
+
41
+ If you use the default `mado-ui/css` import, then you will have access to the following classes, and you should expect some minor changes.
42
+
43
+ ### Modifications
44
+
45
+ You can review the `@layer base` to see these changes directly.
46
+
47
+ 1. All elements are positioned relatively by default, instead of static.
48
+ 2. Browser-defined minimum widths are removed.
49
+ 3. `:focus-visible` uses Tailwind's ring instead of outline.
50
+ 4. Default background and text colors are modified to `--color-neutral-50` and `--color-neutral-950` respectively.
51
+ 5. `cursor: pointer;` is back on all buttons, in spite of Tailwind removing this.
52
+ 6. Color inputs have removed browser default padding on `::-webkit-color-swatch-wrapper`.
53
+ 7. Similar to borders, `<svg>` elements use `fill: currentColor;` as the default.
54
+
55
+ ### Additions
56
+
57
+ These apply to `@layer theme`, `@layer components`, `@utility`, and `@custom-variant` as mentioned.
58
+
59
+ 1. Animation utility classes.
60
+ 2. Modified animations to use the new utility classes.
61
+ 3. More animations.
62
+ 4. UI colors that work great in both light and dark mode.
63
+ 5. More easing options.
64
+ 6. More border radiuses.
65
+ 7. Change gap to use variables for easy reuse in children.
66
+ 8. New grid template rows and columns utility classes for 0fr to 1fr transitions.
67
+ 9. Grid template rows and columns added as transition options.
68
+
69
+ ## Components
70
+
71
+ ### Button
72
+
73
+ A pre-styled button component with utility props for easy customization. Supports both button and anchor functionality.
74
+
75
+ Exported from `mado-ui/button`:
76
+
77
+ Default export:
78
+ - Button
79
+
80
+ Props include `padding`, `rounded`, `theme`, and standard button/anchor attributes.
81
+
82
+ #### Example
83
+
84
+ ```tsx
85
+ import Button from 'mado-ui/button'
86
+
87
+ <Button theme="primary" padding="md" rounded="lg">
88
+ Click me
89
+ </Button>
90
+
91
+ <Button href="/about" theme="blue-gradient">
92
+ Link Button
93
+ </Button>
94
+ ```
95
+
96
+ ### Form
97
+
98
+ A comprehensive form component with built-in validation and status management. Works with controlled or uncontrolled inputs.
99
+
100
+ Exported from `mado-ui/form`:
101
+
102
+ Default export:
103
+ - Form
104
+
105
+ Other exports:
106
+ - Input
107
+ - SubmitButton
108
+
109
+ #### Example
110
+
111
+ ```tsx
112
+ import Form, { Input, SubmitButton } from 'mado-ui/form'
113
+
114
+ <Form onSubmit={({ formContext }) => ({ status: 'success' })}>
115
+ <Input name="email" type="email" label="Email Address" />
116
+ <Input name="password" type="password" label="Password" />
117
+ <SubmitButton>Submit Form</SubmitButton>
118
+ </Form>
119
+ ```
120
+
121
+ ### Ghost
122
+
123
+ A loading placeholder component with animated pulse effect.
124
+
125
+ Exported from `mado-ui/ghost`:
126
+
127
+ Default export:
128
+ - Ghost
129
+
130
+ #### Example
131
+
132
+ ```tsx
133
+ import Ghost from 'mado-ui/ghost'
134
+
135
+ <Ghost className="h-4 w-32" />
136
+ ```
137
+
138
+ ### Heading
139
+
140
+ A heading component that renders HTML heading elements (h1-h6) with appropriate styling. Automatically generates IDs for targeting.
141
+
142
+ Exported from `mado-ui/heading`:
143
+
144
+ Default export:
145
+ - Heading
146
+
147
+ #### Example
148
+
149
+ ```tsx
150
+ import Heading from 'mado-ui/heading'
151
+
152
+ <Heading as="h1">Page Title</Heading>
153
+ <Heading as="h2">Section Title</Heading>
154
+ ```
155
+
156
+ ### Input
157
+
158
+ A form input component with built-in validation, labels, and descriptions. Integrates with the Form component's context.
159
+
160
+ Exported from `mado-ui/form`:
161
+
162
+ - Input
163
+
164
+ Props include validation options, styling props, and standard input attributes.
165
+
166
+ #### Example
167
+
168
+ ```tsx
169
+ import { Input } from 'mado-ui/form'
170
+
171
+ <Input
172
+ name="username"
173
+ label="Username"
174
+ description="Choose a unique username"
175
+ required
176
+ />
177
+ ```
178
+
179
+ ### Link
180
+
181
+ A link component with various animation styles and theming options. Supports both single-line and multiline text.
182
+
183
+ Exported from `mado-ui/link`:
184
+
185
+ Default export:
186
+ - Link
187
+
188
+ Other exports:
189
+ - Anchor
190
+
191
+ #### Example
192
+
193
+ ```tsx
194
+ import Link from 'mado-ui/link'
195
+
196
+ <Link href="/about" type="ltr" theme="blue">
197
+ Learn more
198
+ </Link>
199
+
200
+ <Link href="/contact" type="fill-center" theme="primary">
201
+ Get in touch
202
+ </Link>
203
+ ```
204
+
205
+ ### Modal
206
+
207
+ A pre-built modal component based on @headlessui's Dialog. Handles transitions, drag-to-close functionality, and backdrop interactions.
208
+
209
+ Exported from `mado-ui/modal`:
210
+
211
+ Default export:
212
+ - Modal
213
+
214
+ Other exports:
215
+ - ModalDialog
216
+ - ModalTrigger
217
+ - ModalTitle
218
+ - ModalClose
219
+
220
+ The Modal component must wrap both the ModalDialog and ModalTrigger components to work.
221
+
222
+ #### Example
223
+
224
+ ```tsx
225
+ import Modal, { ModalDialog, ModalTrigger } from 'mado-ui/modal'
226
+
227
+ <Modal>
228
+ <ModalTrigger>Open Modal</ModalTrigger>
229
+ <ModalDialog>
230
+ <h2>Modal Content</h2>
231
+ <p>This is the modal content.</p>
232
+ </ModalDialog>
233
+ </Modal>
234
+ ```
235
+
236
+ ### SubmitButton
237
+
238
+ A specialized button for form submission with status-aware styling and content.
239
+
240
+ Exported from `mado-ui/form`:
241
+
242
+ - SubmitButton
243
+
244
+ #### Example
245
+
246
+ ```tsx
247
+ import { SubmitButton } from 'mado-ui/form'
248
+
249
+ <SubmitButton
250
+ loading="Submitting..."
251
+ success="Form Submitted!"
252
+ error="Submission Failed"
253
+ >
254
+ Submit
255
+ </SubmitButton>
256
+ ```
257
+
258
+ ### Time
259
+
260
+ A time component that displays formatted dates and times with customizable precision.
261
+
262
+ Exported from `mado-ui/time`:
263
+
264
+ Default export:
265
+ - Time
266
+
267
+ #### Example
268
+
269
+ ```tsx
270
+ import Time from 'mado-ui/time'
271
+
272
+ <Time dateObject={new Date()} day month year hours minutes />
273
+ <Time dateTime="2024-01-01T12:00:00Z" />
274
+ ```