@nationaldesignstudio/react 0.0.17 → 0.1.0

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 (41) hide show
  1. package/dist/component-registry.md +181 -29
  2. package/dist/components/atoms/accordion/accordion.d.ts +2 -2
  3. package/dist/components/atoms/background/background.d.ts +158 -0
  4. package/dist/components/atoms/button/button.d.ts +64 -82
  5. package/dist/components/atoms/button/icon-button.d.ts +128 -66
  6. package/dist/components/organisms/card/card.d.ts +130 -4
  7. package/dist/components/organisms/us-gov-banner/us-gov-banner.d.ts +120 -2
  8. package/dist/components/sections/hero/hero.d.ts +166 -150
  9. package/dist/components/sections/quote-block/quote-block.d.ts +152 -0
  10. package/dist/index.d.ts +6 -2
  11. package/dist/index.js +4068 -6052
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/utils.d.ts +1 -2
  14. package/dist/tokens.css +207 -16
  15. package/package.json +2 -4
  16. package/src/components/atoms/accordion/accordion.test.tsx +233 -0
  17. package/src/components/atoms/accordion/accordion.tsx +8 -8
  18. package/src/components/atoms/background/background.test.tsx +213 -0
  19. package/src/components/atoms/background/background.tsx +435 -0
  20. package/src/components/atoms/background/index.ts +22 -0
  21. package/src/components/atoms/button/button.stories.tsx +81 -32
  22. package/src/components/atoms/button/button.tsx +101 -49
  23. package/src/components/atoms/button/icon-button.stories.tsx +179 -28
  24. package/src/components/atoms/button/icon-button.test.tsx +254 -0
  25. package/src/components/atoms/button/icon-button.tsx +178 -59
  26. package/src/components/atoms/pager-control/pager-control.tsx +32 -3
  27. package/src/components/dev-tools/dev-toolbar/dev-toolbar.tsx +2 -0
  28. package/src/components/organisms/card/card.tsx +82 -24
  29. package/src/components/organisms/card/index.ts +7 -0
  30. package/src/components/organisms/navbar/navbar.tsx +2 -0
  31. package/src/components/organisms/us-gov-banner/index.ts +5 -1
  32. package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +72 -16
  33. package/src/components/sections/hero/hero.stories.tsx +124 -1
  34. package/src/components/sections/hero/hero.test.tsx +21 -18
  35. package/src/components/sections/hero/hero.tsx +188 -301
  36. package/src/components/sections/hero/index.ts +13 -0
  37. package/src/components/sections/quote-block/index.ts +5 -0
  38. package/src/components/sections/quote-block/quote-block.tsx +216 -0
  39. package/src/index.ts +40 -0
  40. package/src/lib/utils.ts +1 -6
  41. package/src/stories/ThemeProvider.stories.tsx +11 -5
