@you-agent-factory/components 0.0.0 → 0.0.1

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 (182) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +38 -7
  3. package/dist/category-paths.d.ts +3 -0
  4. package/dist/charts/chart-state-panel.d.ts +11 -0
  5. package/dist/charts/chart.d.ts +35 -0
  6. package/dist/charts/index.d.ts +5 -0
  7. package/dist/charts/index.js +287 -0
  8. package/dist/chunks/action-row.js +39 -0
  9. package/dist/chunks/alert-panel.js +182 -0
  10. package/dist/chunks/button.js +193 -0
  11. package/dist/chunks/cn.js +6 -0
  12. package/dist/chunks/factory-emulator-controls.js +123 -0
  13. package/dist/chunks/package-form-field.js +546 -0
  14. package/dist/chunks/scroll-area.js +261 -0
  15. package/dist/chunks/surface-panel.js +73 -0
  16. package/dist/chunks/table-layout.js +292 -0
  17. package/dist/chunks/typography-roles.js +26 -0
  18. package/dist/chunks/typography.js +129 -0
  19. package/dist/chunks/widget-frame.js +344 -0
  20. package/dist/data-display/code-panel.d.ts +12 -0
  21. package/dist/data-display/data-table.d.ts +27 -0
  22. package/dist/data-display/description-list.d.ts +4 -0
  23. package/{src/data-display/index.ts → dist/data-display/index.d.ts} +4 -26
  24. package/dist/data-display/index.js +20 -0
  25. package/dist/data-display/table-layout.d.ts +8 -0
  26. package/dist/data-display/table.d.ts +14 -0
  27. package/dist/factory-emulator/factory-emulator-controls.d.ts +23 -0
  28. package/dist/factory-emulator/index.d.ts +6 -0
  29. package/dist/factory-emulator/index.js +6 -0
  30. package/dist/feedback/alert-panel-semantics.d.ts +11 -0
  31. package/dist/feedback/alert-panel.d.ts +29 -0
  32. package/dist/feedback/index.d.ts +6 -0
  33. package/dist/feedback/index.js +10 -0
  34. package/dist/feedback/skeleton.d.ts +2 -0
  35. package/dist/forms/index.d.ts +19 -0
  36. package/dist/forms/index.js +37 -0
  37. package/dist/forms/package-checkbox.d.ts +3 -0
  38. package/dist/forms/package-enum-select.d.ts +42 -0
  39. package/dist/forms/package-file-input.d.ts +3 -0
  40. package/dist/forms/package-form-field.d.ts +49 -0
  41. package/dist/forms/package-input.d.ts +6 -0
  42. package/dist/forms/package-native-select.d.ts +3 -0
  43. package/dist/forms/package-select.d.ts +32 -0
  44. package/dist/forms/package-textarea.d.ts +10 -0
  45. package/dist/forms/select-icons.d.ts +3 -0
  46. package/dist/graphs/graph-edge-path.d.ts +18 -0
  47. package/dist/graphs/graph-edge.d.ts +15 -0
  48. package/dist/graphs/graph-node-button.d.ts +11 -0
  49. package/dist/graphs/graph-node-handle-badge.d.ts +5 -0
  50. package/dist/graphs/graph-node-handle.d.ts +18 -0
  51. package/dist/graphs/graph-node-shell.d.ts +13 -0
  52. package/dist/graphs/graph-node-state-indicator.d.ts +6 -0
  53. package/dist/graphs/graph-node-state.d.ts +23 -0
  54. package/dist/graphs/graph-viewport-surface.d.ts +5 -0
  55. package/dist/graphs/index.d.ts +13 -0
  56. package/dist/graphs/index.js +614 -0
  57. package/{src/icons/index.ts → dist/icons/index.d.ts} +1 -2
  58. package/dist/icons/index.js +4 -0
  59. package/dist/index.d.ts +26 -0
  60. package/dist/index.js +145 -0
  61. package/dist/layout/action-row.d.ts +8 -0
  62. package/{src/layout/index.ts → dist/layout/index.d.ts} +1 -3
  63. package/dist/layout/index.js +9 -0
  64. package/dist/layout/surface-panel.d.ts +15 -0
  65. package/{src/navigation/index.ts → dist/navigation/index.d.ts} +1 -2
  66. package/dist/navigation/index.js +4 -0
  67. package/dist/overlays/collapsible.d.ts +5 -0
  68. package/dist/overlays/dialog.d.ts +16 -0
  69. package/dist/overlays/index.d.ts +10 -0
  70. package/dist/overlays/index.js +27 -0
  71. package/dist/overlays/overlay-layout.d.ts +6 -0
  72. package/dist/overlays/popover.d.ts +6 -0
  73. package/dist/overlays/scroll-area.d.ts +9 -0
  74. package/dist/primitives/button-link.d.ts +5 -0
  75. package/dist/primitives/button.d.ts +9 -0
  76. package/dist/primitives/icon-button-shell.d.ts +10 -0
  77. package/{src/primitives/index.ts → dist/primitives/index.d.ts} +2 -19
  78. package/dist/primitives/index.js +49 -0
  79. package/dist/primitives/package-text.d.ts +6 -0
  80. package/dist/primitives/typography-roles.d.ts +12 -0
  81. package/dist/primitives/typography.d.ts +36 -0
  82. package/dist/recipes/index.d.ts +14 -0
  83. package/dist/recipes/index.js +32 -0
  84. package/dist/recipes/widget-frame-content.d.ts +24 -0
  85. package/dist/recipes/widget-frame-disclosure.d.ts +33 -0
  86. package/dist/recipes/widget-frame-layout.d.ts +12 -0
  87. package/dist/recipes/widget-frame-skeleton.d.ts +2 -0
  88. package/dist/recipes/widget-frame-states.d.ts +15 -0
  89. package/dist/recipes/widget-frame-typography.d.ts +10 -0
  90. package/dist/recipes/widget-frame.d.ts +12 -0
  91. package/{src → dist}/styles.css +36 -0
  92. package/dist/testing/index.d.ts +4 -0
  93. package/dist/testing/index.js +16 -0
  94. package/dist/testing/render.d.ts +5 -0
  95. package/{src/tokens/index.ts → dist/tokens/index.d.ts} +1 -2
  96. package/dist/tokens/index.js +4 -0
  97. package/dist/utilities/cn.d.ts +1 -0
  98. package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -3
  99. package/dist/utilities/index.js +6 -0
  100. package/package.json +65 -64
  101. package/docs/README.md +0 -83
  102. package/docs/button.md +0 -119
  103. package/docs/charts.md +0 -325
  104. package/docs/data-display-code-panel.md +0 -120
  105. package/docs/feedback-alert-panel.md +0 -117
  106. package/docs/feedback-skeleton.md +0 -54
  107. package/docs/forms-form-field.md +0 -490
  108. package/docs/forms-input-primitives.md +0 -311
  109. package/docs/forms-select-primitives.md +0 -362
  110. package/docs/graphs.md +0 -250
  111. package/docs/layout-display-primitives.md +0 -211
  112. package/docs/overlays.md +0 -414
  113. package/docs/table-data-table.md +0 -331
  114. package/docs/typography-roles.md +0 -182
  115. package/docs/widget-frame-recipes.md +0 -273
  116. package/src/category-paths.ts +0 -20
  117. package/src/charts/chart-state-panel.tsx +0 -103
  118. package/src/charts/chart.tsx +0 -287
  119. package/src/charts/index.ts +0 -21
  120. package/src/data-display/code-panel.tsx +0 -67
  121. package/src/data-display/data-table.tsx +0 -180
  122. package/src/data-display/description-list.tsx +0 -24
  123. package/src/data-display/table-layout.ts +0 -12
  124. package/src/data-display/table.tsx +0 -131
  125. package/src/feedback/alert-panel-semantics.ts +0 -75
  126. package/src/feedback/alert-panel.tsx +0 -187
  127. package/src/feedback/index.ts +0 -21
  128. package/src/feedback/skeleton.tsx +0 -16
  129. package/src/forms/index.ts +0 -73
  130. package/src/forms/package-checkbox.tsx +0 -50
  131. package/src/forms/package-enum-select.tsx +0 -185
  132. package/src/forms/package-file-input.tsx +0 -25
  133. package/src/forms/package-form-field.tsx +0 -202
  134. package/src/forms/package-input.tsx +0 -25
  135. package/src/forms/package-native-select.tsx +0 -25
  136. package/src/forms/package-select.tsx +0 -209
  137. package/src/forms/package-textarea.tsx +0 -35
  138. package/src/forms/select-icons.tsx +0 -35
  139. package/src/graphs/graph-edge-path.ts +0 -241
  140. package/src/graphs/graph-edge.tsx +0 -130
  141. package/src/graphs/graph-interactive-example.tsx +0 -187
  142. package/src/graphs/graph-node-button.tsx +0 -51
  143. package/src/graphs/graph-node-handle-badge.tsx +0 -108
  144. package/src/graphs/graph-node-handle.ts +0 -28
  145. package/src/graphs/graph-node-shell.tsx +0 -111
  146. package/src/graphs/graph-node-state-indicator.tsx +0 -47
  147. package/src/graphs/graph-node-state.ts +0 -111
  148. package/src/graphs/graph-viewport-surface.tsx +0 -27
  149. package/src/graphs/index.ts +0 -41
  150. package/src/index.ts +0 -209
  151. package/src/layout/action-row.tsx +0 -53
  152. package/src/layout/surface-panel.tsx +0 -91
  153. package/src/overlays/collapsible.tsx +0 -22
  154. package/src/overlays/dialog.tsx +0 -148
  155. package/src/overlays/index.ts +0 -31
  156. package/src/overlays/overlay-layout.ts +0 -9
  157. package/src/overlays/popover.tsx +0 -29
  158. package/src/overlays/scroll-area.tsx +0 -78
  159. package/src/primitives/button-link.tsx +0 -22
  160. package/src/primitives/button.tsx +0 -258
  161. package/src/primitives/icon-button-shell.tsx +0 -49
  162. package/src/primitives/package-text.tsx +0 -29
  163. package/src/primitives/typography-roles.ts +0 -12
  164. package/src/primitives/typography.tsx +0 -165
  165. package/src/recipes/index.ts +0 -61
  166. package/src/recipes/widget-frame-content.tsx +0 -114
  167. package/src/recipes/widget-frame-disclosure.tsx +0 -161
  168. package/src/recipes/widget-frame-layout.ts +0 -40
  169. package/src/recipes/widget-frame-skeleton.tsx +0 -16
  170. package/src/recipes/widget-frame-states.tsx +0 -99
  171. package/src/recipes/widget-frame-typography.ts +0 -19
  172. package/src/recipes/widget-frame.tsx +0 -84
  173. package/src/testing/index.ts +0 -13
  174. package/src/testing/render.tsx +0 -16
  175. package/src/utilities/cn.ts +0 -5
  176. /package/{src → dist}/styles/color-palette-presets.css +0 -0
  177. /package/{src → dist}/styles/color-role-tokens.css +0 -0
  178. /package/{src → dist}/styles/layout-role-tokens.css +0 -0
  179. /package/{src → dist}/styles/text-color-role-tokens.css +0 -0
  180. /package/{src → dist}/styles/typography-role-tokens.css +0 -0
  181. /package/{src → dist}/styles/typography-role-utilities.css +0 -0
  182. /package/{src → dist}/styles/typography-roles.css +0 -0
@@ -0,0 +1,193 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { forwardRef, Children, isValidElement, cloneElement } from "react";
4
+ import { c as cn } from "./cn.js";
5
+ const BUTTON_LOADING_CONTENT_CLASS = "inline-flex items-center justify-center gap-2";
6
+ const BUTTON_LOADING_HIDDEN_CONTENT_CLASS = "opacity-0";
7
+ const BUTTON_LOADING_OVERLAY_CLASS = "pointer-events-none absolute inset-0 inline-flex items-center justify-center";
8
+ const BUTTON_BASE_CLASS = "inline-flex min-h-11 items-center justify-center gap-2 rounded-xl border font-semibold outline-none transition-colors focus-visible:ring-2 focus-visible:ring-af-focus-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:border-outline disabled:bg-surface-container-low disabled:text-on-surface-disabled";
9
+ const BUTTON_TONE_CLASS = {
10
+ default: "border-primary bg-primary text-on-primary hover:border-on-primary-container hover:bg-on-primary-container",
11
+ destructive: "border-error bg-error text-on-error hover:border-af-danger-hover hover:bg-af-danger-hover",
12
+ ghost: "border-transparent bg-transparent text-on-surface-variant hover:bg-af-overlay hover:text-on-surface",
13
+ outline: "border-outline bg-surface-container-high text-on-surface hover:border-outline-variant hover:bg-af-overlay",
14
+ secondary: "border-outline-variant bg-surface-container-low text-primary hover:border-primary hover:bg-af-overlay",
15
+ warning: "border-af-warning-border bg-warning-container text-on-warning-container hover:border-af-warning-border hover:bg-warning-container hover:text-on-warning-container"
16
+ };
17
+ const BUTTON_SIZE_CLASS = {
18
+ default: "px-4 py-2.5 text-sm",
19
+ icon: "h-11 w-11 px-0 py-0",
20
+ iconPill: "h-10 min-h-10 w-10 rounded-full px-0 py-0",
21
+ lg: "px-5 py-3 text-base",
22
+ pill: "min-h-9 rounded-full px-3 py-2 text-xs",
23
+ sm: "min-h-9 rounded-lg px-3 py-2 text-xs"
24
+ };
25
+ const buttonVariants = ({
26
+ className,
27
+ size = "default",
28
+ tone = "default"
29
+ }) => cn(
30
+ BUTTON_BASE_CLASS,
31
+ BUTTON_TONE_CLASS[tone],
32
+ BUTTON_SIZE_CLASS[size],
33
+ className
34
+ );
35
+ function ButtonLoadingSpinner() {
36
+ return /* @__PURE__ */ jsxs(
37
+ "svg",
38
+ {
39
+ "aria-hidden": "true",
40
+ className: "size-4 animate-spin",
41
+ fill: "none",
42
+ focusable: "false",
43
+ viewBox: "0 0 16 16",
44
+ children: [
45
+ /* @__PURE__ */ jsx(
46
+ "circle",
47
+ {
48
+ className: "text-on-surface-disabled",
49
+ cx: "8",
50
+ cy: "8",
51
+ r: "6",
52
+ stroke: "currentColor",
53
+ strokeWidth: "1.5"
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsx(
57
+ "path",
58
+ {
59
+ d: "M8 2a6 6 0 0 1 6 6",
60
+ stroke: "currentColor",
61
+ strokeLinecap: "round",
62
+ strokeWidth: "1.5"
63
+ }
64
+ )
65
+ ]
66
+ }
67
+ );
68
+ }
69
+ function renderButtonContent(children, loading) {
70
+ if (!loading) {
71
+ return children;
72
+ }
73
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
74
+ /* @__PURE__ */ jsx(
75
+ "span",
76
+ {
77
+ className: cn(
78
+ BUTTON_LOADING_CONTENT_CLASS,
79
+ BUTTON_LOADING_HIDDEN_CONTENT_CLASS
80
+ ),
81
+ children
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: BUTTON_LOADING_OVERLAY_CLASS, children: /* @__PURE__ */ jsx(ButtonLoadingSpinner, {}) })
85
+ ] });
86
+ }
87
+ function suppressSlottedActivation(event) {
88
+ event.preventDefault();
89
+ const nativeEvent = event.nativeEvent;
90
+ if (typeof nativeEvent.stopImmediatePropagation === "function") {
91
+ nativeEvent.stopImmediatePropagation();
92
+ return;
93
+ }
94
+ event.stopPropagation();
95
+ }
96
+ function shouldSuppressSlottedKeyboardActivation(event) {
97
+ return event.key === "Enter" || event.key === " ";
98
+ }
99
+ function mergeRefs(...refs) {
100
+ return (value) => {
101
+ for (const ref of refs) {
102
+ if (typeof ref === "function") {
103
+ ref(value);
104
+ } else if (ref && typeof ref === "object") {
105
+ ref.current = value;
106
+ }
107
+ }
108
+ };
109
+ }
110
+ function renderBlockedAsChildButton({
111
+ children,
112
+ className,
113
+ loading,
114
+ props,
115
+ ref,
116
+ size,
117
+ tone
118
+ }) {
119
+ const child = Children.only(children);
120
+ if (!isValidElement(child)) {
121
+ throw new Error("Button with asChild requires a single React element child.");
122
+ }
123
+ return cloneElement(child, {
124
+ ...props,
125
+ "aria-busy": loading || void 0,
126
+ "aria-disabled": true,
127
+ className: buttonVariants({
128
+ className: cn("pointer-events-none", className, child.props.className),
129
+ size,
130
+ tone
131
+ }),
132
+ href: void 0,
133
+ onClick: suppressSlottedActivation,
134
+ onKeyDown: (event) => {
135
+ if (shouldSuppressSlottedKeyboardActivation(event)) {
136
+ suppressSlottedActivation(event);
137
+ }
138
+ },
139
+ ref: mergeRefs(ref, child.props.ref)
140
+ });
141
+ }
142
+ const Button = forwardRef(
143
+ function Button2({
144
+ asChild = false,
145
+ children,
146
+ className,
147
+ disabled,
148
+ loading = false,
149
+ onClick,
150
+ onKeyDown,
151
+ size = "default",
152
+ tone = "default",
153
+ type = "button",
154
+ ...props
155
+ }, ref) {
156
+ const isInteractionBlocked = disabled || loading;
157
+ const showLoadingOverlay = loading && !asChild;
158
+ if (asChild && isInteractionBlocked) {
159
+ return renderBlockedAsChildButton({
160
+ children,
161
+ className,
162
+ loading,
163
+ props,
164
+ ref,
165
+ size,
166
+ tone
167
+ });
168
+ }
169
+ const Component = asChild ? Slot : "button";
170
+ return /* @__PURE__ */ jsx(
171
+ Component,
172
+ {
173
+ "aria-busy": loading || void 0,
174
+ className: buttonVariants({
175
+ className: cn(showLoadingOverlay && "relative", className),
176
+ size,
177
+ tone
178
+ }),
179
+ disabled: asChild ? void 0 : isInteractionBlocked,
180
+ onClick,
181
+ onKeyDown,
182
+ ref,
183
+ ...!asChild ? { type } : void 0,
184
+ ...props,
185
+ children: renderButtonContent(children, showLoadingOverlay)
186
+ }
187
+ );
188
+ }
189
+ );
190
+ export {
191
+ Button as B,
192
+ buttonVariants as b
193
+ };
@@ -0,0 +1,6 @@
1
+ function cn(...classes) {
2
+ return classes.filter(Boolean).join(" ");
3
+ }
4
+ export {
5
+ cn as c
6
+ };
@@ -0,0 +1,123 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { B as Button } from "./button.js";
3
+ import { c as cn } from "./cn.js";
4
+ const FACTORY_EMULATOR_SPEEDS = [0.5, 1, 2, 4];
5
+ const STATUS_TONE_CLASS = {
6
+ danger: "bg-error-container text-on-error-container",
7
+ neutral: "bg-surface-container-high text-on-surface-variant",
8
+ success: "bg-success-container text-on-success-container",
9
+ warning: "bg-warning-container text-on-warning-container"
10
+ };
11
+ function isFactoryEmulatorSpeed(value) {
12
+ return FACTORY_EMULATOR_SPEEDS.includes(value);
13
+ }
14
+ function FactoryEmulatorControls({
15
+ className,
16
+ disabledActions = [],
17
+ isPlaying,
18
+ onPause,
19
+ onPlay,
20
+ onRestart,
21
+ onSpeedChange,
22
+ onStep,
23
+ runtimeStatus,
24
+ showPlaybackActions = true,
25
+ showRuntimeStatus = true,
26
+ showSpeedControl = true,
27
+ speed,
28
+ ...props
29
+ }) {
30
+ const disabled = new Set(disabledActions);
31
+ return /* @__PURE__ */ jsxs(
32
+ "section",
33
+ {
34
+ "aria-label": "Factory emulator playback controls",
35
+ className: cn(
36
+ "factory-emulator-playback flex w-full flex-wrap items-center gap-2 rounded-xl border border-outline bg-surface-container-low p-3",
37
+ className
38
+ ),
39
+ ...props,
40
+ children: [
41
+ showPlaybackActions ? /* @__PURE__ */ jsxs("div", { className: "factory-emulator-playback__actions flex flex-wrap items-center gap-2", children: [
42
+ /* @__PURE__ */ jsx(
43
+ Button,
44
+ {
45
+ className: "factory-emulator-playback__action",
46
+ disabled: disabled.has("play"),
47
+ onClick: onPlay,
48
+ size: "sm",
49
+ children: "Play"
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsx(
53
+ Button,
54
+ {
55
+ className: "factory-emulator-playback__action",
56
+ disabled: disabled.has("pause"),
57
+ onClick: onPause,
58
+ size: "sm",
59
+ tone: "secondary",
60
+ children: "Pause"
61
+ }
62
+ ),
63
+ /* @__PURE__ */ jsx(
64
+ Button,
65
+ {
66
+ className: "factory-emulator-playback__action",
67
+ disabled: disabled.has("step"),
68
+ onClick: onStep,
69
+ size: "sm",
70
+ tone: "outline",
71
+ children: "Step"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsx(
75
+ Button,
76
+ {
77
+ className: "factory-emulator-playback__action",
78
+ disabled: disabled.has("restart"),
79
+ onClick: onRestart,
80
+ size: "sm",
81
+ tone: "ghost",
82
+ children: "Restart"
83
+ }
84
+ )
85
+ ] }) : null,
86
+ showSpeedControl ? /* @__PURE__ */ jsxs("label", { className: "factory-emulator-playback__speed ml-auto flex min-h-9 items-center gap-2 text-body-small font-medium text-on-surface-variant", children: [
87
+ /* @__PURE__ */ jsx("span", { children: "Speed" }),
88
+ /* @__PURE__ */ jsx(
89
+ "select",
90
+ {
91
+ "aria-label": "Playback speed",
92
+ className: "factory-emulator-playback__speed-select min-h-9 rounded-lg border border-outline bg-surface-container-high px-2 text-body-small text-on-surface outline-none focus-visible:ring-2 focus-visible:ring-af-focus-ring",
93
+ onChange: (event) => {
94
+ const nextSpeed = Number(event.target.value);
95
+ if (isFactoryEmulatorSpeed(nextSpeed)) onSpeedChange(nextSpeed);
96
+ },
97
+ value: speed,
98
+ children: FACTORY_EMULATOR_SPEEDS.map((option) => /* @__PURE__ */ jsxs("option", { value: option, children: [
99
+ option,
100
+ "x"
101
+ ] }, option))
102
+ }
103
+ )
104
+ ] }) : null,
105
+ showRuntimeStatus ? /* @__PURE__ */ jsx(
106
+ "output",
107
+ {
108
+ "aria-label": "Runtime status",
109
+ className: cn(
110
+ "factory-emulator-playback__status min-h-9 rounded-full px-3 py-2 text-body-small font-medium",
111
+ STATUS_TONE_CLASS[runtimeStatus.tone ?? "neutral"]
112
+ ),
113
+ "data-playing": isPlaying ? "true" : "false",
114
+ children: runtimeStatus.label
115
+ }
116
+ ) : null
117
+ ]
118
+ }
119
+ );
120
+ }
121
+ export {
122
+ FactoryEmulatorControls as F
123
+ };