@cystackapp/ui 1.4.1 → 2.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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -47
  3. package/dist/assets/background-pattern-grid.svg.js +7 -0
  4. package/dist/assets/empty-cloud.svg.js +5 -0
  5. package/dist/components/accordion/Accordion.d.ts +20 -0
  6. package/dist/components/accordion/Accordion.js +36 -0
  7. package/dist/components/accordion/AccordionTestStory.d.ts +3 -0
  8. package/dist/components/alert/Alert.d.ts +15 -0
  9. package/dist/components/alert/Alert.js +54 -0
  10. package/dist/components/avatar/Avatar.d.ts +13 -0
  11. package/dist/components/avatar/Avatar.js +64 -0
  12. package/dist/components/background-pattern/BackgroundPatternGrid.d.ts +1 -0
  13. package/dist/components/background-pattern/BackgroundPatternGrid.js +6 -0
  14. package/dist/components/badge/Badge.d.ts +1 -1
  15. package/dist/components/badge/Badge.js +3 -3
  16. package/dist/components/badge/BadgeTestStory.d.ts +1 -1
  17. package/dist/components/badge/variants/BadgeMore.d.ts +1 -1
  18. package/dist/components/badge/variants/BadgeMoreTestStory.d.ts +1 -1
  19. package/dist/components/badge/variants/BadgeTag.d.ts +1 -1
  20. package/dist/components/badge/variants/BadgeTag.js +1 -1
  21. package/dist/components/banner/Banner.d.ts +9 -0
  22. package/dist/components/banner/Banner.js +21 -0
  23. package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
  24. package/dist/components/breadcrumb/Breadcrumb.js +36 -0
  25. package/dist/components/button/Button.d.ts +21 -0
  26. package/dist/components/button/Button.js +49 -0
  27. package/dist/components/button/ButtonLoader.d.ts +7 -0
  28. package/dist/components/button/ButtonLoader.js +44 -0
  29. package/dist/components/button/ButtonTestStory.d.ts +5 -0
  30. package/dist/components/button/button-variants.d.ts +13 -0
  31. package/dist/components/button/button-variants.js +58 -0
  32. package/dist/components/card/Card.d.ts +91 -0
  33. package/dist/components/card/Card.js +56 -0
  34. package/dist/components/card/Card.stories-ct.d.ts +1 -0
  35. package/dist/components/card/CardBody.d.ts +9 -0
  36. package/dist/components/card/CardBody.js +16 -0
  37. package/dist/components/card/CardHeader.d.ts +15 -0
  38. package/dist/components/card/CardHeader.js +79 -0
  39. package/dist/components/card/types.d.ts +1 -0
  40. package/dist/components/chart/chart-legend/ChartLegend.d.ts +38 -0
  41. package/dist/components/chart/chart-legend/ChartLegend.js +57 -0
  42. package/dist/components/chart/chart-legend/ChartLegendItem.d.ts +19 -0
  43. package/dist/components/chart/chart-legend/ChartLegendItem.js +30 -0
  44. package/dist/components/chart/chart-legend/types.d.ts +49 -0
  45. package/dist/components/chart/donut-chart/DonutChart.d.ts +55 -0
  46. package/dist/components/chart/donut-chart/DonutChart.js +110 -0
  47. package/dist/components/chart/donut-chart/DonutSegments.d.ts +25 -0
  48. package/dist/components/chart/donut-chart/DonutSegments.js +51 -0
  49. package/dist/components/chart/donut-chart/donut-tooltip.d.ts +20 -0
  50. package/dist/components/chart/donut-chart/donut-tooltip.js +37 -0
  51. package/dist/components/chart/types.d.ts +8 -0
  52. package/dist/components/checkbox/Checkbox.d.ts +6 -0
  53. package/dist/components/checkbox/Checkbox.js +72 -0
  54. package/dist/components/checkbox/CheckboxTestStory.d.ts +7 -0
  55. package/dist/components/collapsible/Collapsible.d.ts +21 -0
  56. package/dist/components/collapsible/Collapsible.js +50 -0
  57. package/dist/components/combobox/Combobox.d.ts +1 -1
  58. package/dist/components/divider/Divider.d.ts +9 -0
  59. package/dist/components/divider/Divider.js +28 -0
  60. package/dist/components/drawer/Drawer.d.ts +8 -0
  61. package/dist/components/drawer/Drawer.js +68 -0
  62. package/dist/components/dropdown/Dropdown.d.ts +45 -0
  63. package/dist/components/dropdown/Dropdown.js +133 -0
  64. package/dist/components/dropdown/DropdownMenu.d.ts +20 -0
  65. package/dist/components/dropdown/DropdownMenu.js +78 -0
  66. package/dist/components/dropdown/DropdownMenuItem.d.ts +13 -0
  67. package/dist/components/dropdown/DropdownMenuItem.js +49 -0
  68. package/dist/components/dropdown/DropdownTestStory.d.ts +5 -0
  69. package/dist/components/dropdown/dropdown-utils.d.ts +4 -0
  70. package/dist/components/dropdown/dropdown-utils.js +14 -0
  71. package/dist/components/dropdown/types.d.ts +48 -0
  72. package/dist/components/dropdown/use-dropdown-keyboard.d.ts +12 -0
  73. package/dist/components/dropdown/use-dropdown-keyboard.js +49 -0
  74. package/dist/components/empty-state/EmptyState.d.ts +26 -0
  75. package/dist/components/empty-state/EmptyState.js +36 -0
  76. package/dist/components/error-state/ErrorState.d.ts +1 -1
  77. package/dist/components/featured-icon/FeaturedIcon.d.ts +12 -0
  78. package/dist/components/featured-icon/FeaturedIcon.js +44 -0
  79. package/dist/components/form-field/FormField.d.ts +13 -0
  80. package/dist/components/form-field/FormField.js +21 -0
  81. package/dist/components/input/Input.d.ts +11 -0
  82. package/dist/components/input/Input.js +39 -0
  83. package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.d.ts +8 -0
  84. package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.js +18 -0
  85. package/dist/components/loading-state/Loader.d.ts +20 -0
  86. package/dist/components/loading-state/Loader.js +38 -0
  87. package/dist/components/loading-state/LoadingState.d.ts +15 -0
  88. package/dist/components/loading-state/LoadingState.js +47 -0
  89. package/dist/components/loading-state/locale/en.json.d.ts +6 -0
  90. package/dist/components/loading-state/locale/en.json.js +7 -0
  91. package/dist/components/loading-state/locale/vi.json.d.ts +6 -0
  92. package/dist/components/loading-state/locale/vi.json.js +7 -0
  93. package/dist/components/media/Media.d.ts +7 -0
  94. package/dist/components/media/Media.js +25 -0
  95. package/dist/components/modal/Modal.d.ts +9 -0
  96. package/dist/components/modal/Modal.js +68 -0
  97. package/dist/components/modal/helpers/HeaderIcon.d.ts +8 -0
  98. package/dist/components/modal/helpers/HeaderIcon.js +32 -0
  99. package/dist/components/modal/helpers/Title.d.ts +6 -0
  100. package/dist/components/modal/helpers/Title.js +9 -0
  101. package/dist/components/modal/helpers/circles-sm.svg.js +5 -0
  102. package/dist/components/modal/modal-context.d.ts +2 -0
  103. package/dist/components/modal/modal-context.js +9 -0
  104. package/dist/components/modal/use-click-outside-modal.d.ts +2 -0
  105. package/dist/components/modal/use-click-outside-modal.js +15 -0
  106. package/dist/components/notification/NotificationBanner.d.ts +9 -0
  107. package/dist/components/notification/NotificationBanner.js +97 -0
  108. package/dist/components/notification/icons.d.ts +5 -0
  109. package/dist/components/notification/icons.js +29 -0
  110. package/dist/components/notification/index.d.ts +4 -0
  111. package/dist/components/notification/index.js +26 -0
  112. package/dist/components/notification/locale/en.json.d.ts +8 -0
  113. package/dist/components/notification/locale/en.json.js +7 -0
  114. package/dist/components/notification/locale/vi.json.d.ts +8 -0
  115. package/dist/components/notification/locale/vi.json.js +7 -0
  116. package/dist/components/operating-system-icon/OperatingSystemIcon.d.ts +6 -0
  117. package/dist/components/operating-system-icon/OperatingSystemIcon.js +19 -0
  118. package/dist/components/operating-system-icon/assets/logo-android.svg.js +5 -0
  119. package/dist/components/operating-system-icon/assets/logo-apple.svg.js +5 -0
  120. package/dist/components/operating-system-icon/assets/logo-ubuntu.svg.js +5 -0
  121. package/dist/components/operating-system-icon/assets/logo-windows-10.svg.js +5 -0
  122. package/dist/components/page-title/PageTitle.d.ts +1 -1
  123. package/dist/components/popover/Popover.d.ts +1 -1
  124. package/dist/components/progress-bar/ProgressBar.d.ts +9 -0
  125. package/dist/components/progress-bar/ProgressBar.js +31 -0
  126. package/dist/components/radio/Radio.d.ts +4 -0
  127. package/dist/components/radio/Radio.js +55 -0
  128. package/dist/components/searchbox/Searchbox.d.ts +7 -0
  129. package/dist/components/searchbox/Searchbox.js +15 -0
  130. package/dist/components/select/Select.d.ts +11 -0
  131. package/dist/components/select/Select.js +44 -0
  132. package/dist/components/skeleton/Skeleton.d.ts +14 -0
  133. package/dist/components/skeleton/Skeleton.js +12 -0
  134. package/dist/components/switch/Switch.d.ts +1 -1
  135. package/dist/components/table/Table.d.ts +32 -0
  136. package/dist/components/table/Table.js +128 -0
  137. package/dist/components/table/TableActionButton.d.ts +15 -0
  138. package/dist/components/table/TableActionButton.js +50 -0
  139. package/dist/components/table/TableCell.d.ts +8 -0
  140. package/dist/components/table/TableCell.js +26 -0
  141. package/dist/components/table/TableHeader.d.ts +15 -0
  142. package/dist/components/table/TableHeader.js +36 -0
  143. package/dist/components/table/TableHeaderCell.d.ts +10 -0
  144. package/dist/components/table/TableHeaderCell.js +35 -0
  145. package/dist/components/table/TablePagination.d.ts +6 -0
  146. package/dist/components/table/TablePagination.js +69 -0
  147. package/dist/components/table/TableRow.d.ts +12 -0
  148. package/dist/components/table/TableRow.js +9 -0
  149. package/dist/components/table/expandable/ExpandableTable.d.ts +30 -0
  150. package/dist/components/table/expandable/ExpandableTable.js +156 -0
  151. package/dist/components/table/hooks/use-fit-page-height.d.ts +14 -0
  152. package/dist/components/table/hooks/use-fit-page-height.js +21 -0
  153. package/dist/components/table/hooks/use-row-selection.d.ts +27 -0
  154. package/dist/components/table/hooks/use-row-selection.js +35 -0
  155. package/dist/components/table/locale/en.json.d.ts +13 -0
  156. package/dist/components/table/locale/en.json.js +21 -0
  157. package/dist/components/table/locale/vi.json.d.ts +13 -0
  158. package/dist/components/table/locale/vi.json.js +21 -0
  159. package/dist/components/table/table-utils.d.ts +10 -0
  160. package/dist/components/table/table-utils.js +10 -0
  161. package/dist/components/table/types.d.ts +84 -0
  162. package/dist/components/tabs/Tabs.d.ts +27 -0
  163. package/dist/components/tabs/Tabs.js +75 -0
  164. package/dist/components/tabs/TabsTestStory.d.ts +4 -0
  165. package/dist/components/tags-input/TagsInput.d.ts +18 -0
  166. package/dist/components/tags-input/TagsInput.js +78 -0
  167. package/dist/components/tags-input/TagsInputTestStory.d.ts +3 -0
  168. package/dist/components/textarea/Textarea.d.ts +7 -0
  169. package/dist/components/textarea/Textarea.js +36 -0
  170. package/dist/components/toast/ToastSlice.d.ts +11 -0
  171. package/dist/components/toast/ToastSlice.js +103 -0
  172. package/dist/components/toast/icons.d.ts +8 -0
  173. package/dist/components/toast/icons.js +19 -0
  174. package/dist/components/toast/index.d.ts +4 -0
  175. package/dist/components/toast/index.js +35 -0
  176. package/dist/components/toast/types.d.ts +14 -0
  177. package/dist/components/toast/use-toast-list.d.ts +4 -0
  178. package/dist/components/toast/use-toast-list.js +27 -0
  179. package/dist/components/tooltip/Tooltip.d.ts +1 -1
  180. package/dist/filters/FilterDropdown.d.ts +9 -0
  181. package/dist/filters/FilterDropdown.js +57 -0
  182. package/dist/filters/types.d.ts +11 -0
  183. package/dist/filters/url-params.d.ts +5 -0
  184. package/dist/filters/url-params.js +20 -0
  185. package/dist/filters/use-filters.d.ts +13 -0
  186. package/dist/filters/use-filters.js +63 -0
  187. package/dist/hooks/use-countdown.d.ts +4 -0
  188. package/dist/hooks/use-countdown.js +18 -0
  189. package/dist/i18n/resources.js +23 -0
  190. package/dist/index.d.ts +66 -0
  191. package/dist/index.js +141 -38
  192. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +421 -350
  193. package/dist/test-utils/expect-visibility.d.ts +45 -0
  194. package/dist/utils/key-typeguard.d.ts +5 -0
  195. package/dist/utils/key-typeguard.js +6 -0
  196. package/dist/utils/observable.d.ts +7 -0
  197. package/dist/utils/observable.js +22 -0
  198. package/dist/utils/use-debounce.d.ts +1 -0
  199. package/dist/utils/use-debounce.js +11 -0
  200. package/package.json +30 -7
  201. package/theme.css +7 -1
@@ -0,0 +1,45 @@
1
+ import { Locator } from '@playwright/test';
2
+ /**
3
+ * Assert that an element is fully invisible to users — not just visually hidden,
4
+ * but also unreachable by pointer and keyboard/assistive tech.
5
+ *
6
+ * Verifies three pillars:
7
+ * 1. **Not visually seen** — `checkVisibility()` returns false (checks opacity, visibility, display on ancestors)
8
+ * 2. **Not interactable** — a real mouse click at the element's coordinates does not trigger event handlers
9
+ * 3. **Not detectable** — the element cannot receive focus, even when programmatically given `tabIndex`
10
+ *
11
+ * Note: this asserts the element itself is invisible, NOT that its ancestors reserve no layout
12
+ * space. A `visibility:hidden` element inside a wrapper that still holds its content height will
13
+ * pass every pillar — the user sees a blank gap, but no assertion on the hidden element alone can
14
+ * detect that. Test the wrapper's height separately when that invariant matters (e.g. Accordion).
15
+ *
16
+ * Pillar 1 retries automatically (via `.toPass()`) to allow CSS transitions to settle.
17
+ *
18
+ * Recommended CSS approach: combine `invisible` (visibility: hidden) with `opacity-0`.
19
+ * This covers all three pillars natively without JS.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * // Assert collapsed accordion content is fully invisible
24
+ * await expectInvisible(component.getByText("Content"));
25
+ *
26
+ * // After expanding, assert it's fully visible
27
+ * await component.getByRole("button").click();
28
+ * await expectVisible(component.getByText("Content"));
29
+ * ```
30
+ */
31
+ export declare function expectInvisible(locator: Locator): Promise<void>;
32
+ /**
33
+ * Assert that an element is fully visible and interactive — the inverse of {@link expectInvisible}.
34
+ *
35
+ * Verifies:
36
+ * 1. **Visually seen** — `checkVisibility()` returns true
37
+ * 2. **Interactable** — a real mouse click reaches the element's event handlers
38
+ * 3. **Detectable** — the element can receive focus
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * await expectVisible(component.getByText("Content"));
43
+ * ```
44
+ */
45
+ export declare function expectVisible(locator: Locator): Promise<void>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type guard that narrows a string to a key of the given object.
3
+ * Counterpart to `enumTypeguard` (which checks values).
4
+ */
5
+ export declare function keyTypeguard<T extends Record<PropertyKey, unknown>>(value: PropertyKey, obj: T): value is keyof T;
@@ -0,0 +1,6 @@
1
+ function r(e, n) {
2
+ return e in n;
3
+ }
4
+ export {
5
+ r as keyTypeguard
6
+ };
@@ -0,0 +1,7 @@
1
+ /** Observer object made for React useEffect: the subscribe function returns a clean up function which unsubscribes when React components unmount. */
2
+ export declare class Observable<T> {
3
+ observers: Function[];
4
+ constructor();
5
+ notify(data: T): void;
6
+ subscribe(f: (typeof this.observers)[number]): () => void;
7
+ }
@@ -0,0 +1,22 @@
1
+ var t = Object.defineProperty;
2
+ var i = (e, s, r) => s in e ? t(e, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[s] = r;
3
+ var o = (e, s, r) => i(e, typeof s != "symbol" ? s + "" : s, r);
4
+ class c {
5
+ constructor() {
6
+ o(this, "observers");
7
+ this.observers = [];
8
+ }
9
+ notify(s) {
10
+ this.observers.forEach((r) => r(s));
11
+ }
12
+ subscribe(s) {
13
+ return this.observers.push(s), () => {
14
+ [...this.observers].forEach((r, b) => {
15
+ r === s && this.observers.splice(b, 1);
16
+ });
17
+ };
18
+ }
19
+ }
20
+ export {
21
+ c as Observable
22
+ };
@@ -0,0 +1 @@
1
+ export declare function useDebounce<T>(value: T, delayMs: number): T;
@@ -0,0 +1,11 @@
1
+ import { useState as u, useEffect as c } from "react";
2
+ function i(e, t) {
3
+ const [o, n] = u(e);
4
+ return c(() => {
5
+ const r = setTimeout(() => n(e), t);
6
+ return () => clearTimeout(r);
7
+ }, [e, t]), o;
8
+ }
9
+ export {
10
+ i as useDebounce
11
+ };
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@cystackapp/ui",
3
- "version": "1.4.1",
3
+ "version": "2.0.0",
4
+ "description": "CyStack design system — reusable React UI components built with Tailwind CSS v4",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://git.cystack.org/platform/ui.git"
9
+ },
4
10
  "type": "module",
