mado-ui 0.3.1 → 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 (148) hide show
  1. package/css/index.css +69 -14
  2. package/dist/components/button.d.ts +74 -29
  3. package/dist/components/details.d.ts +5 -7
  4. package/dist/components/drop-down.d.ts +4 -3
  5. package/dist/components/form/fieldset.d.ts +35 -7
  6. package/dist/components/form/index.d.ts +5 -6
  7. package/dist/components/form/input/date/index.d.ts +36 -0
  8. package/dist/components/form/input/index.d.ts +78 -12
  9. package/dist/components/form/submit-button.d.ts +3 -4
  10. package/dist/components/form/textarea.d.ts +1 -1
  11. package/dist/components/ghost.d.ts +1 -1
  12. package/dist/components/heading.d.ts +1 -1
  13. package/dist/components/iframe.d.ts +15 -0
  14. package/dist/components/index.d.ts +10 -11
  15. package/dist/components/link.d.ts +62 -16
  16. package/dist/components/modal.d.ts +1 -1
  17. package/dist/components/time.d.ts +1 -1
  18. package/dist/components/tooltip.d.ts +1 -1
  19. package/dist/components.esm.js +612 -138
  20. package/dist/components.esm.js.map +1 -1
  21. package/dist/components.js +613 -135
  22. package/dist/components.js.map +1 -1
  23. package/dist/hooks/index.d.ts +4 -3
  24. package/dist/hooks/use-fieldset-context.d.ts +22 -0
  25. package/dist/hooks/use-form-context.d.ts +18 -10
  26. package/dist/hooks.esm.js +99 -5
  27. package/dist/hooks.esm.js.map +1 -1
  28. package/dist/hooks.js +100 -3
  29. package/dist/hooks.js.map +1 -1
  30. package/dist/icons/3-people.d.ts +2 -2
  31. package/dist/icons/3-rectangles-desktop-fill.d.ts +2 -2
  32. package/dist/icons/3-rectangles-desktop.d.ts +2 -2
  33. package/dist/icons/airplane.d.ts +2 -2
  34. package/dist/icons/arrow-triangle-2-circlepath-circle-fill.d.ts +2 -2
  35. package/dist/icons/arrow-triangle-2-circlepath-circle.d.ts +2 -2
  36. package/dist/icons/bag-fill.d.ts +2 -2
  37. package/dist/icons/banknote.d.ts +2 -2
  38. package/dist/icons/bell-fill.d.ts +2 -2
  39. package/dist/icons/bolt-car.d.ts +2 -2
  40. package/dist/icons/bolt-fill.d.ts +2 -2
  41. package/dist/icons/bolt-ring-closed.d.ts +2 -2
  42. package/dist/icons/bolt-trianglebadge-exclamationmark.d.ts +2 -2
  43. package/dist/icons/book-fill.d.ts +2 -2
  44. package/dist/icons/bookmark-fill.d.ts +2 -2
  45. package/dist/icons/briefcase-fill.d.ts +2 -2
  46. package/dist/icons/bubble-left-fill.d.ts +2 -2
  47. package/dist/icons/building-2-fill.d.ts +2 -2
  48. package/dist/icons/calendar.d.ts +2 -2
  49. package/dist/icons/camera-fill.d.ts +2 -2
  50. package/dist/icons/car-fill.d.ts +2 -2
  51. package/dist/icons/cart-fill.d.ts +2 -2
  52. package/dist/icons/chart-bar-doc-horizontal.d.ts +2 -2
  53. package/dist/icons/checkmark-seal.d.ts +2 -2
  54. package/dist/icons/checkmark.d.ts +2 -2
  55. package/dist/icons/chevron-down.d.ts +2 -2
  56. package/dist/icons/chevron-left-forwardslash-chevron-right.d.ts +2 -2
  57. package/dist/icons/chevron-left.d.ts +2 -2
  58. package/dist/icons/chevron-right.d.ts +2 -2
  59. package/dist/icons/chevron-up-chevron-down.d.ts +2 -2
  60. package/dist/icons/circle-fill.d.ts +2 -2
  61. package/dist/icons/clock-badge-checkmark.d.ts +2 -2
  62. package/dist/icons/clock-fill.d.ts +2 -2
  63. package/dist/icons/cloud-fill.d.ts +2 -2
  64. package/dist/icons/cube-fill.d.ts +2 -2
  65. package/dist/icons/curve-point-left.d.ts +2 -2
  66. package/dist/icons/dial-high.d.ts +2 -2
  67. package/dist/icons/doc-fill.d.ts +2 -2
  68. package/dist/icons/doc-on-clipboard.d.ts +2 -2
  69. package/dist/icons/doc-on-doc-fill.d.ts +2 -2
  70. package/dist/icons/doc-on-doc.d.ts +2 -2
  71. package/dist/icons/doc-text-magnifyingglass.d.ts +2 -2
  72. package/dist/icons/dollar-sign.d.ts +2 -2
  73. package/dist/icons/ellipsis-circle-fill.d.ts +2 -2
  74. package/dist/icons/ellipsis-circle.d.ts +2 -2
  75. package/dist/icons/envelope-fill.d.ts +2 -2
  76. package/dist/icons/envelope.d.ts +2 -2
  77. package/dist/icons/exclamationmark-octagon.d.ts +2 -2
  78. package/dist/icons/eye.d.ts +2 -2
  79. package/dist/icons/figure-water-fitness.d.ts +2 -2
  80. package/dist/icons/flag-fill.d.ts +2 -2
  81. package/dist/icons/flame-fill.d.ts +2 -2
  82. package/dist/icons/folder-fill.d.ts +2 -2
  83. package/dist/icons/folder.d.ts +2 -2
  84. package/dist/icons/gearshape-fill.d.ts +2 -2
  85. package/dist/icons/gearshape.d.ts +2 -2
  86. package/dist/icons/gift-fill.d.ts +2 -2
  87. package/dist/icons/globe-americas-fill.d.ts +2 -2
  88. package/dist/icons/hare-fill.d.ts +2 -2
  89. package/dist/icons/house-deskclock.d.ts +2 -2
  90. package/dist/icons/house-fill.d.ts +2 -2
  91. package/dist/icons/house.d.ts +2 -2
  92. package/dist/icons/iphone-house.d.ts +2 -2
  93. package/dist/icons/light-ribbon.d.ts +2 -2
  94. package/dist/icons/lightbulb-fill.d.ts +2 -2
  95. package/dist/icons/lightbulb-led.d.ts +2 -2
  96. package/dist/icons/list-bullet-clipboard-fill.d.ts +2 -2
  97. package/dist/icons/magnifyingglass.d.ts +2 -2
  98. package/dist/icons/map-pin-ellipse.d.ts +2 -2
  99. package/dist/icons/minus-plus-batterblock.d.ts +2 -2
  100. package/dist/icons/network-shield.d.ts +2 -2
  101. package/dist/icons/network.d.ts +2 -2
  102. package/dist/icons/newspaper-fill.d.ts +2 -2
  103. package/dist/icons/number.d.ts +2 -2
  104. package/dist/icons/paperplane-fill.d.ts +2 -2
  105. package/dist/icons/person-crop-square.d.ts +2 -2
  106. package/dist/icons/person-fill-questionmark.d.ts +2 -2
  107. package/dist/icons/person-fill.d.ts +2 -2
  108. package/dist/icons/person.d.ts +2 -2
  109. package/dist/icons/phone-arrow-up-right.d.ts +2 -2
  110. package/dist/icons/phone-fill.d.ts +2 -2
  111. package/dist/icons/phone.d.ts +2 -2
  112. package/dist/icons/play-rectangle-fill.d.ts +2 -2
  113. package/dist/icons/plus.d.ts +2 -2
  114. package/dist/icons/qrcode.d.ts +2 -2
  115. package/dist/icons/rectangle-portrait-and-arrow-left-fill.d.ts +2 -2
  116. package/dist/icons/rectangle-portrait-and-arrow-left.d.ts +2 -2
  117. package/dist/icons/sensor.d.ts +2 -2
  118. package/dist/icons/signature.d.ts +2 -2
  119. package/dist/icons/solar-panel.d.ts +2 -2
  120. package/dist/icons/square-and-arrow-down-fill.d.ts +2 -2
  121. package/dist/icons/square-and-arrow-down.d.ts +2 -2
  122. package/dist/icons/square-and-arrow-up-fill.d.ts +2 -2
  123. package/dist/icons/square-and-arrow-up.d.ts +2 -2
  124. package/dist/icons/square-and-pencil-fill.d.ts +2 -2
  125. package/dist/icons/square-and-pencil.d.ts +2 -2
  126. package/dist/icons/text-bubble.d.ts +2 -2
  127. package/dist/icons/trash-fill.d.ts +2 -2
  128. package/dist/icons/trash.d.ts +2 -2
  129. package/dist/icons/tree.d.ts +2 -2
  130. package/dist/icons/umbrella-fill.d.ts +2 -2
  131. package/dist/icons/xmark.d.ts +2 -2
  132. package/dist/icons.esm.js.map +1 -1
  133. package/dist/icons.js.map +1 -1
  134. package/dist/index.esm.js +612 -138
  135. package/dist/index.esm.js.map +1 -1
  136. package/dist/index.js +613 -135
  137. package/dist/index.js.map +1 -1
  138. package/dist/types/index.d.ts +1 -2
  139. package/dist/types/utils.d.ts +20 -0
  140. package/dist/utils/get-date.d.ts +17 -0
  141. package/dist/utils/index.d.ts +8 -9
  142. package/dist/utils/string-manipulation.d.ts +38 -3
  143. package/dist/utils/tw-sort.d.ts +1 -1
  144. package/dist/utils.esm.js +112 -21
  145. package/dist/utils.esm.js.map +1 -1
  146. package/dist/utils.js +113 -20
  147. package/dist/utils.js.map +1 -1
  148. package/package.json +4 -4
