myoperator-ui 0.0.155 → 0.0.156

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 (2) hide show
  1. package/dist/index.js +231 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4983,6 +4983,237 @@ export { useToast, toast, Toaster };
4983
4983
  * toast.dismiss()
4984
4984
  * \`\`\`
4985
4985
  */
4986
+ `, prefix)
4987
+ }
4988
+ ]
4989
+ },
4990
+ "spinner": {
4991
+ name: "spinner",
4992
+ description: "A loading spinner component with customizable size and color variants for indicating progress",
4993
+ category: "feedback",
4994
+ dependencies: [
4995
+ "class-variance-authority",
4996
+ "clsx",
4997
+ "tailwind-merge"
4998
+ ],
4999
+ files: [
5000
+ {
5001
+ name: "spinner.tsx",
5002
+ content: prefixTailwindClasses(`import * as React from "react";
5003
+ import { cva, type VariantProps } from "class-variance-authority";
5004
+
5005
+ import { cn } from "../../lib/utils";
5006
+
5007
+ /**
5008
+ * Spinner variants for loading indicators.
5009
+ * Uses semantic color tokens for consistent theming.
5010
+ */
5011
+ const spinnerVariants = cva("animate-spin", {
5012
+ variants: {
5013
+ size: {
5014
+ sm: "size-4",
5015
+ default: "size-6",
5016
+ lg: "size-8",
5017
+ xl: "size-12",
5018
+ },
5019
+ variant: {
5020
+ default: "text-semantic-primary",
5021
+ secondary: "text-semantic-text-secondary",
5022
+ muted: "text-semantic-text-muted",
5023
+ inverted: "text-white",
5024
+ current: "text-current",
5025
+ },
5026
+ },
5027
+ defaultVariants: {
5028
+ size: "default",
5029
+ variant: "default",
5030
+ },
5031
+ });
5032
+
5033
+ /**
5034
+ * SVG stroke widths that decrease as size increases for visual balance.
5035
+ */
5036
+ const strokeWidths: Record<string, number> = {
5037
+ sm: 3,
5038
+ default: 3,
5039
+ lg: 2.5,
5040
+ xl: 2,
5041
+ };
5042
+
5043
+ /**
5044
+ * A loading spinner component with customizable size and color variants.
5045
+ * Uses a custom SVG circle with a visible track and animated arc.
5046
+ *
5047
+ * @example
5048
+ * \`\`\`tsx
5049
+ * <Spinner />
5050
+ * <Spinner size="sm" variant="muted" />
5051
+ * <Spinner size="lg" variant="current" />
5052
+ * <Spinner variant="inverted" aria-label="Saving changes" />
5053
+ * \`\`\`
5054
+ */
5055
+ export interface SpinnerProps
5056
+ extends React.HTMLAttributes<HTMLDivElement>,
5057
+ VariantProps<typeof spinnerVariants> {
5058
+ /** Accessible label for the spinner (default: "Loading") */
5059
+ "aria-label"?: string;
5060
+ }
5061
+
5062
+ const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
5063
+ (
5064
+ {
5065
+ className,
5066
+ size = "default",
5067
+ variant,
5068
+ "aria-label": ariaLabel = "Loading",
5069
+ ...props
5070
+ },
5071
+ ref
5072
+ ) => {
5073
+ const strokeWidth = strokeWidths[size || "default"] ?? 3;
5074
+ const radius = 10;
5075
+ const circumference = 2 * Math.PI * radius;
5076
+
5077
+ return (
5078
+ <div
5079
+ ref={ref}
5080
+ role="status"
5081
+ aria-label={ariaLabel}
5082
+ className={cn("inline-flex shrink-0", className)}
5083
+ {...props}
5084
+ >
5085
+ <svg
5086
+ className={cn(spinnerVariants({ size, variant }))}
5087
+ viewBox="0 0 24 24"
5088
+ fill="none"
5089
+ xmlns="http://www.w3.org/2000/svg"
5090
+ >
5091
+ {/* Track circle */}
5092
+ <circle
5093
+ cx="12"
5094
+ cy="12"
5095
+ r={radius}
5096
+ stroke="currentColor"
5097
+ strokeWidth={strokeWidth}
5098
+ opacity="0.25"
5099
+ />
5100
+ {/* Active arc */}
5101
+ <circle
5102
+ cx="12"
5103
+ cy="12"
5104
+ r={radius}
5105
+ stroke="currentColor"
5106
+ strokeWidth={strokeWidth}
5107
+ strokeLinecap="round"
5108
+ strokeDasharray={circumference}
5109
+ strokeDashoffset={circumference * 0.75}
5110
+ />
5111
+ </svg>
5112
+ <span className="sr-only">{ariaLabel}</span>
5113
+ </div>
5114
+ );
5115
+ }
5116
+ );
5117
+ Spinner.displayName = "Spinner";
5118
+
5119
+ export { Spinner, spinnerVariants };
5120
+ `, prefix)
5121
+ }
5122
+ ]
5123
+ },
5124
+ "skeleton": {
5125
+ name: "skeleton",
5126
+ description: "A placeholder loading component with pulse animation for content loading states",
5127
+ category: "feedback",
5128
+ dependencies: [
5129
+ "class-variance-authority",
5130
+ "clsx",
5131
+ "tailwind-merge"
5132
+ ],
5133
+ files: [
5134
+ {
5135
+ name: "skeleton.tsx",
5136
+ content: prefixTailwindClasses(`import * as React from "react";
5137
+ import { cva, type VariantProps } from "class-variance-authority";
5138
+
5139
+ import { cn } from "../../lib/utils";
5140
+
5141
+ /**
5142
+ * Skeleton variants for content placeholders.
5143
+ * Uses semantic background tokens for consistent theming.
5144
+ */
5145
+ const skeletonVariants = cva("animate-pulse", {
5146
+ variants: {
5147
+ variant: {
5148
+ default: "bg-semantic-bg-grey",
5149
+ subtle: "bg-semantic-bg-ui",
5150
+ },
5151
+ shape: {
5152
+ line: "h-4 w-full rounded",
5153
+ circle: "rounded-full",
5154
+ rectangle: "rounded",
5155
+ },
5156
+ },
5157
+ defaultVariants: {
5158
+ variant: "default",
5159
+ shape: "line",
5160
+ },
5161
+ });
5162
+
5163
+ /**
5164
+ * A placeholder loading component with pulse animation for content loading states.
5165
+ * Use shape, width, and height props to match the content being loaded.
5166
+ *
5167
+ * @example
5168
+ * \`\`\`tsx
5169
+ * // Text line placeholder
5170
+ * <Skeleton />
5171
+ *
5172
+ * // Avatar placeholder
5173
+ * <Skeleton shape="circle" width={40} height={40} />
5174
+ *
5175
+ * // Image/card placeholder
5176
+ * <Skeleton shape="rectangle" width="100%" height={200} />
5177
+ *
5178
+ * // Subtle variant
5179
+ * <Skeleton variant="subtle" />
5180
+ * \`\`\`
5181
+ */
5182
+ export interface SkeletonProps
5183
+ extends React.HTMLAttributes<HTMLDivElement>,
5184
+ VariantProps<typeof skeletonVariants> {
5185
+ /** Width of the skeleton (number for px, string for any CSS value) */
5186
+ width?: number | string;
5187
+ /** Height of the skeleton (number for px, string for any CSS value) */
5188
+ height?: number | string;
5189
+ }
5190
+
5191
+ const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
5192
+ ({ className, variant, shape, width, height, style, ...props }, ref) => {
5193
+ const dimensionStyle: React.CSSProperties = {
5194
+ ...style,
5195
+ ...(width !== undefined
5196
+ ? { width: typeof width === "number" ? \`\${width}px\` : width }
5197
+ : {}),
5198
+ ...(height !== undefined
5199
+ ? { height: typeof height === "number" ? \`\${height}px\` : height }
5200
+ : {}),
5201
+ };
5202
+
5203
+ return (
5204
+ <div
5205
+ ref={ref}
5206
+ aria-hidden="true"
5207
+ className={cn(skeletonVariants({ variant, shape, className }))}
5208
+ style={dimensionStyle}
5209
+ {...props}
5210
+ />
5211
+ );
5212
+ }
5213
+ );
5214
+ Skeleton.displayName = "Skeleton";
5215
+
5216
+ export { Skeleton, skeletonVariants };
4986
5217
  `, prefix)
4987
5218
  }
4988
5219
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.155",
3
+ "version": "0.0.156",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",