@eevenkoto/core 0.1.0 → 0.1.1
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 +33 -0
- package/dist/index.d.ts +24 -2
- package/dist/index.js +18 -2
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @eevenkoto/core
|
|
2
|
+
|
|
3
|
+
Shared prop types and pure className helpers for Eevenkoto. No DOM, no templates, no CSS.
|
|
4
|
+
|
|
5
|
+
Most apps use this indirectly through `@eevenkoto/html`, `@eevenkoto/react`, or `@eevenkoto/vue`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @eevenkoto/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { buttonClassNames, type ButtonProps } from '@eevenkoto/core';
|
|
17
|
+
|
|
18
|
+
const className = buttonClassNames({
|
|
19
|
+
variant: 'primary',
|
|
20
|
+
size: 'sm',
|
|
21
|
+
icon: 'star',
|
|
22
|
+
});
|
|
23
|
+
// "eevenkoto-button eevenkoto-button--primary eevenkoto-button--sm eevenkoto-button--icon-left"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Helpers: `buttonClassNames`, `badgeClassNames`, `headingClassNames`, `paragraphClassNames`, `captionClassNames`, `flowClassNames`.
|
|
27
|
+
|
|
28
|
+
Pair with `@eevenkoto/css` for styling.
|
|
29
|
+
|
|
30
|
+
## Related
|
|
31
|
+
|
|
32
|
+
- `@eevenkoto/css` — tokens and component styles
|
|
33
|
+
- `@eevenkoto/html` / `@eevenkoto/react` / `@eevenkoto/vue` — markup bindings
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
type ButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
2
|
-
type
|
|
2
|
+
/** Shared size ladder across controls and type primitives: sm | md | lg */
|
|
3
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
3
4
|
type ButtonIconName = 'star' | 'check' | 'arrow' | 'plus';
|
|
4
5
|
type ButtonIconPosition = 'left' | 'right' | 'only';
|
|
5
6
|
interface ButtonProps {
|
|
6
7
|
variant: ButtonVariant;
|
|
7
8
|
label: string;
|
|
9
|
+
/** Default: md */
|
|
8
10
|
size?: ButtonSize;
|
|
9
11
|
disabled?: boolean;
|
|
10
12
|
/** Which placeholder icon to render. */
|
|
@@ -17,6 +19,26 @@ type ButtonClassNameProps = Pick<ButtonProps, 'variant' | 'size' | 'icon' | 'ico
|
|
|
17
19
|
declare const resolveButtonIconPosition: (props: Pick<ButtonProps, "icon" | "iconPosition">) => ButtonIconPosition | undefined;
|
|
18
20
|
declare const buttonClassNames: (props: ButtonClassNameProps) => string;
|
|
19
21
|
|
|
22
|
+
type BadgeVariant = 'subtle' | 'solid' | 'outline';
|
|
23
|
+
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
24
|
+
type BadgeShape = 'pill' | 'rounded';
|
|
25
|
+
type BadgeIntent = 'neutral' | 'info' | 'success' | 'caution' | 'critical' | 'admin';
|
|
26
|
+
interface BadgeProps {
|
|
27
|
+
label: string;
|
|
28
|
+
/** Surface recipe. Default: subtle */
|
|
29
|
+
variant?: BadgeVariant;
|
|
30
|
+
/** Feedback intent (Tier 2). Default: neutral */
|
|
31
|
+
intent?: BadgeIntent;
|
|
32
|
+
/** Shared sm | md | lg ladder. Default: md */
|
|
33
|
+
size?: BadgeSize;
|
|
34
|
+
/** Default: pill (`radius-full`) */
|
|
35
|
+
shape?: BadgeShape;
|
|
36
|
+
/** Status dot before the label. Default: false */
|
|
37
|
+
dot?: boolean;
|
|
38
|
+
}
|
|
39
|
+
type BadgeClassNameProps = Pick<BadgeProps, 'variant' | 'intent' | 'size' | 'shape'>;
|
|
40
|
+
declare const badgeClassNames: (props?: BadgeClassNameProps) => string;
|
|
41
|
+
|
|
20
42
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
21
43
|
type HeadingTone = 'primary' | 'secondary';
|
|
22
44
|
interface HeadingProps {
|
|
@@ -59,4 +81,4 @@ declare const flowClassNames: (props?: FlowProps) => string;
|
|
|
59
81
|
/** Placeholder SVG path data until a shared icon library exists. */
|
|
60
82
|
declare const buttonIconPaths: Record<ButtonIconName, string>;
|
|
61
83
|
|
|
62
|
-
export { type ButtonClassNameProps, type ButtonIconName, type ButtonIconPosition, type ButtonProps, type ButtonSize, type ButtonVariant, type CaptionClassNameProps, type CaptionProps, type CaptionTone, type FlowDensity, type FlowProps, type HeadingClassNameProps, type HeadingLevel, type HeadingProps, type HeadingTone, type ParagraphClassNameProps, type ParagraphProps, type ParagraphSize, type ParagraphTone, buttonClassNames, buttonIconPaths, captionClassNames, flowClassNames, headingClassNames, paragraphClassNames, resolveButtonIconPosition };
|
|
84
|
+
export { type BadgeClassNameProps, type BadgeIntent, type BadgeProps, type BadgeShape, type BadgeSize, type BadgeVariant, type ButtonClassNameProps, type ButtonIconName, type ButtonIconPosition, type ButtonProps, type ButtonSize, type ButtonVariant, type CaptionClassNameProps, type CaptionProps, type CaptionTone, type FlowDensity, type FlowProps, type HeadingClassNameProps, type HeadingLevel, type HeadingProps, type HeadingTone, type ParagraphClassNameProps, type ParagraphProps, type ParagraphSize, type ParagraphTone, badgeClassNames, buttonClassNames, buttonIconPaths, captionClassNames, flowClassNames, headingClassNames, paragraphClassNames, resolveButtonIconPosition };
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,25 @@ var resolveButtonIconPosition = (props) => {
|
|
|
4
4
|
return props.iconPosition ?? "left";
|
|
5
5
|
};
|
|
6
6
|
var buttonClassNames = (props) => {
|
|
7
|
+
const size = props.size ?? "md";
|
|
7
8
|
const iconPosition = resolveButtonIconPosition(props);
|
|
8
|
-
const sizeClass = props.size ? ` eevenkoto-button--${props.size}` : "";
|
|
9
9
|
const iconClass = iconPosition ? ` eevenkoto-button--icon-${iconPosition}` : "";
|
|
10
|
-
return `eevenkoto-button eevenkoto-button--${props.variant}
|
|
10
|
+
return `eevenkoto-button eevenkoto-button--${props.variant} eevenkoto-button--${size}${iconClass}`;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/badge.ts
|
|
14
|
+
var badgeClassNames = (props = {}) => {
|
|
15
|
+
const variant = props.variant ?? "subtle";
|
|
16
|
+
const intent = props.intent ?? "neutral";
|
|
17
|
+
const size = props.size ?? "md";
|
|
18
|
+
const shape = props.shape ?? "pill";
|
|
19
|
+
return [
|
|
20
|
+
"eevenkoto-badge",
|
|
21
|
+
`eevenkoto-badge--${variant}`,
|
|
22
|
+
`eevenkoto-badge--${intent}`,
|
|
23
|
+
`eevenkoto-badge--${size}`,
|
|
24
|
+
`eevenkoto-badge--${shape}`
|
|
25
|
+
].join(" ");
|
|
11
26
|
};
|
|
12
27
|
|
|
13
28
|
// src/heading.ts
|
|
@@ -44,6 +59,7 @@ var buttonIconPaths = {
|
|
|
44
59
|
plus: "M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3Z"
|
|
45
60
|
};
|
|
46
61
|
export {
|
|
62
|
+
badgeClassNames,
|
|
47
63
|
buttonClassNames,
|
|
48
64
|
buttonIconPaths,
|
|
49
65
|
captionClassNames,
|