@waveinno/ui 0.4.0 → 0.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 (41) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -2
  3. package/dist/components/patterns/index.d.ts +1 -0
  4. package/dist/components/patterns/index.js +1 -1
  5. package/dist/components/patterns/org-chart.d.ts +48 -0
  6. package/dist/components/patterns/org-chart.js +1 -0
  7. package/dist/components/ui/accordion.d.ts +30 -0
  8. package/dist/components/ui/accordion.js +1 -0
  9. package/dist/components/ui/calendar.js +1 -1
  10. package/dist/components/ui/carousel.d.ts +27 -0
  11. package/dist/components/ui/carousel.js +1 -0
  12. package/dist/components/ui/color-picker.d.ts +14 -0
  13. package/dist/components/ui/color-picker.js +1 -0
  14. package/dist/components/ui/confirm-dialog.d.ts +24 -11
  15. package/dist/components/ui/confirm-dialog.js +1 -1
  16. package/dist/components/ui/date-picker.d.ts +18 -1
  17. package/dist/components/ui/date-picker.js +1 -1
  18. package/dist/components/ui/file-upload.d.ts +12 -4
  19. package/dist/components/ui/file-upload.js +1 -1
  20. package/dist/components/ui/hover-card.d.ts +17 -0
  21. package/dist/components/ui/hover-card.js +1 -0
  22. package/dist/components/ui/index.d.ts +10 -0
  23. package/dist/components/ui/index.js +1 -1
  24. package/dist/components/ui/menu.d.ts +24 -0
  25. package/dist/components/ui/menu.js +1 -1
  26. package/dist/components/ui/pagination.d.ts +51 -0
  27. package/dist/components/ui/pagination.js +1 -0
  28. package/dist/components/ui/rating.d.ts +27 -0
  29. package/dist/components/ui/rating.js +1 -0
  30. package/dist/components/ui/scroll-area.d.ts +17 -0
  31. package/dist/components/ui/scroll-area.js +1 -0
  32. package/dist/components/ui/slider.d.ts +18 -6
  33. package/dist/components/ui/slider.js +1 -1
  34. package/dist/components/ui/steps.d.ts +36 -0
  35. package/dist/components/ui/steps.js +1 -0
  36. package/dist/components/ui/tag-input.d.ts +33 -0
  37. package/dist/components/ui/tag-input.js +1 -0
  38. package/dist/components/ui/tree-view.d.ts +38 -0
  39. package/dist/components/ui/tree-view.js +1 -0
  40. package/dist/styles.css +73 -0
  41. package/package.json +4 -1
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ /**
3
+ * TreeView — things inside things: sites → levels → bays, folders, an org.
4
+ *
5
+ * Branches fold with a turning chevron and guide lines show the depth.
6
+ * `selectable` picks one node; `checkable` adds checkboxes where a parent is
7
+ * ticked when all its children are, and half-ticked when some are (ticking a
8
+ * parent ticks everything under it). Keyboard follows the WAI-ARIA tree: ↑ ↓
9
+ * move, → opens or steps in, ← closes or steps out, Home / End, Enter / Space.
10
+ */
11
+ export interface TreeNode {
12
+ id: string;
13
+ label: React.ReactNode;
14
+ icon?: React.ReactNode;
15
+ /** On the right: a count, a status. */
16
+ badge?: React.ReactNode;
17
+ children?: TreeNode[];
18
+ disabled?: boolean;
19
+ }
20
+ export interface TreeViewProps {
21
+ data: TreeNode[];
22
+ expanded?: string[];
23
+ defaultExpanded?: string[];
24
+ onExpandedChange?: (ids: string[]) => void;
25
+ selected?: string | null;
26
+ defaultSelected?: string | null;
27
+ onSelectedChange?: (id: string) => void;
28
+ /** Checkboxes with tri-state parents. The value holds leaf ids. */
29
+ checkable?: boolean;
30
+ checked?: string[];
31
+ defaultChecked?: string[];
32
+ onCheckedChange?: (leafIds: string[]) => void;
33
+ /** Lines from each branch to its children. */
34
+ guides?: boolean;
35
+ "aria-label"?: string;
36
+ className?: string;
37
+ }
38
+ export declare function TreeView({ data, expanded: expandedProp, defaultExpanded, onExpandedChange, selected: selectedProp, defaultSelected, onSelectedChange, checkable, checked: checkedProp, defaultChecked, onCheckedChange, guides, "aria-label": ariaLabel, className, }: TreeViewProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as d,jsxs as R}from"react/jsx-runtime";import{Check as X,ChevronRight as Y,Minus as Z}from"lucide-react";import*as T from"react";import{cn as u}from"../../lib/utils.js";const k=o=>o.children?.length?o.children.flatMap(k):[o.id];function S(o,x,b){const[v,N]=T.useState(x);return[o!==void 0?o:v,r=>{o===void 0&&N(r),b?.(r)}]}function te({data:o,expanded:x,defaultExpanded:b=[],onExpandedChange:v,selected:N,defaultSelected:C=null,onSelectedChange:E,checkable:r,checked:O,defaultChecked:U=[],onCheckedChange:W,guides:q=!0,"aria-label":_="Tree",className:$}){const[z,B]=S(x,b,v),[L,A]=S(N,C,e=>e&&E?.(e)),[D,G]=S(O,U,W),[y,I]=T.useState(null),M=T.useRef(null),m=new Set(z),H=new Set(D),a=[],K=(e,i)=>{for(const n of e)a.push({node:n,parent:i}),n.children?.length&&m.has(n.id)&&K(n.children,n.id)};K(o,null);const J=y&&a.some(e=>e.node.id===y)?y:L??a[0]?.node.id,f=(e,i)=>{const n=new Set(z);i??!n.has(e)?n.add(e):n.delete(e),B([...n])},P=e=>{const i=k(e),n=i.every(s=>H.has(s)),t=new Set(D);i.forEach(s=>n?t.delete(s):t.add(s)),G([...t])},c=e=>{e&&(I(e),M.current?.querySelector(`[data-tree-id="${CSS.escape(e)}"]`)?.focus())},Q=(e,i,n)=>{const t=a.findIndex(h=>h.node.id===i.id),s=!!i.children?.length;let l=!0;if(e.key==="ArrowDown")c(a[t+1]?.node.id);else if(e.key==="ArrowUp")c(a[t-1]?.node.id);else if(e.key==="Home")c(a[0]?.node.id);else if(e.key==="End")c(a[a.length-1]?.node.id);else if(e.key==="ArrowRight")s&&!m.has(i.id)?f(i.id,!0):s&&c(i.children[0].id);else if(e.key==="ArrowLeft")s&&m.has(i.id)?f(i.id,!1):n&&c(n);else if(e.key==="Enter"||e.key===" "){if(i.disabled)return;r?P(i):A(i.id),s&&!r&&e.key==="Enter"&&f(i.id)}else l=!1;l&&e.preventDefault()},V=(e,i,n)=>e.map(t=>{const s=!!t.children?.length,l=s&&m.has(t.id),h=r?k(t):[],F=h.filter(g=>H.has(g)).length,p=r?F===0?!1:F===h.length?!0:"mixed":null,w=!r&&L===t.id;return R("li",{role:"none",children:[R("div",{role:"treeitem","data-tree-id":t.id,"aria-level":i+1,"aria-expanded":s?l:void 0,"aria-selected":r?void 0:w,"aria-checked":r?p==="mixed"?"mixed":!!p:void 0,"aria-disabled":t.disabled||void 0,tabIndex:t.id===J?0:-1,onFocus:()=>I(t.id),onKeyDown:g=>Q(g,t,n),onClick:()=>{t.disabled||(r?P(t):A(t.id),s&&!r&&f(t.id))},className:u("group/tree relative flex min-h-[32px] cursor-pointer select-none items-center gap-1.5 rounded-[calc(8px*var(--radius-scale))] pr-2 text-[13px] outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40",w?"bg-primary-subtle font-medium text-primary":"text-body hover:bg-hover hover:text-text",t.disabled&&"pointer-events-none opacity-45"),style:{paddingLeft:6+i*18},children:[s?d("span",{role:"presentation",onClick:g=>{r&&(g.stopPropagation(),f(t.id))},className:"grid size-5 shrink-0 place-items-center rounded-[5px] text-muted hover:bg-border/60",children:d(Y,{className:u("size-3.5 transition-transform duration-200 ease-[var(--ease)]",l&&"rotate-90")})}):d("span",{className:"size-5 shrink-0"}),r?d("span",{"aria-hidden":!0,className:u("grid size-4 shrink-0 place-items-center rounded-[4px] border transition-colors",p?"border-primary bg-primary text-white":"border-border2 bg-raised"),children:p==="mixed"?d(Z,{className:"size-3",strokeWidth:3}):p?d(X,{className:"size-3",strokeWidth:3}):null}):null,t.icon?d("span",{className:u("grid shrink-0 place-items-center [&_svg]:size-4",w?"text-primary":"text-muted group-hover/tree:text-text"),children:t.icon}):null,d("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.badge]}),s?d("div",{className:u("grid transition-[grid-template-rows] duration-250 ease-[var(--ease)]",l?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:R("div",{className:"relative min-h-0 overflow-hidden",children:[q?d("span",{"aria-hidden":!0,className:"absolute bottom-1.5 top-0 w-px bg-border",style:{left:15+i*18}}):null,d("ul",{role:"group",inert:!l,children:V(t.children,i+1,t.id)})]})}):null]},t.id)});return d("ul",{ref:M,role:"tree","aria-label":_,"aria-multiselectable":r||void 0,className:u("space-y-px",$),children:V(o,0,null)})}export{te as TreeView};
package/dist/styles.css CHANGED
@@ -698,3 +698,76 @@ select {
698
698
  animation-iteration-count: infinite !important;
699
699
  }
700
700
  }
701
+
702
+ /* Accordion content opens to its measured height (Radix sets the variable). */
703
+ @keyframes wm-acc-down {
704
+ from { height: 0; opacity: 0 }
705
+ to { height: var(--radix-accordion-content-height); opacity: 1 }
706
+ }
707
+ @keyframes wm-acc-up {
708
+ from { height: var(--radix-accordion-content-height); opacity: 1 }
709
+ to { height: 0; opacity: 0 }
710
+ }
711
+
712
+ /* ConfirmDialog as a sheet: up from the bottom edge. */
713
+ @keyframes wm-sheet-up {
714
+ from { opacity: 0; transform: translateY(24px) }
715
+ to { opacity: 1; transform: none }
716
+ }
717
+ @keyframes wm-sheet-down {
718
+ from { opacity: 1; transform: none }
719
+ to { opacity: 0; transform: translateY(24px) }
720
+ }
721
+ [data-confirm-sheet][data-state="open"] { animation: wm-sheet-up 300ms var(--ease) }
722
+ [data-confirm-sheet][data-state="closed"] { animation: wm-sheet-down 180ms cubic-bezier(0.4, 0, 1, 1) both }
723
+
724
+ /* ── OrgChart: the connectors between a person and their team ── */
725
+ .wm-org ul {
726
+ position: relative;
727
+ display: flex;
728
+ justify-content: center;
729
+ padding-top: 22px;
730
+ }
731
+ .wm-org > ul { padding-top: 0 }
732
+ .wm-org li {
733
+ position: relative;
734
+ display: flex;
735
+ flex-direction: column;
736
+ align-items: center;
737
+ padding: 22px 10px 0;
738
+ }
739
+ .wm-org > ul > li { padding-top: 0 }
740
+ .wm-org li::before,
741
+ .wm-org li::after {
742
+ content: "";
743
+ position: absolute;
744
+ top: 0;
745
+ right: 50%;
746
+ width: 50%;
747
+ height: 22px;
748
+ border-top: 1.5px solid var(--org-line, var(--border2));
749
+ }
750
+ .wm-org li::after {
751
+ right: auto;
752
+ left: 50%;
753
+ border-left: 1.5px solid var(--org-line, var(--border2));
754
+ }
755
+ .wm-org > ul > li::before,
756
+ .wm-org > ul > li::after,
757
+ .wm-org li:only-child::before { display: none }
758
+ .wm-org li:only-child::after { border-top: 0; border-radius: 0 }
759
+ .wm-org li:first-child::before,
760
+ .wm-org li:last-child::after { border: 0 none }
761
+ .wm-org li:last-child::before {
762
+ border-right: 1.5px solid var(--org-line, var(--border2));
763
+ border-radius: 0 12px 0 0;
764
+ }
765
+ .wm-org li:first-child::after { border-radius: 12px 0 0 0 }
766
+ .wm-org ul ul::before {
767
+ content: "";
768
+ position: absolute;
769
+ top: 0;
770
+ left: 50%;
771
+ height: 22px;
772
+ border-left: 1.5px solid var(--org-line, var(--border2));
773
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waveinno/ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "WAVEINNO design system — tokens, shell, primitives and patterns shared by every WAVEINNO product",
5
5
  "keywords": [
6
6
  "waveinno",
@@ -62,14 +62,17 @@
62
62
  "registry": "https://registry.npmjs.org/"
63
63
  },
64
64
  "dependencies": {
65
+ "@radix-ui/react-accordion": "^1.2.20",
65
66
  "@radix-ui/react-avatar": "^1.2.6",
66
67
  "@radix-ui/react-checkbox": "^1.3.11",
67
68
  "@radix-ui/react-dialog": "^1.1.23",
68
69
  "@radix-ui/react-dropdown-menu": "^2.1.24",
70
+ "@radix-ui/react-hover-card": "^1.1.23",
69
71
  "@radix-ui/react-label": "^2.1.15",
70
72
  "@radix-ui/react-popover": "^1.1.23",
71
73
  "@radix-ui/react-progress": "^1.1.16",
72
74
  "@radix-ui/react-radio-group": "^1.4.7",
75
+ "@radix-ui/react-scroll-area": "^1.2.18",
73
76
  "@radix-ui/react-select": "^2.3.7",
74
77
  "@radix-ui/react-separator": "^1.1.15",
75
78
  "@radix-ui/react-slider": "^1.4.7",