@infonomic/uikit 5.44.0 → 6.0.1

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 (180) hide show
  1. package/README.md +12 -3
  2. package/dist/components/accordion/accordion.d.ts +9 -9
  3. package/dist/components/accordion/accordion.d.ts.map +1 -1
  4. package/dist/components/accordion/accordion.js +4 -4
  5. package/dist/components/accordion/accordion.module.css +6 -5
  6. package/dist/components/accordion/accordion_module.css +4 -4
  7. package/dist/components/avatar/avatar.js +2 -2
  8. package/dist/components/badge/badge.d.ts +5 -13
  9. package/dist/components/badge/badge.d.ts.map +1 -1
  10. package/dist/components/badge/badge.js +12 -9
  11. package/dist/components/button/button-group.d.ts +9 -7
  12. package/dist/components/button/button-group.d.ts.map +1 -1
  13. package/dist/components/button/button-group.js +26 -36
  14. package/dist/components/button/button.d.ts +6 -13
  15. package/dist/components/button/button.d.ts.map +1 -1
  16. package/dist/components/button/button.js +19 -18
  17. package/dist/components/button/button.module.css +32 -54
  18. package/dist/components/button/button_module.css +7 -10
  19. package/dist/components/button/combo-button.d.ts +1 -1
  20. package/dist/components/button/combo-button.d.ts.map +1 -1
  21. package/dist/components/button/combo-button.js +13 -9
  22. package/dist/components/button/combo-button.module.css +16 -7
  23. package/dist/components/button/combo-button_module.css +22 -4
  24. package/dist/components/button/icon-button.d.ts +2 -3
  25. package/dist/components/button/icon-button.d.ts.map +1 -1
  26. package/dist/components/card/card.d.ts +5 -12
  27. package/dist/components/card/card.d.ts.map +1 -1
  28. package/dist/components/card/card.js +13 -9
  29. package/dist/components/chips/chip.d.ts +5 -11
  30. package/dist/components/chips/chip.d.ts.map +1 -1
  31. package/dist/components/chips/chip.js +36 -28
  32. package/dist/components/chips/chip.module.css +22 -36
  33. package/dist/components/chips/chip_module.css +3 -6
  34. package/dist/components/dropdown/dropdown.d.ts +28 -14
  35. package/dist/components/dropdown/dropdown.d.ts.map +1 -1
  36. package/dist/components/dropdown/dropdown.js +34 -20
  37. package/dist/components/forms/calendar.d.ts +1 -1
  38. package/dist/components/forms/calendar.d.ts.map +1 -1
  39. package/dist/components/forms/calendar.js +38 -29
  40. package/dist/components/forms/checkbox.astro +13 -8
  41. package/dist/components/forms/checkbox.d.ts +6 -2
  42. package/dist/components/forms/checkbox.d.ts.map +1 -1
  43. package/dist/components/forms/checkbox.js +11 -7
  44. package/dist/components/forms/checkbox.module.css +20 -20
  45. package/dist/components/forms/checkbox_module.css +13 -10
  46. package/dist/components/forms/input.module.css +10 -11
  47. package/dist/components/forms/input_module.css +3 -5
  48. package/dist/components/forms/radio-group.d.ts +6 -5
  49. package/dist/components/forms/radio-group.d.ts.map +1 -1
  50. package/dist/components/forms/radio-group.js +9 -4
  51. package/dist/components/forms/radio-group.module.css +13 -22
  52. package/dist/components/forms/radio-group_module.css +6 -24
  53. package/dist/components/forms/select.d.ts +4 -5
  54. package/dist/components/forms/select.d.ts.map +1 -1
  55. package/dist/components/forms/select.js +27 -29
  56. package/dist/components/forms/select.module.css +22 -22
  57. package/dist/components/forms/select.module.js +15 -15
  58. package/dist/components/forms/select_module.css +15 -15
  59. package/dist/components/notifications/@types/toast.d.ts +9 -7
  60. package/dist/components/notifications/@types/toast.d.ts.map +1 -1
  61. package/dist/components/notifications/toast.d.ts +12 -16
  62. package/dist/components/notifications/toast.d.ts.map +1 -1
  63. package/dist/components/notifications/toast.js +73 -57
  64. package/dist/components/notifications/toast.module.css +151 -177
  65. package/dist/components/notifications/toast.module.js +8 -12
  66. package/dist/components/notifications/toast_module.css +114 -159
  67. package/dist/components/pager/first-button.d.ts +2 -2
  68. package/dist/components/pager/first-button.d.ts.map +1 -1
  69. package/dist/components/pager/first-button.js +23 -16
  70. package/dist/components/pager/last-button.d.ts +2 -2
  71. package/dist/components/pager/last-button.d.ts.map +1 -1
  72. package/dist/components/pager/last-button.js +23 -16
  73. package/dist/components/pager/next-button.d.ts +2 -2
  74. package/dist/components/pager/next-button.d.ts.map +1 -1
  75. package/dist/components/pager/next-button.js +27 -20
  76. package/dist/components/pager/number-button.d.ts +2 -2
  77. package/dist/components/pager/number-button.d.ts.map +1 -1
  78. package/dist/components/pager/number-button.js +28 -23
  79. package/dist/components/pager/pagination.d.ts +8 -13
  80. package/dist/components/pager/pagination.d.ts.map +1 -1
  81. package/dist/components/pager/previous-button.d.ts +2 -2
  82. package/dist/components/pager/previous-button.d.ts.map +1 -1
  83. package/dist/components/pager/previous-button.js +25 -18
  84. package/dist/components/scroll-area/scroll-area.d.ts +2 -2
  85. package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
  86. package/dist/components/scroll-area/scroll-area.js +4 -2
  87. package/dist/components/tabs/tabs.d.ts +13 -13
  88. package/dist/components/tabs/tabs.d.ts.map +1 -1
  89. package/dist/components/tabs/tabs.js +8 -8
  90. package/dist/components/tabs/tabs.module.css +8 -17
  91. package/dist/components/tabs/tabs_module.css +1 -1
  92. package/dist/components/tooltip/tooltip.d.ts +6 -8
  93. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  94. package/dist/components/tooltip/tooltip.js +49 -20
  95. package/dist/components/tooltip/tooltip.module.css +43 -10
  96. package/dist/components/tooltip/tooltip.module.js +7 -1
  97. package/dist/components/tooltip/tooltip_module.css +36 -4
  98. package/dist/hooks/use-focus-trap/index.d.ts +2 -0
  99. package/dist/hooks/use-focus-trap/index.d.ts.map +1 -0
  100. package/dist/hooks/use-focus-trap/index.js +1 -0
  101. package/dist/hooks/use-focus-trap/scope-tab.d.ts +11 -0
  102. package/dist/hooks/use-focus-trap/scope-tab.d.ts.map +1 -0
  103. package/dist/hooks/use-focus-trap/scope-tab.js +19 -0
  104. package/dist/hooks/use-focus-trap/tabbable.d.ts +14 -0
  105. package/dist/hooks/use-focus-trap/tabbable.d.ts.map +1 -0
  106. package/dist/hooks/use-focus-trap/tabbable.js +36 -0
  107. package/dist/hooks/use-focus-trap/use-focus-trap.d.ts +11 -0
  108. package/dist/hooks/use-focus-trap/use-focus-trap.d.ts.map +1 -0
  109. package/dist/hooks/use-focus-trap/use-focus-trap.js +45 -0
  110. package/dist/icons/chevron-up-icon.d.ts +7 -0
  111. package/dist/icons/chevron-up-icon.d.ts.map +1 -0
  112. package/dist/icons/chevron-up-icon.js +27 -0
  113. package/dist/lib/ripple.d.ts +25 -0
  114. package/dist/lib/ripple.d.ts.map +1 -0
  115. package/dist/lib/ripple.js +53 -0
  116. package/dist/styles/components-vanilla.css +1 -1
  117. package/dist/widgets/datepicker/datepicker.d.ts +1 -1
  118. package/dist/widgets/datepicker/datepicker.d.ts.map +1 -1
  119. package/dist/widgets/datepicker/datepicker.js +118 -116
  120. package/dist/widgets/datepicker/datepicker.module.css +6 -5
  121. package/dist/widgets/datepicker/datepicker_module.css +4 -4
  122. package/dist/widgets/drawer/drawer-wrapper.d.ts.map +1 -1
  123. package/dist/widgets/drawer/drawer-wrapper.js +1 -1
  124. package/dist/widgets/modal/modal-wrapper.d.ts.map +1 -1
  125. package/dist/widgets/modal/modal-wrapper.js +1 -1
  126. package/package.json +2 -6
  127. package/src/components/accordion/accordion.module.css +6 -5
  128. package/src/components/accordion/accordion.stories.tsx +10 -13
  129. package/src/components/accordion/accordion.tsx +13 -13
  130. package/src/components/avatar/avatar.tsx +2 -2
  131. package/src/components/badge/badge.tsx +20 -29
  132. package/src/components/button/button-group.tsx +60 -44
  133. package/src/components/button/button.module.css +32 -54
  134. package/src/components/button/button.tsx +35 -47
  135. package/src/components/button/combo-button.module.css +16 -7
  136. package/src/components/button/combo-button.tsx +17 -9
  137. package/src/components/button/icon-button.tsx +3 -5
  138. package/src/components/card/card.tsx +20 -32
  139. package/src/components/chips/chip.module.css +22 -36
  140. package/src/components/chips/chip.stories.tsx +2 -2
  141. package/src/components/chips/chip.tsx +59 -57
  142. package/src/components/dropdown/dropdown.stories.tsx +2 -4
  143. package/src/components/dropdown/dropdown.tsx +86 -40
  144. package/src/components/forms/calendar.tsx +43 -33
  145. package/src/components/forms/checkbox-group.tsx +1 -1
  146. package/src/components/forms/checkbox.astro +13 -8
  147. package/src/components/forms/checkbox.module.css +20 -20
  148. package/src/components/forms/checkbox.tsx +11 -6
  149. package/src/components/forms/input.module.css +10 -11
  150. package/src/components/forms/radio-group.module.css +13 -22
  151. package/src/components/forms/radio-group.tsx +13 -11
  152. package/src/components/forms/select.module.css +22 -22
  153. package/src/components/forms/select.tsx +36 -33
  154. package/src/components/notifications/@types/toast.ts +9 -7
  155. package/src/components/notifications/toast.module.css +151 -177
  156. package/src/components/notifications/toast.stories.tsx +21 -23
  157. package/src/components/notifications/toast.tsx +90 -86
  158. package/src/components/pager/first-button.tsx +24 -26
  159. package/src/components/pager/last-button.tsx +24 -25
  160. package/src/components/pager/next-button.tsx +24 -23
  161. package/src/components/pager/number-button.tsx +37 -36
  162. package/src/components/pager/pagination.tsx +4 -11
  163. package/src/components/pager/previous-button.tsx +24 -24
  164. package/src/components/scroll-area/scroll-area.tsx +3 -3
  165. package/src/components/tabs/tabs.module.css +8 -17
  166. package/src/components/tabs/tabs.stories.tsx +5 -5
  167. package/src/components/tabs/tabs.tsx +17 -16
  168. package/src/components/tooltip/tooltip.module.css +43 -10
  169. package/src/components/tooltip/tooltip.stories.tsx +4 -4
  170. package/src/components/tooltip/tooltip.tsx +56 -28
  171. package/src/hooks/use-focus-trap/index.ts +1 -0
  172. package/src/hooks/use-focus-trap/scope-tab.ts +48 -0
  173. package/src/hooks/use-focus-trap/tabbable.ts +72 -0
  174. package/src/hooks/use-focus-trap/use-focus-trap.ts +83 -0
  175. package/src/icons/chevron-up-icon.tsx +37 -0
  176. package/src/lib/ripple.ts +95 -0
  177. package/src/widgets/datepicker/datepicker.module.css +6 -5
  178. package/src/widgets/datepicker/datepicker.tsx +137 -135
  179. package/src/widgets/drawer/drawer-wrapper.tsx +1 -1
  180. package/src/widgets/modal/modal-wrapper.tsx +1 -1
