@skyvexsoftware/stratos-sdk 0.16.2 → 0.16.3

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/dist/ui/card.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import * as React from "react";
2
2
  declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
3
3
  declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
4
- declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
4
+ type CardTitleProps = React.ComponentProps<"h3"> & {
5
+ as?: React.ElementType;
6
+ };
7
+ declare function CardTitle({ as: Comp, className, ...props }: CardTitleProps): React.JSX.Element;
5
8
  declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
6
9
  declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
7
10
  declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
package/dist/ui/card.js CHANGED
@@ -6,8 +6,8 @@ function Card({ className, ...props }) {
6
6
  function CardHeader({ className, ...props }) {
7
7
  return (_jsx("div", { "data-slot": "card-header", className: cn("@container/card-header has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6", className), ...props }));
8
8
  }
9
- function CardTitle({ className, ...props }) {
10
- return (_jsx("div", { "data-slot": "card-title", className: cn("font-semibold leading-none", className), ...props }));
9
+ function CardTitle({ as: Comp = "h3", className, ...props }) {
10
+ return (_jsx(Comp, { "data-slot": "card-title", className: cn("font-semibold leading-none", className), ...props }));
11
11
  }
12
12
  function CardDescription({ className, ...props }) {
13
13
  return (_jsx("div", { "data-slot": "card-description", className: cn("text-muted-foreground text-sm", className), ...props }));
@@ -24,6 +24,12 @@ export type ComboboxProps = {
24
24
  contentClassName?: string;
25
25
  align?: "start" | "center" | "end";
26
26
  onOpenChange?: (open: boolean) => void;
27
+ /** Element id applied to the trigger button. */
28
+ id?: string;
29
+ /** Accessible name for the trigger button (and the search field inside the popover). */
30
+ "aria-label"?: string;
31
+ /** Id of an element that labels the trigger button. */
32
+ "aria-labelledby"?: string;
27
33
  };
28
34
  /**
29
35
  * Searchable single-select built on Popover + cmdk. The list scrolls
@@ -31,5 +37,5 @@ export type ComboboxProps = {
31
37
  * selected option with a check. Pass `loading` while options are being
32
38
  * fetched to keep the trigger usable without a flickering empty state.
33
39
  */
34
- export declare function Combobox({ options, value, onValueChange, placeholder, searchPlaceholder, emptyText, loading, loadingText, disabled, triggerClassName, contentClassName, align, onOpenChange, }: ComboboxProps): React.JSX.Element;
40
+ export declare function Combobox({ options, value, onValueChange, placeholder, searchPlaceholder, emptyText, loading, loadingText, disabled, triggerClassName, contentClassName, align, onOpenChange, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }: ComboboxProps): React.JSX.Element;
35
41
  //# sourceMappingURL=combobox.d.ts.map
@@ -11,14 +11,15 @@ import { Popover, PopoverContent, PopoverTrigger } from "./popover";
11
11
  * selected option with a check. Pass `loading` while options are being
12
12
  * fetched to keep the trigger usable without a flickering empty state.
13
13
  */
14
- export function Combobox({ options, value, onValueChange, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", loading = false, loadingText = "Loading…", disabled = false, triggerClassName, contentClassName, align = "start", onOpenChange, }) {
14
+ export function Combobox({ options, value, onValueChange, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", loading = false, loadingText = "Loading…", disabled = false, triggerClassName, contentClassName, align = "start", onOpenChange, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }) {
15
15
  const [open, setOpen] = React.useState(false);
16
16
  const selected = options.find((option) => option.value === value);
17
+ const inputAriaLabel = ariaLabel ?? selected?.label ?? placeholder;
17
18
  const handleOpenChange = (next) => {
18
19
  setOpen(next);
19
20
  onOpenChange?.(next);
20
21
  };
21
- return (_jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", role: "combobox", "aria-expanded": open, disabled: disabled, className: cn("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", triggerClassName), children: [_jsx("span", { className: cn("truncate", !selected && "text-muted-foreground"), children: selected ? selected.label : placeholder }), _jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { align: align, className: cn("w-[var(--radix-popover-trigger-width)] p-0", contentClassName), children: _jsxs(Command, { className: "text-popover-foreground flex w-full flex-col overflow-hidden", children: [_jsxs("div", { className: "border-border flex items-center border-b px-2.5", children: [_jsx(Search, { className: "text-muted-foreground mr-2 h-4 w-4 shrink-0" }), _jsx(Command.Input, { placeholder: searchPlaceholder, className: "placeholder:text-muted-foreground h-9 w-full bg-transparent py-2 text-sm outline-none" })] }), _jsx(Command.List, { className: "max-h-60 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "text-muted-foreground py-3 text-center text-sm", children: loadingText })) : (_jsxs(_Fragment, { children: [_jsx(Command.Empty, { className: "text-muted-foreground py-3 text-center text-sm", children: emptyText }), options.map((option) => (_jsxs(Command.Item, { value: `${option.label} ${option.value}`, onSelect: () => {
22
+ return (_jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled: disabled, className: cn("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", triggerClassName), children: [_jsx("span", { className: cn("truncate", !selected && "text-muted-foreground"), children: selected ? selected.label : placeholder }), _jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { align: align, className: cn("w-[var(--radix-popover-trigger-width)] p-0", contentClassName), children: _jsxs(Command, { className: "text-popover-foreground flex w-full flex-col overflow-hidden", children: [_jsxs("div", { className: "border-border flex items-center border-b px-2.5", children: [_jsx(Search, { className: "text-muted-foreground mr-2 h-4 w-4 shrink-0" }), _jsx(Command.Input, { placeholder: searchPlaceholder, "aria-label": inputAriaLabel, className: "placeholder:text-muted-foreground h-9 w-full bg-transparent py-2 text-sm outline-none" })] }), _jsx(Command.List, { className: "max-h-60 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "text-muted-foreground py-3 text-center text-sm", children: loadingText })) : (_jsxs(_Fragment, { children: [_jsx(Command.Empty, { className: "text-muted-foreground py-3 text-center text-sm", children: emptyText }), options.map((option) => (_jsxs(Command.Item, { value: `${option.label} ${option.value}`, onSelect: () => {
22
23
  onValueChange?.(option.value);
23
24
  handleOpenChange(false);
24
25
  }, className: "aria-selected:bg-accent aria-selected:text-accent-foreground flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-none", children: [_jsx(Check, { className: cn("mr-2 h-4 w-4 shrink-0", value === option.value ? "opacity-100" : "opacity-0") }), _jsx("span", { className: "truncate", children: option.label })] }, option.value)))] })) })] }) })] }));
package/dist/ui/slider.js CHANGED
@@ -2,6 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as SliderPrimitive from "@radix-ui/react-slider";
4
4
  import { cn } from "../utils/cn";
5
- const Slider = React.forwardRef(({ className, ...props }, ref) => (_jsxs(SliderPrimitive.Root, { ref: ref, className: cn("relative flex w-full touch-none select-none items-center", className), ...props, children: [_jsx(SliderPrimitive.Track, { className: "bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full", children: _jsx(SliderPrimitive.Range, { className: "bg-primary absolute h-full" }) }), _jsx(SliderPrimitive.Thumb, { className: "border-primary/50 bg-background focus-visible:ring-ring focus-visible:outline-hidden block h-4 w-4 rounded-full border shadow-sm transition-colors focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50" })] })));
5
+ const Slider = React.forwardRef(({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }, ref) => {
6
+ // Only include the aria attributes when they're actually set. For a
7
+ // multi-value slider, Radix's Thumb falls back to a computed positional
8
+ // label ("Minimum"/"Maximum"/"Value N of M") when no aria-label is
9
+ // supplied; spreading an explicit `aria-label: undefined` key would
10
+ // overwrite that fallback (Radix's internal spread order puts the
11
+ // caller's props last), leaving the thumb with no accessible name at
12
+ // all. Omitting the key entirely preserves whatever fallback Radix
13
+ // computes.
14
+ const thumbAriaProps = {};
15
+ if (ariaLabel !== undefined)
16
+ thumbAriaProps["aria-label"] = ariaLabel;
17
+ if (ariaLabelledBy !== undefined)
18
+ thumbAriaProps["aria-labelledby"] = ariaLabelledBy;
19
+ return (_jsxs(SliderPrimitive.Root, { ref: ref, className: cn("relative flex w-full touch-none select-none items-center", className), ...props, children: [_jsx(SliderPrimitive.Track, { className: "bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full", children: _jsx(SliderPrimitive.Range, { className: "bg-primary absolute h-full" }) }), _jsx(SliderPrimitive.Thumb, { ...thumbAriaProps, className: "border-primary/50 bg-background focus-visible:ring-ring focus-visible:outline-hidden block h-4 w-4 rounded-full border shadow-sm transition-colors focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50" })] }));
20
+ });
6
21
  Slider.displayName = SliderPrimitive.Root.displayName;
7
22
  export { Slider };
@@ -1,13 +1,12 @@
1
1
  import * as React from "react";
2
- type SwitchProps = {
2
+ type SwitchProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "checked" | "onClick" | "type" | "role"> & {
3
3
  checked?: boolean;
4
4
  onCheckedChange?: (checked: boolean) => void;
5
- disabled?: boolean;
6
- className?: string;
7
- id?: string;
8
- name?: string;
9
5
  };
10
- declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const Switch: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "role" | "onClick" | "checked"> & {
7
+ checked?: boolean;
8
+ onCheckedChange?: (checked: boolean) => void;
9
+ } & React.RefAttributes<HTMLButtonElement>>;
11
10
  export { Switch };
12
11
  export type { SwitchProps };
13
12
  //# sourceMappingURL=switch.d.ts.map
package/dist/ui/switch.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { cn } from "../utils/cn";
4
- const Switch = React.forwardRef(({ checked = false, onCheckedChange, disabled, className, ...props }, ref) => (_jsx("button", { type: "button", role: "switch", "aria-checked": checked, ref: ref, disabled: disabled, onClick: () => onCheckedChange?.(!checked), className: cn("relative inline-flex shrink-0 cursor-pointer rounded-md transition-all duration-150", "h-[18px] w-[32px]", checked
4
+ const Switch = React.forwardRef(({ checked = false, onCheckedChange, disabled, className, ...props }, ref) => (_jsx("button", { type: "button", role: "switch", "aria-checked": checked, ref: ref, disabled: disabled, onClick: () => onCheckedChange?.(!checked), className: cn("relative inline-flex shrink-0 cursor-pointer rounded-md transition-all duration-150", "h-[18px] w-[32px]", "focus-visible:outline-hidden focus-visible:ring-ring focus-visible:ring-2", checked
5
5
  ? "border-primary bg-primary border"
6
6
  : "border-border-interactive bg-muted border", disabled && "cursor-not-allowed opacity-50", className), ...props, children: _jsx("span", { className: cn("pointer-events-none absolute top-[2px] h-[12px] w-[12px] rounded-sm transition-[left] duration-150", checked ? "bg-primary-foreground left-[16px]" : "left-[2px] bg-white") }) })));
7
7
  Switch.displayName = "Switch";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyvexsoftware/stratos-sdk",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "Plugin SDK for Stratos — types, hooks, and UI components",
5
5
  "author": {
6
6
  "name": "Skyvex Software Pty Ltd",