@flipdish/ui-library 0.58.1 → 0.59.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 (207) hide show
  1. package/dist/components/atoms/Badge/index.cjs +15 -59
  2. package/dist/components/atoms/Badge/index.cjs.map +1 -1
  3. package/dist/components/atoms/Badge/index.d.ts +22 -98
  4. package/dist/components/atoms/Badge/index.d.ts.map +1 -1
  5. package/dist/components/atoms/Badge/index.js +15 -59
  6. package/dist/components/atoms/Badge/index.js.map +1 -1
  7. package/dist/components/atoms/Badges/Badge/Badge.cjs +71 -0
  8. package/dist/components/atoms/Badges/Badge/Badge.cjs.map +1 -0
  9. package/dist/components/atoms/Badges/Badge/Badge.d.ts +99 -0
  10. package/dist/components/atoms/Badges/Badge/Badge.d.ts.map +1 -0
  11. package/dist/components/atoms/Badges/Badge/Badge.js +63 -0
  12. package/dist/components/atoms/Badges/Badge/Badge.js.map +1 -0
  13. package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.cjs +1 -1
  14. package/dist/components/atoms/Badges/Badge/Badge.styles.cjs.map +1 -0
  15. package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.d.ts +1 -1
  16. package/dist/components/atoms/Badges/Badge/Badge.styles.d.ts.map +1 -0
  17. package/dist/components/atoms/{Badge → Badges/Badge}/Badge.styles.js +1 -1
  18. package/dist/components/atoms/Badges/Badge/Badge.styles.js.map +1 -0
  19. package/dist/components/atoms/Badges/Badge/badge.types.cjs.map +1 -0
  20. package/dist/components/atoms/Badges/Badge/badge.types.d.ts.map +1 -0
  21. package/dist/components/atoms/Badges/Badge/badge.types.js.map +1 -0
  22. package/dist/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.d.ts +2 -2
  23. package/dist/components/atoms/Badges/Badge/utilities/badge.utils.d.ts.map +1 -0
  24. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.cjs +116 -0
  25. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.cjs.map +1 -0
  26. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.d.ts +38 -0
  27. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.d.ts.map +1 -0
  28. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.js +114 -0
  29. package/dist/components/atoms/Badges/BadgeGroup/BadgeGroup.js.map +1 -0
  30. package/dist/components/atoms/Badges/index.cjs +16 -0
  31. package/dist/components/atoms/Badges/index.cjs.map +1 -0
  32. package/dist/components/atoms/Badges/index.d.ts +16 -0
  33. package/dist/components/atoms/Badges/index.d.ts.map +1 -0
  34. package/dist/components/atoms/Badges/index.js +3 -0
  35. package/dist/components/atoms/Badges/index.js.map +1 -0
  36. package/dist/components/forms/fields/FormRadioCardGroup/index.cjs +3 -3
  37. package/dist/components/forms/fields/FormRadioCardGroup/index.cjs.map +1 -1
  38. package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts +3 -3
  39. package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts.map +1 -1
  40. package/dist/components/forms/fields/FormRadioCardGroup/index.js +3 -3
  41. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.cjs +2 -2
  42. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.cjs.map +1 -1
  43. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.js +1 -1
  44. package/dist/components/molecules/ActivityFeed/index.cjs +2 -2
  45. package/dist/components/molecules/ActivityFeed/index.cjs.map +1 -1
  46. package/dist/components/molecules/ActivityFeed/index.d.ts +1 -1
  47. package/dist/components/molecules/ActivityFeed/index.d.ts.map +1 -1
  48. package/dist/components/molecules/ActivityFeed/index.js +1 -1
  49. package/dist/components/molecules/BadgeGroup/index.cjs +3 -110
  50. package/dist/components/molecules/BadgeGroup/index.cjs.map +1 -1
  51. package/dist/components/molecules/BadgeGroup/index.d.ts +5 -37
  52. package/dist/components/molecules/BadgeGroup/index.d.ts.map +1 -1
  53. package/dist/components/molecules/BadgeGroup/index.js +3 -110
  54. package/dist/components/molecules/BadgeGroup/index.js.map +1 -1
  55. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.cjs +37 -0
  56. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.cjs.map +1 -0
  57. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.d.ts +33 -0
  58. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.d.ts.map +1 -0
  59. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.js +35 -0
  60. package/dist/components/molecules/RadioCards/RadioCardAvatar/RadioCardAvatar.js.map +1 -0
  61. package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.cjs +1 -1
  62. package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.cjs.map +1 -0
  63. package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.d.ts +6 -6
  64. package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.d.ts.map +1 -0
  65. package/dist/components/molecules/{RadioGroup → RadioCards/RadioCardAvatar}/hooks/useCommitOnPress.js +1 -1
  66. package/dist/components/molecules/RadioCards/RadioCardAvatar/hooks/useCommitOnPress.js.map +1 -0
  67. package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.cjs → RadioCards/RadioCardBullet/RadioCardBullet.cjs} +3 -3
  68. package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.cjs.map +1 -0
  69. package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.d.ts → RadioCards/RadioCardBullet/RadioCardBullet.d.ts} +5 -5
  70. package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.d.ts.map +1 -0
  71. package/dist/components/molecules/{RadioGroup/components/RadioGroupRadioButton.js → RadioCards/RadioCardBullet/RadioCardBullet.js} +3 -3
  72. package/dist/components/molecules/RadioCards/RadioCardBullet/RadioCardBullet.js.map +1 -0
  73. package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.cjs → RadioCards/RadioCardCheck/RadioCardCheck.cjs} +4 -4
  74. package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.cjs.map +1 -0
  75. package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.d.ts → RadioCards/RadioCardCheck/RadioCardCheck.d.ts} +6 -7
  76. package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.d.ts.map +1 -0
  77. package/dist/components/molecules/{RadioGroup/components/RadioGroupCheckbox.js → RadioCards/RadioCardCheck/RadioCardCheck.js} +4 -4
  78. package/dist/components/molecules/RadioCards/RadioCardCheck/RadioCardCheck.js.map +1 -0
  79. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.cjs → RadioCards/RadioCardIcon/RadioCardIcon.cjs} +3 -3
  80. package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.cjs.map +1 -0
  81. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.d.ts → RadioCards/RadioCardIcon/RadioCardIcon.d.ts} +5 -6
  82. package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.d.ts.map +1 -0
  83. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconSimple.js → RadioCards/RadioCardIcon/RadioCardIcon.js} +3 -3
  84. package/dist/components/molecules/RadioCards/RadioCardIcon/RadioCardIcon.js.map +1 -0
  85. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.cjs → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.cjs} +5 -5
  86. package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.cjs.map +1 -0
  87. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.d.ts → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.d.ts} +3 -3
  88. package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.d.ts.map +1 -0
  89. package/dist/components/molecules/{RadioGroup/components/RadioGroupIconCard.js → RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.js} +4 -4
  90. package/dist/components/molecules/RadioCards/RadioCardIconFeatured/RadioCardIconFeatured.js.map +1 -0
  91. package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.cjs → RadioCards/RadioCardPayment/RadioCardPayment.cjs} +3 -3
  92. package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.cjs.map +1 -0
  93. package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.d.ts → RadioCards/RadioCardPayment/RadioCardPayment.d.ts} +3 -3
  94. package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.d.ts.map +1 -0
  95. package/dist/components/molecules/{RadioGroup/components/RadioGroupPaymentIcon.js → RadioCards/RadioCardPayment/RadioCardPayment.js} +3 -3
  96. package/dist/components/molecules/RadioCards/RadioCardPayment/RadioCardPayment.js.map +1 -0
  97. package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.cjs.map +1 -1
  98. package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.d.ts.map +1 -1
  99. package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.js.map +1 -1
  100. package/dist/components/molecules/RadioCards/index.cjs +18 -0
  101. package/dist/components/molecules/RadioCards/index.cjs.map +1 -0
  102. package/dist/components/molecules/RadioCards/index.d.ts +23 -0
  103. package/dist/components/molecules/RadioCards/index.d.ts.map +1 -0
  104. package/dist/components/molecules/RadioCards/index.js +7 -0
  105. package/dist/components/molecules/RadioCards/index.js.map +1 -0
  106. package/dist/components/molecules/{RadioGroup/radioGroup.types.d.ts → RadioCards/radioCards.types.d.ts} +12 -10
  107. package/dist/components/molecules/RadioCards/radioCards.types.d.ts.map +1 -0
  108. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs +2 -7
  109. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs.map +1 -1
  110. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.d.ts +2 -7
  111. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.d.ts.map +1 -1
  112. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js +2 -7
  113. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js.map +1 -1
  114. package/dist/components/molecules/RadioGroup/index.cjs +26 -14
  115. package/dist/components/molecules/RadioGroup/index.cjs.map +1 -1
  116. package/dist/components/molecules/RadioGroup/index.d.ts +25 -8
  117. package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -1
  118. package/dist/components/molecules/RadioGroup/index.js +23 -7
  119. package/dist/components/molecules/RadioGroup/index.js.map +1 -1
  120. package/dist/components/molecules/Tabs/index.cjs +2 -2
  121. package/dist/components/molecules/Tabs/index.cjs.map +1 -1
  122. package/dist/components/molecules/Tabs/index.js +1 -1
  123. package/dist/components/organisms/Calendar/components/CalendarHeader.cjs +2 -2
  124. package/dist/components/organisms/Calendar/components/CalendarHeader.cjs.map +1 -1
  125. package/dist/components/organisms/Calendar/components/CalendarHeader.js +1 -1
  126. package/dist/components/organisms/HeaderNavigation/components/NavItem.cjs +2 -2
  127. package/dist/components/organisms/HeaderNavigation/components/NavItem.cjs.map +1 -1
  128. package/dist/components/organisms/HeaderNavigation/components/NavItem.js +1 -1
  129. package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.cjs +2 -2
  130. package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.cjs.map +1 -1
  131. package/dist/components/organisms/PageHeader/components/PageHeaderTabNav.js +1 -1
  132. package/dist/components/organisms/SidebarNavigation/components/NavItem.cjs +2 -2
  133. package/dist/components/organisms/SidebarNavigation/components/NavItem.cjs.map +1 -1
  134. package/dist/components/organisms/SidebarNavigation/components/NavItem.js +1 -1
  135. package/dist/components/organisms/Table/index.cjs +2 -2
  136. package/dist/components/organisms/Table/index.cjs.map +1 -1
  137. package/dist/components/organisms/Table/index.js +1 -1
  138. package/dist/native/components/atoms/Badge/index.d.ts +20 -97
  139. package/dist/native/components/atoms/Badge/index.d.ts.map +1 -1
  140. package/dist/native/components/atoms/Badge/index.js +17 -62
  141. package/dist/native/components/atoms/Badge/index.js.map +1 -1
  142. package/dist/native/components/atoms/Badges/Badge/Badge.d.ts +98 -0
  143. package/dist/native/components/atoms/Badges/Badge/Badge.d.ts.map +1 -0
  144. package/dist/native/components/atoms/Badges/Badge/Badge.js +66 -0
  145. package/dist/native/components/atoms/Badges/Badge/Badge.js.map +1 -0
  146. package/dist/native/components/atoms/{Badge → Badges/Badge}/Badge.styles.d.ts +1 -1
  147. package/dist/native/components/atoms/Badges/Badge/Badge.styles.d.ts.map +1 -0
  148. package/dist/native/components/atoms/{Badge → Badges/Badge}/Badge.styles.js +1 -1
  149. package/dist/native/components/atoms/Badges/Badge/Badge.styles.js.map +1 -0
  150. package/dist/native/components/atoms/Badges/Badge/badge.types.d.ts.map +1 -0
  151. package/dist/native/components/atoms/Badges/Badge/badge.types.js.map +1 -0
  152. package/dist/native/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.d.ts +2 -2
  153. package/dist/native/components/atoms/Badges/Badge/utilities/badge.utils.d.ts.map +1 -0
  154. package/dist/native/components/atoms/{Badge → Badges/Badge/utilities}/badge.utils.js +1 -1
  155. package/dist/native/components/atoms/Badges/Badge/utilities/badge.utils.js.map +1 -0
  156. package/dist/native/components/atoms/Badges/index.d.ts +5 -0
  157. package/dist/native/components/atoms/Badges/index.d.ts.map +1 -0
  158. package/dist/native/components/atoms/Badges/index.js +2 -0
  159. package/dist/native/components/atoms/Badges/index.js.map +1 -0
  160. package/dist/native/components/molecules/RadioCards/index.d.ts +12 -0
  161. package/package.json +1 -1
  162. package/dist/components/atoms/Badge/Badge.styles.cjs.map +0 -1
  163. package/dist/components/atoms/Badge/Badge.styles.d.ts.map +0 -1
  164. package/dist/components/atoms/Badge/Badge.styles.js.map +0 -1
  165. package/dist/components/atoms/Badge/badge.types.cjs.map +0 -1
  166. package/dist/components/atoms/Badge/badge.types.d.ts.map +0 -1
  167. package/dist/components/atoms/Badge/badge.types.js.map +0 -1
  168. package/dist/components/atoms/Badge/badge.utils.d.ts.map +0 -1
  169. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs +0 -39
  170. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs.map +0 -1
  171. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts +0 -32
  172. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts.map +0 -1
  173. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js +0 -37
  174. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js.map +0 -1
  175. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.cjs.map +0 -1
  176. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.d.ts.map +0 -1
  177. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.js.map +0 -1
  178. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.cjs.map +0 -1
  179. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.d.ts.map +0 -1
  180. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.js.map +0 -1
  181. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.cjs.map +0 -1
  182. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.d.ts.map +0 -1
  183. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.js.map +0 -1
  184. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.cjs.map +0 -1
  185. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.d.ts.map +0 -1
  186. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.js.map +0 -1
  187. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.cjs.map +0 -1
  188. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.d.ts.map +0 -1
  189. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.js.map +0 -1
  190. package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.cjs.map +0 -1
  191. package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.d.ts.map +0 -1
  192. package/dist/components/molecules/RadioGroup/hooks/useCommitOnPress.js.map +0 -1
  193. package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +0 -1
  194. package/dist/native/components/atoms/Badge/Badge.styles.d.ts.map +0 -1
  195. package/dist/native/components/atoms/Badge/Badge.styles.js.map +0 -1
  196. package/dist/native/components/atoms/Badge/badge.types.d.ts.map +0 -1
  197. package/dist/native/components/atoms/Badge/badge.types.js.map +0 -1
  198. package/dist/native/components/atoms/Badge/badge.utils.d.ts.map +0 -1
  199. package/dist/native/components/atoms/Badge/badge.utils.js.map +0 -1
  200. /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.cjs +0 -0
  201. /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.d.ts +0 -0
  202. /package/dist/components/atoms/{Badge → Badges/Badge}/badge.types.js +0 -0
  203. /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.cjs +0 -0
  204. /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.d.ts +0 -0
  205. /package/dist/components/molecules/{RadioGroup → RadioCards}/hooks/useOptionIds.js +0 -0
  206. /package/dist/native/components/atoms/{Badge → Badges/Badge}/badge.types.d.ts +0 -0
  207. /package/dist/native/components/atoms/{Badge → Badges/Badge}/badge.types.js +0 -0