package/css/index.css CHANGED
@@ -81,6 +81,7 @@
81
81
  --blur-md: 12px;
82
82
  --blur-2xl: 40px;
83
83
  --blur-3xl: 64px;
84
+ --aspect-video: 16 / 9;
84
85
  --default-transition-duration: 150ms;
85
86
  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
86
87
  --default-font-family: var(--font-sans);
@@ -382,6 +383,9 @@
382
383
  .field-sizing-content {
383
384
  field-sizing: content;
384
385
  }
386
+ .aspect-video {
387
+ aspect-ratio: var(--aspect-video);
388
+ }
385
389
  .size-5 {
386
390
  width: calc(var(--spacing) * 5);
387
391
  height: calc(var(--spacing) * 5);
@@ -451,6 +455,9 @@
451
455
  .min-w-0 {
452
456
  min-width: calc(var(--spacing) * 0);
453
457
  }
458
+ .min-w-64 {
459
+ min-width: calc(var(--spacing) * 64);
460
+ }
454
461
  .min-w-fit {
455
462
  min-width: fit-content;
456
463
  }
@@ -537,6 +544,9 @@
537
544
  .list-disc {
538
545
  list-style-type: disc;
539
546
  }
547
+ .grid-cols-2 {
548
+ grid-template-columns: repeat(2, minmax(0, 1fr));
549
+ }
540
550
  .grid-cols-\[1fr_1rem\] {
541
551
  grid-template-columns: 1fr 1rem;
542
552
  }
@@ -555,6 +565,9 @@
555
565
  .justify-center {
556
566
  justify-content: center;
557
567
  }
568
+ .gap-\(--tw-gap\) {
569
+ gap: var(--tw-gap);
570
+ }
558
571
  .gap-1 {
559
572
  gap: calc(var(--spacing) * 1);
560
573
  }
@@ -1109,6 +1122,12 @@
1109
1122
  .text-black {
1110
1123
  color: var(--color-black);
1111
1124
  }
1125
+ .text-current\/80 {
1126
+ color: currentcolor;
1127
+ @supports (color: color-mix(in lab, red, red)) {
1128
+ color: color-mix(in oklab, currentcolor 80%, transparent);
1129
+ }
1130
+ }
1112
1131
  .text-neutral-50 {
1113
1132
  color: var(--color-neutral-50);
1114
1133
  }
@@ -1278,18 +1297,18 @@
1278
1297
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1279
1298
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1280
1299
  }
