@alexgorbatchev/shadcn 0.0.125 → 0.0.127

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.
@@ -1,6 +1,8 @@
1
1
  import type { IAnalyticsProps } from "../analytics/types.js";
2
2
  import type { IDensityProps } from "../density/types.js";
3
3
  import { type ReactElement, type ReactNode } from "react";
4
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
5
+ import { CheckboxGroup as CheckboxGroupPrimitive } from "@base-ui/react/checkbox-group";
4
6
  import { Radio as RadioPrimitive } from "@base-ui/react/radio";
5
7
  import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
6
8
  type OptionCardGroupProps = IAnalyticsProps & RadioGroupPrimitive.Props & IDensityProps;
@@ -9,19 +11,41 @@ type OptionCardGroupProps = IAnalyticsProps & RadioGroupPrimitive.Props & IDensi
9
11
  * selects the focused card, and `name`, `required` and `form` take part in native form submission and validation.
10
12
  */
11
13
  declare function OptionCardGroup({ analytics, density, className, ...props }: OptionCardGroupProps): ReactElement;
12
- type OptionCardProps = Omit<RadioPrimitive.Root.Props, "children"> & IDensityProps & {
14
+ type OptionCheckboxGroupProps = IAnalyticsProps & CheckboxGroupPrimitive.Props & IDensityProps;
15
+ /**
16
+ * A multiple-choice group of option cards, laid out like `OptionCardGroup`. Each card is a checkbox: Tab moves between
17
+ * cards and Space toggles the focused one. `value` lists the checked cards' values.
18
+ */
19
+ declare function OptionCheckboxGroup({ analytics, density, className, ...props }: OptionCheckboxGroupProps): ReactElement;
20
+ interface IOptionCardContentProps {
13
21
  /** The option's name, shown in bold and used as its accessible name. */
14
22
  label: ReactNode;
15
23
  /** A short explanation shown below the label, such as the option's trade-off. */
16
24
  description?: ReactNode;
25
+ /**
26
+ * Folds the description after this many lines, with a More button that shows the rest. The button sits inside the
27
+ * card's border but outside the card's control, so pressing it never changes the choice.
28
+ */
29
+ descriptionLines?: number;
17
30
  /** Marks the option the author recommends with a tag after its label and a tinted border. */
18
31
  recommended?: boolean;
19
32
  /** Text of the recommended tag. */
20
33
  recommendedLabel?: ReactNode;
34
+ /** Why the author recommends this option, shown after its description under a "Why" label. */
35
+ reason?: ReactNode;
36
+ /** A picture of the option shown above its label, such as a screenshot of a design choice. */
37
+ image?: ReactNode;
21
38
  /** Short identifier in the leading column; defaults to the card's letter in its group: a, b, c. */
22
39
  marker?: ReactNode;
23
- };
40
+ }
41
+ type OptionCardProps = Omit<RadioPrimitive.Root.Props, "children"> & IDensityProps & IOptionCardContentProps;
24
42
  /** One option of an `OptionCardGroup`: a bordered card with a leading letter, a bold label and a muted description. */