@@ -1,65 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var uiIcons = require('@flipdish/ui-icons');
5
- var Dot = require('@flipdish/ui-library/components/atoms/Dot');
6
- var Flag = require('@flipdish/ui-library/components/atoms/Flag');
7
- var cx = require('@flipdish/ui-library/utilities/cx');
8
- var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
9
- var Badge_styles = require('./Badge.styles.cjs');
3
+ var Badges = require('@flipdish/ui-library/components/atoms/Badges');
10
4
 
11
- /**
12
- * Compact label for statuses, categories, counts, and tags. Conveys metadata at
13
- * a glance through color and shape without competing with primary content.
14
- *
15
- * @summary compact status, category, or count label
16
- */
17
- const Badge = (props) => {
18
- const { type = 'pill-color', size = 'md', color = 'gray', children, 'data-testid': dataTestId } = props;
19
- const colors = Badge_styles.styles.types.standard[type];
20
- const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
21
- return (jsxRuntime.jsx("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.label[type][size], colors.styles[color].root, props.className), children: children }));
22
- };
23
- /** `Badge` variant with a coloured status dot before the label. */
24
- const BadgeWithDot = (props) => {
25
- const { size = 'md', color = 'gray', type = 'pill-color', className, children, 'data-testid': dataTestId } = props;
26
- const colors = Badge_styles.styles.types.addon[type];
27
- const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
28
- return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.dot[type][size], colors.styles[color].root, className), children: [jsxRuntime.jsx(Dot.Dot, { color: colors.styles[color].dotColor, size: "sm", "data-testid": testIdUtils.joinTestId(badgeTestId, 'dot') }), children] }));
29
- };
30
- /** `Badge` variant with a leading or trailing icon beside the label. */
31
- const BadgeWithIcon = (props) => {
32
- const { size = 'md', color = 'gray', type = 'pill-color', iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, 'data-testid': dataTestId, } = props;
33
- const colors = Badge_styles.styles.types.addon[type];
34
- const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
35
- const icon = IconLeading ? 'leading' : 'trailing';
36
- return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.icon[type][size][icon], colors.styles[color].root, className), children: [IconLeading && jsxRuntime.jsx(IconLeading, { className: cx.cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": testIdUtils.joinTestId(badgeTestId, 'icon') }), children, IconTrailing && jsxRuntime.jsx(IconTrailing, { className: cx.cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": testIdUtils.joinTestId(badgeTestId, 'icon') })] }));
37
- };
38
- /** `Badge` variant with a round country flag before the label. */
39
- const BadgeWithFlag = (props) => {
40
- const { size = 'md', color = 'gray', flag = 'AU', type = 'pill-color', children } = props;
41
- const colors = Badge_styles.styles.types.standard[type];
42
- return (jsxRuntime.jsxs("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.media[type][size], colors.styles[color].root), children: [jsxRuntime.jsx(Flag.Flag, { code: flag, size: "xs" }), children] }));
43
- };
44
- /** `Badge` variant with a small round image before the label. */
45
- const BadgeWithImage = (props) => {
46
- const { size = 'md', color = 'gray', type = 'pill-color', imgSrc, children } = props;
47
- const colors = Badge_styles.styles.types.standard[type];
48
- return (jsxRuntime.jsxs("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.media[type][size], colors.styles[color].root), children: [jsxRuntime.jsx("img", { src: imgSrc, className: "size-4 max-w-none rounded-full", alt: "Badge image" }), children] }));
49
- };
50
- /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
51
- const BadgeWithButton = (props) => {
52
- const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon = uiIcons.X, buttonLabel, children, 'data-testid': dataTestId } = props;
53
- const colors = Badge_styles.styles.types.standard[type];
54
- const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
55
- return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.button[type][size], colors.styles[color].root), children: [children, jsxRuntime.jsx("button", { type: "button", "aria-label": buttonLabel, onClick: props.onButtonClick, "data-testid": testIdUtils.joinTestId(badgeTestId, 'close-button'), className: cx.cx('flex cursor-pointer items-center justify-center p-0.5 outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2', colors.styles[color].addonButton, type === 'pill-color' ? 'rounded-full' : 'rounded-[3px]'), children: jsxRuntime.jsx(Icon, { className: "size-3 stroke-[3px] transition-inherit-all" }) })] }));
56
- };
57
- /** Icon-only `Badge` with no label text. */
58
- const BadgeIcon = (props) => {
59
- const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon } = props;
60
- const colors = Badge_styles.styles.types.standard[type];
61
- return (jsxRuntime.jsx("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.iconOnly[type][size], colors.styles[color].root), children: jsxRuntime.jsx(Icon, { className: cx.cx('size-3 stroke-[3px]', colors.styles[color].addon) }) }));
62
- };
5
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
6
+ const Badge = Badges.Badge;
7
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
8
+ const BadgeWithDot = Badges.BadgeWithDot;
9
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
10
+ const BadgeWithIcon = Badges.BadgeWithIcon;
11
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
12
+ const BadgeWithFlag = Badges.BadgeWithFlag;
13
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
14
+ const BadgeWithImage = Badges.BadgeWithImage;
15
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
16
+ const BadgeWithButton = Badges.BadgeWithButton;
17
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
18
+ const BadgeIcon = Badges.BadgeIcon;
63
19
 
64
20
  exports.Badge = Badge;
65
21
  exports.BadgeIcon = BadgeIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Badge/index.t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,gBACD,WAAW,EACvB,OAAO,EAAE,KAAK,CAAC,aAAa,EAAA,aAAA,EACfI,sBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,EACpD,SAAS,EAAEH,KAAE,CACX,sIAAsI,EACtI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAChC,IAAI,KAAK,YAAY,GAAG,cAAc,GAAG,eAAe,CACzD,YAEDD,cAAA,CAAC,IAAI,IAAC,SAAS,EAAC,4CAA4C,EAAA,CAAG,EAAA,CACxD,CAAA,EAAA,CACJ;AAEX;AAUA;AACO,MAAM,SAAS,GAAG,CAAuB,KAAwB,KAAI;AAC1E,IAAA,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,GAAG,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK;IAE9E,MAAM,MAAM,GAAGF,mBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IAE1C,QACEE,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAEC,KAAE,CAAC,MAAM,CAAC,MAAM,EAAEH,mBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAA,QAAA,EAC9FE,cAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAEC,KAAE,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAA,CAAI,EAAA,CACrE;AAEX;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Badge/index.tsx"],"sourcesContent":[null],"names":["BadgeNext","BadgeWithDotNext","BadgeWithIconNext","BadgeWithFlagNext","BadgeWithImageNext","BadgeWithButtonNext","BadgeIconNext"],"mappings":";;;;AAoBA;AACO,MAAM,KAAK,GAAqBA;AACvC;AACO,MAAM,YAAY,GAA4BC;AACrD;AACO,MAAM,aAAa,GAA6BC;AACvD;AACO,MAAM,aAAa,GAA6BC;AACvD;AACO,MAAM,cAAc,GAA8BC;AACzD;AACO,MAAM,eAAe,GAA+BC;AAC3D;AACO,MAAM,SAAS,GAAyBC;;;;;;;;"}
@@ -1,99 +1,23 @@
1
- import { type CountryCode } from '@flipdish/ui-library/components/atoms/Flag';
2
- import type { MouseEventHandler, ReactNode } from 'react';
3
- import { styles } from './Badge.styles';
4
- import type { BadgeTypes, BadgeTypeToColorMap, IconComponentType, Sizes } from './badge.types';
5
- export type { BadgeColors } from './badge.types';
6
- type FlagTypes = CountryCode;
7
- export type BadgeColor<T extends BadgeTypes> = BadgeTypeToColorMap<typeof styles.types.standard>[T];
8
- export interface BadgeProps<T extends BadgeTypes> {
9
- /** Selects the shape: a fully rounded `pill-color`, a square-cornered `badge-color`, or a neutral `badge-modern`. */
10
- type?: T;
11
- /** Sets the padding and text size. */
12
- size?: Sizes;
13
- /** Sets the fill, text and ring colours; the options available depend on `type`. */
14
- color?: BadgeColor<T>;
15
- /** Label shown inside the badge. */
16
- children: ReactNode;
17
- /** Extra classes merged onto the root `<span>`. */
18
- className?: string;
19
- /** Overrides the `data-testid` (defaults to `fd-badge`). */
20
- 'data-testid'?: string;
21
- }
22
- /**
23
- * Compact label for statuses, categories, counts, and tags. Conveys metadata at
24
- * a glance through color and shape without competing with primary content.
25
- *
26
- * @summary compact status, category, or count label
27
- */
28
- export declare const Badge: <T extends BadgeTypes>(props: BadgeProps<T>) => import("react").JSX.Element;
29
- interface BadgeWithDotProps<T extends BadgeTypes> {
30
- type?: T;
31
- size?: Sizes;
32
- color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
33
- className?: string;
34
- children: ReactNode;
35
- /** Overrides the `data-testid` (defaults to `fd-badge`); the `Dot` derives `--dot` from it. */
36
- 'data-testid'?: string;
37
- }
38
- /** `Badge` variant with a coloured status dot before the label. */
39
- export declare const BadgeWithDot: <T extends BadgeTypes>(props: BadgeWithDotProps<T>) => import("react").JSX.Element;
40
- interface BadgeWithIconProps<T extends BadgeTypes> {
41
- type?: T;
42
- size?: Sizes;
43
- color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
44
- iconLeading?: IconComponentType;
45
- iconTrailing?: IconComponentType;
46
- children: ReactNode;
47
- className?: string;
48
- /** Overrides the `data-testid` (defaults to `fd-badge`); the leading/trailing icon derives `--icon` from it. */
49
- 'data-testid'?: string;
50
- }
51
- /** `Badge` variant with a leading or trailing icon beside the label. */
52
- export declare const BadgeWithIcon: <T extends BadgeTypes>(props: BadgeWithIconProps<T>) => import("react").JSX.Element;
53
- interface BadgeWithFlagProps<T extends BadgeTypes> {
54
- type?: T;
55
- size?: Sizes;
56
- flag?: FlagTypes;
57
- color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
58
- children: ReactNode;
59
- }
60
- /** `Badge` variant with a round country flag before the label. */
61
- export declare const BadgeWithFlag: <T extends BadgeTypes>(props: BadgeWithFlagProps<T>) => import("react").JSX.Element;
62
- interface BadgeWithImageProps<T extends BadgeTypes> {
63
- type?: T;
64
- size?: Sizes;
65
- imgSrc: string;
66
- color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
67
- children: ReactNode;
68
- }
69
- /** `Badge` variant with a small round image before the label. */
70
- export declare const BadgeWithImage: <T extends BadgeTypes>(props: BadgeWithImageProps<T>) => import("react").JSX.Element;
71
- interface BadgeWithButtonProps<T extends BadgeTypes> {
72
- type?: T;
73
- size?: Sizes;
74
- icon?: IconComponentType;
75
- color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
76
- children: ReactNode;
77
- /**
78
- * The label for the button.
79
- */
80
- buttonLabel?: string;
81
- /**
82
- * The click event handler for the button.
83
- */
84
- onButtonClick?: MouseEventHandler<HTMLButtonElement>;
85
- /** Overrides the `data-testid` (defaults to `fd-badge`); the dismiss button derives `--close-button` from it. */
86
- 'data-testid'?: string;
87
- }
88
- /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
89
- export declare const BadgeWithButton: <T extends BadgeTypes>(props: BadgeWithButtonProps<T>) => import("react").JSX.Element;
90
- interface BadgeIconProps<T extends BadgeTypes> {
91
- type?: T;
92
- size?: Sizes;
93
- icon: IconComponentType;
94
- color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
95
- children?: ReactNode;
96
- }
97
- /** Icon-only `Badge` with no label text. */
98
- export declare const BadgeIcon: <T extends BadgeTypes>(props: BadgeIconProps<T>) => import("react").JSX.Element;
1
+ import { type BadgeColor as BadgeColorNext, type BadgeColors as BadgeColorsNext, BadgeIcon as BadgeIconNext, Badge as BadgeNext, type BadgeProps as BadgePropsNext, BadgeWithButton as BadgeWithButtonNext, BadgeWithDot as BadgeWithDotNext, BadgeWithFlag as BadgeWithFlagNext, BadgeWithIcon as BadgeWithIconNext, BadgeWithImage as BadgeWithImageNext } from '@flipdish/ui-library/components/atoms/Badges';
2
+ import type { BadgeTypes } from '../Badges/Badge/badge.types';
3
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
4
+ export declare const Badge: typeof BadgeNext;
5
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
6
+ export declare const BadgeWithDot: typeof BadgeWithDotNext;
7
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
8
+ export declare const BadgeWithIcon: typeof BadgeWithIconNext;
9
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
10
+ export declare const BadgeWithFlag: typeof BadgeWithFlagNext;
11
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
12
+ export declare const BadgeWithImage: typeof BadgeWithImageNext;
13
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
14
+ export declare const BadgeWithButton: typeof BadgeWithButtonNext;
15
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
16
+ export declare const BadgeIcon: typeof BadgeIconNext;
17
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
18
+ export type BadgeColors = BadgeColorsNext;
19
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
20
+ export type BadgeColor<T extends BadgeTypes> = BadgeColorNext<T>;
21
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
22
+ export type BadgeProps<T extends BadgeTypes> = BadgePropsNext<T>;
99
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Badge/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,4CAA4C,CAAC;AAGpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/F,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,KAAK,SAAS,GAAG,WAAW,CAAC;AAE7B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,mBAAmB,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,UAAU;IAC9C,qHAAqH;IACrH,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oFAAoF;IACpF,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtB,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB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M,aAAa,EAAE,OAAO,iBAAqC,CAAC;AACzE,yGAAyG;AACzG,eAAO,MAAM,cAAc,EAAE,OAAO,kBAAuC,CAAC;AAC5E,yGAAyG;AACzG,eAAO,MAAM,eAAe,EAAE,OAAO,mBAAyC,CAAC;AAC/E,yGAAyG;AACzG,eAAO,MAAM,SAAS,EAAE,OAAO,aAA6B,CAAC;AAC7D,yGAAyG;AACzG,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,yGAAyG;AACzG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AACjE,yGAAyG;AACzG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC"}
@@ -1,63 +1,19 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { X } from '@flipdish/ui-icons';
3
- import { Dot } from '@flipdish/ui-library/components/atoms/Dot';
4
- import { Flag } from '@flipdish/ui-library/components/atoms/Flag';
5
- import { cx } from '@flipdish/ui-library/utilities/cx';
6
- import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
7
- import { styles } from './Badge.styles.js';
1
+ import { Badge as Badge$1, BadgeIcon as BadgeIcon$1, BadgeWithButton as BadgeWithButton$1, BadgeWithDot as BadgeWithDot$1, BadgeWithFlag as BadgeWithFlag$1, BadgeWithIcon as BadgeWithIcon$1, BadgeWithImage as BadgeWithImage$1 } from '@flipdish/ui-library/components/atoms/Badges';
8
2
 
9
- /**
10
- * Compact label for statuses, categories, counts, and tags. Conveys metadata at
11
- * a glance through color and shape without competing with primary content.
12
- *
13
- * @summary compact status, category, or count label
14
- */
15
- const Badge = (props) => {
16
- const { type = 'pill-color', size = 'md', color = 'gray', children, 'data-testid': dataTestId } = props;
17
- const colors = styles.types.standard[type];
18
- const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
19
- return (jsx("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.label[type][size], colors.styles[color].root, props.className), children: children }));
20
- };
21
- /** `Badge` variant with a coloured status dot before the label. */
22
- const BadgeWithDot = (props) => {
23
- const { size = 'md', color = 'gray', type = 'pill-color', className, children, 'data-testid': dataTestId } = props;
24
- const colors = styles.types.addon[type];
25
- const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
26
- return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.dot[type][size], colors.styles[color].root, className), children: [jsx(Dot, { color: colors.styles[color].dotColor, size: "sm", "data-testid": joinTestId(badgeTestId, 'dot') }), children] }));
27
- };
28
- /** `Badge` variant with a leading or trailing icon beside the label. */
29
- const BadgeWithIcon = (props) => {
30
- const { size = 'md', color = 'gray', type = 'pill-color', iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, 'data-testid': dataTestId, } = props;
31
- const colors = styles.types.addon[type];
32
- const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
33
- const icon = IconLeading ? 'leading' : 'trailing';
34
- return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.icon[type][size][icon], colors.styles[color].root, className), children: [IconLeading && jsx(IconLeading, { className: cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": joinTestId(badgeTestId, 'icon') }), children, IconTrailing && jsx(IconTrailing, { className: cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": joinTestId(badgeTestId, 'icon') })] }));
35
- };
36
- /** `Badge` variant with a round country flag before the label. */
37
- const BadgeWithFlag = (props) => {
38
- const { size = 'md', color = 'gray', flag = 'AU', type = 'pill-color', children } = props;
39
- const colors = styles.types.standard[type];
40
- return (jsxs("span", { className: cx(colors.common, styles.sizes.media[type][size], colors.styles[color].root), children: [jsx(Flag, { code: flag, size: "xs" }), children] }));
41
- };
42
- /** `Badge` variant with a small round image before the label. */
43
- const BadgeWithImage = (props) => {
44
- const { size = 'md', color = 'gray', type = 'pill-color', imgSrc, children } = props;
45
- const colors = styles.types.standard[type];
46
- return (jsxs("span", { className: cx(colors.common, styles.sizes.media[type][size], colors.styles[color].root), children: [jsx("img", { src: imgSrc, className: "size-4 max-w-none rounded-full", alt: "Badge image" }), children] }));
47
- };
48
- /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
49
- const BadgeWithButton = (props) => {
50
- const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon = X, buttonLabel, children, 'data-testid': dataTestId } = props;
51
- const colors = styles.types.standard[type];
52
- const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
53
- return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.button[type][size], colors.styles[color].root), children: [children, jsx("button", { type: "button", "aria-label": buttonLabel, onClick: props.onButtonClick, "data-testid": joinTestId(badgeTestId, 'close-button'), className: cx('flex cursor-pointer items-center justify-center p-0.5 outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2', colors.styles[color].addonButton, type === 'pill-color' ? 'rounded-full' : 'rounded-[3px]'), children: jsx(Icon, { className: "size-3 stroke-[3px] transition-inherit-all" }) })] }));
54
- };
55
- /** Icon-only `Badge` with no label text. */
56
- const BadgeIcon = (props) => {
57
- const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon } = props;
58
- const colors = styles.types.standard[type];
59
- return (jsx("span", { className: cx(colors.common, styles.sizes.iconOnly[type][size], colors.styles[color].root), children: jsx(Icon, { className: cx('size-3 stroke-[3px]', colors.styles[color].addon) }) }));
60
- };
3
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
4
+ const Badge = Badge$1;
5
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
6
+ const BadgeWithDot = BadgeWithDot$1;
7
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
8
+ const BadgeWithIcon = BadgeWithIcon$1;
9
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
10
+ const BadgeWithFlag = BadgeWithFlag$1;
11
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
12
+ const BadgeWithImage = BadgeWithImage$1;
13
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
14
+ const BadgeWithButton = BadgeWithButton$1;
15
+ /** @deprecated Import from `@flipdish/ui-library/components/atoms/Badges`. Removed in the next major. */
16
+ const BadgeIcon = BadgeIcon$1;
61
17
 
