@schandlergarcia/sf-web-components 1.3.1 → 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 (74) hide show
  1. package/.a4drules/features/command-center-dashboard-rule.md +1 -1
  2. package/.a4drules/skills/command-center-project/SKILL.md +4 -4
  3. package/.a4drules/skills/component-library/SKILL.md +4 -1
  4. package/README.md +2 -0
  5. package/dist/components/library/heroui/Input.d.ts +5 -1
  6. package/dist/components/library/heroui/Input.js +0 -1
  7. package/dist/components/library/heroui/Input.js.map +1 -1
  8. package/dist/components/library/heroui/Kbd.d.ts +6 -5
  9. package/dist/components/library/heroui/Kbd.js +4 -5
  10. package/dist/components/library/heroui/Kbd.js.map +1 -1
  11. package/dist/components/library/heroui/Skeleton.d.ts +8 -5
  12. package/dist/components/library/heroui/Skeleton.js +4 -5
  13. package/dist/components/library/heroui/Skeleton.js.map +1 -1
  14. package/dist/components/library/heroui/Toast.d.ts +6 -3
  15. package/dist/components/library/heroui/Toast.js +3 -4
  16. package/dist/components/library/heroui/Toast.js.map +1 -1
  17. package/dist/components/library/ui/Avatar.d.ts +22 -10
  18. package/dist/components/library/ui/Avatar.js +40 -17
  19. package/dist/components/library/ui/Avatar.js.map +1 -1
  20. package/dist/components/library/ui/Card.d.ts +23 -37
  21. package/dist/components/library/ui/Chip.d.ts +18 -7
  22. package/dist/components/library/ui/Chip.js +11 -12
  23. package/dist/components/library/ui/Chip.js.map +1 -1
  24. package/dist/components/library/ui/Container.d.ts +12 -13
  25. package/dist/components/library/ui/Container.js +16 -17
  26. package/dist/components/library/ui/Container.js.map +1 -1
  27. package/dist/components/library/ui/EmptyState.d.ts +34 -7
  28. package/dist/components/library/ui/EmptyState.js +5 -6
  29. package/dist/components/library/ui/EmptyState.js.map +1 -1
  30. package/dist/components/library/ui/FieldGroup.d.ts +4 -5
  31. package/dist/components/library/ui/FieldGroup.js +4 -5
  32. package/dist/components/library/ui/FieldGroup.js.map +1 -1
  33. package/dist/components/library/ui/Spinner.d.ts +21 -5
  34. package/dist/components/library/ui/Text.d.ts +24 -10
  35. package/dist/components/library/ui/Text.js +20 -23
  36. package/dist/components/library/ui/Text.js.map +1 -1
  37. package/dist/components/library/ui/UIInput.d.ts +4 -5
  38. package/dist/components/library/ui/UIInput.js +5 -6
  39. package/dist/components/library/ui/UIInput.js.map +1 -1
  40. package/dist/components/library/ui/alert.d.ts +23 -21
  41. package/dist/components/library/ui/alert.js +13 -14
  42. package/dist/components/library/ui/alert.js.map +1 -1
  43. package/dist/components/library/ui/card.js +24 -26
  44. package/dist/components/library/ui/card.js.map +1 -1
  45. package/dist/components/library/ui/checkbox.d.ts +4 -4
  46. package/dist/components/library/ui/checkbox.js +4 -5
  47. package/dist/components/library/ui/checkbox.js.map +1 -1
  48. package/dist/components/library/ui/label.d.ts +5 -7
  49. package/dist/components/library/ui/label.js +9 -10
  50. package/dist/components/library/ui/label.js.map +1 -1
  51. package/dist/components/library/ui/spinner.js +16 -17
  52. package/dist/components/library/ui/spinner.js.map +1 -1
  53. package/package.json +1 -1
  54. package/scripts/convert-to-typescript.sh +52 -0
  55. package/src/components/library/heroui/Input.tsx +10 -0
  56. package/src/components/library/heroui/Kbd.tsx +11 -0
  57. package/src/components/library/heroui/Skeleton.tsx +14 -0
  58. package/src/components/library/heroui/{Toast.jsx → Toast.tsx} +5 -2
  59. package/src/components/library/ui/{Alert.jsx → Alert.tsx} +17 -7
  60. package/src/components/library/ui/Avatar.tsx +68 -0
  61. package/src/components/library/ui/{Card.jsx → Card.tsx} +24 -10
  62. package/src/components/library/ui/{Checkbox.jsx → Checkbox.tsx} +4 -2
  63. package/src/components/library/ui/{Chip.jsx → Chip.tsx} +11 -7
  64. package/src/components/library/ui/{Container.jsx → Container.tsx} +13 -4
  65. package/src/components/library/ui/{EmptyState.jsx → EmptyState.tsx} +13 -10
  66. package/src/components/library/ui/{FieldGroup.jsx → FieldGroup.tsx} +4 -2
  67. package/src/components/library/ui/{Label.jsx → Label.tsx} +9 -8
  68. package/src/components/library/ui/{Spinner.jsx → Spinner.tsx} +12 -10
  69. package/src/components/library/ui/{Text.jsx → Text.tsx} +19 -12
  70. package/src/components/library/ui/{UIInput.jsx → UIInput.tsx} +5 -5
  71. package/src/components/library/heroui/Input.jsx +0 -6
  72. package/src/components/library/heroui/Kbd.jsx +0 -8
  73. package/src/components/library/heroui/Skeleton.jsx +0 -8
  74. package/src/components/library/ui/Avatar.jsx +0 -44
