@beaubrain/web-design-system 0.1.0 → 0.1.2

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 (46) hide show
  1. package/README.md +99 -66
  2. package/dist/assets/web-design-system.css +1 -0
  3. package/dist/components/Base/index.d.ts +11 -0
  4. package/dist/components/Button/button.defs.d.ts +119 -0
  5. package/dist/components/Button/button.helpers.d.ts +5 -0
  6. package/dist/components/Button/index.d.ts +117 -0
  7. package/dist/components/Flex/flex.defs.d.ts +281 -0
  8. package/dist/components/Flex/flex.helpers.d.ts +2 -0
  9. package/dist/components/Flex/index.d.ts +15 -0
  10. package/dist/components/Grid/grid.defs.d.ts +312 -0
  11. package/dist/components/Grid/grid.helpers.d.ts +4 -0
  12. package/dist/components/Grid/index.d.ts +15 -0
  13. package/dist/components/Outlet/Outlet.test.d.ts +1 -0
  14. package/dist/components/Outlet/index.d.ts +15 -0
  15. package/dist/components/Spinner/index.d.ts +67 -0
  16. package/dist/components/Spinner/spinner.defs.d.ts +60 -0
  17. package/dist/components/Text/index.d.ts +21 -0
  18. package/dist/components/Text/text.defs.d.ts +93 -0
  19. package/dist/components/VisuallyHidden/index.d.ts +17 -0
  20. package/dist/components/index.d.ts +7 -0
  21. package/dist/core/defs/as-child.defs.d.ts +6 -0
  22. package/dist/core/defs/color.defs.d.ts +20 -0
  23. package/dist/core/defs/gap.defs.d.ts +22 -0
  24. package/dist/core/defs/height.defs.d.ts +21 -0
  25. package/dist/core/defs/index.d.ts +15 -0
  26. package/dist/core/defs/layout.defs.d.ts +194 -0
  27. package/dist/core/defs/leading-trim.defs.d.ts +9 -0
  28. package/dist/core/defs/margin.defs.d.ts +48 -0
  29. package/dist/core/defs/padding.defs.d.ts +49 -0
  30. package/dist/core/defs/prop-defs.d.ts +55 -0
  31. package/dist/core/defs/radius.defs.d.ts +14 -0
  32. package/dist/core/defs/text-align.defs.d.ts +8 -0
  33. package/dist/core/defs/text-wrap.defs.d.ts +8 -0
  34. package/dist/core/defs/truncate.defs.d.ts +7 -0
  35. package/dist/core/defs/weight.defs.d.ts +8 -0
  36. package/dist/core/defs/width.defs.d.ts +21 -0
  37. package/dist/core/react/component-props.d.ts +4 -0
  38. package/dist/core/react/extract-props.d.ts +11 -0
  39. package/dist/core/react/get-styles.d.ts +18 -0
  40. package/dist/core/react/index.d.ts +4 -0
  41. package/dist/core/react/merge-styles.d.ts +5 -0
  42. package/dist/core/react/props.d.ts +6 -0
  43. package/dist/core/react/ref.d.ts +5 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +698 -0
  46. package/package.json +1 -1
