@prizmui/components 0.0.4 → 0.0.7

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 (33) hide show
  1. package/dist/components/Button/Button.d.ts +1 -1
  2. package/dist/components/Button/Button.d.ts.map +1 -1
  3. package/dist/components/Button/Button.types.d.ts +1 -1
  4. package/dist/components/Button/Button.types.d.ts.map +1 -1
  5. package/dist/components/Button/useButton.d.ts.map +1 -1
  6. package/dist/components/Button/useButton.js +6 -5
  7. package/dist/components/Button/useButtonStyles.styles.d.ts.map +1 -1
  8. package/dist/components/Button/useButtonStyles.styles.js +0 -14
  9. package/dist/components/PrizmProvider/PrizmProvider.js +1 -1
  10. package/dist/components/Text/Text.d.ts +4 -0
  11. package/dist/components/Text/Text.d.ts.map +1 -0
  12. package/dist/components/Text/Text.js +8 -0
  13. package/dist/components/Text/Text.types.d.ts +48 -0
  14. package/dist/components/Text/Text.types.d.ts.map +1 -0
  15. package/dist/components/Text/Text.types.js +1 -0
  16. package/dist/components/Text/index.d.ts +4 -0
  17. package/dist/components/Text/index.d.ts.map +1 -0
  18. package/dist/components/Text/index.js +2 -0
  19. package/dist/components/Text/renderText.d.ts +4 -0
  20. package/dist/components/Text/renderText.d.ts.map +1 -0
  21. package/dist/components/Text/renderText.js +6 -0
  22. package/dist/components/Text/useText.d.ts +3 -0
  23. package/dist/components/Text/useText.d.ts.map +1 -0
  24. package/dist/components/Text/useText.js +22 -0
  25. package/dist/components/Text/useTextStyles.styles.d.ts +5 -0
  26. package/dist/components/Text/useTextStyles.styles.d.ts.map +1 -0
  27. package/dist/components/Text/useTextStyles.styles.js +52 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/utilities/types.d.ts +11 -2
  32. package/dist/utilities/types.d.ts.map +1 -1
  33. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { FC } from 'jsx-framework-test-pb';
1
+ import type { FC } from 'jsx-framework-test-pb';
2
2
  import type { ButtonProps } from './Button.types';
3
3
  export declare const Button: FC<ButtonProps>;
4
4
  //# sourceMappingURL=Button.d.ts.map
@@ -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;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAMlC,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"}
@@ -6,7 +6,7 @@ export type ButtonProps = ComponentProps<ButtonSlots> & {
6
6
  /**
7
7
  * @default 'secondary'
8
8
  */
9
- appearance?: 'primary' | 'secondary' | 'tertiary' | 'ghost';
9
+ appearance?: 'primary' | 'secondary' | 'ghost';
10
10
  /**
11
11
  * @default false
12
12
  */
@@ -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;IAEH,UAAU,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,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,WAkB9C,CAAC"}
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"}
@@ -1,15 +1,16 @@
1
1
  export const useButton = (props) => {
2
- const { appearance, disabled, shape, size, as: asProp, ...rootProps } = props;
2
+ const { appearance, disabled, shape, size } = props;
3
3
  const state = {
4
4
  appearance: appearance ?? 'secondary',
5
5
  disabled: disabled ?? false,
6
6
  shape: shape ?? 'rounded',
7
7
  size: size ?? 'medium',
8
- components: { root: asProp ?? 'button' },
8
+ components: { root: 'button' },
9
9
  root: {
10
- ...rootProps,
11
- ...(!asProp || asProp === 'button' ? { type: 'button' } : {}),
12
- },
10
+ elementType: 'button',
11
+ type: props.as !== 'a' ? 'button' : undefined,
12
+ ...props
13
+ }
13
14
  };
14
15
  return state;
15
16
  };
@@ -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;AA0JF,eAAO,MAAM,eAAe,GAAI,OAAO,WAAW,KAAG,WAsBpD,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 = `fluid-${hash}`;
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,4 @@
1
+ import type { FC } from 'jsx-framework-test-pb';
2
+ import type { TextProps } from './Text.types';
3
+ export declare const Text: FC<TextProps>;
4
+ //# sourceMappingURL=Text.d.ts.map
@@ -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,8 @@
1
+ import { useText } from './useText';
2
+ import { renderText } from './renderText';
3
+ import { useTextStyles } from './useTextStyles.styles';
4
+ export const Text = (props) => {
5
+ const state = useText(props);
6
+ useTextStyles(state);
7
+ return renderText(state);
8
+ };
@@ -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,4 @@
1
+ export { Text } from './Text';
2
+ export type { TextProps, TextSlots, TextState } from './Text.types';
3
+ export { textClassNames } from './useTextStyles.styles';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export { Text } from './Text';
2
+ export { textClassNames } from './useTextStyles.styles';
@@ -0,0 +1,4 @@
1
+ import type { JSXElement } from '../../utilities';
2
+ import type { TextState } from './Text.types';
3
+ export declare const renderText: (state: TextState) => JSXElement;
4
+ //# sourceMappingURL=renderText.d.ts.map
@@ -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,6 @@
1
+ import { jsx as _jsx } from "jsx-framework-test-pb/jsx-runtime";
2
+ import { assertSlots } from '../../utilities';
3
+ export const renderText = (state) => {
4
+ assertSlots(state);
5
+ return (_jsx(state.root, { children: state.root.children }));
6
+ };
@@ -0,0 +1,3 @@
1
+ import type { TextProps, TextState } from './Text.types';
2
+ export declare const useText: (props: TextProps) => TextState;
3
+ //# sourceMappingURL=useText.d.ts.map
@@ -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
@@ -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,2 +1,3 @@
1
1
  export { PrizmProvider } from './components/PrizmProvider';
2
2
  export { Button, buttonClassNames } from './components/Button';
3
+ export { Text, textClassNames } from './components/Text';
@@ -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<TProps extends object> = TProps | null | undefined;
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,0DAA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I,OAAO,CAAC,MAAM,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAAE,GAC1D;IAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;CAAE,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@prizmui/components",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,8 +14,8 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "calame": "0.0.6",
18
- "@prizmui/tokens": "0.0.1"
17
+ "@prizmui/tokens": "0.0.3",
18
+ "calame": "0.0.6"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "jsx-framework-test-pb": "*"