25
- declare function OptionCard({ label, description, recommended, recommendedLabel, marker, density, className, ...props }: OptionCardProps): ReactElement;
26
- export { OptionCardGroup, OptionCard };
27
- export type { OptionCardGroupProps, OptionCardProps };
43
+ declare function OptionCard({ label, description, descriptionLines, recommended, recommendedLabel, reason, image, marker, density, className, ...props }: OptionCardProps): ReactElement;
44
+ type OptionCheckboxCardProps = Omit<CheckboxPrimitive.Root.Props, "children"> & IDensityProps & IOptionCardContentProps;
45
+ /**
46
+ * One option of an `OptionCheckboxGroup`: the same card as `OptionCard`, with a checkbox in the leading column so the
47
+ * group reads as "choose any".
48
+ */
49
+ declare function OptionCheckboxCard({ label, description, descriptionLines, recommended, recommendedLabel, reason, image, density, className, ...props }: OptionCheckboxCardProps): ReactElement;
50
+ export { OptionCardGroup, OptionCard, OptionCheckboxGroup, OptionCheckboxCard };
51
+ export type { OptionCardGroupProps, OptionCardProps, OptionCheckboxGroupProps, OptionCheckboxCardProps };
@@ -0,0 +1,13 @@
1
+ import { type ComponentProps, type ReactElement } from "react";
2
+ import type { IDensityProps } from "../density/types.js";
3
+ type ReadMoreProps = ComponentProps<"div"> & IDensityProps & {
4
+ /** The height the content folds to, as a CSS length such as `12rem`. Shorter content shows in full. */
5
+ maxHeight: string;
6
+ };
7
+ /**
8
+ * Long content folded to `maxHeight`, with a More button that shows the rest and Less that folds it again. Content
9
+ * that fits shows in full with no button. The fold fades out its last line so the cut reads as intended.
10
+ */
11
+ declare function ReadMore({ maxHeight, density, className, style, children, ...props }: ReadMoreProps): ReactElement;
12
+ export { ReadMore };
13
+ export type { ReadMoreProps };
@@ -26,7 +26,7 @@ import {
26
26
  PaginationPrevious2,
27
27
  PaginationNext2,
28
28
  PaginationEllipsis2
29
- } from "../../chunk-kx91d0g6.js";
29
+ } from "../../chunk-wk3xn989.js";
30
30
  import {
31
31
  MenuPopup,
32
32
  MenuItem2,
package/dist/index.d.ts CHANGED
@@ -19,8 +19,8 @@ export { Textarea } from "./components/Textarea.js";
19
19
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./components/Tooltip.js";
20
20
  export { Label } from "./components/Label.js";
21
21
  export { RadioGroup, RadioGroupItem } from "./components/RadioGroup.js";
22
- export { OptionCardGroup, OptionCard } from "./components/OptionCardGroup.js";
23
- export type { OptionCardGroupProps, OptionCardProps } from "./components/OptionCardGroup.js";
22
+ export { OptionCardGroup, OptionCard, OptionCheckboxGroup, OptionCheckboxCard } from "./components/OptionCardGroup.js";
23
+ export type { OptionCardGroupProps, OptionCardProps, OptionCheckboxGroupProps, OptionCheckboxCardProps, } from "./components/OptionCardGroup.js";
24
24
  export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, } from "./components/Card.js";
25
25
  export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, } from "./components/Combobox.js";
26
26
  export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants } from "./components/Tabs.js";
@@ -128,6 +128,8 @@ export type { TextProps, TextSize, TextTone, TextWeight } from "./components/Tex
128
128
  export type { TextAlign } from "./typography/types.js";
129
129
  export { Heading } from "./components/Heading.js";
130
130
  export { Quote, quoteVariants } from "./components/Quote.js";
131
+ export { ReadMore } from "./components/ReadMore.js";
132
+ export type { ReadMoreProps } from "./components/ReadMore.js";
131
133
  export type { QuoteProps } from "./components/Quote.js";
132
134
  export { SkipLink } from "./components/SkipLink.js";
133
135
  export type { SkipLinkProps } from "./components/SkipLink.js";
