@cystackapp/ui 1.4.0 → 1.5.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/README.md +105 -0
- package/dist/components/badge/Badge.js +3 -3
- package/dist/components/badge/variants/BadgeTag.js +1 -1
- 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/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/input/Input.d.ts +11 -0
- package/dist/components/input/Input.js +39 -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/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/index.d.ts +14 -0
- package/dist/index.js +55 -34
- package/dist/test-utils/expect-visibility.d.ts +45 -0
- package/dist/utils/observable.d.ts +7 -0
- package/dist/utils/observable.js +22 -0
- package/package.json +3 -2
- package/theme.css +3 -0
package/dist/index.js
CHANGED
|
@@ -1,42 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Button as e } from "./components/button/Button.js";
|
|
2
|
+
import { Badge as m } from "./components/badge/Badge.js";
|
|
3
|
+
import { BadgeTag as x, TAG_ICON_COLOR_CLASSES as f, getBadgeAutoColor as a } from "./components/badge/variants/BadgeTag.js";
|
|
4
|
+
import { BadgeMore as i } from "./components/badge/variants/BadgeMore.js";
|
|
5
|
+
import { useResizeObserver as l } from "./hooks/element-shift/use-resize-observer.js";
|
|
5
6
|
import { useScrollListener as u } from "./hooks/element-shift/use-scroll-listener.js";
|
|
6
|
-
import { useWindowResizeListener as
|
|
7
|
-
import { useMutationObserver as
|
|
8
|
-
import { useTransitionEndListener as
|
|
7
|
+
import { useWindowResizeListener as b } from "./hooks/element-shift/use-window-resize-listener.js";
|
|
8
|
+
import { useMutationObserver as c } from "./hooks/element-shift/use-mutation-observer.js";
|
|
9
|
+
import { useTransitionEndListener as S } from "./hooks/element-shift/use-transition-end-listener.js";
|
|
9
10
|
import { useAnimationFrame as O } from "./hooks/element-shift/use-animation-frame.js";
|
|
10
|
-
import { useElementShift as
|
|
11
|
-
import { Combobox as
|
|
12
|
-
import { useValidatedCombobox as
|
|
13
|
-
import { ErrorState as
|
|
14
|
-
import { PageTitle as
|
|
15
|
-
import { Popover as
|
|
11
|
+
import { useElementShift as L } from "./hooks/element-shift/use-element-shift.js";
|
|
12
|
+
import { Combobox as A } from "./components/combobox/Combobox.js";
|
|
13
|
+
import { useValidatedCombobox as h } from "./components/combobox/use-validated-combobox.js";
|
|
14
|
+
import { ErrorState as P } from "./components/error-state/ErrorState.js";
|
|
15
|
+
import { PageTitle as _ } from "./components/page-title/PageTitle.js";
|
|
16
|
+
import { Popover as w } from "./components/popover/Popover.js";
|
|
16
17
|
import { usePopoverCoord as F } from "./components/popover/use-popover-coord.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { Checkbox as H } from "./components/checkbox/Checkbox.js";
|
|
19
|
+
import { Switch as V } from "./components/switch/Switch.js";
|
|
20
|
+
import { Tooltip as j } from "./components/tooltip/Tooltip.js";
|
|
21
|
+
import { Collapsible as y } from "./components/collapsible/Collapsible.js";
|
|
22
|
+
import { Card as J } from "./components/card/Card.js";
|
|
23
|
+
import { Input as Q } from "./components/input/Input.js";
|
|
24
|
+
import { Toaster as X, createToast as Y } from "./components/toast/index.js";
|
|
25
|
+
import { Modal as $ } from "./components/modal/Modal.js";
|
|
26
|
+
import { ModalHeaderIcon as ro } from "./components/modal/helpers/HeaderIcon.js";
|
|
27
|
+
import { ModalTitle as to } from "./components/modal/helpers/Title.js";
|
|
28
|
+
import { useClickOutsideModal as po } from "./components/modal/use-click-outside-modal.js";
|
|
29
|
+
import { cn as fo } from "./utils/cn.js";
|
|
20
30
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
m as Badge,
|
|
32
|
+
i as BadgeMore,
|
|
33
|
+
x as BadgeTag,
|
|
34
|
+
e as Button,
|
|
35
|
+
J as Card,
|
|
36
|
+
H as Checkbox,
|
|
37
|
+
y as Collapsible,
|
|
38
|
+
A as Combobox,
|
|
39
|
+
P as ErrorState,
|
|
40
|
+
Q as Input,
|
|
41
|
+
$ as Modal,
|
|
42
|
+
ro as ModalHeaderIcon,
|
|
43
|
+
to as ModalTitle,
|
|
44
|
+
_ as PageTitle,
|
|
45
|
+
w as Popover,
|
|
46
|
+
V as Switch,
|
|
47
|
+
f as TAG_ICON_COLOR_CLASSES,
|
|
48
|
+
X as Toaster,
|
|
49
|
+
j as Tooltip,
|
|
50
|
+
fo as cn,
|
|
51
|
+
Y as createToast,
|
|
52
|
+
a as getBadgeAutoColor,
|
|
33
53
|
O as useAnimationFrame,
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
po as useClickOutsideModal,
|
|
55
|
+
L as useElementShift,
|
|
56
|
+
c as useMutationObserver,
|
|
36
57
|
F as usePopoverCoord,
|
|
37
|
-
|
|
58
|
+
l as useResizeObserver,
|
|
38
59
|
u as useScrollListener,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
S as useTransitionEndListener,
|
|
61
|
+
h as useValidatedCombobox,
|
|
62
|
+
b as useWindowResizeListener
|
|
42
63
|
};
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cystackapp/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@platform-dash/eslint-config": "*",
|
|
47
47
|
"eslint": "^10.0.3",
|
|
48
|
-
"@playwright/experimental-ct-react": "
|
|
48
|
+
"@playwright/experimental-ct-react": "1.60.0",
|
|
49
|
+
"@playwright/test": "1.60.0",
|
|
49
50
|
"@storybook/addon-essentials": "^8.6.18",
|
|
50
51
|
"@storybook/react": "^8.6.18",
|
|
51
52
|
"@storybook/react-vite": "^8.6.18",
|
package/theme.css
CHANGED
|
@@ -333,6 +333,9 @@
|
|
|
333
333
|
--shadow-xs: 0px 1px 2px rgba(10, 13, 18, 0.05);
|
|
334
334
|
--shadow-sm-01: 0px 1px 2px -1px rgba(10, 13, 18, 0.1);
|
|
335
335
|
--shadow-sm-02: 0px 1px 3px rgba(10, 13, 18, 0.1);
|
|
336
|
+
--shadow-xs-skeuomorphic: 0px 0px 0px 0.5px rgba(10, 13, 18, 0.18) inset,
|
|
337
|
+
0px -2px 0px 0px rgba(10, 13, 18, 0.05) inset,
|
|
338
|
+
0px 1px 2px 0px rgba(10, 13, 18, 0.05);
|
|
336
339
|
}
|
|
337
340
|
|
|
338
341
|
@keyframes pseudo-rotate {
|