@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.
- package/LICENSE +21 -0
- package/README.md +77 -47
- package/dist/assets/background-pattern-grid.svg.js +7 -0
- package/dist/assets/empty-cloud.svg.js +5 -0
- package/dist/components/accordion/Accordion.d.ts +20 -0
- package/dist/components/accordion/Accordion.js +36 -0
- package/dist/components/accordion/AccordionTestStory.d.ts +3 -0
- package/dist/components/alert/Alert.d.ts +15 -0
- package/dist/components/alert/Alert.js +54 -0
- package/dist/components/avatar/Avatar.d.ts +13 -0
- package/dist/components/avatar/Avatar.js +64 -0
- package/dist/components/background-pattern/BackgroundPatternGrid.d.ts +1 -0
- package/dist/components/background-pattern/BackgroundPatternGrid.js +6 -0
- package/dist/components/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.js +3 -3
- package/dist/components/badge/BadgeTestStory.d.ts +1 -1
- package/dist/components/badge/variants/BadgeMore.d.ts +1 -1
- package/dist/components/badge/variants/BadgeMoreTestStory.d.ts +1 -1
- package/dist/components/badge/variants/BadgeTag.d.ts +1 -1
- package/dist/components/badge/variants/BadgeTag.js +1 -1
- package/dist/components/banner/Banner.d.ts +9 -0
- package/dist/components/banner/Banner.js +21 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
- package/dist/components/breadcrumb/Breadcrumb.js +36 -0
- package/dist/components/button/Button.d.ts +21 -0
- package/dist/components/button/Button.js +49 -0
- package/dist/components/button/ButtonLoader.d.ts +7 -0
- package/dist/components/button/ButtonLoader.js +44 -0
- package/dist/components/button/ButtonTestStory.d.ts +5 -0
- package/dist/components/button/button-variants.d.ts +13 -0
- package/dist/components/button/button-variants.js +58 -0
- package/dist/components/card/Card.d.ts +91 -0
- package/dist/components/card/Card.js +56 -0
- package/dist/components/card/Card.stories-ct.d.ts +1 -0
- package/dist/components/card/CardBody.d.ts +9 -0
- package/dist/components/card/CardBody.js +16 -0
- package/dist/components/card/CardHeader.d.ts +15 -0
- package/dist/components/card/CardHeader.js +79 -0
- package/dist/components/card/types.d.ts +1 -0
- package/dist/components/chart/chart-legend/ChartLegend.d.ts +38 -0
- package/dist/components/chart/chart-legend/ChartLegend.js +57 -0
- package/dist/components/chart/chart-legend/ChartLegendItem.d.ts +19 -0
- package/dist/components/chart/chart-legend/ChartLegendItem.js +30 -0
- package/dist/components/chart/chart-legend/types.d.ts +49 -0
- package/dist/components/chart/donut-chart/DonutChart.d.ts +55 -0
- package/dist/components/chart/donut-chart/DonutChart.js +110 -0
- package/dist/components/chart/donut-chart/DonutSegments.d.ts +25 -0
- package/dist/components/chart/donut-chart/DonutSegments.js +51 -0
- package/dist/components/chart/donut-chart/donut-tooltip.d.ts +20 -0
- package/dist/components/chart/donut-chart/donut-tooltip.js +37 -0
- package/dist/components/chart/types.d.ts +8 -0
- package/dist/components/checkbox/Checkbox.d.ts +6 -0
- package/dist/components/checkbox/Checkbox.js +72 -0
- package/dist/components/checkbox/CheckboxTestStory.d.ts +7 -0
- package/dist/components/collapsible/Collapsible.d.ts +21 -0
- package/dist/components/collapsible/Collapsible.js +50 -0
- package/dist/components/combobox/Combobox.d.ts +1 -1
- package/dist/components/divider/Divider.d.ts +9 -0
- package/dist/components/divider/Divider.js +28 -0
- package/dist/components/drawer/Drawer.d.ts +8 -0
- package/dist/components/drawer/Drawer.js +68 -0
- package/dist/components/dropdown/Dropdown.d.ts +45 -0
- package/dist/components/dropdown/Dropdown.js +133 -0
- package/dist/components/dropdown/DropdownMenu.d.ts +20 -0
- package/dist/components/dropdown/DropdownMenu.js +78 -0
- package/dist/components/dropdown/DropdownMenuItem.d.ts +13 -0
- package/dist/components/dropdown/DropdownMenuItem.js +49 -0
- package/dist/components/dropdown/DropdownTestStory.d.ts +5 -0
- package/dist/components/dropdown/dropdown-utils.d.ts +4 -0
- package/dist/components/dropdown/dropdown-utils.js +14 -0
- package/dist/components/dropdown/types.d.ts +48 -0
- package/dist/components/dropdown/use-dropdown-keyboard.d.ts +12 -0
- package/dist/components/dropdown/use-dropdown-keyboard.js +49 -0
- package/dist/components/empty-state/EmptyState.d.ts +26 -0
- package/dist/components/empty-state/EmptyState.js +36 -0
- package/dist/components/error-state/ErrorState.d.ts +1 -1
- package/dist/components/featured-icon/FeaturedIcon.d.ts +12 -0
- package/dist/components/featured-icon/FeaturedIcon.js +44 -0
- package/dist/components/form-field/FormField.d.ts +13 -0
- package/dist/components/form-field/FormField.js +21 -0
- package/dist/components/input/Input.d.ts +11 -0
- package/dist/components/input/Input.js +39 -0
- package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.d.ts +8 -0
- package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.js +18 -0
- package/dist/components/loading-state/Loader.d.ts +20 -0
- package/dist/components/loading-state/Loader.js +38 -0
- package/dist/components/loading-state/LoadingState.d.ts +15 -0
- package/dist/components/loading-state/LoadingState.js +47 -0
- package/dist/components/loading-state/locale/en.json.d.ts +6 -0
- package/dist/components/loading-state/locale/en.json.js +7 -0
- package/dist/components/loading-state/locale/vi.json.d.ts +6 -0
- package/dist/components/loading-state/locale/vi.json.js +7 -0
- package/dist/components/media/Media.d.ts +7 -0
- package/dist/components/media/Media.js +25 -0
- package/dist/components/modal/Modal.d.ts +9 -0
- package/dist/components/modal/Modal.js +68 -0
- package/dist/components/modal/helpers/HeaderIcon.d.ts +8 -0
- package/dist/components/modal/helpers/HeaderIcon.js +32 -0
- package/dist/components/modal/helpers/Title.d.ts +6 -0
- package/dist/components/modal/helpers/Title.js +9 -0
- package/dist/components/modal/helpers/circles-sm.svg.js +5 -0
- package/dist/components/modal/modal-context.d.ts +2 -0
- package/dist/components/modal/modal-context.js +9 -0
- package/dist/components/modal/use-click-outside-modal.d.ts +2 -0
- package/dist/components/modal/use-click-outside-modal.js +15 -0
- package/dist/components/notification/NotificationBanner.d.ts +9 -0
- package/dist/components/notification/NotificationBanner.js +97 -0
- package/dist/components/notification/icons.d.ts +5 -0
- package/dist/components/notification/icons.js +29 -0
- package/dist/components/notification/index.d.ts +4 -0
- package/dist/components/notification/index.js +26 -0
- package/dist/components/notification/locale/en.json.d.ts +8 -0
- package/dist/components/notification/locale/en.json.js +7 -0
- package/dist/components/notification/locale/vi.json.d.ts +8 -0
- package/dist/components/notification/locale/vi.json.js +7 -0
- package/dist/components/operating-system-icon/OperatingSystemIcon.d.ts +6 -0
- package/dist/components/operating-system-icon/OperatingSystemIcon.js +19 -0
- package/dist/components/operating-system-icon/assets/logo-android.svg.js +5 -0
- package/dist/components/operating-system-icon/assets/logo-apple.svg.js +5 -0
- package/dist/components/operating-system-icon/assets/logo-ubuntu.svg.js +5 -0
- package/dist/components/operating-system-icon/assets/logo-windows-10.svg.js +5 -0
- package/dist/components/page-title/PageTitle.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/progress-bar/ProgressBar.d.ts +9 -0
- package/dist/components/progress-bar/ProgressBar.js +31 -0
- package/dist/components/radio/Radio.d.ts +4 -0
- package/dist/components/radio/Radio.js +55 -0
- package/dist/components/searchbox/Searchbox.d.ts +7 -0
- package/dist/components/searchbox/Searchbox.js +15 -0
- package/dist/components/select/Select.d.ts +11 -0
- package/dist/components/select/Select.js +44 -0
- package/dist/components/skeleton/Skeleton.d.ts +14 -0
- package/dist/components/skeleton/Skeleton.js +12 -0
- package/dist/components/switch/Switch.d.ts +1 -1
- package/dist/components/table/Table.d.ts +32 -0
- package/dist/components/table/Table.js +128 -0
- package/dist/components/table/TableActionButton.d.ts +15 -0
- package/dist/components/table/TableActionButton.js +50 -0
- package/dist/components/table/TableCell.d.ts +8 -0
- package/dist/components/table/TableCell.js +26 -0
- package/dist/components/table/TableHeader.d.ts +15 -0
- package/dist/components/table/TableHeader.js +36 -0
- package/dist/components/table/TableHeaderCell.d.ts +10 -0
- package/dist/components/table/TableHeaderCell.js +35 -0
- package/dist/components/table/TablePagination.d.ts +6 -0
- package/dist/components/table/TablePagination.js +69 -0
- package/dist/components/table/TableRow.d.ts +12 -0
- package/dist/components/table/TableRow.js +9 -0
- package/dist/components/table/expandable/ExpandableTable.d.ts +30 -0
- package/dist/components/table/expandable/ExpandableTable.js +156 -0
- package/dist/components/table/hooks/use-fit-page-height.d.ts +14 -0
- package/dist/components/table/hooks/use-fit-page-height.js +21 -0
- package/dist/components/table/hooks/use-row-selection.d.ts +27 -0
- package/dist/components/table/hooks/use-row-selection.js +35 -0
- package/dist/components/table/locale/en.json.d.ts +13 -0
- package/dist/components/table/locale/en.json.js +21 -0
- package/dist/components/table/locale/vi.json.d.ts +13 -0
- package/dist/components/table/locale/vi.json.js +21 -0
- package/dist/components/table/table-utils.d.ts +10 -0
- package/dist/components/table/table-utils.js +10 -0
- package/dist/components/table/types.d.ts +84 -0
- package/dist/components/tabs/Tabs.d.ts +27 -0
- package/dist/components/tabs/Tabs.js +75 -0
- package/dist/components/tabs/TabsTestStory.d.ts +4 -0
- package/dist/components/tags-input/TagsInput.d.ts +18 -0
- package/dist/components/tags-input/TagsInput.js +78 -0
- package/dist/components/tags-input/TagsInputTestStory.d.ts +3 -0
- package/dist/components/textarea/Textarea.d.ts +7 -0
- package/dist/components/textarea/Textarea.js +36 -0
- package/dist/components/toast/ToastSlice.d.ts +11 -0
- package/dist/components/toast/ToastSlice.js +103 -0
- package/dist/components/toast/icons.d.ts +8 -0
- package/dist/components/toast/icons.js +19 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.js +35 -0
- package/dist/components/toast/types.d.ts +14 -0
- package/dist/components/toast/use-toast-list.d.ts +4 -0
- package/dist/components/toast/use-toast-list.js +27 -0
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/filters/FilterDropdown.d.ts +9 -0
- package/dist/filters/FilterDropdown.js +57 -0
- package/dist/filters/types.d.ts +11 -0
- package/dist/filters/url-params.d.ts +5 -0
- package/dist/filters/url-params.js +20 -0
- package/dist/filters/use-filters.d.ts +13 -0
- package/dist/filters/use-filters.js +63 -0
- package/dist/hooks/use-countdown.d.ts +4 -0
- package/dist/hooks/use-countdown.js +18 -0
- package/dist/i18n/resources.js +23 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +141 -38
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +421 -350
- package/dist/test-utils/expect-visibility.d.ts +45 -0
- package/dist/utils/key-typeguard.d.ts +5 -0
- package/dist/utils/key-typeguard.js +6 -0
- package/dist/utils/observable.d.ts +7 -0
- package/dist/utils/observable.js +22 -0
- package/dist/utils/use-debounce.d.ts +1 -0
- package/dist/utils/use-debounce.js +11 -0
- package/package.json +30 -7
- 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,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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cystackapp/ui",
|
|
3
|
-
"version": "
|
|
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
|
|
31
|
-
"i18n:check": "node
|
|
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.
|
|
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
|
-
"@
|
|
47
|
-
"eslint": "^10
|
|
48
|
-
"@playwright/experimental-ct-react": "
|
|
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
|
-
|
|
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 {
|