package/dist/index.js CHANGED
@@ -14,7 +14,9 @@ import {
14
14
  AccordionTrigger2,
15
15
  AccordionContent2,
16
16
  OptionCardGroup2,
17
+ OptionCheckboxGroup2,
17
18
  OptionCard2,
19
+ OptionCheckboxCard2,
18
20
  EmptyState3,
19
21
  PageMessage2,
20
22
  ActionBar2,
@@ -166,6 +168,7 @@ import {
166
168
  Heading2,
167
169
  quoteVariants2,
168
170
  Quote2,
171
+ ReadMore2,
169
172
  SkipLink2,
170
173
  WeatherSummary2,
171
174
  WeatherForecast2,
@@ -184,7 +187,7 @@ import {
184
187
  StatusTracker2,
185
188
  DashboardLayout2,
186
189
  BillingUsage2
187
- } from "./chunk-kx91d0g6.js";
190
+ } from "./chunk-wk3xn989.js";
188
191
  import {
189
192
  Combobox2,
190
193
  ComboboxValue2,
@@ -775,6 +778,8 @@ export {
775
778
  NumberFieldScrubAreaCursor2 as NumberFieldScrubAreaCursor,
776
779
  OptionCard2 as OptionCard,
777
780
  OptionCardGroup2 as OptionCardGroup,
781
+ OptionCheckboxCard2 as OptionCheckboxCard,
782
+ OptionCheckboxGroup2 as OptionCheckboxGroup,
778
783
  OptionSelect2 as OptionSelect,
779
784
  Outline2 as Outline,
780
785
  OutlineItem2 as OutlineItem,
@@ -805,6 +810,7 @@ export {
805
810
  Quote2 as Quote,
806
811
  RadioGroup2 as RadioGroup,
807
812
  RadioGroupItem2 as RadioGroupItem,
813
+ ReadMore2 as ReadMore,
808
814
  ReviewList2 as ReviewList,
809
815
  ScrollArea2 as ScrollArea,
810
816
  ScrollBar2 as ScrollBar,
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.125",
2054
+ version: "0.0.127",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
package/dist/typeset.css CHANGED
@@ -31,6 +31,15 @@
31
31
  --typeset-rule: var(--color-border, color-mix(in oklab, currentColor 20%, transparent));
32
32
  }
33
33
 
34
+ /*
35
+ * Compact prose inside a dense control, such as an option card's description: the surrounding text size at every
36
+ * width (no larger phone step) and tighter spacing between blocks, so it reads as part of the control.
37
+ */
38
+ .typeset.typeset-compact:not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
39
+ --typeset-flow: 0.5em;
40
+ font-size: var(--typeset-size);
41
+ }
42
+
34
43
  .typeset *:not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
35
44
  /* Paragraphs. */
36
45
  &:where(p) {
@@ -8,7 +8,7 @@ Source: src/components/stories/forms/OptionCardGroup.stories.tsx
8
8
  ## Public imports
9
9
 
10
10
  ```tsx
11
- import { OptionCard, OptionCardGroup, Field, FieldError, FieldLegend, FieldSet, Button } from "@alexgorbatchev/shadcn";
11
+ import { OptionCard, OptionCardGroup, OptionCheckboxCard, OptionCheckboxGroup, Field, FieldError, FieldLegend, FieldSet, Button } from "@alexgorbatchev/shadcn";
12
12
  ```
13
13
 
14
14
  ## Supporting imports
@@ -192,3 +192,69 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
192
192
  </div>)
193
193
  }
194
194
  ```
195
+
196
+ ### FoldedDescription
197
+
198
+ ```tsx
199
+ {
200
+ render: (args) => (<div className="w-96">
201
+ <OptionCardGroup aria-label="Deployment strategy" {...args}>
202
+ <OptionCard value="blue-green" label="Blue-green" description={LONG_TRADE_OFF} descriptionLines={3}/>
203
+ <OptionCard value="recreate" label="Recreate" description="Stops everything first." descriptionLines={3}/>
204
+ </OptionCardGroup>
205
+ </div>)
206
+ }
207
+ ```
208
+
209
+ ### RecommendedWithReasonAndImage
210
+
211
+ ```tsx
212
+ {
213
+ render: (args) => (<div className="w-96">
214
+ <OptionCardGroup aria-label="Hero layout" {...args}>
215
+ <OptionCard value="split" label="Split hero" image={<img src={fixture_attachmentImage} alt="Split hero layout" className="block w-full"/>} description="Text on the left, product shot on the right." recommended reason="It keeps the call to action above the fold at every width."/>
216
+ <OptionCard value="full" label="Full-bleed hero" description="One large image behind the headline."/>
217
+ </OptionCardGroup>
218
+ </div>)
219
+ }
220
+ ```
221
+
222
+ ### MultipleChoice
223
+
224
+ ```tsx
225
+ {
226
+ render: () => {
227
+ function Example(): ReactElement {
228
+ const [value, setValue] = useState<string[]>([]);
229
+ return (<div className="w-96">
230
+ <OptionCheckboxGroup aria-label="Projects" value={value} onValueChange={setValue}>
231
+ <OptionCheckboxCard value="web" label="Web" description="The customer site."/>
232
+ <OptionCheckboxCard value="api" label="API" description="Public endpoints." recommended/>
233
+ <OptionCheckboxCard value="docs" label="Docs"/>
234
+ </OptionCheckboxGroup>
235
+ <output aria-label="Chosen projects">{value.join(",")}</output>
236
+ </div>);
237
+ }
238
+ return <Example />;
239
+ }
240
+ }
241
+ ```
242
+
243
+ ### CompactProseDescription
244
+
245
+ ```tsx
246
+ {
247
+ render: (args) => (<div className="w-96">
248
+ <OptionCardGroup aria-label="Rollout" {...args}>
249
+ <OptionCard value="blue-green" label="Blue-green" description={<span className="typeset typeset-compact block" data-testid="compact">
250
+ <p>Starts a full copy and switches traffic at once.</p>
251
+ <p>Rollback is instant.</p>
252
+ </span>}/>
253
+ <OptionCard value="recreate" label="Recreate" description={<span className="typeset block" data-testid="regular">
254
+ <p>Stops everything, then starts the new release.</p>
255
+ <p>Simple, with downtime.</p>
256
+ </span>}/>
257
+ </OptionCardGroup>
258
+ </div>)
259
+ }
260
+ ```
@@ -0,0 +1,60 @@
1
+ # ReadMore
2
+
3
+ ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
4
+
5
+ Story: @alexgorbatchev/shadcn/components/layout/ReadMore
6
+ Source: src/components/stories/layout/ReadMore.stories.tsx
7
+
8
+ [Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/layout/ReadMore.stories.tsx)
9
+
10
+ ## Public imports
11
+
12
+ ```tsx
13
+ import { ReadMore } from "@alexgorbatchev/shadcn";
14
+ ```
15
+
16
+ ## Default component
17
+
18
+ ```tsx
19
+ ReadMore
20
+ ```
21
+
22
+ ## Default args
23
+
24
+ ```tsx
25
+ { maxHeight: "6rem", "aria-label": "Context" }
26
+ ```
27
+
28
+ ## Default render
29
+
30
+ ```tsx
31
+ (args) => (<div className="w-80 text-sm">
32
+ <ReadMore {...args}>
33
+ {PARAGRAPHS.map((text) => (<p key={text} className="mb-2">
34
+ {text}
35
+ </p>))}
36
+ </ReadMore>
37
+ </div>)
38
+ ```
39
+
40
+ ## Examples
41
+
42
+ Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
43
+
44
+ ### Folded
45
+
46
+ ```tsx
47
+ {}
48
+ ```
49
+
50
+ ### ShortContent
51
+
52
+ ```tsx
53
+ {
54
+ render: (args) => (<div className="w-80 text-sm">
55
+ <ReadMore {...args}>
56
+ <p>Short enough to show in full.</p>
57
+ </ReadMore>
58
+ </div>)
59
+ }
60
+ ```
package/llms.txt CHANGED
@@ -442,6 +442,7 @@ Generated from the public package exports and Storybook sources.
442
442
  - [PageHeader](./llms/components/layout/PageHeader.md)
443
443
  - [PageIntro](./llms/components/layout/PageIntro.md)
444
444
  - [PanelHeader](./llms/components/layout/PanelHeader.md)
445
+ - [ReadMore](./llms/components/layout/ReadMore.md): ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
445
446
  - [Resizable](./llms/components/layout/Resizable.md)
446
447
  - [ScrollArea](./llms/components/layout/ScrollArea.md)
447
448
  - [Separator](./llms/components/layout/Separator.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.125",
3
+ "version": "0.0.127",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {