@alexgorbatchev/shadcn 0.0.181 → 0.0.183
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/{chunk-c78ze1d9.js → chunk-5dew2cny.js} +2 -2
- package/dist/{chunk-swd03ayz.js → chunk-8eckv8n0.js} +1 -1
- package/dist/components/ActionBar.d.ts +6 -2
- package/dist/components/gantt/index.js +1 -1
- package/dist/components/json-render/JsonForm.d.ts +20 -4
- package/dist/components/json-render/index.js +19 -6
- package/dist/index.js +2 -2
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/JsonRenderForm.md +20 -0
- package/llms/components/layout/ActionBar.md +20 -0
- package/llms/components/navigation/Tabs.md +18 -0
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ function Tabs2({ analytics, density, className, orientation = "horizontal", ...p
|
|
|
35
35
|
var tabsListVariants2 = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-sm p-px text-muted-foreground group-data-[orientation=horizontal]/tabs:h-control group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
36
36
|
variants: {
|
|
37
37
|
variant: {
|
|
38
|
-
default: "bg-
|
|
38
|
+
default: "bg-secondary ring-1 ring-input/70",
|
|
39
39
|
line: "gap-1 bg-transparent"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
@@ -56,7 +56,7 @@ function TabsTrigger2({ density, className, ...props }) {
|
|
|
56
56
|
return /* @__PURE__ */ jsx(TabsPrimitive.Tab, {
|
|
57
57
|
"data-density": density,
|
|
58
58
|
"data-slot": "tabs-trigger",
|
|
59
|
-
className: (state) => cn2("relative inline-flex h-full flex-1 items-center justify-center gap-control-gap rounded-sm border border-transparent px-2 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-colors group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:
|
|
59
|
+
className: (state) => cn2("relative inline-flex h-full flex-1 items-center justify-center gap-control-gap rounded-sm border border-transparent px-2 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-colors group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:border-input data-active:bg-muted data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-end-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", typeof className === "function" ? className(state) : className),
|
|
60
60
|
...props
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -887,7 +887,7 @@ function ActionBarRow2({
|
|
|
887
887
|
}) {
|
|
888
888
|
return /* @__PURE__ */ jsx9("div", {
|
|
889
889
|
"data-slot": "action-bar-row",
|
|
890
|
-
className: cn2("flex min-w-0 gap-x-4 gap-y-1 text-xs", wrap ? "flex-wrap" : "flex-nowrap", align === "end" ? "items-end" : "items-center", justify === "between" ? "justify-between" : justify === "end" ? "justify-end" : "justify-start", className),
|
|
890
|
+
className: cn2("flex min-w-0 gap-x-4 gap-y-1 text-xs", wrap ? "flex-wrap" : "flex-nowrap", align === "end" ? "items-end" : align === "start" ? "items-start" : "items-center", justify === "between" ? "justify-between" : justify === "end" ? "justify-end" : "justify-start", className),
|
|
891
891
|
...props
|
|
892
892
|
});
|
|
893
893
|
}
|
|
@@ -20,8 +20,12 @@ declare function ActionBar({ sticky, stuck, surface, progress, className, childr
|
|
|
20
20
|
interface IActionBarRowProps extends ComponentProps<"div"> {
|
|
21
21
|
/** How the row distributes its items; `between` puts the last item, usually the primary action, at the end. */
|
|
22
22
|
justify?: "start" | "between" | "end";
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* `end` aligns items to the row's bottom, so an action lines up with the last line of a multi-line status. `start`
|
|
25
|
+
* aligns them to the top, so an action shares the centre line of the first row of a status group that wraps, when
|
|
26
|
+
* that row's tallest item is the action's height.
|
|
27
|
+
*/
|
|
28
|
+
align?: "center" | "start" | "end";
|
|
25
29
|
/** Whether items wrap onto further lines; a one-row bar sets it false. */
|
|
26
30
|
wrap?: boolean;
|
|
27
31
|
}
|
|
@@ -13,6 +13,7 @@ interface IJsonFormContext {
|
|
|
13
13
|
errors: Readonly<Record<string, string>>;
|
|
14
14
|
defaults: readonly string[];
|
|
15
15
|
changed: readonly string[];
|
|
16
|
+
hiddenLabels: readonly string[];
|
|
16
17
|
}
|
|
17
18
|
export interface IJsonFormProviderProps {
|
|
18
19
|
mode?: JsonFormMode;
|
|
@@ -33,10 +34,20 @@ export interface IJsonFormProviderProps {
|
|
|
33
34
|
* controls shows a "Changed" tag in its own label row, beside Required and Default.
|
|
34
35
|
*/
|
|
35
36
|
changed?: readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* Binding paths whose label a surrounding heading already shows, such as `["/answers/goal"]` under a heading that asks
|
|
39
|
+
* the same question. Each of those controls hides its label visually and keeps it as its accessible name; its tags
|
|
40
|
+
* stay visible. Applies to controls whose label sits above them (Input, Textarea, Select, Radio, DropdownMenu,
|
|
41
|
+
* ToggleGroup) and to read-only values; a Switch, Checkbox or Slider keeps the label beside it, which names the control.
|
|
42
|
+
*/
|
|
43
|
+
hiddenLabels?: readonly string[];
|
|
36
44
|
children?: ReactNode;
|
|
37
45
|
}
|
|
38
|
-
/**
|
|
39
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Sets the mode, the field messages, the default-valued fields, the changed fields, and the fields with hidden labels of
|
|
48
|
+
* the bound controls inside it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function JsonFormProvider({ mode, errors, defaults, changed, hiddenLabels, children, }: IJsonFormProviderProps): ReactElement;
|
|
40
51
|
/** The nearest `JsonFormProvider`'s mode and messages, or `undefined` outside one. */
|
|
41
52
|
export declare function useJsonForm(): IJsonFormContext | undefined;
|
|
42
53
|
type Reveal = () => void;
|
|
@@ -72,6 +83,8 @@ export interface IJsonField {
|
|
|
72
83
|
isDefault: boolean;
|
|
73
84
|
/** The value differs from the last submitted answer (`JsonFormProvider`'s `changed`); the label shows a "Changed" tag. */
|
|
74
85
|
isChanged: boolean;
|
|
86
|
+
/** A surrounding heading already shows the label (`JsonFormProvider`'s `hiddenLabels`); it is hidden visually. */
|
|
87
|
+
isLabelHidden: boolean;
|
|
75
88
|
error?: string;
|
|
76
89
|
mode: JsonFormMode;
|
|
77
90
|
messageId: string;
|
|
@@ -98,7 +111,10 @@ export interface IJsonFieldLabelProps {
|
|
|
98
111
|
export declare function JsonFieldTags({ field }: {
|
|
99
112
|
field: IJsonField;
|
|
100
113
|
}): ReactElement | null;
|
|
101
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* The field's label followed by its "Required", "Default", and "Changed" tags. A hidden label stays in place for
|
|
116
|
+
* assistive technology; with no tags to show, the whole row is hidden visually.
|
|
117
|
+
*/
|
|
102
118
|
export declare function JsonFieldLabel({ field, id, htmlFor }: IJsonFieldLabelProps): ReactElement | null;
|
|
103
119
|
/** What an answer control the author left empty shows instead of a value it would not send. */
|
|
104
120
|
export declare const NOT_SET_TEXT = "Not answered";
|
|
@@ -114,5 +130,5 @@ export interface IJsonFieldValueProps {
|
|
|
114
130
|
hideLabel?: boolean;
|
|
115
131
|
}
|
|
116
132
|
/** The field as read-only text: its label, then its value, grouped and named by the label. */
|
|
117
|
-
export declare function JsonFieldValue({ field, text, hideLabel }: IJsonFieldValueProps): ReactElement;
|
|
133
|
+
export declare function JsonFieldValue({ field, text, hideLabel: isHideRequested, }: IJsonFieldValueProps): ReactElement;
|
|
118
134
|
export {};
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-8eckv8n0.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
TabsList2,
|
|
101
101
|
TabsTrigger2,
|
|
102
102
|
TabsContent2
|
|
103
|
-
} from "../../chunk-
|
|
103
|
+
} from "../../chunk-5dew2cny.js";
|
|
104
104
|
import"../../chunk-4e96tpw0.js";
|
|
105
105
|
import {
|
|
106
106
|
Checkbox2
|
|
@@ -282,14 +282,16 @@ var JsonFormContext = createContext(undefined);
|
|
|
282
282
|
var noErrors = {};
|
|
283
283
|
var noDefaults = [];
|
|
284
284
|
var noChanged = [];
|
|
285
|
+
var noHiddenLabels = [];
|
|
285
286
|
function JsonFormProvider({
|
|
286
287
|
mode = "edit",
|
|
287
288
|
errors = noErrors,
|
|
288
289
|
defaults = noDefaults,
|
|
289
290
|
changed = noChanged,
|
|
291
|
+
hiddenLabels = noHiddenLabels,
|
|
290
292
|
children
|
|
291
293
|
}) {
|
|
292
|
-
const value = useMemo(() => ({ mode, errors, defaults, changed }), [mode, errors, defaults, changed]);
|
|
294
|
+
const value = useMemo(() => ({ mode, errors, defaults, changed, hiddenLabels }), [mode, errors, defaults, changed, hiddenLabels]);
|
|
293
295
|
return /* @__PURE__ */ jsx5(JsonFormContext, {
|
|
294
296
|
value,
|
|
295
297
|
children
|
|
@@ -326,6 +328,7 @@ function useJsonField({ path, label, checks, ownErrors = [] }) {
|
|
|
326
328
|
isRequired,
|
|
327
329
|
isDefault: !!path && !!form?.defaults.includes(path),
|
|
328
330
|
isChanged: !!path && !!form?.changed.includes(path),
|
|
331
|
+
isLabelHidden: !!path && !!form?.hiddenLabels.includes(path),
|
|
329
332
|
error,
|
|
330
333
|
mode: form?.mode ?? "edit",
|
|
331
334
|
messageId,
|
|
@@ -360,16 +363,21 @@ function JsonFieldTags({ field }) {
|
|
|
360
363
|
]
|
|
361
364
|
});
|
|
362
365
|
}
|
|
366
|
+
function hasTags(field) {
|
|
367
|
+
return field.isRequired && field.mode !== "values" || field.isDefault || field.isChanged && field.mode !== "values";
|
|
368
|
+
}
|
|
363
369
|
function JsonFieldLabel({ field, id, htmlFor }) {
|
|
364
|
-
|
|
370
|
+
const isTagged = hasTags(field);
|
|
371
|
+
if (!field.label && !isTagged)
|
|
365
372
|
return null;
|
|
366
373
|
return /* @__PURE__ */ jsxs2("div", {
|
|
367
374
|
"data-slot": "json-field-label",
|
|
368
|
-
className: "flex min-w-0 flex-wrap items-center gap-2",
|
|
375
|
+
className: field.isLabelHidden && !isTagged ? "sr-only" : "flex min-w-0 flex-wrap items-center gap-2",
|
|
369
376
|
children: [
|
|
370
377
|
field.label && /* @__PURE__ */ jsx5(Label2, {
|
|
371
378
|
id,
|
|
372
379
|
htmlFor,
|
|
380
|
+
className: cn2(field.isLabelHidden && "sr-only"),
|
|
373
381
|
children: field.label
|
|
374
382
|
}),
|
|
375
383
|
/* @__PURE__ */ jsx5(JsonFieldTags, {
|
|
@@ -389,8 +397,13 @@ function JsonFieldMessage({ field }) {
|
|
|
389
397
|
children: field.error
|
|
390
398
|
});
|
|
391
399
|
}
|
|
392
|
-
function JsonFieldValue({
|
|
400
|
+
function JsonFieldValue({
|
|
401
|
+
field,
|
|
402
|
+
text,
|
|
403
|
+
hideLabel: isHideRequested = false
|
|
404
|
+
}) {
|
|
393
405
|
const labelId = useId();
|
|
406
|
+
const hideLabel = isHideRequested || field.isLabelHidden;
|
|
394
407
|
return /* @__PURE__ */ jsxs2("div", {
|
|
395
408
|
role: "group",
|
|
396
409
|
"aria-labelledby": !hideLabel && field.label ? labelId : undefined,
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2,
|
|
190
190
|
SelectionAction2
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-8eckv8n0.js";
|
|
192
192
|
import {
|
|
193
193
|
statusDotVariants2,
|
|
194
194
|
StatusDot2
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
useDropTarget2,
|
|
226
226
|
DropTarget2,
|
|
227
227
|
Kanban2
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-5dew2cny.js";
|
|
229
229
|
import {
|
|
230
230
|
NumberField2,
|
|
231
231
|
NumberFieldGroup2,
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.183",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -44,6 +44,26 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
### HiddenLabels
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
{
|
|
51
|
+
args: {
|
|
52
|
+
spec: answerSpec,
|
|
53
|
+
state: { answers: { ...answers, company: "" } },
|
|
54
|
+
hiddenLabels: ["/answers/company", "/answers/notes", "/answers/plan"],
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### HiddenLabelsReadOnly
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
{
|
|
63
|
+
args: { spec: answerSpec, state: { answers }, mode: "values", hiddenLabels: ["/answers/company"] }
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
47
67
|
### LockedKeepsReadingControls
|
|
48
68
|
|
|
49
69
|
```tsx
|
|
@@ -42,6 +42,26 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### ActionOnFirstRowOfWrappedStatus
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
{
|
|
49
|
+
args: {
|
|
50
|
+
children: (<ActionBarRow justify="between" align="start" wrap={false}>
|
|
51
|
+
<div data-testid="status" className="flex w-40 flex-wrap items-center gap-2">
|
|
52
|
+
<Button type="button" variant="outline">
|
|
53
|
+
7 of 11
|
|
54
|
+
</Button>
|
|
55
|
+
<Button type="button" variant="outline">
|
|
56
|
+
Next unanswered
|
|
57
|
+
</Button>
|
|
58
|
+
</div>
|
|
59
|
+
<Button type="button">I’m done</Button>
|
|
60
|
+
</ActionBarRow>),
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
45
65
|
### StuckToTheBottom
|
|
46
66
|
|
|
47
67
|
```tsx
|
|
@@ -56,6 +56,24 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
56
56
|
{}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
### SelectedFilledLight
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
{
|
|
63
|
+
args: { defaultValue: "overview" },
|
|
64
|
+
globals: { theme: "light" }
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### SelectedFilledDark
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
{
|
|
72
|
+
args: { defaultValue: "overview" },
|
|
73
|
+
globals: { theme: "dark" }
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
59
77
|
### Settings
|
|
60
78
|
|
|
61
79
|
```tsx
|