@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.
Files changed (52) hide show
  1. package/README.md +105 -0
  2. package/dist/components/badge/Badge.js +3 -3
  3. package/dist/components/badge/variants/BadgeTag.js +1 -1
  4. package/dist/components/button/Button.d.ts +21 -0
  5. package/dist/components/button/Button.js +49 -0
  6. package/dist/components/button/ButtonLoader.d.ts +7 -0
  7. package/dist/components/button/ButtonLoader.js +44 -0
  8. package/dist/components/button/ButtonTestStory.d.ts +5 -0
  9. package/dist/components/button/button-variants.d.ts +13 -0
  10. package/dist/components/button/button-variants.js +58 -0
  11. package/dist/components/card/Card.d.ts +91 -0
  12. package/dist/components/card/Card.js +56 -0
  13. package/dist/components/card/Card.stories-ct.d.ts +1 -0
  14. package/dist/components/card/CardBody.d.ts +9 -0
  15. package/dist/components/card/CardBody.js +16 -0
  16. package/dist/components/card/CardHeader.d.ts +15 -0
  17. package/dist/components/card/CardHeader.js +79 -0
  18. package/dist/components/card/types.d.ts +1 -0
  19. package/dist/components/checkbox/Checkbox.d.ts +6 -0
  20. package/dist/components/checkbox/Checkbox.js +72 -0
  21. package/dist/components/checkbox/CheckboxTestStory.d.ts +7 -0
  22. package/dist/components/collapsible/Collapsible.d.ts +21 -0
  23. package/dist/components/collapsible/Collapsible.js +50 -0
  24. package/dist/components/input/Input.d.ts +11 -0
  25. package/dist/components/input/Input.js +39 -0
  26. package/dist/components/modal/Modal.d.ts +9 -0
  27. package/dist/components/modal/Modal.js +68 -0
  28. package/dist/components/modal/helpers/HeaderIcon.d.ts +8 -0
  29. package/dist/components/modal/helpers/HeaderIcon.js +32 -0
  30. package/dist/components/modal/helpers/Title.d.ts +6 -0
  31. package/dist/components/modal/helpers/Title.js +9 -0
  32. package/dist/components/modal/helpers/circles-sm.svg.js +5 -0
  33. package/dist/components/modal/modal-context.d.ts +2 -0
  34. package/dist/components/modal/modal-context.js +9 -0
  35. package/dist/components/modal/use-click-outside-modal.d.ts +2 -0
  36. package/dist/components/modal/use-click-outside-modal.js +15 -0
  37. package/dist/components/toast/ToastSlice.d.ts +11 -0
  38. package/dist/components/toast/ToastSlice.js +103 -0
  39. package/dist/components/toast/icons.d.ts +8 -0
  40. package/dist/components/toast/icons.js +19 -0
  41. package/dist/components/toast/index.d.ts +4 -0
  42. package/dist/components/toast/index.js +35 -0
  43. package/dist/components/toast/types.d.ts +14 -0
  44. package/dist/components/toast/use-toast-list.d.ts +4 -0
  45. package/dist/components/toast/use-toast-list.js +27 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.js +55 -34
  48. package/dist/test-utils/expect-visibility.d.ts +45 -0
  49. package/dist/utils/observable.d.ts +7 -0
  50. package/dist/utils/observable.js +22 -0
  51. package/package.json +3 -2
  52. package/theme.css +3 -0
package/dist/index.js CHANGED
@@ -1,42 +1,63 @@
1
- import { Badge as r } from "./components/badge/Badge.js";
2
- import { BadgeTag as m, TAG_ICON_COLOR_CLASSES as p, getBadgeAutoColor as x } from "./components/badge/variants/BadgeTag.js";
3
- import { BadgeMore as s } from "./components/badge/variants/BadgeMore.js";
4
- import { useResizeObserver as a } from "./hooks/element-shift/use-resize-observer.js";
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 g } from "./hooks/element-shift/use-window-resize-listener.js";
7
- import { useMutationObserver as C } from "./hooks/element-shift/use-mutation-observer.js";
8
- import { useTransitionEndListener as b } from "./hooks/element-shift/use-transition-end-listener.js";
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 v } from "./hooks/element-shift/use-element-shift.js";
11
- import { Combobox as B } from "./components/combobox/Combobox.js";
12
- import { useValidatedCombobox as c } from "./components/combobox/use-validated-combobox.js";
13
- import { ErrorState as R } from "./components/error-state/ErrorState.js";
14
- import { PageTitle as h } from "./components/page-title/PageTitle.js";
15
- import { Popover as z } from "./components/popover/Popover.js";
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 { Switch as I } from "./components/switch/Switch.js";
18
- import { Tooltip as V } from "./components/tooltip/Tooltip.js";
19
- import { cn as j } from "./utils/cn.js";
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
- r as Badge,
22
- s as BadgeMore,
23
- m as BadgeTag,
24
- B as Combobox,
25
- R as ErrorState,
26
- h as PageTitle,
27
- z as Popover,
28
- I as Switch,
29
- p as TAG_ICON_COLOR_CLASSES,
30
- V as Tooltip,
31
- j as cn,
32
- x as getBadgeAutoColor,
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
- v as useElementShift,
35
- C as useMutationObserver,
54
+ po as useClickOutsideModal,
55
+ L as useElementShift,
56
+ c as useMutationObserver,
36
57
  F as usePopoverCoord,
37
- a as useResizeObserver,
58
+ l as useResizeObserver,
38
59
  u as useScrollListener,
39
- b as useTransitionEndListener,
40
- c as useValidatedCombobox,
41
- g as useWindowResizeListener
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.4.0",
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": "^1.59.1",
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 {