@@ -1,22 +1,23 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
 
3
- export default function Label({ children, htmlFor, required, className = "", ...rest }) {
4
- // If no htmlFor provided, render as div for compatibility
5
- const Tag = htmlFor ? 'label' : 'div';
6
- const props = htmlFor ? { htmlFor, ...rest } : rest;
3
+ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
4
+ required?: boolean;
5
+ }
7
6
 
7
+ export default function Label({ children, htmlFor, required, className = "", ...rest }: LabelProps) {
8
8
  return (
9
- <Tag
10
- {...props}
9
+ <label
10
+ htmlFor={htmlFor}
11
11
  className={[
12
12
  "text-sm font-medium text-slate-700 dark:text-slate-200",
13
13
  className
14
14
  ]
15
15
  .filter(Boolean)
16
16
  .join(" ")}
17
+ {...rest}
17
18
  >
18
19
  {children}
19
20
  {required && <span className="ml-0.5 text-red-500">*</span>}
20
- </Tag>
21
+ </label>
21
22
  );
22
23
  }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
 
3
3
  const SIZE_CLASSES = {
4
4
  xs: "h-3 w-3",
@@ -6,21 +6,23 @@ const SIZE_CLASSES = {
6
6
  md: "h-5 w-5",
7
7
  lg: "h-6 w-6",
8
8
  xl: "h-8 w-8",
9
- };
9
+ } as const;
10
10
 
11
11
  const TONE_CLASSES = {
12
12
  brand: "text-brand-500",
13
13
  white: "text-white",
14
14
  muted: "text-slate-400 dark:text-slate-500",
15
15
  current: "text-current",
16
- };
16
+ } as const;
17
+
18
+ export interface SpinnerProps extends React.SVGAttributes<SVGSVGElement> {
19
+ size?: keyof typeof SIZE_CLASSES;
20
+ tone?: keyof typeof TONE_CLASSES;
21
+ label?: string;
22
+ }
17
23
 
18
24
  /**
19
25
  * Animated spinner.
20
- *
21
- * @param {"xs"|"sm"|"md"|"lg"|"xl"} size
22
- * @param {"brand"|"white"|"muted"|"current"} tone
23
- * @param {string} label — screen-reader label
24
26
  */