62
18
  export { Badge, BadgeIcon, BadgeWithButton, BadgeWithDot, BadgeWithFlag, BadgeWithIcon, BadgeWithImage };
63
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Badge/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","CloseX"],"mappings":";;;;;;;;AAgCA;;;;;AAKG;AACI,MAAM,KAAK,GAAG,CAAuB,KAAoB,KAAI;IAClE,MAAM,EAAE,IAAI,GAAG,YAAY,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK;IACvG,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1C,IAAA,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAElG,IAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAmB,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC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M,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAA,QAAA,EAC9FA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAA,CAAI,EAAA,CACrE;AAEX;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Badge/index.tsx"],"sourcesContent":[null],"names":["BadgeNext","BadgeWithDotNext","BadgeWithIconNext","BadgeWithFlagNext","BadgeWithImageNext","BadgeWithButtonNext","BadgeIconNext"],"mappings":";;AAoBA;AACO,MAAM,KAAK,GAAqBA;AACvC;AACO,MAAM,YAAY,GAA4BC;AACrD;AACO,MAAM,aAAa,GAA6BC;AACvD;AACO,MAAM,aAAa,GAA6BC;AACvD;AACO,MAAM,cAAc,GAA8BC;AACzD;AACO,MAAM,eAAe,GAA+BC;AAC3D;AACO,MAAM,SAAS,GAAyBC;;"}
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var uiIcons = require('@flipdish/ui-icons');
5
+ var Dot = require('@flipdish/ui-library/components/atoms/Dot');
6
+ var Flag = require('@flipdish/ui-library/components/atoms/Flag');
7
+ var cx = require('@flipdish/ui-library/utilities/cx');
8
+ var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
9
+ var Badge_styles = require('./Badge.styles.cjs');
10
+
11
+ /**
12
+ * Compact label for statuses, categories, counts, and tags. Conveys metadata at
13
+ * a glance through color and shape without competing with primary content.
14
+ *
15
+ * @summary compact status, category, or count label
16
+ */
17
+ const Badge = (props) => {
18
+ const { type = 'pill-color', size = 'md', color = 'gray', children, 'data-testid': dataTestId } = props;
19
+ const colors = Badge_styles.styles.types.standard[type];
20
+ const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
21
+ return (jsxRuntime.jsx("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.label[type][size], colors.styles[color].root, props.className), children: children }));
22
+ };
23
+ /** `Badge` variant with a coloured status dot before the label. */
24
+ const BadgeWithDot = (props) => {
25
+ const { size = 'md', color = 'gray', type = 'pill-color', className, children, 'data-testid': dataTestId } = props;
26
+ const colors = Badge_styles.styles.types.addon[type];
27
+ const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
28
+ return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.dot[type][size], colors.styles[color].root, className), children: [jsxRuntime.jsx(Dot.Dot, { color: colors.styles[color].dotColor, size: "sm", "data-testid": testIdUtils.joinTestId(badgeTestId, 'dot') }), children] }));
29
+ };
30
+ /** `Badge` variant with a leading or trailing icon beside the label. */
31
+ const BadgeWithIcon = (props) => {
32
+ const { size = 'md', color = 'gray', type = 'pill-color', iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, 'data-testid': dataTestId, } = props;
33
+ const colors = Badge_styles.styles.types.addon[type];
34
+ const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
35
+ const icon = IconLeading ? 'leading' : 'trailing';
36
+ return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.icon[type][size][icon], colors.styles[color].root, className), children: [IconLeading && jsxRuntime.jsx(IconLeading, { className: cx.cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": testIdUtils.joinTestId(badgeTestId, 'icon') }), children, IconTrailing && jsxRuntime.jsx(IconTrailing, { className: cx.cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": testIdUtils.joinTestId(badgeTestId, 'icon') })] }));
37
+ };
38
+ /** `Badge` variant with a round country flag before the label. */
39
+ const BadgeWithFlag = (props) => {
40
+ const { size = 'md', color = 'gray', flag = 'AU', type = 'pill-color', children } = props;
41
+ const colors = Badge_styles.styles.types.standard[type];
42
+ return (jsxRuntime.jsxs("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.media[type][size], colors.styles[color].root), children: [jsxRuntime.jsx(Flag.Flag, { code: flag, size: "xs" }), children] }));
43
+ };
44
+ /** `Badge` variant with a small round image before the label. */
45
+ const BadgeWithImage = (props) => {
46
+ const { size = 'md', color = 'gray', type = 'pill-color', imgSrc, children } = props;
47
+ const colors = Badge_styles.styles.types.standard[type];
48
+ return (jsxRuntime.jsxs("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.media[type][size], colors.styles[color].root), children: [jsxRuntime.jsx("img", { src: imgSrc, className: "size-4 max-w-none rounded-full", alt: "Badge image" }), children] }));
49
+ };
50
+ /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
51
+ const BadgeWithButton = (props) => {
52
+ const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon = uiIcons.X, buttonLabel, children, 'data-testid': dataTestId } = props;
53
+ const colors = Badge_styles.styles.types.standard[type];
54
+ const badgeTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
55
+ return (jsxRuntime.jsxs("span", { "data-testid": badgeTestId, className: cx.cx(colors.common, Badge_styles.styles.sizes.button[type][size], colors.styles[color].root), children: [children, jsxRuntime.jsx("button", { type: "button", "aria-label": buttonLabel, onClick: props.onButtonClick, "data-testid": testIdUtils.joinTestId(badgeTestId, 'close-button'), className: cx.cx('flex cursor-pointer items-center justify-center p-0.5 outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2', colors.styles[color].addonButton, type === 'pill-color' ? 'rounded-full' : 'rounded-[3px]'), children: jsxRuntime.jsx(Icon, { className: "size-3 stroke-[3px] transition-inherit-all" }) })] }));
56
+ };
57
+ /** Icon-only `Badge` with no label text. */
58
+ const BadgeIcon = (props) => {
59
+ const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon } = props;
60
+ const colors = Badge_styles.styles.types.standard[type];
61
+ return (jsxRuntime.jsx("span", { className: cx.cx(colors.common, Badge_styles.styles.sizes.iconOnly[type][size], colors.styles[color].root), children: jsxRuntime.jsx(Icon, { className: cx.cx('size-3 stroke-[3px]', colors.styles[color].addon) }) }));
62
+ };
63
+
64
+ exports.Badge = Badge;
65
+ exports.BadgeIcon = BadgeIcon;
66
+ exports.BadgeWithButton = BadgeWithButton;
67
+ exports.BadgeWithDot = BadgeWithDot;
68
+ exports.BadgeWithFlag = BadgeWithFlag;
69
+ exports.BadgeWithIcon = BadgeWithIcon;
70
+ exports.BadgeWithImage = BadgeWithImage;
71
+ //# sourceMappingURL=Badge.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.cjs","sources":["../../../../../src/components/atoms/Badges/Badge/Badge.tsx"],"sourcesContent":[null],"names":["styles","useResolvedTestId","_jsx","cx","_jsxs","Dot","joinTestId","Flag","CloseX"],"mappings":";;;;;;;;;;AA8BA;;;;;AAKG;AACI,MAAM,KAAK,GAAG,CAAuB,KAAoB,KAAI;IAClE,MAAM,EAAE,IAAI,GAAG,YAAY,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK;IACvG,MAAM,MAAM,GAAGA,mBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1C,IAAA,MAAM,WAAW,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAElG,IAAA,QACEC,cAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAmB,WAAW,EAAE,SAAS,EAAEC,KAAE,CAAC,MAAM,CAAC,MAAM,EAAEH,mBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,CA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AI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAA,QAAA,EAC9FE,cAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAEC,KAAE,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAA,CAAI,EAAA,CACrE;AAEX;;;;;;;;"}
@@ -0,0 +1,99 @@
1
+ import { type CountryCode } from '@flipdish/ui-library/components/atoms/Flag';
2
+ import type { MouseEventHandler, ReactNode } from 'react';
3
+ import { styles } from './Badge.styles';
4
+ import type { BadgeTypes, BadgeTypeToColorMap, IconComponentType, Sizes } from './badge.types';
5
+ type FlagTypes = CountryCode;
6
+ export type BadgeColor<T extends BadgeTypes> = BadgeTypeToColorMap<typeof styles.types.standard>[T];
7
+ export interface BadgeProps<T extends BadgeTypes> {
8
+ /** Selects the shape: a fully rounded `pill-color`, a square-cornered `color`, or a neutral `modern`. */
9
+ type?: T;
10
+ /** Sets the padding and text size. */
11
+ size?: Sizes;
12
+ /** Sets the fill, text and ring colours; the options available depend on `type`. */
13
+ color?: BadgeColor<T>;
14
+ /** Label shown inside the badge. */
15
+ children: ReactNode;
16
+ /** Extra classes merged onto the root `<span>`. */
17
+ className?: string;
18
+ /** Overrides the `data-testid` (defaults to `fd-badge`). */
19
+ 'data-testid'?: string;
20
+ }
21
+ /**
22
+ * Compact label for statuses, categories, counts, and tags. Conveys metadata at
23
+ * a glance through color and shape without competing with primary content.
24
+ *
25
+ * @summary compact status, category, or count label
26
+ */
27
+ export declare const Badge: <T extends BadgeTypes>(props: BadgeProps<T>) => import("react").JSX.Element;
28
+ interface BadgeWithDotProps<T extends BadgeTypes> {
29
+ type?: T;
30
+ size?: Sizes;
31
+ color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
32
+ className?: string;
33
+ children: ReactNode;
34
+ /** Overrides the `data-testid` (defaults to `fd-badge`); the `Dot` derives `--dot` from it. */
35
+ 'data-testid'?: string;
36
+ }
37
+ /** `Badge` variant with a coloured status dot before the label. */
38
+ export declare const BadgeWithDot: <T extends BadgeTypes>(props: BadgeWithDotProps<T>) => import("react").JSX.Element;
39
+ interface BadgeWithIconProps<T extends BadgeTypes> {
40
+ type?: T;
41
+ size?: Sizes;
42
+ color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
43
+ iconLeading?: IconComponentType;
44
+ iconTrailing?: IconComponentType;
45
+ children: ReactNode;
46
+ className?: string;
47
+ /** Overrides the `data-testid` (defaults to `fd-badge`); the leading/trailing icon derives `--icon` from it. */
48
+ 'data-testid'?: string;
49
+ }
50
+ /** `Badge` variant with a leading or trailing icon beside the label. */
51
+ export declare const BadgeWithIcon: <T extends BadgeTypes>(props: BadgeWithIconProps<T>) => import("react").JSX.Element;
52
+ interface BadgeWithFlagProps<T extends BadgeTypes> {
53
+ type?: T;
54
+ size?: Sizes;
55
+ flag?: FlagTypes;
56
+ color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
57
+ children: ReactNode;
58
+ }
59
+ /** `Badge` variant with a round country flag before the label. */
60
+ export declare const BadgeWithFlag: <T extends BadgeTypes>(props: BadgeWithFlagProps<T>) => import("react").JSX.Element;
61
+ interface BadgeWithImageProps<T extends BadgeTypes> {
62
+ type?: T;
63
+ size?: Sizes;
64
+ imgSrc: string;
65
+ color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
66
+ children: ReactNode;
67
+ }
68
+ /** `Badge` variant with a small round image before the label. */
69
+ export declare const BadgeWithImage: <T extends BadgeTypes>(props: BadgeWithImageProps<T>) => import("react").JSX.Element;
70
+ interface BadgeWithButtonProps<T extends BadgeTypes> {
71
+ type?: T;
72
+ size?: Sizes;
73
+ icon?: IconComponentType;
74
+ color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
75
+ children: ReactNode;
76
+ /**
77
+ * The label for the button.
78
+ */
79
+ buttonLabel?: string;
80
+ /**
81
+ * The click event handler for the button.
82
+ */
83
+ onButtonClick?: MouseEventHandler<HTMLButtonElement>;
84
+ /** Overrides the `data-testid` (defaults to `fd-badge`); the dismiss button derives `--close-button` from it. */
85
+ 'data-testid'?: string;
86
+ }
87
+ /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
88
+ export declare const BadgeWithButton: <T extends BadgeTypes>(props: BadgeWithButtonProps<T>) => import("react").JSX.Element;
89
+ interface BadgeIconProps<T extends BadgeTypes> {
90
+ type?: T;
91
+ size?: Sizes;
92
+ icon: IconComponentType;
93
+ color?: BadgeTypeToColorMap<typeof styles.types.standard>[T];
94
+ children?: ReactNode;
95
+ }
96
+ /** Icon-only `Badge` with no label text. */
97
+ export declare const BadgeIcon: <T extends BadgeTypes>(props: BadgeIconProps<T>) => import("react").JSX.Element;
98
+ export {};
99
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Badges/Badge/Badge.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,4CAA4C,CAAC;AAGpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/F,KAAK,SAAS,GAAG,WAAW,CAAC;AAE7B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,mBAAmB,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,UAAU;IAC9C,yGAAyG;IACzG,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oFA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MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,iHAAiH;IACjH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2FAA2F;AAC3F,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,UAAU,EAAE,OAAO,oBAAoB,CAAC,CAAC,CAAC,gCAwBnF,CAAC;AAEF,UAAU,cAAc,CAAC,CAAC,SAAS,UAAU;IAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4CAA4C;AAC5C,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,UAAU,EAAE,OAAO,cAAc,CAAC,CAAC,CAAC,gCAUvE,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { X } from '@flipdish/ui-icons';
3
+ import { Dot } from '@flipdish/ui-library/components/atoms/Dot';
4
+ import { Flag } from '@flipdish/ui-library/components/atoms/Flag';
5
+ import { cx } from '@flipdish/ui-library/utilities/cx';
6
+ import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
7
+ import { styles } from './Badge.styles.js';
8
+
9
+ /**
10
+ * Compact label for statuses, categories, counts, and tags. Conveys metadata at
11
+ * a glance through color and shape without competing with primary content.
12
+ *
13
+ * @summary compact status, category, or count label
14
+ */
15
+ const Badge = (props) => {
16
+ const { type = 'pill-color', size = 'md', color = 'gray', children, 'data-testid': dataTestId } = props;
17
+ const colors = styles.types.standard[type];
18
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
19
+ return (jsx("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.label[type][size], colors.styles[color].root, props.className), children: children }));
20
+ };
21
+ /** `Badge` variant with a coloured status dot before the label. */
22
+ const BadgeWithDot = (props) => {
23
+ const { size = 'md', color = 'gray', type = 'pill-color', className, children, 'data-testid': dataTestId } = props;
24
+ const colors = styles.types.addon[type];
25
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
26
+ return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.dot[type][size], colors.styles[color].root, className), children: [jsx(Dot, { color: colors.styles[color].dotColor, size: "sm", "data-testid": joinTestId(badgeTestId, 'dot') }), children] }));
27
+ };
28
+ /** `Badge` variant with a leading or trailing icon beside the label. */
29
+ const BadgeWithIcon = (props) => {
30
+ const { size = 'md', color = 'gray', type = 'pill-color', iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, 'data-testid': dataTestId, } = props;
31
+ const colors = styles.types.addon[type];
32
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
33
+ const icon = IconLeading ? 'leading' : 'trailing';
34
+ return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.icon[type][size][icon], colors.styles[color].root, className), children: [IconLeading && jsx(IconLeading, { className: cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": joinTestId(badgeTestId, 'icon') }), children, IconTrailing && jsx(IconTrailing, { className: cx(colors.styles[color].addon, 'size-3 stroke-3'), "data-testid": joinTestId(badgeTestId, 'icon') })] }));
35
+ };
36
+ /** `Badge` variant with a round country flag before the label. */
37
+ const BadgeWithFlag = (props) => {
38
+ const { size = 'md', color = 'gray', flag = 'AU', type = 'pill-color', children } = props;
39
+ const colors = styles.types.standard[type];
40
+ return (jsxs("span", { className: cx(colors.common, styles.sizes.media[type][size], colors.styles[color].root), children: [jsx(Flag, { code: flag, size: "xs" }), children] }));
41
+ };
42
+ /** `Badge` variant with a small round image before the label. */
43
+ const BadgeWithImage = (props) => {
44
+ const { size = 'md', color = 'gray', type = 'pill-color', imgSrc, children } = props;
45
+ const colors = styles.types.standard[type];
46
+ return (jsxs("span", { className: cx(colors.common, styles.sizes.media[type][size], colors.styles[color].root), children: [jsx("img", { src: imgSrc, className: "size-4 max-w-none rounded-full", alt: "Badge image" }), children] }));
47
+ };
48
+ /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
49
+ const BadgeWithButton = (props) => {
50
+ const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon = X, buttonLabel, children, 'data-testid': dataTestId } = props;
51
+ const colors = styles.types.standard[type];
52
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
53
+ return (jsxs("span", { "data-testid": badgeTestId, className: cx(colors.common, styles.sizes.button[type][size], colors.styles[color].root), children: [children, jsx("button", { type: "button", "aria-label": buttonLabel, onClick: props.onButtonClick, "data-testid": joinTestId(badgeTestId, 'close-button'), className: cx('flex cursor-pointer items-center justify-center p-0.5 outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2', colors.styles[color].addonButton, type === 'pill-color' ? 'rounded-full' : 'rounded-[3px]'), children: jsx(Icon, { className: "size-3 stroke-[3px] transition-inherit-all" }) })] }));
54
+ };
55
+ /** Icon-only `Badge` with no label text. */
56
+ const BadgeIcon = (props) => {
57
+ const { size = 'md', color = 'gray', type = 'pill-color', icon: Icon } = props;
58
+ const colors = styles.types.standard[type];
59
+ return (jsx("span", { className: cx(colors.common, styles.sizes.iconOnly[type][size], colors.styles[color].root), children: jsx(Icon, { className: cx('size-3 stroke-[3px]', colors.styles[color].addon) }) }));
60
+ };
61
+
62
+ export { Badge, BadgeIcon, BadgeWithButton, BadgeWithDot, BadgeWithFlag, BadgeWithIcon, BadgeWithImage };
63
+ //# sourceMappingURL=Badge.js.map