@prizmui/components 0.0.2 → 0.0.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/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -1
- package/dist/components/Button/Button.types.d.ts.map +1 -1
- package/dist/components/Button/useButton.d.ts.map +1 -1
- package/dist/components/Button/useButton.js +3 -1
- package/dist/components/Button/useButtonStyles.styles.d.ts.map +1 -1
- package/dist/components/Button/useButtonStyles.styles.js +0 -14
- package/dist/components/PrizmProvider/PrizmProvider.js +1 -1
- package/dist/components/Text/Text.d.ts +4 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/Text.js +8 -0
- package/dist/components/Text/Text.types.d.ts +48 -0
- package/dist/components/Text/Text.types.d.ts.map +1 -0
- package/dist/components/Text/Text.types.js +1 -0
- package/dist/components/Text/index.d.ts +4 -0
- package/dist/components/Text/index.d.ts.map +1 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/Text/renderText.d.ts +4 -0
- package/dist/components/Text/renderText.d.ts.map +1 -0
- package/dist/components/Text/renderText.js +6 -0
- package/dist/components/Text/useText.d.ts +3 -0
- package/dist/components/Text/useText.d.ts.map +1 -0
- package/dist/components/Text/useText.js +22 -0
- package/dist/components/Text/useTextStyles.styles.d.ts +5 -0
- package/dist/components/Text/useTextStyles.styles.d.ts.map +1 -0
- package/dist/components/Text/useTextStyles.styles.js +52 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utilities/assertSlots.d.ts.map +1 -1
- package/dist/utilities/assertSlots.js +12 -9
- package/dist/utilities/types.d.ts +11 -2
- package/dist/utilities/types.d.ts.map +1 -1
- package/package.json +30 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAMlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEjG,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACpD;;OAEG;
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEjG,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACpD;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAE1C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,GACjD,QAAQ,CACJ,IAAI,CACA,WAAW,EACX,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAC/C,CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/useButton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,SAAS,GAAI,OAAO,WAAW,KAAG,
|
|
1
|
+
{"version":3,"file":"useButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/useButton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,SAAS,GAAI,OAAO,WAAW,KAAG,WAmB9C,CAAC"}
|
|
@@ -7,7 +7,9 @@ export const useButton = (props) => {
|
|
|
7
7
|
size: size ?? 'medium',
|
|
8
8
|
components: { root: 'button' },
|
|
9
9
|
root: {
|
|
10
|
-
|
|
10
|
+
elementType: 'button',
|
|
11
|
+
type: props.as !== 'a' ? 'button' : undefined,
|
|
12
|
+
...props
|
|
11
13
|
}
|
|
12
14
|
};
|
|
13
15
|
return state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useButtonStyles.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Button/useButtonStyles.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,WAAW,CAExD,CAAC;
|
|
1
|
+
{"version":3,"file":"useButtonStyles.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Button/useButtonStyles.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG/D,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,WAAW,CAExD,CAAC;AAuIF,eAAO,MAAM,eAAe,GAAI,OAAO,WAAW,KAAG,WAsBpD,CAAC"}
|
|
@@ -55,19 +55,6 @@ const useRootStyles = makeStyles({
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
secondary: {},
|
|
58
|
-
tertiary: {
|
|
59
|
-
backgroundColor: 'transparent',
|
|
60
|
-
...shorthands.borderColor('transparent'),
|
|
61
|
-
color: tokens.colorNeutralForeground1,
|
|
62
|
-
':hover': {
|
|
63
|
-
backgroundColor: tokens.colorNeutralBackground1Hover,
|
|
64
|
-
...shorthands.borderColor('transparent'),
|
|
65
|
-
},
|
|
66
|
-
':active': {
|
|
67
|
-
backgroundColor: tokens.colorNeutralBackground1Pressed,
|
|
68
|
-
...shorthands.borderColor('transparent'),
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
58
|
ghost: {
|
|
72
59
|
backgroundColor: 'transparent',
|
|
73
60
|
...shorthands.borderColor('transparent'),
|
|
@@ -124,7 +111,6 @@ const useRootDisabledStyles = makeStyles({
|
|
|
124
111
|
},
|
|
125
112
|
primary: {},
|
|
126
113
|
secondary: {},
|
|
127
|
-
tertiary: {},
|
|
128
114
|
ghost: {},
|
|
129
115
|
});
|
|
130
116
|
export const useButtonStyles = (state) => {
|
|
@@ -10,7 +10,7 @@ function hashTheme(theme) {
|
|
|
10
10
|
}
|
|
11
11
|
function getThemeClassName(theme) {
|
|
12
12
|
const hash = hashTheme(theme);
|
|
13
|
-
const className = `
|
|
13
|
+
const className = `prizm-${hash}`;
|
|
14
14
|
if (!injectedThemes.has(className)) {
|
|
15
15
|
const vars = Object.entries(theme)
|
|
16
16
|
.map(([key, value]) => `--${key}: ${value}`)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAK9C,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAM9B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentState, Slot } from '../../utilities';
|
|
2
|
+
export type TextSlots = {
|
|
3
|
+
root: NonNullable<Slot<'span', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'pre' | 'strong' | 'b' | 'em' | 'i'>>;
|
|
4
|
+
};
|
|
5
|
+
export type TextProps = ComponentProps<TextSlots> & {
|
|
6
|
+
/**
|
|
7
|
+
* @default start
|
|
8
|
+
*/
|
|
9
|
+
align?: 'start' | 'center' | 'end' | 'justify';
|
|
10
|
+
/**
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
block?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @default base
|
|
16
|
+
*/
|
|
17
|
+
font?: 'base' | 'monospace' | 'numeric';
|
|
18
|
+
/**
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
italic?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @default 300
|
|
24
|
+
*/
|
|
25
|
+
size?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000;
|
|
26
|
+
/**
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
strikethrough?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
truncate?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
underline?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @default regular
|
|
40
|
+
*/
|
|
41
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
42
|
+
/**
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
wrap?: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type TextState = ComponentState<TextSlots> & Required<Pick<TextProps, 'align' | 'block' | 'font' | 'italic' | 'size' | 'strikethrough' | 'truncate' | 'underline' | 'weight' | 'wrap'>>;
|
|
48
|
+
//# sourceMappingURL=Text.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3E,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;CACxH,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAExC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IAEpD;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC,GAC7C,QAAQ,CACJ,IAAI,CACA,SAAS,EACT,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,eAAe,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAClH,CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderText.d.ts","sourceRoot":"","sources":["../../../src/components/Text/renderText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,eAAO,MAAM,UAAU,GAAI,OAAO,SAAS,KAAG,UAQ7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useText.d.ts","sourceRoot":"","sources":["../../../src/components/Text/useText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,KAAG,SAyB1C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const useText = (props) => {
|
|
2
|
+
const { align, block, font, italic, size, strikethrough, truncate, underline, weight, wrap } = props;
|
|
3
|
+
const state = {
|
|
4
|
+
align: align ?? 'start',
|
|
5
|
+
block: block ?? false,
|
|
6
|
+
font: font ?? 'base',
|
|
7
|
+
italic: italic ?? false,
|
|
8
|
+
size: size ?? 300,
|
|
9
|
+
strikethrough: strikethrough ?? false,
|
|
10
|
+
truncate: truncate ?? false,
|
|
11
|
+
underline: underline ?? false,
|
|
12
|
+
weight: weight ?? 'regular',
|
|
13
|
+
wrap: wrap ?? true,
|
|
14
|
+
components: { root: 'span' },
|
|
15
|
+
root: {
|
|
16
|
+
elementType: 'span',
|
|
17
|
+
type: props.as,
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return state;
|
|
22
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SlotClassNames } from '../../utilities';
|
|
2
|
+
import type { TextSlots, TextState } from './Text.types';
|
|
3
|
+
export declare const textClassNames: SlotClassNames<TextSlots>;
|
|
4
|
+
export declare const useTextStyles: (state: TextState) => TextState;
|
|
5
|
+
//# sourceMappingURL=useTextStyles.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextStyles.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Text/useTextStyles.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,SAAS,CAEpD,CAAC;AA4CF,eAAO,MAAM,aAAa,GAAI,OAAO,SAAS,KAAG,SA0ChD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses } from 'calame';
|
|
2
|
+
import { tokens } from '@prizmui/tokens';
|
|
3
|
+
export const textClassNames = {
|
|
4
|
+
root: 'c-text',
|
|
5
|
+
};
|
|
6
|
+
const useRootBaseClassName = makeResetStyles({
|
|
7
|
+
fontFamily: tokens.fontFamilyBase,
|
|
8
|
+
fontSize: tokens.fontSizeBase300,
|
|
9
|
+
lineHeight: tokens.lineHeightBase300,
|
|
10
|
+
fontWeight: tokens.fontWeightRegular,
|
|
11
|
+
textAlign: 'start',
|
|
12
|
+
display: 'inline',
|
|
13
|
+
whiteSpace: 'normal',
|
|
14
|
+
overflow: 'visible',
|
|
15
|
+
textOverflow: 'clip'
|
|
16
|
+
});
|
|
17
|
+
const useRootStyles = makeStyles({
|
|
18
|
+
alignStart: { textAlign: 'start' },
|
|
19
|
+
alignCenter: { textAlign: 'center' },
|
|
20
|
+
alignEnd: { textAlign: 'end' },
|
|
21
|
+
alignJustify: { textAlign: 'justify' },
|
|
22
|
+
block: { display: 'block' },
|
|
23
|
+
fontBase: { fontFamily: tokens.fontFamilyBase },
|
|
24
|
+
fontMonospace: { fontFamily: tokens.fontFamilyMonospace },
|
|
25
|
+
fontNumeric: { fontFamily: tokens.fontFamilyNumeric },
|
|
26
|
+
italic: { fontStyle: 'italic' },
|
|
27
|
+
base100: { fontSize: tokens.fontSizeBase100, lineHeight: tokens.lineHeightBase100 },
|
|
28
|
+
base200: { fontSize: tokens.fontSizeBase200, lineHeight: tokens.lineHeightBase200 },
|
|
29
|
+
base300: { fontSize: tokens.fontSizeBase300, lineHeight: tokens.lineHeightBase300 },
|
|
30
|
+
base400: { fontSize: tokens.fontSizeBase400, lineHeight: tokens.lineHeightBase400 },
|
|
31
|
+
base500: { fontSize: tokens.fontSizeBase500, lineHeight: tokens.lineHeightBase500 },
|
|
32
|
+
base600: { fontSize: tokens.fontSizeBase600, lineHeight: tokens.lineHeightBase600 },
|
|
33
|
+
base700: { fontSize: tokens.fontSizeBase700, lineHeight: tokens.lineHeightBase700 },
|
|
34
|
+
hero800: { fontSize: tokens.fontSizeHero800, lineHeight: tokens.lineHeightHero800 },
|
|
35
|
+
hero900: { fontSize: tokens.fontSizeHero900, lineHeight: tokens.lineHeightHero900 },
|
|
36
|
+
hero1000: { fontSize: tokens.fontSizeHero1000, lineHeight: tokens.lineHeightHero1000 },
|
|
37
|
+
strikethrough: { textDecorationLine: 'line-through' },
|
|
38
|
+
truncate: { textOverflow: 'ellipsis' },
|
|
39
|
+
underline: { textDecorationLine: 'underline' },
|
|
40
|
+
weightRegular: { fontWeight: tokens.fontWeightRegular },
|
|
41
|
+
weightMedium: { fontWeight: tokens.fontWeightMedium },
|
|
42
|
+
weightSemibold: { fontWeight: tokens.fontWeightSemibold },
|
|
43
|
+
weightBold: { fontWeight: tokens.fontWeightBold },
|
|
44
|
+
nowrap: { whiteSpace: 'nowrap', overflow: 'hidden' }
|
|
45
|
+
});
|
|
46
|
+
export const useTextStyles = (state) => {
|
|
47
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
48
|
+
const rootStyles = useRootStyles();
|
|
49
|
+
const { align, block, font, italic, size, strikethrough, truncate, underline, weight, wrap } = state;
|
|
50
|
+
state.root.className = mergeClasses(textClassNames.root, rootBaseClassName, align === 'start' && rootStyles.alignStart, align === 'center' && rootStyles.alignCenter, align === 'end' && rootStyles.alignEnd, align === 'justify' && rootStyles.alignJustify, block && rootStyles.block, font === 'base' && rootStyles.fontBase, font === 'monospace' && rootStyles.fontMonospace, font === 'numeric' && rootStyles.fontNumeric, italic && rootStyles.italic, size === 100 && rootStyles.base100, size === 200 && rootStyles.base200, size === 300 && rootStyles.base300, size === 400 && rootStyles.base400, size === 500 && rootStyles.base500, size === 600 && rootStyles.base600, size === 700 && rootStyles.base700, size === 800 && rootStyles.hero800, size === 900 && rootStyles.hero900, size === 1000 && rootStyles.hero1000, strikethrough && rootStyles.strikethrough, truncate && rootStyles.truncate, underline && rootStyles.underline, weight === 'regular' && rootStyles.weightRegular, weight === 'medium' && rootStyles.weightMedium, weight === 'semibold' && rootStyles.weightSemibold, weight === 'bold' && rootStyles.weightBold, wrap === false && rootStyles.nowrap, state.root.className);
|
|
51
|
+
return state;
|
|
52
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { PrizmProvider } from './components/PrizmProvider';
|
|
|
2
2
|
export type { PrizmProviderProps } from './components/PrizmProvider';
|
|
3
3
|
export { Button, buttonClassNames } from './components/Button';
|
|
4
4
|
export type { ButtonProps, ButtonSlots, ButtonState } from './components/Button';
|
|
5
|
+
export { Text, textClassNames } from './components/Text';
|
|
6
|
+
export type { TextProps, TextSlots, TextState } from './components/Text';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertSlots.d.ts","sourceRoot":"","sources":["../../src/utilities/assertSlots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAgB,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,eAAe,EACtD,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAAE,
|
|
1
|
+
{"version":3,"file":"assertSlots.d.ts","sourceRoot":"","sources":["../../src/utilities/assertSlots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAgB,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,eAAe,EACtD,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAAE,CAkChG"}
|
|
@@ -39,14 +39,17 @@ export function assertSlots(state) {
|
|
|
39
39
|
// Explicit JSX children (extraProps.children) only override baked-in
|
|
40
40
|
// children when they are not undefined, so callers can safely write
|
|
41
41
|
// <state.root>{someVar}</state.root> even when someVar is undefined.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
const fn = (extraProps = {}) => {
|
|
43
|
+
const { children: explicitChildren, ...otherExtra } = extraProps;
|
|
44
|
+
return jsx(Component, {
|
|
45
|
+
...slotProps,
|
|
46
|
+
...otherExtra,
|
|
47
|
+
...(explicitChildren !== undefined && { children: explicitChildren }),
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
// Attach original props onto the function so callers can still
|
|
51
|
+
// read slot props after assertSlots, e.g. state.root.children.
|
|
52
|
+
Object.assign(fn, slotProps);
|
|
53
|
+
state[slotName] = fn;
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -40,8 +40,12 @@ export type IntrinsicShorthandProps<TDefaultAs extends IntrinsicElementTag, TFal
|
|
|
40
40
|
* - An object of props for the slot element (including optional `as` to change type)
|
|
41
41
|
* - `null` — explicitly suppress the slot (don't render it)
|
|
42
42
|
* - `undefined` — optional slot not provided by the consumer
|
|
43
|
+
*
|
|
44
|
+
* Accepts two forms:
|
|
45
|
+
* - `Slot<TProps>` — wraps an existing props object type
|
|
46
|
+
* - `Slot<'div', 'span' | 'a'>` — intrinsic tag shorthand, forwarded to `IntrinsicShorthandProps`
|
|
43
47
|
*/
|
|
44
|
-
export type Slot<
|
|
48
|
+
export type Slot<TDefaultAs extends IntrinsicElementTag | object, TFallbackAs extends IntrinsicElementTag = never> = (TDefaultAs extends IntrinsicElementTag ? IntrinsicShorthandProps<TDefaultAs, TFallbackAs> : TDefaultAs) | null | undefined;
|
|
45
49
|
/**
|
|
46
50
|
* The shape of a component's slot definitions.
|
|
47
51
|
* `root` is always required; additional slots are optional.
|
|
@@ -85,7 +89,12 @@ export type ComponentProps<TSlots extends SlotPropsRecord, TPrimarySlot extends
|
|
|
85
89
|
export type ComponentState<TSlots extends SlotPropsRecord> = {
|
|
86
90
|
components: ComponentsRecord<TSlots>;
|
|
87
91
|
} & {
|
|
88
|
-
[K in keyof TSlots]: Exclude<TSlots[K], undefined
|
|
92
|
+
[K in keyof TSlots]: Exclude<TSlots[K], undefined> & {
|
|
93
|
+
/** The base element type for this slot (the default `as` value). */
|
|
94
|
+
elementType?: ElementType;
|
|
95
|
+
/** The resolved element type, set from the consumer's `as` prop. */
|
|
96
|
+
type?: ElementType;
|
|
97
|
+
};
|
|
89
98
|
};
|
|
90
99
|
/**
|
|
91
100
|
* Root slot props for a button-like element that can render as:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utilities/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI9D;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,CAAC,SAAS,OAAO,GAClE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,KAAK,CAAC;AAIZ,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC;AAE9D,0DAA0D;AAC1D,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,mBAAmB,IAC3D,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAE7B;;;GAGG;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eAAe,IAAI;IACzD,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACxC,GAAG;KACC,CAAC,IAAI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;QACjD,oEAAoE;QACpE,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,oEAAoE;QACpE,IAAI,CAAC,EAAE,WAAW,CAAC;KACtB;CACJ,CAAC;AAIF;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,IACzE,uBAAuB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAInD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,eAAe,IAAI;KACxD,CAAC,IAAI,MAAM,MAAM,GAAG,MAAM;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "@prizmui/components",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsc --watch",
|
|
19
|
+
"typecheck": "tsc --noEmit"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"calame": "workspace:*",
|
|
23
|
+
"@prizmui/tokens": "workspace:*"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"jsx-framework-test-pb": "*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"jsx-framework-test-pb": "latest",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
11
31
|
}
|
|
12
|
-
|
|
13
|
-
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"calame": "0.0.6",
|
|
18
|
-
"@prizmui/tokens": "0.0.1"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"jsx-framework-test-pb": "*"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"jsx-framework-test-pb": "latest",
|
|
25
|
-
"typescript": "^5.9.3"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc",
|
|
29
|
-
"dev": "tsc --watch",
|
|
30
|
-
"typecheck": "tsc --noEmit"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
32
|
+
}
|