5
11
  "main": "./dist/index.js",
6
12
  "types": "./dist/index.d.ts",
@@ -22,17 +28,18 @@
22
28
  "build": "vite build",
23
29
  "dev": "vite build --watch",
24
30
  "typecheck": "tsc --noEmit --pretty",
31
+ "lint": "eslint src",
25
32
  "storybook": "storybook dev -p 6007",
26
33
  "test": "vitest run --passWithNoTests && playwright test -c playwright-ct.config.ts",
27
34
  "test:component": "playwright test -c playwright-ct.config.ts",
28
35
  "test:unit": "vitest run",
29
36
  "test:unit:watch": "vitest",
30
- "i18n": "node ../../scripts/generate-i18n.mjs",
31
- "i18n:check": "node ../../scripts/check-i18n-keys.mjs"
37
+ "i18n": "node scripts/generate-i18n.mjs --scan src --output src/i18n/resources.ts",
38
+ "i18n:check": "node scripts/check-i18n-keys.mjs"
32
39
  },
33
40
  "peerDependencies": {
34
41
  "@untitled-ui/icons-react": "^0.1.4",
35
- "i18next": "23.7.7",
42
+ "i18next": ">=23.0.0",
36
43
  "react": "^18.0.0",
37
44
  "react-dom": "^18.0.0",
38
45
  "react-i18next": "^15.0.0",
@@ -43,21 +50,37 @@
43
50
  "tailwind-merge": "^3.5.0"
44
51
  },