@@ -0,0 +1,49 @@
1
+ import { GetPropDefTypes } from './prop-defs';
2
+ declare const paddingValues: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
3
+ declare const paddingPropDefs: {
4
+ p: {
5
+ type: "enum | string";
6
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
7
+ className: string;
8
+ customProperties: "--p"[];
9
+ };
10
+ px: {
11
+ type: "enum | string";
12
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
13
+ className: string;
14
+ customProperties: "--px"[];
15
+ };
16
+ py: {
17
+ type: "enum | string";
18
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
19
+ className: string;
20
+ customProperties: "--py"[];
21
+ };
22
+ pt: {
23
+ type: "enum | string";
24
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
25
+ className: string;
26
+ customProperties: "--pt"[];
27
+ };
28
+ pr: {
29
+ type: "enum | string";
30
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
31
+ className: string;
32
+ customProperties: "--pr"[];
33
+ };
34
+ pb: {
35
+ type: "enum | string";
36
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
37
+ className: string;
38
+ customProperties: "--pb"[];
39
+ };
40
+ pl: {
41
+ type: "enum | string";
42
+ values: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
43
+ className: string;
44
+ customProperties: "--pl"[];
45
+ };
46
+ };
47
+ type PaddingPropDefs = GetPropDefTypes<typeof paddingPropDefs>;
48
+ export { paddingPropDefs, paddingValues };
49
+ export type { PaddingPropDefs };
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+ type Union<S = string, T extends string | number = string> = T | Omit<S, T>;
3
+ type ReactNodePropDef = {
4
+ type: 'ReactNode';
5
+ default?: React.ReactNode;
6
+ required?: boolean;
7
+ };
8
+ type BooleanPropDef = {
9
+ type: 'boolean';
10
+ default?: boolean;
11
+ required?: boolean;
12
+ className?: string;
13
+ };
14
+ type StringPropDef = {
15
+ type: 'string';
16
+ default?: string;
17
+ required?: boolean;
18
+ };
19
+ type EnumPropDef<T> = {
20
+ type: 'enum';
21
+ values: readonly T[];
22
+ default?: T;
23
+ required?: boolean;
24
+ };
25
+ type EnumOrStringPropDef<T> = {
26
+ type: 'enum | string';
27
+ values: readonly T[];
28
+ default?: T | string;
29
+ required?: boolean;
30
+ };
31
+ type NonStylingPropDef = {
32
+ className?: never;
33
+ customProperties?: never;
34
+ parseValue?: never;
35
+ };
36
+ type StylingPropDef = {
37
+ className: string;
38
+ parseValue?: (value: string) => string | undefined;
39
+ };
40
+ type CustomStylingPropDef = {
41
+ className: string;
42
+ customProperties: `--${string}`[];
43
+ parseValue?: (value: string) => string | undefined;
44
+ };
45
+ type PropDef<T = any> = ReactNodePropDef | BooleanPropDef | (StringPropDef & NonStylingPropDef) | (StringPropDef & CustomStylingPropDef) | (EnumPropDef<T> & StylingPropDef) | (EnumPropDef<T> & NonStylingPropDef) | (EnumOrStringPropDef<T> & CustomStylingPropDef) | (EnumOrStringPropDef<T> & NonStylingPropDef);
46
+ type GetPropDefType<Def> = Def extends ReactNodePropDef ? React.ReactNode : Def extends BooleanPropDef ? boolean : Def extends StringPropDef ? string : Def extends EnumPropDef<infer Type> ? Type : Def extends EnumOrStringPropDef<infer Type> ? Type extends string ? Union<string, Type> : Type : never;
47
+ type GetPropDefTypes<P> = {
48
+ [K in keyof P]?: GetPropDefType<P[K]>;
49
+ };
50
+ type PropDefsWithClassName<T> = T extends Record<string, PropDef> ? {
51
+ [K in keyof T]: T[K] extends {
52
+ className: string;
53
+ } ? K : never;
54
+ }[keyof T] : never;
55
+ export type { Union, PropDef, GetPropDefTypes, PropDefsWithClassName };
@@ -0,0 +1,14 @@
1
+ import { GetPropDefTypes } from './prop-defs';
2
+ declare const radii: readonly ["none", "s", "m", "l", "full"];
3
+ declare const radiusPropDef: {
4
+ radius: {
5
+ type: "enum | string";
6
+ values: readonly ["none", "s", "m", "l", "full"];
7
+ default: undefined;
8
+ className: string;
9
+ customProperties: "--radius"[];
10
+ };
11
+ };
12
+ type RadiusPropDef = GetPropDefTypes<typeof radiusPropDef>;
13
+ export { radiusPropDef, radii };
14
+ export type { RadiusPropDef };
@@ -0,0 +1,8 @@
1
+ declare const textAlignPropDef: {
2
+ align: {
3
+ type: "enum";
4
+ values: readonly ["left", "center", "right"];
5
+ className: string;
6
+ };
7
+ };
8
+ export { textAlignPropDef };
@@ -0,0 +1,8 @@
1
+ declare const textWrapPropDef: {
2
+ wrap: {
3
+ type: "enum";
4
+ className: string;
5
+ values: readonly ["wrap", "nowrap", "pretty", "balance"];
6
+ };
7
+ };
8
+ export { textWrapPropDef };
@@ -0,0 +1,7 @@
1
+ declare const truncatePropDef: {
2
+ truncate: {
3
+ type: "boolean";
4
+ className: string;
5
+ };
6
+ };
7
+ export { truncatePropDef };
@@ -0,0 +1,8 @@
1
+ declare const weightPropDef: {
2
+ weight: {
3
+ type: "enum";
4
+ values: readonly ["light", "regular", "medium", "semibold", "bold"];
5
+ className: string;
6
+ };
7
+ };
8
+ export { weightPropDef };
@@ -0,0 +1,21 @@
1
+ import { GetPropDefTypes } from './prop-defs';
2
+ declare const widthPropDefs: {
3
+ width: {
4
+ type: "string";
5
+ className: string;
6
+ customProperties: "--width"[];
7
+ };
8
+ minWidth: {
9
+ type: "string";
10
+ className: string;
11
+ customProperties: "--min-width"[];
12
+ };
13
+ maxWidth: {
14
+ type: "string";
15
+ className: string;
16
+ customProperties: "--max-width"[];
17
+ };
18
+ };
19
+ type WidthPropDefs = GetPropDefTypes<typeof widthPropDefs>;
20
+ export { widthPropDefs };
21
+ export type { WidthPropDefs };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ type ComponentPropsWithout<T extends React.ElementType, O extends Omit<string, keyof React.ComponentPropsWithoutRef<T>> | keyof React.ComponentPropsWithoutRef<T>> = Omit<React.ComponentPropsWithoutRef<T>, O & string>;
3
+ type DefaultRemovedProps = 'asChild' | 'defaultChecked' | 'defaultValue' | 'color';
4
+ export type { ComponentPropsWithout, DefaultRemovedProps };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { PropDef, PropDefsWithClassName } from '../defs/prop-defs';
3
+ declare const extractProps: <P extends {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ [key: string]: any;
7
+ }, T extends Record<string, PropDef>[]>(props: P, ...propDefs: T) => Omit<P & {
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ }, PropDefsWithClassName<T[number]>>;
11
+ export { extractProps };
@@ -0,0 +1,18 @@
1
+ import { Union } from '../defs/prop-defs';
2
+ interface GetStylesOptions {
3
+ className: string;
4
+ customProperties: `--${string}`[];
5
+ value: Union | string | undefined;
6
+ propValues: string[] | readonly string[];
7
+ parseValue?: (value: string) => string | undefined;
8
+ }
9
+ declare const getStyles: ({ className, customProperties, ...args }: GetStylesOptions) => readonly [string | undefined, Record<string, string | undefined> | undefined];
10
+ interface GetClassNamesOptions {
11
+ allowCustomValues?: boolean;
12
+ className: string;
13
+ value: Union | string | undefined;
14
+ propValues: string[] | readonly string[];
15
+ parseValue?: (value: string) => string | undefined;
16
+ }
17
+ declare const getClassNames: ({ allowCustomValues, className, value, propValues, parseValue, }: GetClassNamesOptions) => string | undefined;
18
+ export { getClassNames, getStyles };
@@ -0,0 +1,4 @@
1
+ export * from './props';
2
+ export * from './ref';
3
+ export * from './extract-props';
4
+ export * from './component-props';
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ type InlineStyle = React.CSSProperties | Record<string, string | number | null | undefined> | undefined;
3
+ declare const mergeStyles: (...styles: Array<InlineStyle>) => InlineStyle;
4
+ export { mergeStyles };
5
+ export type { InlineStyle };
@@ -0,0 +1,6 @@
1
+ type AnyProps = Record<string, any>;
2
+ declare const mergeProps: (parentProps: AnyProps, childProps: AnyProps) => {
3
+ [x: string]: any;
4
+ };
5
+ export { mergeProps };
6
+ export type { AnyProps };
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ type PossibleRef<T> = React.Ref<T> | undefined;
3
+ declare const composeRefs: <T>(...refs: PossibleRef<T>[]) => React.RefCallback<T>;
4
+ declare const getElementRef: (element: React.ReactElement) => any;
5
+ export { composeRefs, getElementRef };
@@ -0,0 +1 @@
1
+ export * from './components/index.js';