package/README.md CHANGED
@@ -10,11 +10,11 @@ It just doesn't belong in UI kits and libraries.
10
10
 
11
11
  ## Rationale
12
12
 
13
- In addition to our thoughts above, this kit is built around the philosophy of adopting or 'folding in' best-in-class components, like the ones in well-known 'à la carte' headless component libraries such as [Base UI](https://base-ui.com/), [Radix UI](https://www.radix-ui.com/), and [React Aria](https://react-spectrum.adobe.com/react-aria/index.html) as well as individually well-known components such as [React Day Picker](https://github.com/gpbl/react-day-picker) and more.
13
+ In addition to our thoughts above, this kit is built around the philosophy of adopting or 'folding in' best-in-class components, like the ones in well-known 'à la carte' headless component libraries such as [Base UI](https://base-ui.com/), and [React Aria](https://react-spectrum.adobe.com/react-aria/index.html) as well as individually well-known components such as [React Day Picker](https://github.com/gpbl/react-day-picker) and more.
14
14
 
15
15
  Having lived through a full generation of 'all-in-one' and difficult to override themed UI kits like Bootstrap and Material UI, the trend towards composable headless (unstyled) component libraries is a welcome one - and one that forms the basis of this kit.
16
16
 
17
- Many of the current components are built on Radix UI. The great thing about wrapping these components in a client-consumable interface and library, is that in theory at least, the consumer of our kit's components won't have to worry about implementation details, or migration from Radix UI to Base UI or other. The 'contract' and core styling semantics will never change.
17
+ Many of the current components are built on Base UI. The great thing about wrapping these components in a client-consumable interface and library, is that in theory at least, the consumer of our kit's components won't have to worry about implementation details, or migration from Base UI to another underlying component library. The 'contract' and core styling semantics will never change.
18
18
 
19
19
  ## Design Goals
20
20
 
@@ -36,7 +36,7 @@ For components - this means ensuring that the layer specificity order appears at
36
36
 
37
37
  The use of CSS modules will also allow us to support exporting individual components separately (we export a single bundle for import at the moment) helping to reduce the import and bundle size of the consuming client. Once we've enabled single component exports, a client will then be able to import the main style.css file followed by an individual component. We'll be revisiting this soon.
38
38
 
39
- Lastly - we highly value the option to 'tell' components to ignore or override a top-level theme decision of light or dark. There is an intentionally duplicated `.not-dark` class selector in our tokens.css file. Since we're using shadows to create ring offsets (which we desire for focus, active modes etc.) and since CSS shadows need a background color - being able to use `.not-dark` means that we can override components that need to be in 'dark mode' on an otherwise 'light theme', or that need to be in .not-dark mode, on an otherwise 'dark theme'. This allows us to use the correct ring, background and component colors for components that might be placed on fixed dark or light background panels or sections - irrespective of the currently selected theme
39
+ Lastly - we highly value the option to 'tell' components to ignore or override a top-level theme decision of light or dark. There is an intentionally duplicated `.not-dark` class selector in our functional tokens file. Being able to use `.not-dark` means that we can override components that need to be in 'dark mode' on an otherwise 'light theme', or that need to be in .not-dark mode, on an otherwise 'dark theme'.
40
40
 
41
41
  ## Getting Started
42
42
 
@@ -119,6 +119,15 @@ Here's an example Tailwind CSS integration. Note that we have our own reset, and
119
119
  'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
120
120
  'Liberation Mono', 'Courier New', monospace;
121
121
 
122
+ --color-primary: var(--primary);
123
+ --color-secondary: var(--secondary);
124
+ --color-accent: var(--accent);
125
+ --color-noeffect: var(--noeffect);
126
+ --color-success: var(--success);
127
+ --color-info: var(--info);
128
+ --color-warning: var(--warning);
129
+ --color-danger: var(--danger);
130
+
122
131
  --color-theme-25: var(--theme-25);
123
132
  --color-theme-50: var(--theme-50);
124
133
  --color-theme-100: var(--theme-100);
@@ -4,29 +4,29 @@
4
4
  * style the accordion here in order to provide a base for customization.
5
5
  */
6
6
  import type React from 'react';
7
- import { Accordion as AccordionPrimitive } from 'radix-ui';
7
+ import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion';
8
8
  export type AccordionRootElement = React.ComponentRef<'div'>;
9
9
  export type AccordionItemElement = React.ComponentRef<'div'>;
10
- export type AccordionHeaderElement = React.ComponentRef<'h2'>;
10
+ export type AccordionHeaderElement = React.ComponentRef<'h3'>;
11
11
  export type AccordionTriggerElement = React.ComponentRef<'button'>;
12
- export type AccordionContentElement = React.ComponentRef<'div'>;
12
+ export type AccordionPanelElement = React.ComponentRef<'div'>;
13
13
  export declare const Accordion: {
14
14
  Root: ({ children, className, ref, ...props }: {
15
15
  children: React.ReactNode;
16
16
  className?: string;
17
17
  ref?: React.RefObject<AccordionRootElement>;
18
- } & (AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps)) => React.JSX.Element;
19
- Item: ({ ref, children, className, ...props }: AccordionPrimitive.AccordionItemProps & {
18
+ } & React.ComponentProps<typeof AccordionPrimitive.Root>) => React.JSX.Element;
19
+ Item: ({ ref, children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item> & {
20
20
  ref?: React.RefObject<AccordionItemElement>;
21
21
  }) => React.JSX.Element;
22
- Header: ({ ref, children, className, ...props }: AccordionPrimitive.AccordionHeaderProps & {
22
+ Header: ({ ref, children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Header> & {
23
23
  ref?: React.RefObject<AccordionHeaderElement>;
24
24
  }) => React.JSX.Element;
25
- Trigger: ({ ref, children, className, ...props }: AccordionPrimitive.AccordionTriggerProps & {
25
+ Trigger: ({ ref, children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger> & {
26
26
  ref?: React.RefObject<AccordionTriggerElement>;
27
27
  }) => React.JSX.Element;
28
- Content: ({ ref, children, className, ...props }: AccordionPrimitive.AccordionContentProps & {
29
- ref?: React.RefObject<AccordionContentElement>;
28
+ Panel: ({ ref, children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Panel> & {
29
+ ref?: React.RefObject<AccordionPanelElement>;
30
30
  }) => React.JSX.Element;
31
31
  };
32
32
  //# sourceMappingURL=accordion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAI1D,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAuB5D,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAoB5D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,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{ Accordion } from "radix-ui";
5
5
  import accordion_module from "./accordion.module.js";
6
6
  const Root = ({ children, className, ref, ...props })=>/*#__PURE__*/ jsx(Accordion.Root, {
7
7
  ref: ref,
@@ -33,8 +33,8 @@ const Trigger = function({ ref, children, className, ...props }) {
33
33
  children: children
34
34
  });
35
35
  };
36
- const Content = function({ ref, children, className, ...props }) {
37
- return /*#__PURE__*/ jsx(Accordion.Content, {
36
+ const Panel = function({ ref, children, className, ...props }) {
37
+ return /*#__PURE__*/ jsx(Accordion.Panel, {
38
38
  className: classnames('infonomic-accordion-content', accordion_module.content, className),
39
39
  ...props,
40
40
  ref: ref,
@@ -46,6 +46,6 @@ const accordion_Accordion = {
46
46
  Item: Item,
47
47
  Header: Header,
48
48
  Trigger: Trigger,
49
- Content: Content
49
+ Panel: Panel
50
50
  };
51
51
  export { accordion_Accordion as Accordion };
@@ -1,6 +1,7 @@
1
1
  @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-components;
2
2
 
3
3
  @layer infonomic-components {
4
+
4
5
  .item,
5
6
  :global(.infonomic-accordion-item) {
6
7
  overflow: hidden;
@@ -25,11 +26,11 @@
25
26
  :global(.infonomic-accordion-content) {
26
27
  overflow: hidden;
27
28
 
28
- &[data-state="open"] {
29
+ &[data-open] {
29
30
  animation: accordionSlideDown 300ms cubic-bezier(0.87, 0, 0.13, 1);
30
31
  }
31
32
 
32
- &[data-state="closed"] {
33
+ &[data-ending-style] {
33
34
  animation: accordionSlideUp 300ms cubic-bezier(0.87, 0, 0.13, 1);
34
35
  }
35
36
  }
@@ -40,17 +41,17 @@
40
41
  }
41
42
 
42
43
  to {
43
- height: var(--radix-accordion-content-height);
44
+ height: var(--accordion-panel-height);
44
45
  }
45
46
  }
46
47
 
47
48
  @keyframes accordionSlideUp {
48
49
  from {
49
- height: var(--radix-accordion-content-height);
50
+ height: var(--accordion-panel-height);
50
51
  }
51
52
 
52
53
  to {
53
54
  height: 0;
54
55
  }
55
56
  }
56
- }
57
+ }
@@ -22,11 +22,11 @@
22
22
  overflow: hidden;
23
23
  }
24
24
 
25
- :is(.content-KoW8ID, .infonomic-accordion-content)[data-state="open"] {
25
+ :is(.content-KoW8ID, .infonomic-accordion-content)[data-open] {
26
26
  animation: .3s cubic-bezier(.87, 0, .13, 1) accordionSlideDown-gllXUs;
27
27
  }
28
28
 
29
- :is(.content-KoW8ID, .infonomic-accordion-content)[data-state="closed"] {
29
+ :is(.content-KoW8ID, .infonomic-accordion-content)[data-ending-style] {
30
30
  animation: .3s cubic-bezier(.87, 0, .13, 1) accordionSlideUp-mpDLB0;
31
31
  }
32
32
 
@@ -36,13 +36,13 @@
36
36
  }
37
37
 
38
38
  to {
39
- height: var(--radix-accordion-content-height);
39
+ height: var(--accordion-panel-height);
40
40
  }
41
41
  }
42
42
 
43
43
  @keyframes accordionSlideUp-mpDLB0 {
44
44
  from {
45
- height: var(--radix-accordion-content-height);
45
+ height: var(--accordion-panel-height);
46
46
  }
47
47
 
48
48
  to {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Avatar } from "@base-ui/react/avatar";
3
4
  import classnames from "classnames";
4
- import { Avatar } from "radix-ui";
5
5
  import avatar_module from "./avatar.module.js";
6
6
  const url = 'https://picsum.photos/150';
7
7
  const avatar_Avatar = ({ initials })=>/*#__PURE__*/ jsxs(Avatar.Root, {
@@ -14,7 +14,7 @@ const avatar_Avatar = ({ initials })=>/*#__PURE__*/ jsxs(Avatar.Root, {
14
14
  }),
15
15
  /*#__PURE__*/ jsx(Avatar.Fallback, {
16
16
  className: classnames('infonomic-avatar-fallback', avatar_module["avatar-fallback"]),
17
- delayMs: 600,
17
+ delay: 600,
18
18
  children: /*#__PURE__*/ jsx("span", {
19
19
  className: classnames('infonomic-avatar-text', avatar_module["avatar-text"]),
20
20
  children: initials
@@ -1,21 +1,13 @@
1
+ import { useRender } from '@base-ui/react/use-render';
1
2
  import type { Intent } from '../@types/shared';
2
- type AsDiv = {
3
- asChild?: false;
4
- } & React.ComponentPropsWithoutRef<'div'>;
5
- interface AsSlot {
6
- asChild?: true;
7
- }
8
- export type BadgeRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
9
- export type BadgeProps<C extends React.ElementType = 'div'> = {
3
+ export type BadgeProps = useRender.ComponentProps<'div'> & {
10
4
  children: React.ReactNode;
11
5
  intent?: Intent;
12
6
  className?: string;
13
- asChild?: boolean;
14
- ref?: BadgeRefType<C>;
15
- } & (AsSlot | AsDiv);
7
+ ref?: React.Ref<HTMLDivElement>;
8
+ };
16
9
  export declare const Badge: {
17
- <C extends React.ElementType = "div">({ className, intent, children, asChild, ref, ...rest }: BadgeProps<C>): React.JSX.Element;
10
+ ({ className, intent, children, render, ref, ...rest }: BadgeProps): React.JSX.Element;
18
11
  displayName: string;
19
12
  };
20
- export {};
21
13
  //# sourceMappingURL=badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAEzC,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;CACf;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE7F,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI;IAC5D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CACtB,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;AAEpB,eAAO,MAAM,KAAK;KAAI,CAAC,SAAS,KAAK,CAAC,WAAW,kEAO9C,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAiBnC,CAAA"}
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAIrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,KAAK;4DAOf,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAmBhC,CAAA"}
@@ -1,15 +1,18 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Slot } from "@radix-ui/react-slot";
1
+ import { useRender } from "@base-ui/react/use-render";
3
2
  import classnames from "classnames";
4
3
  import badge_module from "./badge.module.js";
5
- const Badge = ({ className, intent = 'primary', children, asChild, ref, ...rest })=>{
6
- const Comp = true === asChild ? Slot : 'div';
7
- return /*#__PURE__*/ jsx(Comp, {
8
- ref: ref,
9
- className: classnames('infonomic-badge', `infonomic-badge-${intent}`, badge_module.badge, badge_module[intent], className),
10
- ...rest,
11
- children: children
4
+ const Badge = ({ className, intent = 'primary', children, render, ref, ...rest })=>{
5
+ const element = useRender({
6
+ defaultTagName: 'div',
7
+ render,
8
+ ref,
9
+ props: {
10
+ ...rest,
11
+ className: classnames('infonomic-badge', `infonomic-badge-${intent}`, badge_module.badge, badge_module[intent], className),
12
+ children
13
+ }
12
14
  });
15
+ return element;
13
16
  };
14
17
  Badge.displayName = 'Badge';
15
18
  export { Badge };
@@ -1,5 +1,6 @@
1
- import React, { type ComponentPropsWithoutRef, type Ref } from 'react';
2
- import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
1
+ import React, { type Ref } from 'react';
2
+ import { Toggle } from '@base-ui/react/toggle';
3
+ import { ToggleGroup } from '@base-ui/react/toggle-group';
3
4
  import type { EnableRipple, Intent, Size, Variant } from './@types/button';
4
5
  interface ButtonGroupContextType {
5
6
  variant?: Variant;
@@ -10,13 +11,13 @@ interface ButtonGroupContextType {
10
11
  inactive?: Intent;
11
12
  value?: string | string[];
12
13
  }
13
- type ToggleGroupRootProps = ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;
14
- type SingleToggleGroupProps = Omit<ToggleGroupRootProps, 'type' | 'value' | 'onValueChange'> & {
14
+ type ToggleGroupProps = React.ComponentProps<typeof ToggleGroup>;
15
+ type SingleToggleGroupProps = Omit<ToggleGroupProps, 'multiple' | 'value' | 'onValueChange'> & {
15
16
  type: 'single';
16
17
  value?: string;
17
18
  onValueChange?: (value: string) => void;
18
19
  };
19
- type MultipleToggleGroupProps = Omit<ToggleGroupRootProps, 'type' | 'value' | 'onValueChange'> & {
20
+ type MultipleToggleGroupProps = Omit<ToggleGroupProps, 'multiple' | 'value' | 'onValueChange'> & {
20
21
  type: 'multiple';
21
22
  value?: string[];
22
23
  onValueChange?: (value: string[]) => void;
@@ -26,12 +27,13 @@ export type ButtonGroupProps = (SingleToggleGroupProps | MultipleToggleGroupProp
26
27
  ref?: Ref<HTMLDivElement>;
27
28
  } & ButtonGroupContextType;
28
29
  declare const ButtonGroup: ({ className, variant, size, ripple, expandToFit, active, inactive, type, onValueChange, value, defaultValue, children, ref, ...props }: ButtonGroupProps) => React.JSX.Element;
29
- type ButtonGroupItemProps = ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & {
30
+ type ButtonGroupItemProps = Omit<React.ComponentProps<typeof Toggle>, 'className'> & {
31
+ className?: string;
30
32
  ref?: Ref<HTMLButtonElement>;
31
33
  } & ButtonGroupContextType;
32
34
  declare const ButtonGroupItem: {
33
35
  ({ className, children, value, ref, ...props }: ButtonGroupItemProps): React.JSX.Element;
34
- displayName: string | undefined;
36
+ displayName: string;
35
37
  };
36
38
  export { ButtonGroup, ButtonGroupItem };
37
39
  //# sourceMappingURL=button-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-group.d.ts","sourceRoot":"","sources":["../../../src/components/button/button-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAGtE,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAE1E,UAAU,sBAAsB;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1B;AAWD,KAAK,oBAAoB,GAAG,wBAAwB,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAA;AAGtF,KAAK,sBAAsB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,eAAe,CAAC,GAAG;IAC7F,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK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,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAC7B,GAAG,sBAAsB,CAAA;AAE1B,QAAA,MAAM,eAAe;oDAAmD,oBAAoB;;CAyB3F,CAAA;AAID,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA"}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import react from "react";
4
+ import { Toggle } from "@base-ui/react/toggle";
5
+ import { ToggleGroup } from "@base-ui/react/toggle-group";
4
6
  import classnames from "classnames";
5
- import { ToggleGroup } from "radix-ui";
6
7
  import { Button } from "./button.js";
7
8
  import button_group_module from "./button-group.module.js";
8
9
  const ButtonGroupContext = /*#__PURE__*/ react.createContext({
@@ -14,33 +15,23 @@ const ButtonGroupContext = /*#__PURE__*/ react.createContext({
14
15
  inactive: 'noeffect'
15
16
  });
16
17
  const ButtonGroup = ({ className, variant = 'filled', size = 'md', ripple = true, expandToFit = false, active = 'primary', inactive = 'noeffect', type, onValueChange, value, defaultValue, children, ref, ...props })=>{
17
- if ('multiple' === type) return /*#__PURE__*/ jsx(ToggleGroup.Root, {
18
- type: "multiple",
19
- defaultValue: defaultValue,
20
- value: value,
21
- ref: ref,
22
- onValueChange: onValueChange,
23
- className: classnames(button_group_module["button-group"], className),
24
- ...props,
25
- children: /*#__PURE__*/ jsx(ButtonGroupContext, {
26
- value: {
27
- variant,
28
- size,
29
- ripple,
30
- expandToFit,
31
- active,
32
- inactive,
33
- value
34
- },
35
- children: children
36
- })
37
- });
38
- return /*#__PURE__*/ jsx(ToggleGroup.Root, {
39
- type: "single",
40
- value: value,
41
- defaultValue: defaultValue,
18
+ const isMultiple = 'multiple' === type;
19
+ const handleValueChange = (newValue, event)=>{
20
+ if (!onValueChange) return;
21
+ isMultiple ? onValueChange(newValue) : onValueChange(newValue[0] ?? '');
22
+ };
23
+ const normalizedValue = null == value ? void 0 : Array.isArray(value) ? value : [
24
+ value
25
+ ];
26
+ const normalizedDefault = null == defaultValue ? void 0 : Array.isArray(defaultValue) ? defaultValue : [
27
+ defaultValue
28
+ ];
29
+ return /*#__PURE__*/ jsx(ToggleGroup, {
30
+ multiple: isMultiple,
31
+ defaultValue: normalizedDefault,
32
+ value: normalizedValue,
42
33
  ref: ref,
43
- onValueChange: onValueChange,
34
+ onValueChange: handleValueChange,
44
35
  className: classnames(button_group_module["button-group"], className),
45
36
  ...props,
46
37
  children: /*#__PURE__*/ jsx(ButtonGroupContext, {
@@ -57,25 +48,24 @@ const ButtonGroup = ({ className, variant = 'filled', size = 'md', ripple = true
57
48
  })
58
49
  });
59
50
  };
60
- ButtonGroupContext.displayName = ToggleGroup.Root.displayName;
51
+ ButtonGroupContext.displayName = 'ButtonGroup';
61
52
  const ButtonGroupItem = ({ className, children, value, ref, ...props })=>{
62
53
  const context = react.useContext(ButtonGroupContext);
63
54
  const active = Array.isArray(context.value) ? context.value.includes(value) : context.value === value;
64
- return /*#__PURE__*/ jsx(ToggleGroup.Item, {
65
- asChild: true,
55
+ return /*#__PURE__*/ jsx(Toggle, {
66
56
  value: value,
67
57
  ref: ref,
68
- ...props,
69
- children: /*#__PURE__*/ jsx(Button, {
58
+ render: /*#__PURE__*/ jsx(Button, {
70
59
  className: className,
71
60
  fullWidth: context.expandToFit,
72
61
  variant: context.variant,
73
62
  intent: active ? context.active : context.inactive,
74
63
  size: context.size,
75
- ripple: context.ripple,
76
- children: children
77
- })
64
+ ripple: context.ripple
65
+ }),
66
+ ...props,
67
+ children: children
78
68
  });
79
69
  };
80
- ButtonGroupItem.displayName = ToggleGroup.Item.displayName;
70
+ ButtonGroupItem.displayName = 'ButtonGroupItem';
81
71
  export { ButtonGroup, ButtonGroupItem };
@@ -1,13 +1,7 @@
1
1
  import type React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
2
3
  import type { Intent, Size, Variant } from './@types/button.js';
3
- export type ButtonRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
4
- type AsButton = {
5
- asChild?: false;
6
- } & React.ComponentPropsWithoutRef<'button'>;
7
- interface AsSlot {
8
- asChild?: true;
9
- }
10
- export type ButtonProps<C extends React.ElementType = 'button'> = {
4
+ export type ButtonProps = useRender.ComponentProps<'button'> & {
11
5
  variant?: Variant;
12
6
  size?: Size;
13
7
  type?: 'submit' | 'reset' | 'button';
@@ -15,9 +9,8 @@ export type ButtonProps<C extends React.ElementType = 'button'> = {
15
9
  fullWidth?: boolean;
16
10
  ripple?: boolean;
17
11
  className?: string;
18
- children: React.ReactNode;
19
- ref?: React.RefObject<ButtonRefType<C>>;
20
- } & (AsButton | AsSlot) & React.HTMLAttributes<HTMLElement>;
21
- export declare const Button: <C extends React.ElementType = "button">({ variant, size, type, intent, fullWidth, ripple, className, children, asChild, ref, ...rest }: ButtonProps<C>) => React.JSX.Element;
22
- export {};
12
+ children?: React.ReactNode;
13
+ ref?: React.Ref<HTMLButtonElement>;
14
+ } & React.HTMLAttributes<HTMLElement>;
15
+ export declare const Button: ({ variant, size, type, intent, fullWidth, ripple, className, children, render, ref, ...rest }: ButtonProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
23
16
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE/D,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE9F,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,E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A;IACX,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CACnC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAErC,eAAO,MAAM,MAAM,GAAI,+FAYpB,WAAW,2EAiCb,CAAA"}
@@ -1,28 +1,29 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { Slot } from "@radix-ui/react-slot";
2
+ import { mergeProps } from "@base-ui/react/merge-props";
3
+ import { useRender } from "@base-ui/react/use-render";
4
4
  import classnames from "classnames";
5
- import material_ripple_effects from "material-ripple-effects";
5
+ import { Ripple } from "../../lib/ripple.js";
6
6
  import button_module from "./button.module.js";
7
- const Button = ({ variant = 'filled', size = 'md', type = 'button', intent = 'primary', fullWidth = false, ripple = true, className, children, asChild, ref, ...rest })=>{
8
- const Comp = null != asChild && true === asChild ? Slot : 'button';
9
- let onMouseDown;
7
+ const Button = ({ variant = 'filled', size = 'md', type = 'button', intent = 'primary', fullWidth = false, ripple = true, className, children, render, ref, ...rest })=>{
8
+ const defaultProps = {
9
+ type,
10
+ className: classnames('infonomic-button', `infonomic-button-${intent}`, `infonomic-button-${variant}`, `infonomic-button-${size}`, button_module.button, button_module[variant], button_module[size], button_module[intent], {
11
+ [button_module.fullWidth]: true === fullWidth
12
+ }, className),
13
+ children
14
+ };
10
15
  if (true === ripple) {
11
- const rippleEffect = new material_ripple_effects();
12
- onMouseDown = (e)=>{
13
- if (rest.onMouseDown) rest.onMouseDown(e);
16
+ const rippleEffect = new Ripple();
17
+ defaultProps.onMouseDown = (e)=>{
14
18
  rippleEffect.create(e, 'filled' === variant || 'gradient' === variant ? 'light' : 'dark');
15
19
  };
16
20
  }
17
- return /*#__PURE__*/ jsx(Comp, {
18
- ref: ref,
19
- type: type,
20
- className: classnames('infonomic-button', `infonomic-button-${intent}`, `infonomic-button-${variant}`, `infonomic-button-${size}`, button_module.button, button_module[variant], button_module[size], button_module[intent], {
21
- [button_module.fullWidth]: true === fullWidth
22
- }, className),
23
- onMouseDown: onMouseDown,
24
- ...rest,
25
- children: children
21
+ const element = useRender({
22
+ defaultTagName: 'button',
23
+ render,
24
+ ref,
25
+ props: mergeProps(defaultProps, rest)
26
26
  });
27
+ return element;
27
28
  };
28
29
  export { Button };