@darthcharles/greda 1.0.0 → 1.2.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.
- package/README.md +51 -0
- package/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/components/ui/popover.d.ts +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +243 -189
- package/dist/index.js.map +1 -1
- package/dist/styles.css +36 -1
- package/dist/themes/cobalto.css +53 -0
- package/dist/themes/comal.css +37 -0
- package/dist/tokens.css +83 -0
- package/dist/utils.js +13 -7
- package/dist/utils.js.map +1 -1
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -68,8 +68,59 @@ your generated utilities override component styles, including responsive variant
|
|
|
68
68
|
The import-only theme integration requires Tailwind 4; Greda's precompiled
|
|
69
69
|
component styles also work without Tailwind.
|
|
70
70
|
|
|
71
|
+
## Typography
|
|
72
|
+
|
|
73
|
+
Shared typography roles work with compiled CSS and Tailwind 4:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<h1 className="text-display text-primary">Take your time.</h1>
|
|
77
|
+
<p className="text-body text-secondary">A little room to explore.</p>
|
|
78
|
+
<p className="text-caption text-muted">Materials included</p>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `text-display`, `text-title`, `text-body`, `text-label`, `text-caption` and
|
|
82
|
+
`text-eyebrow` for complete styles: family, size, weight, line height and tracking.
|
|
83
|
+
Colors, margins, casing, italics and HTML semantics remain independent. Existing
|
|
84
|
+
size utilities such as `text-sm` still work; `font-medium` can adjust one part of
|
|
85
|
+
a role. Tailwind 4 can generate variants such as `md:text-title`.
|
|
86
|
+
|
|
87
|
+
Customize a role on the same theme boundary using `--type-ROLE-family`, `-size`,
|
|
88
|
+
`-weight`, `-leading` and `-tracking`, for example
|
|
89
|
+
`--type-display-size: clamp(2rem, 6vw, 4rem)`. Font aliases rebind at theme
|
|
90
|
+
boundaries so scoped font overrides apply. See **Design Tokens → Typography**
|
|
91
|
+
in Storybook to choose a style, customize its tokens, and browse the foundation
|
|
92
|
+
reference. Each style has a live preview and expandable token details.
|
|
93
|
+
|
|
71
94
|
## Theming
|
|
72
95
|
|
|
96
|
+
For an optional ready-made identity, import Cobalto after the package stylesheet
|
|
97
|
+
and select it on the document root:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import "@darthcharles/greda/styles.css";
|
|
101
|
+
import "@darthcharles/greda/themes/cobalto.css";
|
|
102
|
+
// <html data-theme="cobalto" data-color-scheme="light">
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Cobalto supplies blue/paper colors, Arial/Helvetica and square corners, with a
|
|
106
|
+
complementary dark palette selected by `data-color-scheme="dark"` on the same
|
|
107
|
+
element. Importing it alone leaves the neutral base unchanged. The application
|
|
108
|
+
still controls page backgrounds and fonts. Select **cobalto** in Storybook to
|
|
109
|
+
preview components, and see the [composition recipe](src/stories/Cobalto.mdx)
|
|
110
|
+
for large mixed-weight titles, an asterisk, a polaroid photo, scoped portals,
|
|
111
|
+
and Tailwind 4 import order. Both recipes use Tailwind utilities directly in JSX;
|
|
112
|
+
compile them with your application’s Tailwind 4 setup.
|
|
113
|
+
|
|
114
|
+
Comal is also available as an optional theme. Import
|
|
115
|
+
`@darthcharles/greda/themes/comal.css` after the package stylesheet and set
|
|
116
|
+
`data-theme="comal"` with `data-color-scheme="light"` or `"dark"` on the same
|
|
117
|
+
element. It uses warm neutrals, terracotta actions and rounded corners. Its font
|
|
118
|
+
stacks reference DM Sans and Fraunces; load those fonts in your application or
|
|
119
|
+
override `--font-sans` and `--font-heading`. No fonts are downloaded or bundled
|
|
120
|
+
by either theme. Both exports can be imported together and selected by attribute.
|
|
121
|
+
See the [Comal composition recipe](src/stories/Comal.mdx) for a complete fictional
|
|
122
|
+
workshop page, optional font setup, responsive layout and copyable Tailwind JSX.
|
|
123
|
+
|
|
73
124
|
Customization is optional. To change the default theme, import your own
|
|
74
125
|
`theme.css` after the package stylesheet and override the base colors or other
|
|
75
126
|
tokens you need.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -15,5 +15,6 @@ requested for the initial component set.
|
|
|
15
15
|
|
|
16
16
|
Local adaptations: relative imports; shared semantic color utilities; a scoped CSS baseline;
|
|
17
17
|
consumer token mapping; optional portal containers; button loading, 1px press feedback from the current Nova style, and a default
|
|
18
|
-
non-submit type; viewport bounds on dialogs
|
|
18
|
+
non-submit type; viewport bounds on dialogs and popovers; popover root positioning options,
|
|
19
|
+
portal container refs, and an explicit close helper; invalid-field styles; an accessible
|
|
19
20
|
toast close name; and a distinct indeterminate checkbox icon.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export type PopoverAnchorProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;
|
|
5
|
+
type Side = NonNullable<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>["side"]>;
|
|
6
|
+
type Align = NonNullable<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>["align"]>;
|
|
7
|
+
export interface PopoverProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {
|
|
8
|
+
placement?: Side | `${Side}-${Exclude<Align, "center">}`;
|
|
9
|
+
sideOffset?: number;
|
|
10
|
+
}
|
|
11
|
+
declare function Popover({ placement, sideOffset, ...props }: PopoverProps): React.JSX.Element;
|
|
12
|
+
export type PopoverTriggerProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>;
|
|
13
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export type PopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
|
|
15
|
+
container?: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>["container"] | React.RefObject<HTMLElement | null>;
|
|
16
|
+
};
|
|
17
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
18
|
+
container?: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>["container"] | React.RefObject<HTMLElement | null>;
|
|
19
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export type PopoverCloseProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Close>;
|
|
21
|
+
declare const PopoverClose: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverAnchor };
|
package/dist/index.d.ts
CHANGED