@@ -0,0 +1,216 @@
1
+ import * as React from "react";
2
+ import { tv, type VariantProps } from "tailwind-variants";
3
+ import { BackgroundOverlay } from "@/components/atoms/background";
4
+
5
+ // =============================================================================
6
+ // QuoteBlock Variants
7
+ // =============================================================================
8
+
9
+ const quoteBlockVariants = tv({
10
+ slots: {
11
+ root: "relative flex min-h-[500px] w-full flex-col overflow-hidden rounded-radius-8",
12
+ content: [
13
+ "relative z-10 flex max-w-[1440px] flex-1 flex-col items-start justify-end",
14
+ "p-40",
15
+ "md:p-80",
16
+ "lg:p-112",
17
+ ],
18
+ quoteWrapper: "relative flex flex-col gap-40 md:gap-48",
19
+ quote: [
20
+ "relative text-text-inverted",
21
+ "typography-small-headline-small",
22
+ "md:typography-medium-headline-small",
23
+ "lg:typography-large-headline-small",
24
+ "font-serif md:font-serif lg:font-serif",
25
+ ],
26
+ openQuote: [
27
+ "absolute text-text-inverted",
28
+ "typography-small-headline-small",
29
+ "md:typography-medium-headline-small",
30
+ "lg:typography-large-headline-small",
31
+ "font-serif md:font-serif lg:font-serif",
32
+ "-left-[0.5em] -top-[0.1em]",
33
+ ],
34
+ attribution: "flex flex-col items-start gap-4",
35
+ signature: "h-auto w-[120px] md:w-[153px]",
36
+ byline: "flex flex-col text-text-inverted",
37
+ bylineName: "typography-body-medium text-text-inverted",
38
+ bylineTitle: "typography-body-medium text-text-inverted opacity-80",
39
+ },
40
+ variants: {
41
+ size: {
42
+ default: {
43
+ root: "",
44
+ },
45
+ compact: {
46
+ root: "min-h-[400px] lg:min-h-[600px]",
47
+ },
48
+ },
49
+ },
50
+ defaultVariants: {
51
+ size: "default",
52
+ },
53
+ });
54
+
55
+ // =============================================================================
56
+ // QuoteBlock Component
57
+ // =============================================================================
58
+
59
+ export interface QuoteBlockProps
60
+ extends Omit<React.HTMLAttributes<HTMLElement>, "children">,
61
+ VariantProps<typeof quoteBlockVariants> {
62
+ /**
63
+ * The quote text to display
64
+ */
65
+ quote: string;
66
+ /**
67
+ * Whether to show decorative quote marks
68
+ * @default true
69
+ */
70
+ showQuoteMarks?: boolean;
71
+ /**
72
+ * Signature image URL (optional)
73
+ */
74
+ signatureImage?: string;
75
+ /**
76
+ * Alt text for signature image
77
+ */
78
+ signatureAlt?: string;
79
+ /**
80
+ * Attribution name (e.g., "Donald J. Trump")
81
+ */
82
+ attributionName?: string;
83
+ /**
84
+ * Attribution title (e.g., "45 & 47 President of the United States")
85
+ */
86
+ attributionTitle?: string;
87
+ /**
88
+ * Background element - use BackgroundImage or similar
89
+ */
90
+ background?: React.ReactNode;
91
+ /**
92
+ * Overlay opacity (0-1)
93
+ */
94
+ overlayOpacity?: number;
95
+ /**
96
+ * Overlay color
97
+ */
98
+ overlayColor?: string;
99
+ /**
100
+ * Custom class for the quote text
101
+ */
102
+ quoteClassName?: string;
103
+ /**
104
+ * Custom class for the byline name
105
+ */
106
+ bylineNameClassName?: string;
107
+ /**
108
+ * Custom class for the byline title
109
+ */
110
+ bylineTitleClassName?: string;
111
+ }
112
+
113
+ const QuoteBlock = React.forwardRef<HTMLElement, QuoteBlockProps>(
114
+ (
115
+ {
116
+ className,
117
+ quote,
118
+ showQuoteMarks = true,
119
+ signatureImage,
120
+ signatureAlt = "Signature",
121
+ attributionName,
122
+ attributionTitle,
123
+ background,
124
+ overlayOpacity = 0,
125
+ overlayColor = "black",
126
+ quoteClassName,
127
+ bylineNameClassName,
128
+ bylineTitleClassName,
129
+ size,
130
+ ...props
131
+ },
132
+ ref,
133
+ ) => {
134
+ const styles = quoteBlockVariants({ size });
135
+
136
+ return (
137
+ <section
138
+ ref={ref}
139
+ className={styles.root({ class: className })}
140
+ {...props}
141
+ >
142
+ {/* Background */}
143
+ {background}
144
+
145
+ {/* Overlay */}
146
+ {overlayOpacity > 0 && (
147
+ <BackgroundOverlay
148
+ opacity={overlayOpacity}
149
+ className={overlayColor !== "black" ? undefined : "bg-black"}
150
+ style={
151
+ overlayColor !== "black"
152
+ ? { backgroundColor: overlayColor }
153
+ : undefined
154
+ }
155
+ />
156
+ )}
157
+
158
+ {/* Content */}
159
+ <div className={styles.content()}>
160
+ <div className={styles.quoteWrapper()}>
161
+ {/* Quote */}
162
+ <blockquote className={styles.quote({ class: quoteClassName })}>
163
+ {showQuoteMarks && (
164
+ <span className={styles.openQuote()} aria-hidden="true">
165
+ "
166
+ </span>
167
+ )}
168
+ <span className="relative">
169
+ {showQuoteMarks ? `${quote}"` : quote}
170
+ </span>
171
+ </blockquote>
172
+
173
+ {/* Attribution */}
174
+ {(signatureImage || attributionName || attributionTitle) && (
175
+ <div className={styles.attribution()}>
176
+ {signatureImage && (
177
+ <img
178
+ src={signatureImage}
179
+ alt={signatureAlt}
180
+ className={styles.signature()}
181
+ />
182
+ )}
183
+ {(attributionName || attributionTitle) && (
184
+ <div className={styles.byline()}>
185
+ {attributionName && (
186
+ <span
187
+ className={styles.bylineName({
188
+ class: bylineNameClassName,
189
+ })}
190
+ >
191
+ {attributionName}
192
+ </span>
193
+ )}
194
+ {attributionTitle && (
195
+ <span
196
+ className={styles.bylineTitle({
197
+ class: bylineTitleClassName,
198
+ })}
199
+ >
200
+ {attributionTitle}
201
+ </span>
202
+ )}
203
+ </div>
204
+ )}
205
+ </div>
206
+ )}
207
+ </div>
208
+ </div>
209
+ </section>
210
+ );
211
+ },
212
+ );
213
+
214
+ QuoteBlock.displayName = "QuoteBlock";
215
+
216
+ export { QuoteBlock, quoteBlockVariants };
package/src/index.ts CHANGED
@@ -6,6 +6,28 @@ export type {
6
6
  AccordionProps,
7
7
  } from "./components/atoms/accordion";
