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
@@ -1,9 +1,9 @@
1
- import { AnyElementProps, OneOf } from '../types';
1
+ import { AnyElementProps, ColorTheme, OneOf } from '../types';
2
2
  import { ElementType } from 'react';
3
- export type AnchorProps<TTag extends ElementType<any, 'a'> = 'a'> = AnyElementProps<TTag> & {
3
+ export type AnchorProps<TTag extends ElementType = 'a'> = AnyElementProps<TTag> & {
4
4
  disabled?: boolean;
5
5
  };
6
- export declare function Anchor({ as, className, disabled, href, onClick, target, rel, ...props }: AnchorProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Anchor<TTag extends ElementType = 'a'>({ as, className, disabled, href, onClick, target, rel, ...props }: AnchorProps<TTag>): import("react/jsx-runtime").JSX.Element;
7
7
  type ThemeColorOrClasses = OneOf<[
8
8
  {
9
9
  /**
@@ -17,18 +17,7 @@ type ThemeColorOrClasses = OneOf<[
17
17
  classes: string;
18
18
  }
19
19
  ]>;
20
- type ColorTheme = OneOf<[
21
- {
22
- /** Color theme. */
23
- theme?: 'blue' | 'brown' | 'green' | 'grey' | 'sky-blue' | 'magenta' | 'orange' | 'pink' | 'purple' | 'red' | 'violet' | 'yellow';
24
- },
25
- {
26
- /** Color theme. */
27
- theme?: 'custom';
28
- customTheme: ThemeColorOrClasses;
29
- }
30
- ]>;
31
- export type LinkProps<TTag extends ElementType<any, 'a'> = 'a'> = AnyElementProps<TTag, OneOf<[
20
+ export type LinkProps<TTag extends ElementType = typeof Anchor> = AnyElementProps<TTag, OneOf<[
32
21
  {
33
22
  type?: 'center' | 'lift' | 'ltr' | 'multiline' | 'multiline-center' | 'multiline-lift' | 'multiline-ltr' | 'multiline-rtl' | 'multiline-static' | 'normal' | 'rtl' | 'static';
34
23
  },
@@ -65,5 +54,62 @@ export type LinkProps<TTag extends ElementType<any, 'a'> = 'a'> = AnyElementProp
65
54
  * @example
66
55
  * <Link href='/about' type='fill-ltr' theme='red' title='About Us'>Learn more about our company</Link>
67
56
  */
68
- export default function Link({ as, className, customTheme, theme, type, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
57
+ export declare function Link<TTag extends ElementType = typeof Anchor>({ as, className, customTheme, theme, type, ...props }: LinkProps<TTag>): import("react/jsx-runtime").JSX.Element;
58
+ export type ExtendedLinkConfig = {
59
+ /** Modifies the default element that is rendered. The `as` prop on the component still overrides the default set here. */
60
+ as?: ElementType;
61
+ /** Adds default classes. */
62
+ className?: string;
63
+ /** Sets the default theme. */
64
+ defaultTheme?: ColorTheme['theme'] | string;
65
+ /** Sets the default for the `type` prop. */
66
+ type?: LinkProps['type'];
67
+ /** Add more theme options. */
68
+ theme?: {
69
+ [themeName: string]: {
70
+ /** Custom theme configuration - supports both multiline and regular link theme formats */
71
+ customTheme: Omit<ThemeColorOrClasses, 'themeColor'> & {
72
+ themeColor?: {
73
+ /** Example: `'after:[--theme-color:var(--color-blue-500)]'` */
74
+ fill: string;
75
+ /** Example: `'[--theme-color:var(--color-blue-500)]'` */
76
+ multilineFill: string;
77
+ };
78
+ };
79
+ /** Additional CSS classes to apply */
80
+ className?: string;
81
+ };
82
+ };
83
+ };
84
+ type ExtendedThemeNames<T extends ExtendedLinkConfig> = T['theme'] extends Record<string, unknown> ? keyof T['theme'] : never;
85
+ export type ExtendedLinkProps<TExtendedConfig extends ExtendedLinkConfig, TTag extends ElementType = typeof Anchor> = Omit<LinkProps<TTag>, 'theme' | 'customTheme'> & {
86
+ theme?: LinkProps<TTag>['theme'] | ExtendedThemeNames<TExtendedConfig>;
87
+ customTheme?: LinkProps<TTag>['customTheme'];
88
+ };
89
+ /**
90
+ * # createLink
91
+ * Creates an extended Link component with additional theme options.
92
+ *
93
+ * @param config - Configuration object defining new themes and defaults
94
+ * @returns A new Link component with extended theme support
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * const MyLink = createLink({
99
+ * as: NextLink,
100
+ * className: 'font-bold',
101
+ * type: 'fill',
102
+ * theme: {
103
+ * primary: {
104
+ * customTheme: {
105
+ * fill: 'after:[--theme-color:var(--color-primary-500)]',
106
+ * multilineFill: '[--theme-color:var(--color-primary-500)]'
107
+ * },
108
+ * className: 'text-white'
109
+ * }
110
+ * }
111
+ * })
112
+ * ```
113
+ */
114
+ export declare function createLink<TExtendedConfig extends ExtendedLinkConfig>(config: TExtendedConfig): <TTag extends ElementType = typeof Anchor>({ theme, className, customTheme, type, as, ...props }: ExtendedLinkProps<TExtendedConfig, TTag>) => import("react/jsx-runtime").JSX.Element;
69
115
  export {};
@@ -15,4 +15,4 @@ export declare function ModalTrigger<T extends ElementType = typeof HeadlessButt
15
15
  export declare function ModalTitle(props: DialogTitleProps): import("react/jsx-runtime").JSX.Element;
16
16
  export declare function ModalDialog(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
17
17
  export declare function ModalClose<T extends ElementType = typeof HeadlessButton>({ as, ...props }: AnyElementProps<T>): import("react/jsx-runtime").JSX.Element;
18
- export default function Modal({ children, className, onClose, onOpen, place }: ModalProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function Modal({ children, className, onClose, onOpen, place }: ModalProps): import("react/jsx-runtime").JSX.Element;
@@ -12,5 +12,5 @@ type TimeProps = HTMLAttributes<HTMLTimeElement> & Partial<{
12
12
  ref?: RefObject<HTMLTimeElement | null>;
13
13
  };
14
14
  import { HTMLAttributes, RefObject } from 'react';
15
- export default function Time({ children, dateObject, dateTime, day, hours, milliseconds, minutes, month, seconds, year, ref, ...props }: TimeProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Time({ children, dateObject, dateTime, day, hours, milliseconds, minutes, month, seconds, year, ref, ...props }: TimeProps): import("react/jsx-runtime").JSX.Element;
16
16
  export {};
@@ -23,4 +23,4 @@ import { Placement } from '@floating-ui/react-dom';
23
23
  import { Button as HeadlessButton } from '@headlessui/react';
24
24
  export declare function TooltipTrigger<T extends ElementType = typeof HeadlessButton>({ as, asChild, children, ...props }: TooltipTriggerProps<T>): import("react/jsx-runtime").JSX.Element;
25
25
  export declare function TooltipPanel<T extends ElementType = 'div'>({ as, children, className, style, ...props }: TooltipPanelProps<T>): import("react/jsx-runtime").JSX.Element;
26
- export default function Tooltip({ anchor, arrow, arrowClassName, children, delay, offset, onClose, onOpen, portal, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function Tooltip({ anchor, arrow, arrowClassName, children, delay, offset, onClose, onOpen, portal, }: TooltipProps): import("react/jsx-runtime").JSX.Element;