@deepgram/styles 0.2.11 → 0.2.12

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 (168) hide show
  1. package/design-system.yaml +3098 -3336
  2. package/dist/deepgram.css +1 -1
  3. package/dist/deepgram.expanded.css +665 -883
  4. package/dist/react/ActionGroup.d.ts +4 -0
  5. package/dist/react/ActionGroup.js +9 -0
  6. package/dist/react/Alert.d.ts +34 -0
  7. package/dist/react/Alert.js +71 -0
  8. package/dist/react/Btn.d.ts +11 -0
  9. package/dist/react/Btn.js +16 -0
  10. package/dist/react/BtnCollapse.d.ts +4 -0
  11. package/dist/react/BtnCollapse.js +9 -0
  12. package/dist/react/BtnDangerGhost.d.ts +4 -0
  13. package/dist/react/BtnDangerGhost.js +9 -0
  14. package/dist/react/BtnGhost.d.ts +4 -0
  15. package/dist/react/BtnGhost.js +9 -0
  16. package/dist/react/BtnIcon.d.ts +4 -0
  17. package/dist/react/BtnIcon.js +9 -0
  18. package/dist/react/BtnSecondary.d.ts +4 -0
  19. package/dist/react/BtnSecondary.js +9 -0
  20. package/dist/react/BtnSmall.d.ts +4 -0
  21. package/dist/react/BtnSmall.js +9 -0
  22. package/dist/react/Card.d.ts +26 -0
  23. package/dist/react/Card.js +51 -0
  24. package/dist/react/CardHeading.d.ts +4 -0
  25. package/dist/react/CardHeading.js +9 -0
  26. package/dist/react/CardHeadings.d.ts +7 -0
  27. package/dist/react/CardHeadings.js +16 -0
  28. package/dist/react/Checkbox.d.ts +4 -0
  29. package/dist/react/Checkbox.js +9 -0
  30. package/dist/react/CheckboxDescription.d.ts +4 -0
  31. package/dist/react/CheckboxDescription.js +9 -0
  32. package/dist/react/CheckboxGroup.d.ts +4 -0
  33. package/dist/react/CheckboxGroup.js +9 -0
  34. package/dist/react/CheckboxLabel.d.ts +4 -0
  35. package/dist/react/CheckboxLabel.js +9 -0
  36. package/dist/react/CodeBlock.d.ts +7 -0
  37. package/dist/react/CodeBlock.js +12 -0
  38. package/dist/react/Columns.d.ts +25 -0
  39. package/dist/react/Columns.js +44 -0
  40. package/dist/react/ConstrainWidth.d.ts +4 -0
  41. package/dist/react/ConstrainWidth.js +9 -0
  42. package/dist/react/DragDropZone.d.ts +17 -0
  43. package/dist/react/DragDropZone.js +38 -0
  44. package/dist/react/Footer.d.ts +10 -0
  45. package/dist/react/Footer.js +23 -0
  46. package/dist/react/FormError.d.ts +4 -0
  47. package/dist/react/FormError.js +9 -0
  48. package/dist/react/FormField.d.ts +4 -0
  49. package/dist/react/FormField.js +9 -0
  50. package/dist/react/FormHelper.d.ts +4 -0
  51. package/dist/react/FormHelper.js +9 -0
  52. package/dist/react/FormLabel.d.ts +4 -0
  53. package/dist/react/FormLabel.js +9 -0
  54. package/dist/react/GridMobileStack.d.ts +4 -0
  55. package/dist/react/GridMobileStack.js +9 -0
  56. package/dist/react/Header.d.ts +25 -0
  57. package/dist/react/Header.js +58 -0
  58. package/dist/react/Hero.d.ts +25 -0
  59. package/dist/react/Hero.js +58 -0
  60. package/dist/react/Icon.d.ts +5 -0
  61. package/dist/react/Icon.js +10 -0
  62. package/dist/react/Input.d.ts +6 -0
  63. package/dist/react/Input.js +11 -0
  64. package/dist/react/ItemTitle.d.ts +4 -0
  65. package/dist/react/ItemTitle.js +9 -0
  66. package/dist/react/Link.d.ts +4 -0
  67. package/dist/react/Link.js +9 -0
  68. package/dist/react/Modal.d.ts +8 -0
  69. package/dist/react/Modal.js +17 -0
  70. package/dist/react/Newsletter.d.ts +8 -0
  71. package/dist/react/Newsletter.js +17 -0
  72. package/dist/react/Option.d.ts +4 -0
  73. package/dist/react/Option.js +9 -0
  74. package/dist/react/PageHeading.d.ts +10 -0
  75. package/dist/react/PageHeading.js +23 -0
  76. package/dist/react/PageHeadings.d.ts +13 -0
  77. package/dist/react/PageHeadings.js +30 -0
  78. package/dist/react/Prose.d.ts +6 -0
  79. package/dist/react/Prose.js +11 -0
  80. package/dist/react/Radio.d.ts +4 -0
  81. package/dist/react/Radio.js +9 -0
  82. package/dist/react/RadioDescription.d.ts +7 -0
  83. package/dist/react/RadioDescription.js +16 -0
  84. package/dist/react/RadioGroup.d.ts +4 -0
  85. package/dist/react/RadioGroup.js +9 -0
  86. package/dist/react/RadioLabel.d.ts +4 -0
  87. package/dist/react/RadioLabel.js +9 -0
  88. package/dist/react/Section.d.ts +9 -0
  89. package/dist/react/Section.js +14 -0
  90. package/dist/react/SectionHeading.d.ts +4 -0
  91. package/dist/react/SectionHeading.js +9 -0
  92. package/dist/react/Select.d.ts +4 -0
  93. package/dist/react/Select.js +9 -0
  94. package/dist/react/Spinner.d.ts +7 -0
  95. package/dist/react/Spinner.js +16 -0
  96. package/dist/react/Status.d.ts +12 -0
  97. package/dist/react/Status.js +17 -0
  98. package/dist/react/TextUtilities.d.ts +4 -0
  99. package/dist/react/TextUtilities.js +9 -0
  100. package/dist/react/Textarea.d.ts +4 -0
  101. package/dist/react/Textarea.js +9 -0
  102. package/dist/react/Toggle.d.ts +4 -0
  103. package/dist/react/Toggle.js +9 -0
  104. package/dist/react/ToggleGroup.d.ts +4 -0
  105. package/dist/react/ToggleGroup.js +9 -0
  106. package/dist/react/ToggleLabel.d.ts +4 -0
  107. package/dist/react/ToggleLabel.js +9 -0
  108. package/dist/react/index.d.ts +43 -0
  109. package/dist/react/index.js +43 -0
  110. package/dist/utils.d.ts +16 -0
  111. package/dist/utils.js +50 -0
  112. package/lib/deepgram.css +531 -486
  113. package/lib/tailwind-theme.css +0 -1
  114. package/package.json +17 -2
  115. package/src/react/ActionGroup.tsx +14 -0
  116. package/src/react/Alert.tsx +130 -0
  117. package/src/react/Btn.tsx +28 -0
  118. package/src/react/BtnCollapse.tsx +14 -0
  119. package/src/react/BtnDangerGhost.tsx +14 -0
  120. package/src/react/BtnGhost.tsx +14 -0
  121. package/src/react/BtnIcon.tsx +14 -0
  122. package/src/react/BtnSecondary.tsx +14 -0
  123. package/src/react/BtnSmall.tsx +14 -0
  124. package/src/react/Card.tsx +93 -0
  125. package/src/react/CardHeading.tsx +14 -0
  126. package/src/react/CardHeadings.tsx +27 -0
  127. package/src/react/Checkbox.tsx +14 -0
  128. package/src/react/CheckboxDescription.tsx +14 -0
  129. package/src/react/CheckboxGroup.tsx +14 -0
  130. package/src/react/CheckboxLabel.tsx +14 -0
  131. package/src/react/CodeBlock.tsx +20 -0
  132. package/src/react/Columns.tsx +82 -0
  133. package/src/react/ConstrainWidth.tsx +14 -0
  134. package/src/react/DragDropZone.tsx +68 -0
  135. package/src/react/Footer.tsx +40 -0
  136. package/src/react/FormError.tsx +14 -0
  137. package/src/react/FormField.tsx +14 -0
  138. package/src/react/FormHelper.tsx +14 -0
  139. package/src/react/FormLabel.tsx +14 -0
  140. package/src/react/GridMobileStack.tsx +14 -0
  141. package/src/react/Header.tsx +105 -0
  142. package/src/react/Hero.tsx +105 -0
  143. package/src/react/Icon.tsx +16 -0
  144. package/src/react/Input.tsx +18 -0
  145. package/src/react/ItemTitle.tsx +14 -0
  146. package/src/react/Link.tsx +14 -0
  147. package/src/react/Modal.tsx +29 -0
  148. package/src/react/Newsletter.tsx +29 -0
  149. package/src/react/Option.tsx +14 -0
  150. package/src/react/PageHeading.tsx +40 -0
  151. package/src/react/PageHeadings.tsx +53 -0
  152. package/src/react/Prose.tsx +18 -0
  153. package/src/react/Radio.tsx +14 -0
  154. package/src/react/RadioDescription.tsx +27 -0
  155. package/src/react/RadioGroup.tsx +14 -0
  156. package/src/react/RadioLabel.tsx +14 -0
  157. package/src/react/Section.tsx +24 -0
  158. package/src/react/SectionHeading.tsx +14 -0
  159. package/src/react/Select.tsx +14 -0
  160. package/src/react/Spinner.tsx +27 -0
  161. package/src/react/Status.tsx +30 -0
  162. package/src/react/TextUtilities.tsx +14 -0
  163. package/src/react/Textarea.tsx +14 -0
  164. package/src/react/Toggle.tsx +14 -0
  165. package/src/react/ToggleGroup.tsx +14 -0
  166. package/src/react/ToggleLabel.tsx +14 -0
  167. package/src/react/index.ts +43 -0
  168. package/src/utils.ts +60 -0
