ssovee-os-web-ui 0.1.31 → 0.1.32

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 CHANGED
@@ -59,7 +59,6 @@ export function Example() {
59
59
 
60
60
  ### Simple window
61
61
 
62
- {% raw %}
63
62
  ```tsx
64
63
  import { WindowWithoutSideMenu, Typography } from "ssovee-os-web-ui";
65
64
 
@@ -82,11 +81,9 @@ export function NotesWindow() {
82
81
  );
83
82
  }
84
83
  ```
85
- {% endraw %}
86
84
 
87
85
  ### Window with sidebar menu
88
86
 
89
- {% raw %}
90
87
  ```tsx
91
88
  import { WindowWithSideMenu, Typography, Button } from "ssovee-os-web-ui";
92
89
 
@@ -121,7 +118,23 @@ export function SettingsWindow() {
121
118
  );
122
119
  }
123
120
  ```
124
- {% endraw %}
121
+
122
+ ## Skeleton loader
123
+
124
+ ```tsx
125
+ import { Skeleton } from "ssovee-os-web-ui";
126
+
127
+ export function LoadingState() {
128
+ return (
129
+ <div style={{ display: "grid", gap: 12 }}>
130
+ <Skeleton variant="text" lines={3} />
131
+ <Skeleton variant="avatar" className="h-12 w-12" />
132
+ <Skeleton variant="image" className="h-40" />
133
+ <Skeleton variant="card" lines={4} />
134
+ </div>
135
+ );
136
+ }
137
+ ```
125
138
 
126
139
  ## Plugin playground
127
140
 
@@ -173,6 +186,7 @@ The package exports these components and types for external use:
173
186
  - `Dropdown`
174
187
  - `DropdownOption`
175
188
  - `Loading`
189
+ - `Skeleton`
176
190
  - `Toast`
177
191
  - `Alert`
178
192
  - `Modal`
package/dist/index.cjs CHANGED
@@ -783,6 +783,105 @@ var Loading = ({
783
783
  return content;
784
784
  };
785
785
  var Loading_default = Loading;
786
+ var basePulseClasses = "bg-surface-1/35 dark:bg-surface-3/20 rounded-md overflow-hidden";
787
+ var lineWidths = ["w-full", "w-11/12", "w-4/5", "w-3/5"];
788
+ var Skeleton = ({
789
+ variant = "text",
790
+ lines = 3,
791
+ lineClassName,
792
+ className,
793
+ animate = true,
794
+ ...props
795
+ }) => {
796
+ const pulseClasses = animate ? "animate-pulse" : "";
797
+ if (variant === "avatar") {
798
+ return /* @__PURE__ */ jsxRuntime.jsx(
799
+ "div",
800
+ {
801
+ className: cn(basePulseClasses, pulseClasses, "rounded-full h-10 w-10", className),
802
+ "aria-hidden": "true",
803
+ ...props
804
+ }
805
+ );
806
+ }
807
+ if (variant === "image") {
808
+ return /* @__PURE__ */ jsxRuntime.jsx(
809
+ "div",
810
+ {
811
+ className: cn(basePulseClasses, pulseClasses, "h-40 w-full", className),
812
+ "aria-hidden": "true",
813
+ ...props
814
+ }
815
+ );
816
+ }
817
+ if (variant === "rect") {
818
+ return /* @__PURE__ */ jsxRuntime.jsx(
819
+ "div",
820
+ {
821
+ className: cn(basePulseClasses, pulseClasses, "h-12 w-full", className),
822
+ "aria-hidden": "true",
823
+ ...props
824
+ }
825
+ );
826
+ }
827
+ if (variant === "card") {
828
+ return /* @__PURE__ */ jsxRuntime.jsxs(
829
+ "div",
830
+ {
831
+ className: cn(
832
+ "w-full rounded-xl border border-surface-1/40 bg-secondary/60 p-4",
833
+ className
834
+ ),
835
+ "aria-hidden": "true",
836
+ ...props,
837
+ children: [
838
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
839
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-10 w-10 rounded-full") }),
840
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
841
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-3 w-1/3 rounded") }),
842
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-3 w-1/4 rounded") })
843
+ ] })
844
+ ] }),
845
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 space-y-2", children: Array.from({ length: Math.max(lines, 2) }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
846
+ "div",
847
+ {
848
+ className: cn(
849
+ basePulseClasses,
850
+ pulseClasses,
851
+ "h-3 rounded",
852
+ lineWidths[index % lineWidths.length],
853
+ lineClassName
854
+ )
855
+ },
856
+ `card-line-${index}`
857
+ )) })
858
+ ]
859
+ }
860
+ );
861
+ }
862
+ return /* @__PURE__ */ jsxRuntime.jsx(
863
+ "div",
864
+ {
865
+ className: cn("w-full space-y-2", className),
866
+ "aria-hidden": "true",
867
+ ...props,
868
+ children: Array.from({ length: Math.max(lines, 1) }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
869
+ "div",
870
+ {
871
+ className: cn(
872
+ basePulseClasses,
873
+ pulseClasses,
874
+ "h-3 rounded",
875
+ lineWidths[index % lineWidths.length],
876
+ lineClassName
877
+ )
878
+ },
879
+ `text-line-${index}`
880
+ ))
881
+ }
882
+ );
883
+ };
884
+ var Skeleton_default = Skeleton;
786
885
  var Toast = ({
787
886
  heading,
788
887
  message,
@@ -1513,6 +1612,9 @@ var SearchInput = React22__namespace.default.forwardRef(
1513
1612
  const inputRef = React22.useRef(null);
1514
1613
  React22.useImperativeHandle(ref, () => inputRef.current);
1515
1614
  const { addShortcutListener, removeShortcutListener, formatKeys, getShortcutByCommand } = useShortcutFormatter_default();
1615
+ React22.useEffect(() => {
1616
+ setSearchValue(value ?? "");
1617
+ }, [value]);
1516
1618
  const handleChange = (e) => {
1517
1619
  const newValue = e.target.value;
1518
1620
  setSearchValue(newValue);
@@ -1553,17 +1655,31 @@ var SearchInput = React22__namespace.default.forwardRef(
1553
1655
  outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
1554
1656
  };
1555
1657
  const sizeClasses = {
1556
- sm: "h-8 px-2 pl-8 text-sm",
1557
- md: "h-10 px-3 pl-10 text-base",
1558
- lg: "h-12 px-4 pl-12 text-lg"
1658
+ sm: "h-8 px-2 pl-8 text-sm leading-tight",
1659
+ md: "h-10 px-3 pl-10 text-base leading-tight",
1660
+ lg: "h-12 px-4 pl-12 text-lg leading-tight"
1559
1661
  };
1560
1662
  const iconSizeClasses = {
1561
1663
  sm: "w-4 h-4",
1562
1664
  md: "w-5 h-5",
1563
1665
  lg: "w-6 h-6"
1564
1666
  };
1565
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
1566
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-neutral-400", children: /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: iconSizeClasses[size] }) }),
1667
+ const iconPositionClasses = {
1668
+ sm: "left-2",
1669
+ md: "left-3",
1670
+ lg: "left-3.5"
1671
+ };
1672
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full min-w-0", children: [
1673
+ /* @__PURE__ */ jsxRuntime.jsx(
1674
+ "div",
1675
+ {
1676
+ className: cn(
1677
+ "pointer-events-none absolute top-1/2 -translate-y-1/2 text-neutral-400",
1678
+ iconPositionClasses[size]
1679
+ ),
1680
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: iconSizeClasses[size] })
1681
+ }
1682
+ ),
1567
1683
  /* @__PURE__ */ jsxRuntime.jsx(
1568
1684
  "input",
1569
1685
  {
@@ -1575,6 +1691,7 @@ var SearchInput = React22__namespace.default.forwardRef(
1575
1691
  className: cn(
1576
1692
  baseClasses,
1577
1693
  variantClasses[variant],
1694
+ "w-full min-w-0",
1578
1695
  sizeClasses[size],
1579
1696
  showClearButton && searchValue ? "pr-10" : "",
1580
1697
  className
@@ -1586,7 +1703,9 @@ var SearchInput = React22__namespace.default.forwardRef(
1586
1703
  "button",
1587
1704
  {
1588
1705
  onClick: handleClear,
1589
- className: "absolute right-3 top-1/2 transform -translate-y-1/2 text-neutral-400 hover:text-neutral-600 transition-colors",
1706
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-neutral-600 transition-colors",
1707
+ "aria-label": "Clear search",
1708
+ type: "button",
1590
1709
  children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: iconSizeClasses[size], fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1591
1710
  }
1592
1711
  )
@@ -3145,6 +3264,7 @@ exports.Progress = Progress_default;
3145
3264
  exports.Radio = Radio_default;
3146
3265
  exports.SearchInput = SearchInput_default;
3147
3266
  exports.Select = Select_default;
3267
+ exports.Skeleton = Skeleton_default;
3148
3268
  exports.Table = Table;
3149
3269
  exports.TableBody = TableBody;
3150
3270
  exports.TableCaption = TableCaption;