@molecule/app-ui-react 1.0.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 (179) hide show
  1. package/LICENSE +115 -0
  2. package/README.md +2786 -0
  3. package/dist/components/Accordion.d.ts +12 -0
  4. package/dist/components/Accordion.d.ts.map +1 -0
  5. package/dist/components/Accordion.js +80 -0
  6. package/dist/components/Accordion.js.map +1 -0
  7. package/dist/components/Alert.d.ts +26 -0
  8. package/dist/components/Alert.d.ts.map +1 -0
  9. package/dist/components/Alert.js +53 -0
  10. package/dist/components/Alert.js.map +1 -0
  11. package/dist/components/AuthGuard.d.ts +66 -0
  12. package/dist/components/AuthGuard.d.ts.map +1 -0
  13. package/dist/components/AuthGuard.js +42 -0
  14. package/dist/components/AuthGuard.js.map +1 -0
  15. package/dist/components/Avatar.d.ts +12 -0
  16. package/dist/components/Avatar.d.ts.map +1 -0
  17. package/dist/components/Avatar.js +25 -0
  18. package/dist/components/Avatar.js.map +1 -0
  19. package/dist/components/Badge.d.ts +12 -0
  20. package/dist/components/Badge.d.ts.map +1 -0
  21. package/dist/components/Badge.js +18 -0
  22. package/dist/components/Badge.js.map +1 -0
  23. package/dist/components/Button.d.ts +12 -0
  24. package/dist/components/Button.d.ts.map +1 -0
  25. package/dist/components/Button.js +19 -0
  26. package/dist/components/Button.js.map +1 -0
  27. package/dist/components/Card.d.ts +34 -0
  28. package/dist/components/Card.d.ts.map +1 -0
  29. package/dist/components/Card.js +71 -0
  30. package/dist/components/Card.js.map +1 -0
  31. package/dist/components/Checkbox.d.ts +12 -0
  32. package/dist/components/Checkbox.d.ts.map +1 -0
  33. package/dist/components/Checkbox.js +41 -0
  34. package/dist/components/Checkbox.js.map +1 -0
  35. package/dist/components/Dropdown.d.ts +38 -0
  36. package/dist/components/Dropdown.d.ts.map +1 -0
  37. package/dist/components/Dropdown.js +352 -0
  38. package/dist/components/Dropdown.js.map +1 -0
  39. package/dist/components/EmptyState.d.ts +15 -0
  40. package/dist/components/EmptyState.d.ts.map +1 -0
  41. package/dist/components/EmptyState.js +20 -0
  42. package/dist/components/EmptyState.js.map +1 -0
  43. package/dist/components/FloatingInput.d.ts +22 -0
  44. package/dist/components/FloatingInput.d.ts.map +1 -0
  45. package/dist/components/FloatingInput.js +38 -0
  46. package/dist/components/FloatingInput.js.map +1 -0
  47. package/dist/components/Form.d.ts +22 -0
  48. package/dist/components/Form.d.ts.map +1 -0
  49. package/dist/components/Form.js +81 -0
  50. package/dist/components/Form.js.map +1 -0
  51. package/dist/components/Icon.d.ts +48 -0
  52. package/dist/components/Icon.d.ts.map +1 -0
  53. package/dist/components/Icon.js +46 -0
  54. package/dist/components/Icon.js.map +1 -0
  55. package/dist/components/Input.d.ts +12 -0
  56. package/dist/components/Input.d.ts.map +1 -0
  57. package/dist/components/Input.js +25 -0
  58. package/dist/components/Input.js.map +1 -0
  59. package/dist/components/LanguagePicker.d.ts +60 -0
  60. package/dist/components/LanguagePicker.d.ts.map +1 -0
  61. package/dist/components/LanguagePicker.js +45 -0
  62. package/dist/components/LanguagePicker.js.map +1 -0
  63. package/dist/components/Layout.d.ts +24 -0
  64. package/dist/components/Layout.d.ts.map +1 -0
  65. package/dist/components/Layout.js +104 -0
  66. package/dist/components/Layout.js.map +1 -0
  67. package/dist/components/Modal.d.ts +32 -0
  68. package/dist/components/Modal.d.ts.map +1 -0
  69. package/dist/components/Modal.js +235 -0
  70. package/dist/components/Modal.js.map +1 -0
  71. package/dist/components/PageHeader.d.ts +15 -0
  72. package/dist/components/PageHeader.d.ts.map +1 -0
  73. package/dist/components/PageHeader.js +20 -0
  74. package/dist/components/PageHeader.js.map +1 -0
  75. package/dist/components/PageShell.d.ts +15 -0
  76. package/dist/components/PageShell.d.ts.map +1 -0
  77. package/dist/components/PageShell.js +20 -0
  78. package/dist/components/PageShell.js.map +1 -0
  79. package/dist/components/Pagination.d.ts +12 -0
  80. package/dist/components/Pagination.d.ts.map +1 -0
  81. package/dist/components/Pagination.js +78 -0
  82. package/dist/components/Pagination.js.map +1 -0
  83. package/dist/components/PanelClose.d.ts +40 -0
  84. package/dist/components/PanelClose.d.ts.map +1 -0
  85. package/dist/components/PanelClose.js +32 -0
  86. package/dist/components/PanelClose.js.map +1 -0
  87. package/dist/components/Progress.d.ts +45 -0
  88. package/dist/components/Progress.d.ts.map +1 -0
  89. package/dist/components/Progress.js +21 -0
  90. package/dist/components/Progress.js.map +1 -0
  91. package/dist/components/RadioGroup.d.ts +12 -0
  92. package/dist/components/RadioGroup.d.ts.map +1 -0
  93. package/dist/components/RadioGroup.js +34 -0
  94. package/dist/components/RadioGroup.js.map +1 -0
  95. package/dist/components/Select.d.ts +12 -0
  96. package/dist/components/Select.d.ts.map +1 -0
  97. package/dist/components/Select.js +57 -0
  98. package/dist/components/Select.js.map +1 -0
  99. package/dist/components/Separator.d.ts +25 -0
  100. package/dist/components/Separator.d.ts.map +1 -0
  101. package/dist/components/Separator.js +18 -0
  102. package/dist/components/Separator.js.map +1 -0
  103. package/dist/components/SidebarUserCard.d.ts +60 -0
  104. package/dist/components/SidebarUserCard.d.ts.map +1 -0
  105. package/dist/components/SidebarUserCard.js +45 -0
  106. package/dist/components/SidebarUserCard.js.map +1 -0
  107. package/dist/components/Skeleton.d.ts +26 -0
  108. package/dist/components/Skeleton.d.ts.map +1 -0
  109. package/dist/components/Skeleton.js +45 -0
  110. package/dist/components/Skeleton.js.map +1 -0
  111. package/dist/components/Spinner.d.ts +17 -0
  112. package/dist/components/Spinner.d.ts.map +1 -0
  113. package/dist/components/Spinner.js +32 -0
  114. package/dist/components/Spinner.js.map +1 -0
  115. package/dist/components/Switch.d.ts +12 -0
  116. package/dist/components/Switch.d.ts.map +1 -0
  117. package/dist/components/Switch.js +52 -0
  118. package/dist/components/Switch.js.map +1 -0
  119. package/dist/components/Table.d.ts +12 -0
  120. package/dist/components/Table.d.ts.map +1 -0
  121. package/dist/components/Table.js +53 -0
  122. package/dist/components/Table.js.map +1 -0
  123. package/dist/components/Tabs.d.ts +12 -0
  124. package/dist/components/Tabs.d.ts.map +1 -0
  125. package/dist/components/Tabs.js +72 -0
  126. package/dist/components/Tabs.js.map +1 -0
  127. package/dist/components/Textarea.d.ts +12 -0
  128. package/dist/components/Textarea.d.ts.map +1 -0
  129. package/dist/components/Textarea.js +66 -0
  130. package/dist/components/Textarea.js.map +1 -0
  131. package/dist/components/ThemeToggle.d.ts +43 -0
  132. package/dist/components/ThemeToggle.d.ts.map +1 -0
  133. package/dist/components/ThemeToggle.js +30 -0
  134. package/dist/components/ThemeToggle.js.map +1 -0
  135. package/dist/components/Toast.d.ts +61 -0
  136. package/dist/components/Toast.d.ts.map +1 -0
  137. package/dist/components/Toast.js +159 -0
  138. package/dist/components/Toast.js.map +1 -0
  139. package/dist/components/Tooltip.d.ts +21 -0
  140. package/dist/components/Tooltip.d.ts.map +1 -0
  141. package/dist/components/Tooltip.js +245 -0
  142. package/dist/components/Tooltip.js.map +1 -0
  143. package/dist/components/UserMenu.d.ts +59 -0
  144. package/dist/components/UserMenu.d.ts.map +1 -0
  145. package/dist/components/UserMenu.js +34 -0
  146. package/dist/components/UserMenu.js.map +1 -0
  147. package/dist/components/UserMenuPopover.d.ts +139 -0
  148. package/dist/components/UserMenuPopover.d.ts.map +1 -0
  149. package/dist/components/UserMenuPopover.js +173 -0
  150. package/dist/components/UserMenuPopover.js.map +1 -0
  151. package/dist/components/index.d.ts +43 -0
  152. package/dist/components/index.d.ts.map +1 -0
  153. package/dist/components/index.js +43 -0
  154. package/dist/components/index.js.map +1 -0
  155. package/dist/index.d.ts +131 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +131 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/types.d.ts +7 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/dist/types.js +7 -0
  162. package/dist/types.js.map +1 -0
  163. package/dist/utilities/index.d.ts +8 -0
  164. package/dist/utilities/index.d.ts.map +1 -0
  165. package/dist/utilities/index.js +8 -0
  166. package/dist/utilities/index.js.map +1 -0
  167. package/dist/utilities/initials.d.ts +13 -0
  168. package/dist/utilities/initials.d.ts.map +1 -0
  169. package/dist/utilities/initials.js +23 -0
  170. package/dist/utilities/initials.js.map +1 -0
  171. package/dist/utilities/renderIcon.d.ts +21 -0
  172. package/dist/utilities/renderIcon.d.ts.map +1 -0
  173. package/dist/utilities/renderIcon.js +40 -0
  174. package/dist/utilities/renderIcon.js.map +1 -0
  175. package/dist/utilities.d.ts +12 -0
  176. package/dist/utilities.d.ts.map +1 -0
  177. package/dist/utilities.js +14 -0
  178. package/dist/utilities.js.map +1 -0
  179. package/package.json +68 -0
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Accordion component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { AccordionProps } from '@molecule/app-ui';
8
+ /**
9
+ * Accordion component.
10
+ */
11
+ export declare const Accordion: React.ForwardRefExoticComponent<AccordionProps<string> & React.RefAttributes<HTMLDivElement>>;
12
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8E,MAAM,OAAO,CAAA;AAGlG,OAAO,KAAK,EAAsC,cAAc,EAAE,MAAM,kBAAkB,CAAA;AA2E1F;;GAEG;AACH,eAAO,MAAM,SAAS,+FAiFrB,CAAA"}
@@ -0,0 +1,80 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Accordion component.
4
+ *
5
+ * @module
6
+ */
7
+ import { createContext, forwardRef, useCallback, useContext, useId, useState } from 'react';
8
+ import { t } from '@molecule/app-i18n';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { renderIcon } from '../utilities/renderIcon.js';
11
+ const AccordionContext = createContext(null);
12
+ const useAccordionContext = () => {
13
+ const context = useContext(AccordionContext);
14
+ if (!context) {
15
+ throw new Error(t('react.error.useAccordionOutsideProvider', undefined, {
16
+ defaultValue: 'Accordion components must be used within an Accordion',
17
+ }));
18
+ }
19
+ return context;
20
+ };
21
+ const AccordionItemComponent = ({ item, className }) => {
22
+ const { expandedItems, toggleItem } = useAccordionContext();
23
+ const isExpanded = expandedItems.includes(item.value);
24
+ const contentId = useId();
25
+ const triggerId = useId();
26
+ const cm = getClassMap();
27
+ return (_jsxs("div", { className: cm.cn(cm.accordionItem, className), "data-state": isExpanded ? 'open' : 'closed', children: [_jsxs("button", { id: triggerId, type: "button", className: cm.cn(cm.accordion({ variant: 'default' }), cm.accordionTriggerBase), onClick: () => !item.disabled && toggleItem(item.value), "aria-expanded": isExpanded, "aria-controls": contentId, "data-state": isExpanded ? 'open' : 'closed', disabled: item.disabled, children: [item.header, renderIcon('chevron-down', cm.accordionChevron)] }), _jsx("div", { id: contentId, role: "region", "aria-labelledby": triggerId, "data-state": isExpanded ? 'open' : 'closed', className: cm.accordionContent, style: {
28
+ display: isExpanded ? 'block' : 'none',
29
+ }, children: _jsx("div", { className: cm.accordionContentInner, children: item.content }) })] }));
30
+ };
31
+ /**
32
+ * Accordion component.
33
+ */
34
+ export const Accordion = forwardRef(({ items, value, defaultValue, onChange, multiple = false, collapsible = true, className, style, testId, }, ref) => {
35
+ const cm = getClassMap();
36
+ // Normalize value to array
37
+ const normalizeValue = (v) => {
38
+ if (v === undefined)
39
+ return [];
40
+ return Array.isArray(v) ? v : [v];
41
+ };
42
+ const [internalExpanded, setInternalExpanded] = useState(() => normalizeValue(defaultValue));
43
+ // Use controlled value if provided, otherwise use internal state
44
+ const expandedItems = value !== undefined ? normalizeValue(value) : internalExpanded;
45
+ const toggleItem = useCallback((itemValue) => {
46
+ let newExpanded;
47
+ if (expandedItems.includes(itemValue)) {
48
+ // Collapsing
49
+ if (!collapsible && expandedItems.length === 1) {
50
+ // Can't collapse if not collapsible and it's the only expanded item
51
+ return;
52
+ }
53
+ newExpanded = expandedItems.filter((v) => v !== itemValue);
54
+ }
55
+ else {
56
+ // Expanding
57
+ if (multiple) {
58
+ newExpanded = [...expandedItems, itemValue];
59
+ }
60
+ else {
61
+ newExpanded = [itemValue];
62
+ }
63
+ }
64
+ if (value === undefined) {
65
+ setInternalExpanded(newExpanded);
66
+ }
67
+ // Call onChange with appropriate type
68
+ if (onChange) {
69
+ if (multiple) {
70
+ onChange(newExpanded);
71
+ }
72
+ else {
73
+ onChange((newExpanded[0] || ''));
74
+ }
75
+ }
76
+ }, [expandedItems, multiple, collapsible, value, onChange]);
77
+ return (_jsx(AccordionContext.Provider, { value: { expandedItems, toggleItem, multiple }, children: _jsx("div", { ref: ref, className: cm.cn(cm.accordionRoot, className), style: style, "data-testid": testId, children: items.map((item) => (_jsx(AccordionItemComponent, { item: item }, item.value))) }) }));
78
+ });
79
+ Accordion.displayName = 'Accordion';
80
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/components/Accordion.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAElG,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAWvD,MAAM,gBAAgB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAA;AAE1E,MAAM,mBAAmB,GAAG,GAA0B,EAAE;IACtD,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,CAAC,CAAC,yCAAyC,EAAE,SAAS,EAAE;YACtD,YAAY,EAAE,uDAAuD;SACtE,CAAC,CACH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,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Alert component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { AlertProps } from '@molecule/app-ui';
8
+ /**
9
+ * Alert component.
10
+ *
11
+ * `role="alert"` is assertive: it interrupts a screen reader immediately,
12
+ * which is correct ONLY for content that appears dynamically (a validation
13
+ * error after submit, a save failure). An Alert rendered statically with
14
+ * the rest of the page (an informational banner already in the initial
15
+ * render) has nothing to interrupt — announcing it assertively on mount is
16
+ * the same over-announcing trap the Toast role fix addresses. `live`
17
+ * (default `true`, matching the previous unconditional behavior so no
18
+ * existing dynamic-error usage silently goes quiet) makes this honest and
19
+ * caller-controlled: pass `live={false}` for a banner that is part of the
20
+ * page's normal content, and it announces politely (`role="status"`)
21
+ * instead of interrupting.
22
+ */
23
+ export declare const Alert: React.ForwardRefExoticComponent<AlertProps & {
24
+ live?: boolean;
25
+ } & React.RefAttributes<HTMLDivElement>>;
26
+ //# sourceMappingURL=Alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAA;AAyBhE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;WAAoD,OAAO;wCAkD5E,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Alert component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef } from 'react';
8
+ import { t } from '@molecule/app-i18n';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { renderIcon } from '../utilities/renderIcon.js';
11
+ const statusVariantMap = {
12
+ primary: 'default',
13
+ secondary: 'default',
14
+ success: 'success',
15
+ warning: 'warning',
16
+ error: 'error',
17
+ info: 'info',
18
+ };
19
+ /**
20
+ * Map alert status to icon name.
21
+ */
22
+ const statusIconMap = {
23
+ info: 'info-circle',
24
+ success: 'check-circle',
25
+ warning: 'exclamation-triangle',
26
+ error: 'x-circle',
27
+ };
28
+ /**
29
+ * Alert component.
30
+ *
31
+ * `role="alert"` is assertive: it interrupts a screen reader immediately,
32
+ * which is correct ONLY for content that appears dynamically (a validation
33
+ * error after submit, a save failure). An Alert rendered statically with
34
+ * the rest of the page (an informational banner already in the initial
35
+ * render) has nothing to interrupt — announcing it assertively on mount is
36
+ * the same over-announcing trap the Toast role fix addresses. `live`
37
+ * (default `true`, matching the previous unconditional behavior so no
38
+ * existing dynamic-error usage silently goes quiet) makes this honest and
39
+ * caller-controlled: pass `live={false}` for a banner that is part of the
40
+ * page's normal content, and it announces politely (`role="status"`)
41
+ * instead of interrupting.
42
+ */
43
+ export const Alert = forwardRef(({ children, title, status = 'info', variant: _variant, live = true, dismissible, onDismiss, icon, dismissLabel, className, style, testId, }, ref) => {
44
+ const cm = getClassMap();
45
+ const alertVariant = statusVariantMap[status] || 'default';
46
+ const iconName = statusIconMap[alertVariant];
47
+ const defaultIcon = iconName ? renderIcon(iconName, cm.iconMd) : null;
48
+ const alertClasses = cm.cn(cm.alert({ variant: alertVariant }), className);
49
+ const role = live ? 'alert' : 'status';
50
+ return (_jsxs("div", { ref: ref, role: role, className: alertClasses, style: style, "data-testid": testId, children: [(icon || defaultIcon) && (_jsx("span", { className: cm.alertIconWrapper, children: (icon || defaultIcon) })), _jsxs("div", { className: cm.alertContent, children: [title && _jsx("h5", { className: cm.alertTitle, children: title }), _jsx("div", { className: cm.alertDescription, children: children })] }), dismissible && (_jsx("button", { type: "button", onClick: onDismiss, className: cm.alertDismiss, "aria-label": dismissLabel ?? t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' }), children: renderIcon('x-mark', cm.iconSm) }))] }));
51
+ });
52
+ Alert.displayName = 'Alert';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I,CAAA;IAErE,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;IAC1E,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAA;IAEtC,OAAO,CACL,eAAK,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,iBAAe,MAAM,aAClF,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,CACxB,eAAM,SAAS,EAAE,EAAE,CAAC,gBAAgB,YAAG,CAAC,IAAI,IAAI,WAAW,CAAoB,GAAQ,CACxF,EACD,eAAK,SAAS,EAAE,EAAE,CAAC,YAAY,aAC5B,KAAK,IAAI,aAAI,SAAS,EAAE,EAAE,CAAC,UAAU,YAAG,KAAK,GAAM,EACpD,cAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,YAAG,QAA2B,GAAO,IACpE,EACL,WAAW,IAAI,CACd,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,SAAS,EAClB,SAAS,EAAE,EAAE,CAAC,YAAY,gBAExB,YAAY,IAAI,CAAC,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,YAG9E,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,GACzB,CACV,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Props for {@link AuthGuard}.
4
+ *
5
+ * All props are optional — the default behavior (loading tag → redirect
6
+ * to `/login` → `<Outlet />`) matches the bare-bones guard apps were
7
+ * shipping locally. The props let apps customize per-call without
8
+ * forking the component.
9
+ */
10
+ export interface AuthGuardProps {
11
+ /**
12
+ * Element rendered while `useAuth().state.initialized` is `false`.
13
+ * Overrides the default `<div data-mol-id="auth-guard-loading">…</div>`
14
+ * loading tag — pass a full-page spinner or any other UI you want
15
+ * during the auth bootstrap window.
16
+ */
17
+ loadingFallback?: ReactNode;
18
+ /**
19
+ * i18n key used for the default loading-tag text. Defaults to
20
+ * `'common.loading'`. Ignored when `loadingFallback` is set.
21
+ */
22
+ loadingKey?: string;
23
+ /**
24
+ * Fallback text if the i18n key is missing. Defaults to `'Loading...'`
25
+ * (the project-canonical ASCII glyph — Phase C of the locale
26
+ * canonicalization plan). Ignored when `loadingFallback` is set.
27
+ */
28
+ loadingDefault?: string;
29
+ /**
30
+ * Path to redirect to when the user is not authenticated. Defaults to
31
+ * `'/login'`. The current `useLocation()` is preserved as `state.from`
32
+ * for post-login restoration.
33
+ */
34
+ loginPath?: string;
35
+ /**
36
+ * Callback invoked when `isAuthenticated` transitions to `true` (or is
37
+ * already `true` on first render). Useful for one-shot per-app
38
+ * bootstrap effects (e.g. seeding fixture data). The caller is
39
+ * responsible for idempotency if the auth state can flip back and
40
+ * forth — this fires on every transition.
41
+ */
42
+ onAuthenticated?: () => void;
43
+ /**
44
+ * Children to render when authenticated. Defaults to `<Outlet />`,
45
+ * which is the React Router pattern this guard is designed for.
46
+ */
47
+ children?: ReactNode;
48
+ }
49
+ /**
50
+ * Route-element guard for authenticated sections of a React Router tree.
51
+ *
52
+ * - While `useAuth().state.initialized` is `false`, renders the
53
+ * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
54
+ * - If the user is not authenticated, redirects to `loginPath` carrying
55
+ * the attempted location in `state.from` for post-login restoration.
56
+ * - Otherwise renders `children` (or `<Outlet />` if none).
57
+ *
58
+ * The default loading tag carries `data-mol-id="auth-guard-loading"`
59
+ * so AI agents and e2e tests can target it reliably. When the caller
60
+ * passes a custom `loadingFallback`, it's the caller's responsibility
61
+ * to include any data-mol-id they need.
62
+ *
63
+ * @param props - {@link AuthGuardProps}
64
+ */
65
+ export declare function AuthGuard({ loadingFallback, loadingKey, loadingDefault, loginPath, onAuthenticated, children, }?: AuthGuardProps): ReactNode;
66
+ //# sourceMappingURL=AuthGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,UAA6B,EAC7B,cAA6B,EAC7B,SAAoB,EACpB,eAAe,EACf,QAAQ,GACT,GAAE,cAAmB,GAAG,SAAS,CA2BjC"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ import { Navigate, Outlet, useLocation } from 'react-router';
4
+ import { useAuth, useTranslation } from '@molecule/app-react';
5
+ /**
6
+ * Route-element guard for authenticated sections of a React Router tree.
7
+ *
8
+ * - While `useAuth().state.initialized` is `false`, renders the
9
+ * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
10
+ * - If the user is not authenticated, redirects to `loginPath` carrying
11
+ * the attempted location in `state.from` for post-login restoration.
12
+ * - Otherwise renders `children` (or `<Outlet />` if none).
13
+ *
14
+ * The default loading tag carries `data-mol-id="auth-guard-loading"`
15
+ * so AI agents and e2e tests can target it reliably. When the caller
16
+ * passes a custom `loadingFallback`, it's the caller's responsibility
17
+ * to include any data-mol-id they need.
18
+ *
19
+ * @param props - {@link AuthGuardProps}
20
+ */
21
+ export function AuthGuard({ loadingFallback, loadingKey = 'common.loading', loadingDefault = 'Loading...', loginPath = '/login', onAuthenticated, children, } = {}) {
22
+ const { isAuthenticated, state } = useAuth();
23
+ const { t } = useTranslation();
24
+ const location = useLocation();
25
+ const lastAuthRef = useRef(false);
26
+ useEffect(() => {
27
+ if (!onAuthenticated)
28
+ return;
29
+ if (isAuthenticated && !lastAuthRef.current) {
30
+ onAuthenticated();
31
+ }
32
+ lastAuthRef.current = isAuthenticated;
33
+ }, [isAuthenticated, onAuthenticated]);
34
+ if (!state.initialized) {
35
+ return (loadingFallback ?? (_jsx("div", { "data-mol-id": "auth-guard-loading", children: t(loadingKey, {}, { defaultValue: loadingDefault }) })));
36
+ }
37
+ if (!isAuthenticated) {
38
+ return _jsx(Navigate, { to: loginPath, state: { from: location }, replace: true });
39
+ }
40
+ return _jsx(_Fragment, { children: children ?? _jsx(Outlet, {}) });
41
+ }
42
+ //# sourceMappingURL=AuthGuard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthGuard.js","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAkD7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,eAAe,EACf,UAAU,GAAG,gBAAgB,EAC7B,cAAc,GAAG,YAAY,EAC7B,SAAS,GAAG,QAAQ,EACpB,eAAe,EACf,QAAQ,MACU,EAAE;IACpB,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAA;IAC5C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAEjC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe;YAAE,OAAM;QAC5B,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC5C,eAAe,EAAE,CAAA;QACnB,CAAC;QACD,WAAW,CAAC,OAAO,GAAG,eAAe,CAAA;IACvC,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAA;IAEtC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QACvB,OAAO,CACL,eAAe,IAAI,CACjB,6BAAiB,oBAAoB,YAClC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,GAChD,CACP,CACF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,SAAG,CAAA;IACvE,CAAC;IACD,OAAO,4BAAG,QAAQ,IAAI,KAAC,MAAM,KAAG,GAAI,CAAA;AACtC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Avatar component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { AvatarProps } from '@molecule/app-ui';
8
+ /**
9
+ * Avatar component.
10
+ */
11
+ export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
12
+ //# sourceMappingURL=Avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAMnD;;GAEG;AACH,eAAO,MAAM,MAAM,oFA4ClB,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Avatar component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef, useState } from 'react';
8
+ import { t } from '@molecule/app-i18n';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { getInitials } from '../utilities/initials.js';
11
+ import { renderIcon } from '../utilities/renderIcon.js';
12
+ /**
13
+ * Avatar component.
14
+ */
15
+ export const Avatar = forwardRef(({ src, alt, name, size = 'md', rounded = true, fallback, className, style, testId }, ref) => {
16
+ const [imageError, setImageError] = useState(false);
17
+ const cm = getClassMap();
18
+ const showFallback = !src || imageError;
19
+ const avatarSize = typeof size === 'number' ? undefined : size;
20
+ const containerClasses = cm.cn(cm.avatar({ size: avatarSize }), !rounded && cm.avatarSquare, className);
21
+ const customSize = typeof size === 'number' ? { width: size, height: size } : undefined;
22
+ return (_jsx("div", { ref: ref, className: containerClasses, style: { ...style, ...customSize }, "data-testid": testId, children: !showFallback ? (_jsx("img", { src: src, alt: alt || name || t('ui.avatar.alt', undefined, { defaultValue: 'Avatar' }), className: cm.avatarImage, onError: () => setImageError(true) })) : (_jsx("div", { className: cm.avatarFallback, children: fallback ? fallback : name ? (_jsx("span", { className: cm.avatarInitials, children: getInitials(name) })) : (renderIcon('user', cm.avatarFallbackIcon)) })) }));
23
+ });
24
+ Avatar.displayName = 'Avatar';
25
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"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GAAG,KAAK,EAAE,GAAG,UAAU,EAAE,iBACrB,MAAM,YAElB,CAAC,YAAY,CAAC,CAAC,CAAC,CACf,cACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,EAC7E,SAAS,EAAE,EAAE,CAAC,WAAW,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,GAClC,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAE,EAAE,CAAC,cAAc,YAC9B,QAAQ,CAAC,CAAC,CACR,QACF,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,eAAM,SAAS,EAAE,EAAE,CAAC,cAAc,YAAG,WAAW,CAAC,IAAI,CAAC,GAAQ,CAC/D,CAAC,CAAC,CAAC,CACF,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAC1C,GACG,CACP,GACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Badge component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { BadgeProps } from '@molecule/app-ui';
8
+ /**
9
+ * Badge component.
10
+ */
11
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
12
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;GAEG;AACH,eAAO,MAAM,KAAK,oFA4BjB,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Badge component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef } from 'react';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ /**
10
+ * Badge component.
11
+ */
12
+ export const Badge = forwardRef(({ children, color = 'primary', variant: _variant = 'solid', size, rounded = true, className, style, testId, }, ref) => {
13
+ const cm = getClassMap();
14
+ const badgeClasses = cm.cn(cm.badge({ variant: color, size }), !rounded && cm.badgeSquare, className);
15
+ return (_jsx("span", { ref: ref, className: badgeClasses, style: style, "data-testid": testId, children: children }));
16
+ });
17
+ Badge.displayName = 'Badge';
18
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,QAAQ,EACR,KAAK,GAAG,SAAS,EACjB,OAAO,EAAE,QAAQ,GAAG,OAAO,EAC3B,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACP,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IAExB,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,CACxB,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAClC,CAAC,OAAO,IAAI,EAAE,CAAC,WAAW,EAC1B,SAAS,CACV,CAAA;IAED,OAAO,CACL,eAAM,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,iBAAe,MAAM,YACvE,QAA2B,GACvB,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Button component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { ButtonProps } from '@molecule/app-ui';
8
+ /**
9
+ * Button component.
10
+ */
11
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
12
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAKnD;;GAEG;AACH,eAAO,MAAM,MAAM,uFAgDlB,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Button component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef } from 'react';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ import { Spinner } from './Spinner.js';
10
+ /**
11
+ * Button component.
12
+ */
13
+ export const Button = forwardRef(({ children, variant = 'solid', color = 'primary', size = 'md', loading = false, loadingText, fullWidth = false, leftIcon, rightIcon, className, style, testId, disabled, type = 'button', onClick, ...rest }, ref) => {
14
+ const cm = getClassMap();
15
+ const classes = cm.cn(cm.button({ variant, color, size, fullWidth }), className);
16
+ return (_jsxs("button", { ref: ref, type: type, className: classes, style: style, "data-testid": testId, disabled: disabled || loading, onClick: onClick, "aria-busy": loading, ...rest, children: [loading && _jsx(Spinner, { size: "sm", className: cm.buttonIconLeft }), !loading && !!leftIcon && (_jsx("span", { className: cm.buttonIconLeft, children: leftIcon })), loading && loadingText ? loadingText : children, !loading && !!rightIcon && (_jsx("span", { className: cm.buttonIconRight, children: rightIcon }))] }));
17
+ });
18
+ Button.displayName = 'Button';
19
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CACE,EACE,QAAQ,EACR,OAAO,GAAG,OAAO,EACjB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;IAEhF,OAAO,CACL,kBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,iBACC,MAAM,EACnB,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,OAAO,EAAE,OAAgE,eAC9D,OAAO,KACb,IAAsD,aAE1D,OAAO,IAAI,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,EAAE,CAAC,cAAc,GAAI,EAC9D,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CACzB,eAAM,SAAS,EAAE,EAAE,CAAC,cAAc,YAAG,QAA2B,GAAQ,CACzE,EACA,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAE,QAA4B,EACpE,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,IAAI,CAC1B,eAAM,SAAS,EAAE,EAAE,CAAC,eAAe,YAAG,SAA4B,GAAQ,CAC3E,IACM,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Card component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { CardProps } from '@molecule/app-ui';
8
+ /**
9
+ * Card component.
10
+ */
11
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & {
12
+ 'data-mol-id'?: string;
13
+ } & React.RefAttributes<HTMLDivElement>>;
14
+ /**
15
+ * Card header component.
16
+ */
17
+ export declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
18
+ /**
19
+ * Card title component.
20
+ */
21
+ export declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
22
+ /**
23
+ * Card description component.
24
+ */
25
+ export declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
26
+ /**
27
+ * Card content component.
28
+ */
29
+ export declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
30
+ /**
31
+ * Card footer component.
32
+ */
33
+ export declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
34
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAWjD;;GAEG;AACH,eAAO,MAAM,IAAI;oBAA4D,MAAM;wCA8ClF,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,UAAU,6GAUtB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,SAAS,qHAUrB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,eAAe,yHAW1B,CAAA;AAIF;;GAEG;AACH,eAAO,MAAM,WAAW,6GAUvB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,UAAU,6GAUtB,CAAA"}
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Card component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef } from 'react';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ const variantMap = {
10
+ elevated: 'elevated',
11
+ outlined: 'outline',
12
+ filled: 'default',
13
+ };
14
+ // paddingMap removed — use cm.cardPadding(size) instead
15
+ /**
16
+ * Card component.
17
+ */
18
+ export const Card = forwardRef(({ children, variant = 'elevated', interactive, padding = 'md', className, style, testId, onClick, ...rest }, ref) => {
19
+ const cm = getClassMap();
20
+ const paddingClass = padding === 'none' ? '' : cm.cardPadding(padding);
21
+ const cardVariant = variantMap[variant] || 'default';
22
+ const cardClasses = cm.cn(cm.card({ variant: cardVariant }), paddingClass, interactive && cm.cardInteractive, className);
23
+ const passthrough = {};
24
+ for (const [k, v] of Object.entries(rest)) {
25
+ if (k.startsWith('data-') || k.startsWith('aria-'))
26
+ passthrough[k] = v;
27
+ }
28
+ return (_jsx("div", { ref: ref, className: cardClasses, style: style, "data-testid": testId, onClick: onClick, role: interactive ? 'button' : undefined, tabIndex: interactive ? 0 : undefined, ...passthrough, children: children }));
29
+ });
30
+ Card.displayName = 'Card';
31
+ /**
32
+ * Card header component.
33
+ */
34
+ export const CardHeader = forwardRef(({ children, className, ...props }, ref) => {
35
+ const cm = getClassMap();
36
+ return (_jsx("div", { ref: ref, className: cm.cn(cm.cardHeader, className), ...props, children: children }));
37
+ });
38
+ CardHeader.displayName = 'CardHeader';
39
+ /**
40
+ * Card title component.
41
+ */
42
+ export const CardTitle = forwardRef(({ children, className, ...props }, ref) => {
43
+ const cm = getClassMap();
44
+ return (_jsx("h3", { ref: ref, className: cm.cn(cm.cardTitle, className), ...props, children: children }));
45
+ });
46
+ CardTitle.displayName = 'CardTitle';
47
+ /**
48
+ * Card description component.
49
+ */
50
+ export const CardDescription = forwardRef(({ children, className, ...props }, ref) => {
51
+ const cm = getClassMap();
52
+ return (_jsx("p", { ref: ref, className: cm.cn(cm.cardDescription, className), ...props, children: children }));
53
+ });
54
+ CardDescription.displayName = 'CardDescription';
55
+ /**
56
+ * Card content component.
57
+ */
58
+ export const CardContent = forwardRef(({ children, className, ...props }, ref) => {
59
+ const cm = getClassMap();
60
+ return (_jsx("div", { ref: ref, className: cm.cn(cm.cardContent, className), ...props, children: children }));
61
+ });
62
+ CardContent.displayName = 'CardContent';
63
+ /**
64
+ * Card footer component.
65
+ */
66
+ export const CardFooter = forwardRef(({ children, className, ...props }, ref) => {
67
+ const cm = getClassMap();
68
+ return (_jsx("div", { ref: ref, className: cm.cn(cm.cardFooter, className), ...props, children: children }));
69
+ });
70
+ CardFooter.displayName = 'CardFooter';
71
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,UAAU,GAAiE;IAC/E,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;C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,GACP,CACL,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACzC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IAExB,OAAO,CACL,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,KAAM,KAAK,YAClE,QAAQ,GACL,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACzC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IAExB,OAAO,CACL,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,KAAM,KAAK,YACjE,QAAQ,GACL,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Checkbox component.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import type { CheckboxProps } from '@molecule/app-ui';
8
+ /**
9
+ * Checkbox component.
10
+ */
11
+ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
12
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAA;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;GAEG;AACH,eAAO,MAAM,QAAQ,wFAkFpB,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Checkbox component.
4
+ *
5
+ * @module
6
+ */
7
+ import { forwardRef, useCallback, useEffect, useId, useRef } from 'react';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ /**
10
+ * Checkbox component.
11
+ */
12
+ export const Checkbox = forwardRef(({ label, checked, indeterminate, size: _size, error, className, style, testId, disabled, name, id, onChange, ...rest }, ref) => {
13
+ // Always track the node in internalRef (for the indeterminate DOM flag)
14
+ // AND forward it to the caller's ref. The previous `(ref || internalRef)
15
+ // as RefObject` cast silently broke `indeterminate` whenever the caller
16
+ // passed a CALLBACK ref (functions have no `.current`).
17
+ const internalRef = useRef(null);
18
+ const setRefs = useCallback((node) => {
19
+ internalRef.current = node;
20
+ if (typeof ref === 'function')
21
+ ref(node);
22
+ else if (ref)
23
+ ref.current = node;
24
+ }, [ref]);
25
+ const cm = getClassMap();
26
+ const checkboxId = id || name;
27
+ // The error message must be programmatically associated with the input
28
+ // (like Input/Textarea/Select already do) — a bare sibling <p> is never
29
+ // announced by screen readers, so the failure reason was invisible.
30
+ const generatedId = useId();
31
+ const errorId = `${checkboxId || generatedId}-error`;
32
+ useEffect(() => {
33
+ if (internalRef.current) {
34
+ internalRef.current.indeterminate = !!indeterminate;
35
+ }
36
+ }, [indeterminate]);
37
+ const checkboxClasses = cm.cn(cm.checkbox({ error: !!error }), className);
38
+ return (_jsxs("div", { className: cm.formFieldWrapper, children: [_jsxs("label", { className: cm.controlLabel, children: [_jsx("input", { ref: setRefs, type: "checkbox", id: checkboxId, name: name, checked: checked, disabled: disabled, "data-state": checked ? 'checked' : 'unchecked', "aria-invalid": !!error, "aria-describedby": error ? errorId : undefined, className: checkboxClasses, style: style, "data-testid": testId, onChange: onChange, ...rest }), !!label && (_jsx("span", { className: cm.cn(cm.controlText, disabled && cm.controlDisabled), children: label }))] }), error && (_jsx("p", { id: errorId, className: cm.cn(cm.formError, cm.sp('mt', 1)), children: error }))] }));
39
+ });
40
+ Checkbox.displayName = 'Checkbox';
41
+ //# sourceMappingURL=Checkbox.js.map