@@ -0,0 +1,27 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface RadioDescriptionProps extends ComponentPropsWithRef<'div'> {
4
+ }
5
+
6
+ export const RadioDescription = forwardRef<HTMLDivElement, RadioDescriptionProps>(
7
+ function RadioDescription({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-radio-description',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
13
+ }
14
+ );
15
+
16
+ export interface RadioDescriptionHintProps extends ComponentPropsWithRef<'span'> {
17
+ }
18
+
19
+ export const RadioDescriptionHint = forwardRef<HTMLSpanElement, RadioDescriptionHintProps>(
20
+ function RadioDescriptionHint({ className, children, ...props }, ref) {
21
+ const cls = [
22
+ 'dg-radio-description__hint',
23
+ className,
24
+ ].filter(Boolean).join(' ');
25
+ return <span ref={ref} className={cls} {...props}>{children}</span>;
26
+ }
27
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface RadioGroupProps extends ComponentPropsWithRef<'div'> {
4
+ }
5
+
6
+ export const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(
7
+ function RadioGroup({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-radio-group',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface RadioLabelProps extends ComponentPropsWithRef<'label'> {
4
+ }
5
+
6
+ export const RadioLabel = forwardRef<HTMLLabelElement, RadioLabelProps>(
7
+ function RadioLabel({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-radio-label',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <label ref={ref} className={cls} {...props}>{children}</label>;
13
+ }
14
+ );
@@ -0,0 +1,24 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface SectionProps extends ComponentPropsWithRef<'div'> {
4
+ compact?: boolean;
5
+ spacious?: boolean;
6
+ bordered?: boolean;
7
+ elevated?: boolean;
8
+ fieldset?: boolean;
9
+ }
10
+
11
+ export const Section = forwardRef<HTMLDivElement, SectionProps>(
12
+ function Section({ compact, spacious, bordered, elevated, fieldset, className, children, ...props }, ref) {
13
+ const cls = [
14
+ 'dg-section',
15
+ compact && 'dg-section--compact',
16
+ spacious && 'dg-section--spacious',
17
+ bordered && 'dg-section--bordered',
18
+ elevated && 'dg-section--elevated',
19
+ fieldset && 'dg-section--fieldset',
20
+ className,
21
+ ].filter(Boolean).join(' ');
22
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
23
+ }
24
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface SectionHeadingProps extends ComponentPropsWithRef<'h2'> {
4
+ }
5
+
6
+ export const SectionHeading = forwardRef<HTMLHeadingElement, SectionHeadingProps>(
7
+ function SectionHeading({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-section-heading',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <h2 ref={ref} className={cls} {...props}>{children}</h2>;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface SelectProps extends ComponentPropsWithRef<'select'> {
4
+ }
5
+
6
+ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
7
+ function Select({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-select',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <select ref={ref} className={cls} {...props}>{children}</select>;
13
+ }
14
+ );
@@ -0,0 +1,27 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface SpinnerProps extends ComponentPropsWithRef<'div'> {
4
+ }
5
+
6
+ export const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(
7
+ function Spinner({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-spinner',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
13
+ }
14
+ );
15
+
16
+ export interface SpinnerTitleProps extends ComponentPropsWithRef<'p'> {
17
+ }
18
+
19
+ export const SpinnerTitle = forwardRef<HTMLParagraphElement, SpinnerTitleProps>(
20
+ function SpinnerTitle({ className, children, ...props }, ref) {
21
+ const cls = [
22
+ 'dg-spinner__title',
23
+ className,
24
+ ].filter(Boolean).join(' ');
25
+ return <p ref={ref} className={cls} {...props}>{children}</p>;
26
+ }
27
+ );
@@ -0,0 +1,30 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface StatusProps extends ComponentPropsWithRef<'div'> {
4
+ info?: boolean;
5
+ success?: boolean;
6
+ warning?: boolean;
7
+ error?: boolean;
8
+ primary?: boolean;
9
+ secondary?: boolean;
10
+ withIcon?: boolean;
11
+ compact?: boolean;
12
+ }
13
+
14
+ export const Status = forwardRef<HTMLDivElement, StatusProps>(
15
+ function Status({ info, success, warning, error, primary, secondary, withIcon, compact, className, children, ...props }, ref) {
16
+ const cls = [
17
+ 'dg-status',
18
+ info && 'dg-status--info',
19
+ success && 'dg-status--success',
20
+ warning && 'dg-status--warning',
21
+ error && 'dg-status--error',
22
+ primary && 'dg-status--primary',
23
+ secondary && 'dg-status--secondary',
24
+ withIcon && 'dg-status--with-icon',
25
+ compact && 'dg-status--compact',
26
+ className,
27
+ ].filter(Boolean).join(' ');
28
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
29
+ }
30
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface TextUtilitiesProps extends ComponentPropsWithRef<'div'> {
4
+ }
5
+
6
+ export const TextUtilities = forwardRef<HTMLDivElement, TextUtilitiesProps>(
7
+ function TextUtilities({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-text-utilities',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface TextareaProps extends ComponentPropsWithRef<'textarea'> {
4
+ }
5
+
6
+ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
7
+ function Textarea({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-textarea',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <textarea ref={ref} className={cls} {...props}>{children}</textarea>;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface ToggleProps extends ComponentPropsWithRef<'input'> {
4
+ }
5
+
6
+ export const Toggle = forwardRef<HTMLInputElement, ToggleProps>(
7
+ function Toggle({ className, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-toggle',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <input ref={ref} type="checkbox" className={cls} {...props} />;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface ToggleGroupProps extends ComponentPropsWithRef<'div'> {
4
+ }
5
+
6
+ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
7
+ function ToggleGroup({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-toggle-group',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <div ref={ref} className={cls} {...props}>{children}</div>;
13
+ }
14
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef, type ComponentPropsWithRef } from 'react';
2
+
3
+ export interface ToggleLabelProps extends ComponentPropsWithRef<'label'> {
4
+ }
5
+
6
+ export const ToggleLabel = forwardRef<HTMLLabelElement, ToggleLabelProps>(
7
+ function ToggleLabel({ className, children, ...props }, ref) {
8
+ const cls = [
9
+ 'dg-toggle-label',
10
+ className,
11
+ ].filter(Boolean).join(' ');
12
+ return <label ref={ref} className={cls} {...props}>{children}</label>;
13
+ }
14
+ );
@@ -0,0 +1,43 @@
1
+ export { Btn, type BtnProps } from './Btn.js';
2
+ export { ActionGroup, type ActionGroupProps } from './ActionGroup.js';
3
+ export { Section, type SectionProps } from './Section.js';
4
+ export { Card, type CardProps, CardImage, type CardImageProps, CardIcon, type CardIconProps, CardHeader, type CardHeaderProps, CardBody, type CardBodyProps, CardFooter, type CardFooterProps } from './Card.js';
5
+ export { CodeBlock, type CodeBlockProps } from './CodeBlock.js';
6
+ export { Hero, type HeroProps, HeroTitle, type HeroTitleProps, HeroContent, type HeroContentProps, HeroAnnouncement, type HeroAnnouncementProps, HeroAnnouncementText, type HeroAnnouncementTextProps, HeroAnnouncementCta, type HeroAnnouncementCtaProps, HeroBody, type HeroBodyProps, HeroActions, type HeroActionsProps } from './Hero.js';
7
+ export { SectionHeading, type SectionHeadingProps } from './SectionHeading.js';
8
+ export { PageHeading, type PageHeadingProps, PageHeadingTitle, type PageHeadingTitleProps, PageHeadingDescription, type PageHeadingDescriptionProps } from './PageHeading.js';
9
+ export { PageHeadings, type PageHeadingsProps, PageHeadingsTitleWrapper, type PageHeadingsTitleWrapperProps, PageHeadingsTitle, type PageHeadingsTitleProps, PageHeadingsActions, type PageHeadingsActionsProps } from './PageHeadings.js';
10
+ export { CardHeading, type CardHeadingProps } from './CardHeading.js';
11
+ export { CardHeadings, type CardHeadingsProps, CardHeadingsTitle, type CardHeadingsTitleProps } from './CardHeadings.js';
12
+ export { ItemTitle, type ItemTitleProps } from './ItemTitle.js';
13
+ export { Prose, type ProseProps } from './Prose.js';
14
+ export { Icon, type IconProps } from './Icon.js';
15
+ export { Input, type InputProps } from './Input.js';
16
+ export { Textarea, type TextareaProps } from './Textarea.js';
17
+ export { Checkbox, type CheckboxProps } from './Checkbox.js';
18
+ export { Select, type SelectProps } from './Select.js';
19
+ export { Option, type OptionProps } from './Option.js';
20
+ export { Radio, type RadioProps } from './Radio.js';
21
+ export { Toggle, type ToggleProps } from './Toggle.js';
22
+ export { CheckboxLabel, type CheckboxLabelProps } from './CheckboxLabel.js';
23
+ export { CheckboxDescription, type CheckboxDescriptionProps } from './CheckboxDescription.js';
24
+ export { CheckboxGroup, type CheckboxGroupProps } from './CheckboxGroup.js';
25
+ export { RadioLabel, type RadioLabelProps } from './RadioLabel.js';
26
+ export { RadioDescription, type RadioDescriptionProps, RadioDescriptionHint, type RadioDescriptionHintProps } from './RadioDescription.js';
27
+ export { RadioGroup, type RadioGroupProps } from './RadioGroup.js';
28
+ export { ToggleLabel, type ToggleLabelProps } from './ToggleLabel.js';
29
+ export { ToggleGroup, type ToggleGroupProps } from './ToggleGroup.js';
30
+ export { FormLabel, type FormLabelProps } from './FormLabel.js';
31
+ export { FormHelper, type FormHelperProps } from './FormHelper.js';
32
+ export { FormError, type FormErrorProps } from './FormError.js';
33
+ export { FormField, type FormFieldProps } from './FormField.js';
34
+ export { DragDropZone, type DragDropZoneProps, DragDropZoneInput, type DragDropZoneInputProps, DragDropZoneIcon, type DragDropZoneIconProps, DragDropZoneText, type DragDropZoneTextProps, DragDropZoneHint, type DragDropZoneHintProps } from './DragDropZone.js';
35
+ export { Status, type StatusProps } from './Status.js';
36
+ export { Spinner, type SpinnerProps, SpinnerTitle, type SpinnerTitleProps } from './Spinner.js';
37
+ export { ConstrainWidth, type ConstrainWidthProps } from './ConstrainWidth.js';
38
+ export { GridMobileStack, type GridMobileStackProps } from './GridMobileStack.js';
39
+ export { Columns, type ColumnsProps, ColumnsWrapper, type ColumnsWrapperProps, ColumnsMobileHeader, type ColumnsMobileHeaderProps, ColumnsSidebarToggle, type ColumnsSidebarToggleProps, ColumnsColumn, type ColumnsColumnProps } from './Columns.js';
40
+ export { Footer, type FooterProps, FooterSocialLinks, type FooterSocialLinksProps, FooterSocialLink, type FooterSocialLinkProps } from './Footer.js';
41
+ export { TextUtilities, type TextUtilitiesProps } from './TextUtilities.js';
42
+ export { Newsletter, type NewsletterProps, NewsletterForm, type NewsletterFormProps } from './Newsletter.js';
43
+ export { Alert, type AlertProps, AlertContent, type AlertContentProps, AlertIcon, type AlertIconProps, AlertBody, type AlertBodyProps, AlertTitle, type AlertTitleProps, AlertDescription, type AlertDescriptionProps, AlertActions, type AlertActionsProps, AlertList, type AlertListProps, AlertDismiss, type AlertDismissProps } from './Alert.js';
package/src/utils.ts ADDED
@@ -0,0 +1,60 @@
1
+ const STORAGE_KEY = 'dg-theme';
2
+ const EVENT_NAME = 'dg-theme-change';
3
+
4
+ type Theme = 'light' | 'dark' | 'system';
5
+
6
+ function applyAndPersist(theme: Theme): void {
7
+ if (theme === 'system') {
8
+ document.documentElement.style.removeProperty('color-scheme');
9
+ } else {
10
+ document.documentElement.style.colorScheme = theme;
11
+ }
12
+ localStorage.setItem(STORAGE_KEY, theme);
13
+ document.dispatchEvent(
14
+ new CustomEvent(EVENT_NAME, { detail: { theme } })
15
+ );
16
+ }
17
+
18
+ export function setLight(): void {
19
+ applyAndPersist('light');
20
+ }
21
+
22
+ export function setDark(): void {
23
+ applyAndPersist('dark');
24
+ }
25
+
26
+ export function setSystem(): void {
27
+ applyAndPersist('system');
28
+ }
29
+
30
+ /** Read the current theme from the `<html>` inline style. */
31
+ export function getTheme(): Theme {
32
+ const value = document.documentElement.style.colorScheme;
33
+ if (value === 'light') return 'light';
34
+ if (value === 'dark') return 'dark';
35
+ return 'system';
36
+ }
37
+
38
+ /**
39
+ * Restore the saved theme from localStorage.
40
+ * Call this in an inline `<script>` in `<head>` to prevent FOUC.
41
+ */
42
+ export function restoreTheme(): void {
43
+ const saved = localStorage.getItem(STORAGE_KEY);
44
+ if (saved === 'light' || saved === 'dark') {
45
+ document.documentElement.style.colorScheme = saved;
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Subscribe to theme changes. Returns an unsubscribe function.
51
+ */
52
+ export function onThemeChange(
53
+ callback: (theme: Theme) => void
54
+ ): () => void {
55
+ const handler = (e: Event) => {
56
+ callback((e as CustomEvent<{ theme: Theme }>).detail.theme);
57
+ };
58
+ document.addEventListener(EVENT_NAME, handler);
59
+ return () => document.removeEventListener(EVENT_NAME, handler);
60
+ }