45
52
  "devDependencies": {
46
- "@platform-dash/eslint-config": "*",
47
- "eslint": "^10.0.3",
48
- "@playwright/experimental-ct-react": "^1.59.1",
53
+ "@eslint/compat": "^2.0.3",
54
+ "@eslint/js": "^10",
55
+ "@playwright/experimental-ct-react": "1.60.0",
56
+ "@playwright/test": "1.60.0",
49
57
  "@storybook/addon-essentials": "^8.6.18",
50
58
  "@storybook/react": "^8.6.18",
51
59
  "@storybook/react-vite": "^8.6.18",
52
60
  "@storybook/test": "^8.6.18",
53
61
  "@tailwindcss/vite": "~4.1",
62
+ "@types/node": "^25.9.2",
54
63
  "@types/react": "^18.2.34",
55
64
  "@types/react-dom": "^18.2.14",
65
+ "@untitled-ui/icons-react": "^0.1.4",
56
66
  "@vitejs/plugin-react": "^5",
67
+ "ajv": "^8.20.0",
68
+ "eslint": "^10.0.3",
69
+ "eslint-config-prettier": "^10.0.1",
70
+ "eslint-plugin-react": "^7.37.5",
71
+ "eslint-plugin-react-hooks": "^7.0.1",
72
+ "globals": "^16",
73
+ "i18next": "^23.7.7",
57
74
  "picocolors": "^1.1.1",
75
+ "prettier": "^3.8.4",
76
+ "react": "^18.2.0",
77
+ "react-dom": "^18.2.0",
78
+ "react-i18next": "^15.0.0",
79
+ "react-router-dom": "^6.20.0",
58
80
  "storybook": "^8.6.18",
59
81
  "tailwindcss": "~4.1",
60
82
  "typescript": "~5.9",
83
+ "typescript-eslint": "^8",
61
84
  "vite": "^6",
62
85
  "vite-plugin-dts": "^4",
63
86
  "vite-plugin-svgr": "^4",
package/theme.css CHANGED
@@ -1,4 +1,7 @@
1
- @source "./src";
1
+ /* The published package ships dist/ (not src/), so consumers' Tailwind must
2
+ scan the built output for class names. Local dev tooling (storybook,
3
+ playwright) adds its own `@source` for src/. */
4
+ @source "./dist";
2
5
 
3
6
  @layer base {
4
7
  button {
@@ -333,6 +336,9 @@
333
336
  --shadow-xs: 0px 1px 2px rgba(10, 13, 18, 0.05);
334
337
  --shadow-sm-01: 0px 1px 2px -1px rgba(10, 13, 18, 0.1);
335
338
  --shadow-sm-02: 0px 1px 3px rgba(10, 13, 18, 0.1);
339
+ --shadow-xs-skeuomorphic: 0px 0px 0px 0.5px rgba(10, 13, 18, 0.18) inset,
340
+ 0px -2px 0px 0px rgba(10, 13, 18, 0.05) inset,
341
+ 0px 1px 2px 0px rgba(10, 13, 18, 0.05);
336
342
  }
337
343
 
338
344
  @keyframes pseudo-rotate {