@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,23 @@
1
+ /**
2
+ * Initials derivation for avatar fallbacks.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Compute up-to-two-letter initials from a display name or email.
8
+ *
9
+ * @param value - The name or email to derive initials from.
10
+ * @returns The uppercased initials, or `'?'` when no usable input is given.
11
+ */
12
+ export function getInitials(value) {
13
+ if (!value)
14
+ return '?';
15
+ const cleaned = value.includes('@') ? value.split('@')[0] : value;
16
+ const parts = cleaned.split(/[\s._-]+/).filter(Boolean);
17
+ if (parts.length === 0)
18
+ return '?';
19
+ const first = parts[0]?.[0] ?? '';
20
+ const last = parts.length > 1 ? (parts[parts.length - 1]?.[0] ?? '') : '';
21
+ return (first + last).toUpperCase().slice(0, 2) || '?';
22
+ }
23
+ //# sourceMappingURL=initials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initials.js","sourceRoot":"","sources":["../../src/utilities/initials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAA;IACtB,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IACjE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACjC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACzE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAA;AACxD,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Render an icon from the current icon set.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import { type IconName } from '@molecule/app-icons';
8
+ /**
9
+ * Renders an icon by name as a React SVG element.
10
+ *
11
+ * The SVG is marked `aria-hidden` + `focusable="false"`: every call site is
12
+ * decorative chrome (close X, chevrons, status glyphs) whose accessible name
13
+ * comes from the surrounding control's `aria-label`/text. Without this, some
14
+ * screen reader/browser combos announce a stray "image" for each glyph.
15
+ *
16
+ * @param name - Icon name from the icon set
17
+ * @param className - CSS class for sizing
18
+ * @returns React SVG element
19
+ */
20
+ export declare function renderIcon(name: IconName, className?: string): React.ReactElement;
21
+ //# sourceMappingURL=renderIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/utilities/renderIcon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAyBjF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Render an icon from the current icon set.
3
+ *
4
+ * @module
5
+ */
6
+ import React from 'react';
7
+ import { getIcon } from '@molecule/app-icons';
8
+ /**
9
+ * Renders an icon by name as a React SVG element.
10
+ *
11
+ * The SVG is marked `aria-hidden` + `focusable="false"`: every call site is
12
+ * decorative chrome (close X, chevrons, status glyphs) whose accessible name
13
+ * comes from the surrounding control's `aria-label`/text. Without this, some
14
+ * screen reader/browser combos announce a stray "image" for each glyph.
15
+ *
16
+ * @param name - Icon name from the icon set
17
+ * @param className - CSS class for sizing
18
+ * @returns React SVG element
19
+ */
20
+ export function renderIcon(name, className) {
21
+ const icon = getIcon(name);
22
+ return React.createElement('svg', {
23
+ xmlns: 'http://www.w3.org/2000/svg',
24
+ 'aria-hidden': true,
25
+ focusable: false,
26
+ className,
27
+ viewBox: icon.viewBox || '0 0 20 20',
28
+ fill: icon.fill || 'currentColor',
29
+ stroke: icon.stroke,
30
+ strokeWidth: icon.strokeWidth,
31
+ strokeLinecap: icon.strokeLinecap,
32
+ strokeLinejoin: icon.strokeLinejoin,
33
+ }, ...icon.paths.map((p, i) => React.createElement('path', {
34
+ key: i,
35
+ d: p.d,
36
+ fillRule: p.fillRule,
37
+ clipRule: p.clipRule,
38
+ })));
39
+ }
40
+ //# sourceMappingURL=renderIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderIcon.js","sourceRoot":"","sources":["../../src/utilities/renderIcon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAiB,MAAM,qBAAqB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAc,EAAE,SAAkB;IAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,KAAK,CAAC,aAAa,CACxB,KAAK,EACL;QACE,KAAK,EAAE,4BAA4B;QACnC,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,KAAK;QAChB,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,WAAW;QACpC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,cAAc;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,EACD,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACzB,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,CAAC;QACN,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;KACrB,CAAC,CACH,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Utility functions for UI components.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Merge class name strings, filtering out falsy values (undefined, null, false).
8
+ * @param inputs - Class name strings or falsy values to be filtered out.
9
+ * @returns A single space-separated class string.
10
+ */
11
+ export declare function cn(...inputs: (string | undefined | null | false)[]): string;
12
+ //# sourceMappingURL=utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG,MAAM,CAE3E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Utility functions for UI components.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Merge class name strings, filtering out falsy values (undefined, null, false).
8
+ * @param inputs - Class name strings or falsy values to be filtered out.
9
+ * @returns A single space-separated class string.
10
+ */
11
+ export function cn(...inputs) {
12
+ return inputs.filter(Boolean).join(' ');
13
+ }
14
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAA6C;IACjE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@molecule/app-ui-react",
3
+ "version": "1.0.0",
4
+ "description": "React UI components for molecule.dev",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./components/Tooltip.js": {
14
+ "types": "./dist/components/Tooltip.d.ts",
15
+ "import": "./dist/components/Tooltip.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "dev": "tsc --watch",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest"
28
+ },
29
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
30
+ "license": "Apache-2.0",
31
+ "engines": {
32
+ "node": ">=20"
33
+ },
34
+ "peerDependencies": {
35
+ "@molecule/app-i18n": "^1.0.0",
36
+ "@molecule/app-icons": "^1.0.0",
37
+ "@molecule/app-react": "^1.0.0",
38
+ "@molecule/app-ui": "^1.0.0",
39
+ "react": "^18.0.0 || ^19.0.0",
40
+ "react-dom": "^18.0.0 || ^19.0.0",
41
+ "react-router": "^7.0.0 || ^8.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@molecule/app-i18n": "1.0.0",
45
+ "@molecule/app-icons": "1.0.0",
46
+ "@molecule/app-react": "1.0.0",
47
+ "@testing-library/react": "16.3.2",
48
+ "@types/node": "26.1.2",
49
+ "@types/react": "19.2.17",
50
+ "@types/react-dom": "19.2.3",
51
+ "jsdom": "30.0.1",
52
+ "react": "19.2.8",
53
+ "react-dom": "19.2.8",
54
+ "react-router": "8.3.0",
55
+ "typescript": "6.0.3",
56
+ "vitest": "4.1.10"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/molecule-dev/molecule.git",
61
+ "directory": "packages/app/frameworks/react-ui"
62
+ },
63
+ "homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/app/frameworks/react-ui",
64
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ }
68
+ }