@jackbernnie/hiyf 0.1.3 → 0.1.5
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/AGENTS.md +17 -0
- package/dist/components/Icon.d.ts +42 -0
- package/dist/components/Icon.js +38 -0
- package/dist/components/ui/card.js +4 -4
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
package/AGENTS.md
CHANGED
|
@@ -96,6 +96,23 @@ ContextMenu. App shell & data viz: Sidebar, Resizable, Chart.
|
|
|
96
96
|
|
|
97
97
|
When unsure of a prop, check the component's TypeScript types — every prop is typed.
|
|
98
98
|
|
|
99
|
+
## Icons
|
|
100
|
+
|
|
101
|
+
Icons are standardized on **hugeicons** — they ship with this package. **Do NOT
|
|
102
|
+
add `lucide-react`, `react-icons`, or any other icon library.** Render icons with
|
|
103
|
+
the `Icon` component and import glyphs from the package's `/icons` entry:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Icon } from '@jackbernnie/hiyf'
|
|
107
|
+
import { Home01Icon, Search01Icon } from '@jackbernnie/hiyf/icons'
|
|
108
|
+
|
|
109
|
+
<Icon icon={Home01Icon} /> // size defaults to s (16px)
|
|
110
|
+
<Icon icon={Search01Icon} size="m" color="muted" />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`size`: `xs s m l xl`. `color` defaults to `current` (inherits text color, so
|
|
114
|
+
icons inside buttons just work); other values: `muted accent success warning danger`.
|
|
115
|
+
|
|
99
116
|
## When something you need doesn't exist
|
|
100
117
|
|
|
101
118
|
Work through this in order. **Don't get stuck, and don't expand the design system
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Icon — the design system's single icon primitive. The whole system is built on
|
|
6
|
+
* **hugeicons**; this is the on-system way to render one. Import glyphs from
|
|
7
|
+
* `@jackbernnie/hiyf/icons` (a re-export of @hugeicons/core-free-icons), so there
|
|
8
|
+
* is no separate install and no reason to reach for lucide or another icon lib.
|
|
9
|
+
*
|
|
10
|
+
* import { Icon } from '@jackbernnie/hiyf'
|
|
11
|
+
* import { Home01Icon } from '@jackbernnie/hiyf/icons'
|
|
12
|
+
* <Icon icon={Home01Icon} size="s" />
|
|
13
|
+
*
|
|
14
|
+
* `size` is a token; `color` is enumerated and defaults to `current` (inherits
|
|
15
|
+
* the surrounding text color, so icons inside buttons/links just work). No
|
|
16
|
+
* className/style escape hatch.
|
|
17
|
+
*/
|
|
18
|
+
declare const SIZE: {
|
|
19
|
+
readonly xs: 12;
|
|
20
|
+
readonly s: 16;
|
|
21
|
+
readonly m: 20;
|
|
22
|
+
readonly l: 24;
|
|
23
|
+
readonly xl: 32;
|
|
24
|
+
};
|
|
25
|
+
export type IconSize = keyof typeof SIZE;
|
|
26
|
+
declare const iconVariants: (props?: ({
|
|
27
|
+
color?: "current" | "muted" | "accent" | "danger" | "warning" | "success" | null | undefined;
|
|
28
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
29
|
+
export type IconColor = NonNullable<VariantProps<typeof iconVariants>["color"]>;
|
|
30
|
+
export interface IconProps {
|
|
31
|
+
/** A hugeicons glyph, e.g. imported from `@jackbernnie/hiyf/icons`. */
|
|
32
|
+
icon: React.ComponentProps<typeof HugeiconsIcon>["icon"];
|
|
33
|
+
/** Token size. Defaults to `s` (16px) — the common inline size. */
|
|
34
|
+
size?: IconSize;
|
|
35
|
+
/** Color intent. Defaults to `current` (inherits surrounding text color). */
|
|
36
|
+
color?: IconColor;
|
|
37
|
+
strokeWidth?: number;
|
|
38
|
+
"aria-label"?: string;
|
|
39
|
+
"aria-hidden"?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function Icon({ icon, size, color, strokeWidth, ...a11y }: IconProps): React.JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { HugeiconsIcon } from '@hugeicons/react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
const SIZE = { xs: 12, s: 16, m: 20, l: 24, xl: 32 };
|
|
6
|
+
const iconVariants = cva("shrink-0", {
|
|
7
|
+
variants: {
|
|
8
|
+
color: {
|
|
9
|
+
current: "",
|
|
10
|
+
muted: "text-muted-foreground",
|
|
11
|
+
accent: "text-primary",
|
|
12
|
+
success: "text-emerald-600 dark:text-emerald-400",
|
|
13
|
+
warning: "text-amber-600 dark:text-amber-400",
|
|
14
|
+
danger: "text-destructive"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { color: "current" }
|
|
18
|
+
});
|
|
19
|
+
function Icon({
|
|
20
|
+
icon,
|
|
21
|
+
size = "s",
|
|
22
|
+
color,
|
|
23
|
+
strokeWidth = 2,
|
|
24
|
+
...a11y
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
HugeiconsIcon,
|
|
28
|
+
{
|
|
29
|
+
icon,
|
|
30
|
+
size: SIZE[size],
|
|
31
|
+
strokeWidth,
|
|
32
|
+
className: iconVariants({ color }),
|
|
33
|
+
...a11y
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Icon };
|
|
@@ -12,7 +12,7 @@ function Card({
|
|
|
12
12
|
"data-slot": "card",
|
|
13
13
|
"data-size": size,
|
|
14
14
|
className: cn(
|
|
15
|
-
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
15
|
+
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card px-(--card-spacing) py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
16
16
|
className
|
|
17
17
|
),
|
|
18
18
|
...props
|
|
@@ -25,7 +25,7 @@ function CardHeader({ className, ...props }) {
|
|
|
25
25
|
{
|
|
26
26
|
"data-slot": "card-header",
|
|
27
27
|
className: cn(
|
|
28
|
-
"group/card-header @container/card-header grid auto-rows-min items-start gap-1
|
|
28
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
29
29
|
className
|
|
30
30
|
),
|
|
31
31
|
...props
|
|
@@ -60,7 +60,7 @@ function CardContent({ className, ...props }) {
|
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
62
|
"data-slot": "card-content",
|
|
63
|
-
className: cn(
|
|
63
|
+
className: cn(className),
|
|
64
64
|
...props
|
|
65
65
|
}
|
|
66
66
|
);
|
|
@@ -71,7 +71,7 @@ function CardFooter({ className, ...props }) {
|
|
|
71
71
|
{
|
|
72
72
|
"data-slot": "card-footer",
|
|
73
73
|
className: cn(
|
|
74
|
-
"flex items-center rounded-b-xl
|
|
74
|
+
"flex items-center rounded-b-xl [.border-t]:pt-(--card-spacing)",
|
|
75
75
|
className
|
|
76
76
|
),
|
|
77
77
|
...props
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@hugeicons/core-free-icons";
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@hugeicons/core-free-icons';
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { GridItem } from './components/GridItem';
|
|
|
8
8
|
export type { GridItemProps } from './components/GridItem';
|
|
9
9
|
export type { GridLine, GridPlacement } from './utils/grid';
|
|
10
10
|
export { createText } from './primitives/createText';
|
|
11
|
+
export { Icon } from './components/Icon';
|
|
12
|
+
export type { IconProps, IconSize, IconColor } from './components/Icon';
|
|
11
13
|
export { Button } from './components/Button';
|
|
12
14
|
export type { ButtonProps, ButtonIntent, ButtonSize } from './components/Button';
|
|
13
15
|
export { ButtonGroup } from './components/ButtonGroup';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { Text } from './components/Text.js';
|
|
|
3
3
|
export { Grid } from './components/Grid.js';
|
|
4
4
|
export { GridItem } from './components/GridItem.js';
|
|
5
5
|
export { createText } from './primitives/createText.js';
|
|
6
|
+
export { Icon } from './components/Icon.js';
|
|
6
7
|
export { Button } from './components/Button.js';
|
|
7
8
|
export { ButtonGroup } from './components/ButtonGroup.js';
|
|
8
9
|
export { Input } from './components/Input.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackbernnie/hiyf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "human-in-your-face — a personal, LLM-safe design system. Forked from Polar's Orbit (Apache-2.0).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./dist/tokens/tokens.stylex.d.ts",
|
|
30
30
|
"default": "./dist/tokens/tokens.stylex.js"
|
|
31
31
|
},
|
|
32
|
+
"./icons": {
|
|
33
|
+
"types": "./dist/icons.d.ts",
|
|
34
|
+
"default": "./dist/icons.js"
|
|
35
|
+
},
|
|
32
36
|
"./theme.css": "./src/theme.css",
|
|
33
37
|
"./styles.css": "./dist/stylex.css",
|
|
34
38
|
"./*": {
|