1281
- .transition-\[background-size\] {
1282
- transition-property: background-size;
1300
+ .transition-\[background-size\,background-image\,color\] {
1301
+ transition-property: background-size,background-image,color;
1283
1302
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1284
1303
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1285
1304
  }
1286
- .transition-\[background-size_background-image_color\] {
1287
- transition-property: background-size background-image color;
1305
+ .transition-\[background-size\,color\] {
1306
+ transition-property: background-size,color;
1288
1307
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1289
1308
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1290
1309
  }
1291
- .transition-\[background-size_color\] {
1292
- transition-property: background-size color;
1310
+ .transition-\[background-size\] {
1311
+ transition-property: background-size;
1293
1312
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1294
1313
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1295
1314
  }
@@ -1313,8 +1332,8 @@
1313
1332
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1314
1333
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1315
1334
  }
1316
- .transition-\[transform_color\] {
1317
- transition-property: transform color;
1335
+ .transition-\[transform\,color\] {
1336
+ transition-property: transform,color;
1318
1337
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1319
1338
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1320
1339
  }
@@ -1354,6 +1373,31 @@
1354
1373
  --tw-ease: var(--ease-in-out);
1355
1374
  transition-timing-function: var(--ease-in-out);
1356
1375
  }
1376
+ .gap-1 {
1377
+ --tw-gap: calc(var(--spacing) * 1);
1378
+ --tw-gap-x: var(--tw-gap, calc(var(--spacing) * 1));
1379
+ --tw-gap-y: var(--tw-gap, calc(var(--spacing) * 1));
1380
+ }
1381
+ .gap-2 {
1382
+ --tw-gap: calc(var(--spacing) * 2);
1383
+ --tw-gap-x: var(--tw-gap, calc(var(--spacing) * 2));
1384
+ --tw-gap-y: var(--tw-gap, calc(var(--spacing) * 2));
1385
+ }
1386
+ .gap-3 {
1387
+ --tw-gap: calc(var(--spacing) * 3);
1388
+ --tw-gap-x: var(--tw-gap, calc(var(--spacing) * 3));
1389
+ --tw-gap-y: var(--tw-gap, calc(var(--spacing) * 3));
1390
+ }
1391
+ .gap-4 {
1392
+ --tw-gap: calc(var(--spacing) * 4);
1393
+ --tw-gap-x: var(--tw-gap, calc(var(--spacing) * 4));
1394
+ --tw-gap-y: var(--tw-gap, calc(var(--spacing) * 4));
1395
+ }
1396
+ .gap-8 {
1397
+ --tw-gap: calc(var(--spacing) * 8);
1398
+ --tw-gap-x: var(--tw-gap, calc(var(--spacing) * 8));
1399
+ --tw-gap-y: var(--tw-gap, calc(var(--spacing) * 8));
1400
+ }
1357
1401
  .animation-delay-150 {
1358
1402
  --tw-animation-delay: 150ms;
1359
1403
  animation-delay: var(--tw-animation-delay);
@@ -1376,6 +1420,9 @@
1376
1420
  .\[--theme-color\:var\(--color-cyan-500\)\] {
1377
1421
  --theme-color: var(--color-cyan-500);
1378
1422
  }
1423
+ .\[--theme-color\:var\(--color-primary-500\)\] {
1424
+ --theme-color: var(--color-primary-500);
1425
+ }
1379
1426
  .\[--theme-color\:var\(--color-ui-blue\)\] {
1380
1427
  --theme-color: var(--color-ui-blue);
1381
1428
  }
@@ -1709,6 +1756,14 @@
1709
1756
  color: var(--color-ui-red);
1710
1757
  }
1711
1758
  }
1759
+ .after\:transition-\[transform\,background-color\] {
1760
+ &::after {
1761
+ content: var(--tw-content);
1762
+ transition-property: transform,background-color;
1763
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1764
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
1765
+ }
1766
+ }
1712
1767
  .after\:transition-\[transform_background-color\] {
1713
1768
  &::after {
1714
1769
  content: var(--tw-content);
@@ -1752,6 +1807,12 @@
1752
1807
  --theme-color: var(--color-blue-500);
1753
1808
  }
1754
1809
  }
1810
+ .after\:\[--theme-color\:var\(--color-primary-500\)\] {
1811
+ &::after {
1812
+ content: var(--tw-content);
1813
+ --theme-color: var(--color-primary-500);
1814
+ }
1815
+ }
1755
1816
  .after\:\[--theme-color\:var\(--color-ui-blue\)\] {
1756
1817
  &::after {
1757
1818
  content: var(--tw-content);
@@ -2263,12 +2324,6 @@
2263
2324
  line-height: var(--tw-leading, var(--text-5xl--line-height));
2264
2325
  }
2265
2326
  }
2266
- .sm\:text-xl {
2267
- @media (width >= 40rem) {
2268
- font-size: var(--text-xl);
2269
- line-height: var(--tw-leading, var(--text-xl--line-height));
2270
- }
2271
- }
2272
2327
  .sm\:text-\[12rem\] {
2273
2328
  @media (width >= 40rem) {
2274
2329
  font-size: 12rem;
@@ -1,43 +1,88 @@
1
+ import { Url, UrlObject } from 'node:url';
1
2
  import { ElementType } from 'react';
2
- import { AnyElementProps, OneOf } from '../types';
3
- type ColorTheme = OneOf<[
4
- {
5
- /** Color theme. */
6
- theme?: 'blue' | 'brown' | 'green' | 'grey' | 'sky-blue' | 'magenta' | 'orange' | 'pink' | 'purple' | 'red' | 'violet' | 'yellow';
3
+ import { AnyElementProps, ColorTheme, OneOf } from '../types';
4
+ type LinkOrOther<TTag extends ElementType = typeof HeadlessButton> = OneOf<[
5
+ AnyElementProps<TTag> & {
6
+ href?: never;
7
7
  },
8
- {
9
- /** Color theme. */
10
- theme?: 'custom';
11
- customTheme: OneOf<[
12
- {
13
- /** Example: `'[--theme-color:var(--color-blue-500)]'` */
14
- themeColor: string;
15
- },
16
- {
17
- /** This doesn't use any preset color theme classes. */
18
- classes: string;
19
- }
20
- ]>;
8
+ AnyElementProps<typeof Anchor> & {
9
+ href?: string | Url | UrlObject;
21
10
  }
22
11
  ]>;
23
- type LinkOrOther<TTag extends ElementType> = (AnyElementProps<TTag> & {
24
- href?: never;
25
- }) | (AnchorProps & {
26
- href: string;
27
- });
28
- export type ButtonProps<TTag extends ElementType> = LinkOrOther<TTag> & ColorTheme & {
12
+ export type ButtonPadding = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
13
+ export type ButtonBorderRadius = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
14
+ export type ButtonProps<TTag extends ElementType = typeof HeadlessButton> = LinkOrOther<TTag> & ColorTheme & {
29
15
  /** Customizes the theme color to a sensible gradient. */
30
16
  gradient?: boolean;
31
17
  /** The size of the element based on padding. */
32
- padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
33
- /** The size of the border-1 radius. */
34
- rounded?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
18
+ padding?: ButtonPadding;
19
+ /** The size of the border radius. */
20
+ rounded?: ButtonBorderRadius;
35
21
  };
36
- import { AnchorProps } from './link';
22
+ export type ExtendedButtonConfig = {
23
+ /** Modifies the default(s) for what element is rendered. The `as` prop on the component still overrides the default(s) set here. */
24
+ as?: ElementType | {
25
+ /** Modifies the base link element when `href` is present. */
26
+ link?: ElementType;
27
+ /** Modifies the base button element. */
28
+ default?: ElementType;
29
+ };
30
+ /** Adds default classes. */
31
+ className?: string;
32
+ defaultTheme?: ColorTheme['theme'] | string;
33
+ /** Sets the default for the `gradient` prop. */
34
+ gradient?: boolean;
35
+ /** Sets the default for the `padding` prop. */
36
+ padding?: ButtonPadding;
37
+ /** Sets the default for the `rounded` prop. */
38
+ rounded?: ButtonBorderRadius;
39
+ /** Add more theme options. */
40
+ theme?: {
41
+ [themeName: string]: {
42
+ /** Custom theme configuration */
43
+ customTheme: NonNullable<ColorTheme['customTheme']>;
44
+ /** Additional CSS classes to apply */
45
+ className?: string;
46
+ };
47
+ };
48
+ };
49
+ type ExtendedThemeNames<T extends ExtendedButtonConfig> = T['theme'] extends Record<string, unknown> ? keyof T['theme'] : never;
50
+ export type ExtendedButtonProps<TExtendedConfig extends ExtendedButtonConfig, TTag extends ElementType = typeof HeadlessButton> = Omit<ButtonProps<TTag>, 'theme' | 'customTheme'> & {
51
+ theme?: ButtonProps<TTag>['theme'] | ExtendedThemeNames<TExtendedConfig>;
52
+ customTheme?: ButtonProps<TTag>['customTheme'];
53
+ };
54
+ import { Anchor } from './link';
37
55
  import { Button as HeadlessButton } from '@headlessui/react';
38
56
  /**
39
57
  * # Button
40
58
  * - A pre-styled button with utility props for easy customization depending on use case.
41
59
  */
42
- export default function Button<TTag extends ElementType = typeof HeadlessButton>({ className, customTheme, gradient, padding, rounded, theme, ...props }: ButtonProps<TTag>): import("react/jsx-runtime").JSX.Element;
60
+ export declare function Button<TTag extends ElementType = typeof HeadlessButton>({ className, customTheme, gradient, padding, rounded, theme, ...props }: ButtonProps<TTag>): import("react/jsx-runtime").JSX.Element;
61
+ /**
62
+ * # createButton
63
+ * Creates an extended Button component with additional theme options.
64
+ *
65
+ * @param extendedThemes - Configuration object defining new themes
66
+ * @returns A new Button component with extended theme support
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * const MyButton = createButton({
71
+ * as: {
72
+ * default: 'div',
73
+ * link: NextLink
74
+ * },
75
+ * className: 'min-w-64',
76
+ * padding: 'sm',
77
+ * rounded: 'full',
78
+ * theme: {
79
+ * primary: {
80
+ * customTheme: { themeColor: '[--theme-color:var(--color-primary-500)]' },
81
+ * className: 'text-white'
82
+ * }
83
+ * }
84
+ * })
85
+ * ```
86
+ */
87
+ export declare function createButton<TExtendedConfig extends ExtendedButtonConfig>(config: TExtendedConfig): <TTag extends ElementType = typeof HeadlessButton>({ theme, className, customTheme, gradient, padding, rounded, as, ...props }: ExtendedButtonProps<TExtendedConfig, TTag>) => import("react/jsx-runtime").JSX.Element;
43
88
  export {};
@@ -5,14 +5,12 @@ export type DetailsBodyProps<TTag extends ElementType = 'div'> = Omit<Disclosure
5
5
  export type DetailsProps<TTag extends ElementType = 'div'> = Omit<DisclosureProps<TTag>, 'className' | 'role'> & {
6
6
  className?: string;
7
7
  };
8
- export type DetailsSummaryProps<TTag extends ElementType = typeof Button> = Omit<DisclosureButtonProps<TTag> & {
9
- href?: never;
10
- }, 'className' | 'href' | 'role'> & {
8
+ export type DetailsSummaryProps<TTag extends ElementType = typeof Button<typeof HeadlessButton>> = Omit<DisclosureButtonProps<TTag>, 'as' | 'className' | 'role'> & {
11
9
  arrow?: boolean | ReactNode;
12
10
  className?: string;
13
11
  };
14
- import { DisclosureProps, DisclosureButtonProps, DisclosurePanelProps } from '@headlessui/react';
15
- import Button from './button';
16
- export declare function DetailsSummary<TTag extends ElementType = typeof Button<'button'>>({ arrow, as, children, className, ...props }: DetailsSummaryProps<TTag>): import("react/jsx-runtime").JSX.Element;
12
+ import { Button as HeadlessButton, DisclosureProps, DisclosureButtonProps, DisclosurePanelProps } from '@headlessui/react';
13
+ import { Button } from './button';
14
+ export declare function DetailsSummary<TTag extends ElementType = typeof Button>({ arrow, children, className, ...props }: DetailsSummaryProps<TTag>): import("react/jsx-runtime").JSX.Element;
17
15
  export declare function DetailsBody<TTag extends ElementType = 'div'>({ children, className, ...props }: DetailsBodyProps<TTag>): import("react/jsx-runtime").JSX.Element;
18
- export default function Details<TTag extends ElementType = 'div'>({ as, className, ...props }: DetailsProps<TTag>): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Details<TTag extends ElementType = 'div'>({ as, className, ...props }: DetailsProps<TTag>): import("react/jsx-runtime").JSX.Element;
@@ -7,10 +7,11 @@ export type DropDownButtonProps<TTag extends ElementType = 'button'> = Omit<Menu
7
7
  export type DropDownItemProps = MenuItemProps;
8
8
  export type DropDownItemsProps = Omit<MenuItemsProps, 'className' | 'transition'> & {
9
9
  className?: string;
10
+ containerClassName?: string;
10
11
  };
11
12
  export type DropDownProps = MenuProps;
12
13
  export type DropDownSectionProps = MenuSectionProps & {
13
- label: string;
14
+ label?: string;
14
15
  labelProps?: Omit<MenuHeadingProps, 'children'> & {
15
16
  /** @deprecated Use `label` instead. */
16
17
  children?: never;
@@ -22,7 +23,7 @@ export type DropDownSeparatorProps = MenuSeparatorProps;
22
23
  import { MenuButtonProps, MenuHeadingProps, MenuItemProps, MenuItemsProps, MenuProps, MenuSectionProps, MenuSeparatorProps } from '@headlessui/react';
23
24
  export declare function DropDownButton<TTag extends ElementType = 'button'>({ arrow, as, children, className, ...props }: DropDownButtonProps<TTag>): import("react/jsx-runtime").JSX.Element;
24
25
  export declare function DropDownItem({ as, ...props }: DropDownItemProps): import("react/jsx-runtime").JSX.Element;
25
- export declare function DropDownItems({ anchor, children, className, style, ...props }: DropDownItemsProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function DropDownItems({ anchor, children, className, containerClassName, style, ...props }: DropDownItemsProps): import("react/jsx-runtime").JSX.Element;
26
27
  export declare function DropDownSection({ children, label, labelProps, separatorAbove, separatorBelow, ...props }: DropDownSectionProps): import("react/jsx-runtime").JSX.Element;
27
28
  export declare function DropDownSeparator({ className, ...props }: DropDownSeparatorProps): import("react/jsx-runtime").JSX.Element;
28
- export default function DropDown(props: DropDownProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function DropDown(props: DropDownProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,37 @@
1
- export type FieldsetProps = HeadlessFieldsetProps & {
2
- legend?: string;
3
- legendProps?: Omit<LegendProps, 'children'> & {
4
- /** @deprecated Use the `legend` prop instead. */
5
- children?: never;
6
- };
1
+ import { OneOf } from '../../types';
2
+ type NameOrLegend = OneOf<[
3
+ {
4
+ legend: string;
5
+ legendProps?: Omit<LegendProps, 'children'> & {
6
+ /** @deprecated Use the `legend` prop instead. */
7
+ children?: never;
8
+ };
9
+ },
10
+ {
11
+ name: string;
12
+ }
13
+ ]>;
14
+ export type FieldsetProps = Omit<HeadlessFieldsetProps, 'name'> & NameOrLegend & {
15
+ /** When true, the fieldset will only be used for decoration and will not affect the `formContext`. */
16
+ decorative?: boolean;
17
+ /**
18
+ * Joins all values in the fieldset into a single string value.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <Fieldset legend='Full Name' join=' '>
23
+ * <Input name='First Name />
24
+ * <Input name='Last Name />
25
+ * </Fieldset>
26
+ * ```
27
+ * `[{ name: 'First Name', value: 'Johnny' }, { name: 'Last Name', value: 'Appleseed' }]`
28
+ *
29
+ * ↓
30
+ *
31
+ * `[{ name: 'Full Name', value: 'Johnny Appleseed' }]`
32
+ */
33
+ join?: string;
7
34
  };
8
35
  import { FieldsetProps as HeadlessFieldsetProps, LegendProps } from '@headlessui/react';
9
- export default function Fieldset({ children, className, legend, legendProps, ...props }: FieldsetProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function Fieldset({ children, className, decorative, join, legend, legendProps, name, ...props }: FieldsetProps): import("react/jsx-runtime").JSX.Element;
37
+ export {};
@@ -24,9 +24,8 @@ export type FormProps<T extends ElementType = 'form'> = Omit<AnyElementProps<T,
24
24
  }>;
25
25
  };
26
26
  import { FormContext, FormStatus } from '../../hooks';
27
- export default function Form<T extends ElementType = 'form'>({ controlled, initialStatus, ...props }: FormProps<T>): import("react/jsx-runtime").JSX.Element;
28
- import Fieldset, { FieldsetProps } from './fieldset';
29
- import Input, { InputProps } from './input';
30
- import SubmitButton, { SubmitButtonProps } from './submit-button';
31
- import Textarea, { TextareaProps } from './textarea';
32
- export { Fieldset, FieldsetProps, Input, InputProps, Textarea, TextareaProps, SubmitButton, SubmitButtonProps };
27
+ export declare function Form<T extends ElementType = 'form'>({ controlled, initialStatus, ...props }: FormProps<T>): import("react/jsx-runtime").JSX.Element;
28
+ export * from './fieldset';
29
+ export * from './input';
30
+ export * from './submit-button';
31
+ export * from './textarea';
@@ -0,0 +1,36 @@
1
+ import { ColorTheme, OneOf } from '../../../../types';
2
+ export type DateOrTimeSelectorType = 'dropdown' | 'rotary';
3
+ export type DateSelectorType = DateOrTimeSelectorType | 'calendar';
4
+ export type TimeSelectorType = DateOrTimeSelectorType | 'clock';
5
+ export type DateAndTimeSelectorType = DateOrTimeSelectorType | 'clock-and-calendar';
6
+ export type DateTimeInputProps = OneOf<[
7
+ {
8
+ type: 'date';
9
+ /** Using an array, offers multiple, defaulting to the first listed option. */
10
+ ui?: DateSelectorType | DateSelectorType[] | {
11
+ desktop: DateSelectorType | DateSelectorType[];
12
+ mobile: DateSelectorType | DateSelectorType[];
13
+ };
14
+ },
15
+ {
16
+ type: 'datetime';
17
+ /** Using an array, offers multiple, defaulting to the first listed option. */
18
+ ui?: DateAndTimeSelectorType | DateAndTimeSelectorType[] | {
19
+ desktop: DateAndTimeSelectorType | DateAndTimeSelectorType[];
20
+ mobile: DateAndTimeSelectorType | DateAndTimeSelectorType[];
21
+ };
22
+ },
23
+ {
24
+ type: 'time';
25
+ /** Using an array, offers multiple, defaulting to the first listed option. */
26
+ ui?: TimeSelectorType | TimeSelectorType[] | {
27
+ desktop: TimeSelectorType | TimeSelectorType[];
28
+ mobile: TimeSelectorType | TimeSelectorType[];
29
+ };
30
+ }
31
+ ]> & {
32
+ max?: Date;
33
+ min?: Date;
34
+ theme?: ColorTheme;
35
+ };
36
+ export declare function DateTimeInput({ theme, type, ui, ...props }: DateTimeInputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,54 @@
1
1
  import { OneOf } from '../../../types';
2
- type PasswordOptionList = {
3
- matchPreviousInput: boolean;
4
- requireLowercaseCharacter: boolean;
5
- requireNumber: boolean;
6
- requireSpecialCharacter: boolean;
7
- requireUppercaseCharacter: boolean;
8
- };
9
- type TypeOfPasswordOrNot = OneOf<[
2
+ type DateMinMax = Date | [number, DateTimeObject['month'], DateTimeObject['day']] | Pick<DateTimeObject, 'day' | 'month' | 'year'>;
3
+ type DateTimeMinMax = Date | [
4
+ number,
5
+ DateTimeObject['month'],
6
+ DateTimeObject['day'],
7
+ DateTimeObject['hour'],
8
+ DateTimeObject['minute'],
9
+ DateTimeObject['second']
10
+ ] | DateTimeObject;
11
+ type TimeMinMax = [DateTimeObject['hour'], DateTimeObject['minute'], DateTimeObject['second']] | Pick<DateTimeObject, 'hour' | 'minute' | 'second'>;
12
+ type WeekMinMax = [number, WeekNumber];
13
+ type InputType = OneOf<[
14
+ {
15
+ type?: 'date';
16
+ min?: DateMinMax;
17
+ max?: DateMinMax;
18
+ },
19
+ {
20
+ type?: 'datetime' | 'datetime-local';
21
+ min?: DateTimeMinMax;
22
+ max?: DateTimeMinMax;
23
+ },
24
+ {
25
+ type?: 'number';
26
+ max?: number;
27
+ min?: number;
28
+ },
10
29
  {
11
30
  type?: 'password';
12
- passwordOptions?: Partial<PasswordOptionList>;
31
+ options?: Partial<PasswordOptions>;
13
32
  },
14
33
  {
15
- type?: Exclude<HTMLInputTypeAttribute, 'password'>;
34
+ type?: 'tel';
35
+ options?: Partial<PhoneOptions>;
36
+ },
37
+ {
38
+ type?: 'time';
39
+ min?: TimeMinMax;
40
+ max?: TimeMinMax;
41
+ },
42
+ {
43
+ type?: 'week';
44
+ min?: WeekMinMax;
45
+ max?: WeekMinMax;
46
+ },
47
+ {
48
+ type?: Exclude<HTMLInputTypeAttribute, 'date' | 'datetime' | 'datetime-local' | 'number' | 'password' | 'tel' | 'time' | 'week'>;
16
49
  }
17
50
  ]>;
18
- export type InputProps = Omit<HeadlessInputProps, 'name' | 'type'> & TypeOfPasswordOrNot & {
51
+ export type InputProps = Omit<HeadlessInputProps, 'max' | 'min' | 'name' | 'type'> & InputType & {
19
52
  description?: ReactNode;
20
53
  descriptionProps?: Omit<DescriptionProps, 'children'> & {
21
54
  /** @deprecated Use the `description` prop instead. */
@@ -30,7 +63,40 @@ export type InputProps = Omit<HeadlessInputProps, 'name' | 'type'> & TypeOfPassw
30
63
  name: string;
31
64
  ref?: RefObject<HTMLInputElement | null>;
32
65
  };
66
+ type PasswordOptions = {
67
+ matchPreviousInput: boolean;
68
+ requireLowercaseCharacter: boolean;
69
+ requireNumber: boolean;
70
+ requireSpecialCharacter: boolean;
71
+ requireUppercaseCharacter: boolean;
72
+ };
73
+ type PhoneOptions = {
74
+ countryCode: string;
75
+ /**
76
+ * @example
77
+ * format: 'continuous'
78
+ * returns: 5555555555
79
+ *
80
+ * @example
81
+ * format: 'dot'
82
+ * returns: 555.555.5555
83
+ *
84
+ * @example
85
+ * format: 'hyphenated'
86
+ * returns: 555-555-5555
87
+ *
88
+ * @example
89
+ * format: 'space'
90
+ * returns: 555 555 5555
91
+ *
92
+ * @example
93
+ * format: 'standard' (default)
94
+ * returns: (555) 555-5555
95
+ */
96
+ format: 'continuous' | 'dot' | 'hyphenated' | 'none' | 'space' | 'standard';
97
+ };
33
98
  import { HTMLInputTypeAttribute, ReactNode, RefObject } from 'react';
34
99
  import { DescriptionProps, FieldProps, InputProps as HeadlessInputProps, LabelProps } from '@headlessui/react';
35
- export default function Input({ checked, className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid, label, labelProps, name, onBlur, onChange, placeholder, ref, required, type, value, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
100
+ import { DateTimeObject, WeekNumber } from '../../../utils';
101
+ export declare function Input({ checked, className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid, label, labelProps, max, min, name, onBlur, onChange, options, placeholder, ref, required, type, value, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
36
102
  export {};
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- export type SubmitButtonProps = Omit<ButtonProps<'button'> & {
3
- href?: never;
4
- }, 'as' | 'customTheme' | 'href' | 'theme'> & {
2
+ export type SubmitButtonProps = Omit<ButtonProps, 'as' | 'customTheme' | 'href' | 'theme'> & {
3
+ /** This doesn't do much by default, because we use built-in colors for different form states. You'll have to modify a good bit to make this do anything. */
5
4
  customTheme?: {
6
5
  /** Example: `'[--theme-color:var(--color-blue-500)]'` */
7
6
  themeColor: string;
@@ -36,4 +35,4 @@ export type SubmitButtonProps = Omit<ButtonProps<'button'> & {
36
35
  theme?: never;
37
36
  };
38
37
  import { ButtonProps } from '../button';
39
- export default function SubmitButton({ children, className, customTheme, error, incomplete, loading, success, type, ...props }: SubmitButtonProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function SubmitButton({ children, className, customTheme, error, incomplete, loading, success, type, ...props }: SubmitButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -15,4 +15,4 @@ export type TextareaProps = Omit<HeadlessTextareaProps, 'name'> & {
15
15
  };
16
16
  import { ReactNode, RefObject } from 'react';
17
17
  import { DescriptionProps, FieldProps, TextareaProps as HeadlessTextareaProps, LabelProps } from '@headlessui/react';
18
- export default function Textarea({ className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid, label, labelProps, name, onBlur, onChange, placeholder, ref, required, value, ...props }: TextareaProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function Textarea({ className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid, label, labelProps, name, onBlur, onChange, placeholder, ref, required, value, ...props }: TextareaProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  type GhostProps = HTMLAttributes<HTMLDivElement>;
3
- export default function Ghost({ children, className, ...props }: GhostProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function Ghost({ children, className, ...props }: GhostProps): import("react/jsx-runtime").JSX.Element;
4
4
  export {};
@@ -16,4 +16,4 @@ import { HTMLAttributes, RefObject } from 'react';
16
16
  * A heading component that renders HTML heading elements (h1-h6) with appropriate styling.
17
17
  * Automatically generates an ID for the heading based on its content if none is provided.
18
18
  */
19
- export default function Heading({ as, children, customize, className, id, ref, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function Heading({ as, children, customize, className, id, ref, ...props }: HeadingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export type IFrameAllowAttribute = 'accelerometer' | 'autoplay' | 'camera' | 'encrypted-media' | 'fullscreen' | 'gyroscope' | 'magnetometer' | 'microphone' | 'payment' | 'picture-in-picture' | 'publickey-credentials-get' | 'usb';
2
+ export type IFrameReferrerPolicyAttribute = 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
3
+ export type IFrameSandboxAttribute = 'allow-downloads' | 'allow-forms' | 'allow-modals' | 'allow-orientation-lock' | 'allow-pointer-lock' | 'allow-popups' | 'allow-popups-to-escape-sandbox' | 'allow-presentation' | 'allow-same-origin' | 'allow-scripts' | 'allow-top-navigation' | 'allow-top-navigation-by-user-activation' | 'allow-top-navigation-to-custom-protocols';
4
+ export type IFrameProps = Omit<ComponentPropsWithRef<'iframe'>, 'allow' | 'children' | 'referrerPolicy' | 'sandbox' | 'title'> & {
5
+ allow?: IFrameAllowAttribute | IFrameAllowAttribute[] | 'allow-all';
6
+ referrerPolicy?: IFrameReferrerPolicyAttribute;
7
+ sandbox?: IFrameSandboxAttribute | IFrameSandboxAttribute[] | 'allow-all';
8
+ title: string;
9
+ };
10
+ import { ComponentPropsWithRef } from 'react';
11
+ /**
12
+ * # iFrame
13
+ * - An `<iframe/>` with preset classes, backup, and required title for SEO.
14
+ */
15
+ export declare function IFrame({ allow, className, referrerPolicy, sandbox, ...props }: IFrameProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,10 @@
1
- import Button, { ButtonProps } from './button';
2
- import Details, { DetailsBody, DetailsBodyProps, DetailsProps, DetailsSummary, DetailsSummaryProps } from './details';
3
- import DropDown, { DropDownButton, DropDownButtonProps, DropDownItem, DropDownItemProps, DropDownItems, DropDownItemsProps, DropDownProps, DropDownSection, DropDownSectionProps, DropDownSeparator, DropDownSeparatorProps } from './drop-down';
4
- import Form, { Fieldset, FieldsetProps, FormProps, FormSubmitArgs, Input, InputProps, SubmitButton, SubmitButtonProps, Textarea, TextareaProps } from './form';
5
- import Ghost from './ghost';
6
- import Heading, { HeadingProps } from './heading';
7
- import Link, { Anchor, AnchorProps, LinkProps } from './link';
8
- import Modal, { ModalDialog, ModalProps, ModalTrigger } from './modal';
9
- import Time from './time';
10
- import Tooltip, { TooltipPanel, TooltipProps, TooltipTrigger } from './tooltip';
11
- export { Anchor, AnchorProps, Button, ButtonProps, Details, DetailsBody, DetailsBodyProps, DetailsProps, DetailsSummary, DetailsSummaryProps, DropDown, DropDownButton, DropDownButtonProps, DropDownItem, DropDownItemProps, DropDownItems, DropDownItemsProps, DropDownProps, DropDownSection, DropDownSectionProps, DropDownSeparator, DropDownSeparatorProps, Fieldset, FieldsetProps, Form, FormProps, FormSubmitArgs, Ghost, Heading, HeadingProps, Input, InputProps, Link, LinkProps, Modal, ModalDialog, ModalProps, ModalTrigger, SubmitButton, SubmitButtonProps, Textarea, TextareaProps, Time, Tooltip, TooltipPanel, TooltipProps, TooltipTrigger, };
1
+ export * from './button';
2
+ export * from './details';
3
+ export * from './drop-down';
4
+ export * from './form';
5
+ export * from './ghost';
6
+ export * from './heading';
7
+ export * from './link';
8
+ export * from './modal';
9
+ export * from './time';
10
+ export * from './tooltip';