8
8
  export { Accordion, AccordionItem } from "./components/atoms/accordion";
9
+ export type {
10
+ BackgroundGradientProps,
11
+ BackgroundImageProps,
12
+ BackgroundOverlayProps,
13
+ BackgroundProps,
14
+ BackgroundStreamProps,
15
+ BackgroundVideoProps,
16
+ } from "./components/atoms/background";
17
+ export {
18
+ Background,
19
+ BackgroundGradient,
20
+ BackgroundImage,
21
+ BackgroundOverlay,
22
+ BackgroundStream,
23
+ BackgroundVideo,
24
+ backgroundGradientVariants,
25
+ backgroundImageVariants,
26
+ backgroundOverlayVariants,
27
+ backgroundStreamVariants,
28
+ backgroundVariants,
29
+ backgroundVideoVariants,
30
+ } from "./components/atoms/background";
9
31
  export type { ButtonProps, IconButtonProps } from "./components/atoms/button";
10
32
  export {
11
33
  Button,
@@ -84,12 +106,25 @@ export type {
84
106
  HeroBackgroundImageProps,
85
107
  HeroBackgroundStreamProps,
86
108
  HeroBackgroundVideoProps,
109
+ HeroContentProps,
110
+ HeroGradientProps,
111
+ HeroHeaderProps,
112
+ HeroOverlayProps,
87
113
  HeroProps,
88
114
  } from "./components/sections/hero";
89
115
  export {
90
116
  DEFAULT_TITLE_TYPOGRAPHY,
91
117
  Hero,
92
118
  HeroBackground,
119
+ HeroBackgroundImage,
120
+ HeroBackgroundStream,
121
+ HeroBackgroundVideo,
122
+ HeroContent,
123
+ HeroGradient,
124
+ HeroHeader,
125
+ HeroOverlay,
126
+ heroContentVariants,
127
+ heroHeaderVariants,
93
128
  heroVariants,
94
129
  } from "./components/sections/hero";
95
130
  export type {
@@ -97,6 +132,11 @@ export type {
97
132
  ProseSectionProps,
98
133
  } from "./components/sections/prose";
99
134
  export { Prose, ProseSection } from "./components/sections/prose";
135
+ export type { QuoteBlockProps } from "./components/sections/quote-block";
136
+ export {
137
+ QuoteBlock,
138
+ quoteBlockVariants,
139
+ } from "./components/sections/quote-block";
100
140
  export type { RiverProps } from "./components/sections/river";
101
141
  export { River, riverVariants } from "./components/sections/river";
102
142
  export type { ToutProps } from "./components/sections/tout";
package/src/lib/utils.ts CHANGED
@@ -1,6 +1 @@
1
- import { type ClassValue, clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs));
6
- }
1
+ export { cnBase as cn } from "tailwind-variants";
@@ -38,9 +38,15 @@ function ThemeDemo({ title }: { title?: string }) {
38
38
 
39
39
  {/* Button variants */}
40
40
  <div className="flex flex-wrap gap-3 mb-6">
41
- <Button variant="primary">Primary</Button>
42
- <Button variant="secondary">Secondary</Button>
43
- <Button variant="primaryOutline">Outline</Button>
41
+ <Button variant="solid" colorScheme="dark">
42
+ Solid Dark
43
+ </Button>
44
+ <Button variant="solid" colorScheme="light">
45
+ Solid Light
46
+ </Button>
47
+ <Button variant="outline" colorScheme="dark">
48
+ Outline
49
+ </Button>
44
50
  </div>
45
51
 
46
52
  {/* Card component */}
@@ -54,10 +60,10 @@ function ThemeDemo({ title }: { title?: string }) {
54
60
  </CardDescription>
55
61
  </CardBody>
56
62
  <CardActions>
57
- <Button variant="primary" size="sm">
63
+ <Button variant="solid" colorScheme="dark" size="sm">
58
64
  Action
59
65
  </Button>
60
- <Button variant="secondary" size="sm">
66
+ <Button variant="outline" colorScheme="dark" size="sm">
61
67
  Cancel
62
68
  </Button>
63
69
  </CardActions>