25
27
  export default function Spinner({
26
28
  size = "md",
@@ -28,14 +30,14 @@ export default function Spinner({
28
30
  label = "Loading",
29
31
  className = "",
30
32
  ...rest
31
- }) {
33
+ }: SpinnerProps) {
32
34
  return (
33
35
  <svg
34
36
  {...rest}
35
37
  className={[
36
38
  "animate-spin",
37
- SIZE_CLASSES[size] ?? SIZE_CLASSES.md,
38
- TONE_CLASSES[tone] ?? TONE_CLASSES.brand,
39
+ SIZE_CLASSES[size],
40
+ TONE_CLASSES[tone],
39
41
  className,
40
42
  ]
41
43
  .filter(Boolean)
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
 
3
3
  const SIZE_CLASSES = {
4
4
  xs: "text-xs",
@@ -7,30 +7,39 @@ const SIZE_CLASSES = {
7
7
  lg: "text-lg",
8
8
  xl: "text-xl",
9
9
  xxl: "text-2xl"
10
- };
10
+ } as const;
11
11
 
12
12
  const WEIGHT_CLASSES = {
13
13
  regular: "font-normal",
14
14
  medium: "font-medium",
15
15
  bold: "font-semibold"
16
- };
16
+ } as const;
17
17
 
18
- export default function UIText({
19
- as: Comp = "span",
18
+ export interface UITextProps<T extends React.ElementType = "span"> {
19
+ as?: T;
20
+ size?: keyof typeof SIZE_CLASSES;
21
+ weight?: keyof typeof WEIGHT_CLASSES;
22
+ muted?: boolean;
23
+ className?: string;
24
+ children?: React.ReactNode;
25
+ }
26
+
27
+ export default function UIText<T extends React.ElementType = "span">({
28
+ as,
20
29
  size = "md",
21
30
  weight = "regular",
22
31
  muted = false,
23
- style,
24
32
  className = "",
25
33
  children,
26
34
  ...rest
27
- }) {
35
+ }: UITextProps<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof UITextProps<T>>) {
36
+ const Comp = as || "span";
37
+
28
38
  return (
29
39
  <Comp
30
- style={style}
31
40
  className={[
32
- SIZE_CLASSES[size] ?? SIZE_CLASSES.md,
33
- WEIGHT_CLASSES[weight] ?? WEIGHT_CLASSES.regular,
41
+ SIZE_CLASSES[size],
42
+ WEIGHT_CLASSES[weight],
34
43
  muted ? "text-slate-600 dark:text-slate-300" : "text-slate-900 dark:text-slate-50",
35
44
  className
36
45
  ]
@@ -42,5 +51,3 @@ export default function UIText({
42
51
  </Comp>
43
52
  );
44
53
  }
45
-
46
-
@@ -1,14 +1,16 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
 
3
- export default function UIInput({ style = undefined, className = "", ...rest }) {
3
+ export interface UIInputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
4
+
5
+ export default function UIInput({ className = "", ...rest }: UIInputProps) {
4
6
  return (
5
7
  <input
6
- style={style}
7
8
  className={[
8
9
  "h-10 w-full rounded-lg border border-slate-200 bg-white px-3 text-sm text-slate-900 shadow-sm",
9
10
  "placeholder:text-slate-400",
10
11
  "focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2 dark:focus:ring-offset-slate-950",
11
12
  "dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 dark:placeholder:text-slate-500",
13
+ "disabled:cursor-not-allowed disabled:opacity-50",
12
14
  className
13
15
  ]
14
16
  .filter(Boolean)
@@ -17,5 +19,3 @@ export default function UIInput({ style = undefined, className = "", ...rest })
17
19
  />
18
20
  );
19
21
  }
20
-
21
-
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import { Input } from "@heroui/react";
3
-
4
- export default function HeroUIInput(props) {
5
- return <Input {...props} />;
6
- }
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { Kbd } from "@heroui/react";
3
-
4
- export default function HeroUIKbd({ children, ...props }) {
5
- return <Kbd {...props}>{children}</Kbd>;
6
- }
7
-
8
- export { Kbd };
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { Skeleton } from "@heroui/react";
3
-
4
- export default function HeroUISkeleton({ children, ...props }) {
5
- return <Skeleton {...props}>{children}</Skeleton>;
6
- }
7
-
8
- export { Skeleton };
@@ -1,44 +0,0 @@
1
- import React from "react";
2
-
3
- const SIZE_MAP = {
4
- xs: "h-6 w-6 text-[9px]",
5
- sm: "h-8 w-8 text-[10px]",
6
- md: "h-9 w-9 text-xs",
7
- lg: "h-11 w-11 text-sm",
8
- };
9
-
10
- const TONE_MAP = {
11
- slate: "bg-slate-800 text-white",
12
- brand: "bg-brand-500 text-white",
13
- neutral: "bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",
14
- };
15
-
16
- export default function Avatar({ src, name, initials, icon, size = "sm", tone = "slate", className = "", ...rest }) {
17
- const sizeClass = SIZE_MAP[size] ?? SIZE_MAP.sm;
18
-
19
- if (src) {
20
- return (
21
- <img
22
- src={src}
23
- alt={name ?? ""}
24
- className={`${sizeClass} shrink-0 rounded-full border border-slate-200 object-cover dark:border-slate-800 ${className}`}
25
- {...rest}
26
- />
27
- );
28
- }
29
-
30
- if (React.isValidElement(icon)) {
31
- return (
32
- <div className={`${sizeClass} ${TONE_MAP[tone] ?? TONE_MAP.slate} flex shrink-0 items-center justify-center rounded-full ${className}`} {...rest}>
33
- {icon}
34
- </div>
35
- );
36
- }
37
-
38
- const label = initials ?? (name ? name.split(" ").map(w => w[0]).join("").slice(0, 2).toUpperCase() : "?");
39
- return (
40
- <div className={`${sizeClass} ${TONE_MAP[tone] ?? TONE_MAP.slate} flex shrink-0 items-center justify-center rounded-full font-bold ${className}`} {...rest}>
41
- {label}
42
- </div>
43
- );
44
- }