@lumx/core 4.3.2-alpha.8 → 4.4.0

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 (97) hide show
  1. package/js/components/Badge/BadgeWrapperTests.d.ts +9 -0
  2. package/js/components/Badge/Tests.d.ts +12 -0
  3. package/js/components/Button/Button.d.ts +48 -0
  4. package/js/components/Button/ButtonRoot.d.ts +55 -0
  5. package/js/components/Button/ButtonRootTests.d.ts +12 -0
  6. package/js/components/Button/IconButton.d.ts +45 -0
  7. package/js/components/Button/IconButtonTests.d.ts +15 -0
  8. package/js/components/Button/Tests.d.ts +15 -0
  9. package/js/components/Checkbox/Tests.d.ts +15 -0
  10. package/js/components/Checkbox/index.d.ts +49 -0
  11. package/js/components/Divider/Tests.d.ts +12 -0
  12. package/js/components/Divider/index.d.ts +27 -0
  13. package/js/components/Flag/Tests.d.ts +14 -0
  14. package/js/components/Flag/index.d.ts +34 -0
  15. package/js/components/FlexBox/Tests.d.ts +13 -0
  16. package/js/components/FlexBox/constants.d.ts +4 -0
  17. package/js/components/FlexBox/index.d.ts +50 -0
  18. package/js/components/FlexBox/types.d.ts +7 -0
  19. package/js/components/GridColumn/GridColumn.d.ts +48 -0
  20. package/js/components/GridColumn/GridColumnTests.d.ts +12 -0
  21. package/js/components/Heading/Tests.d.ts +11 -0
  22. package/js/components/Heading/constants.d.ts +21 -0
  23. package/js/components/Heading/index.d.ts +44 -0
  24. package/js/components/Heading/utils.d.ts +8 -0
  25. package/js/components/Icon/Tests.d.ts +14 -0
  26. package/js/components/Icon/constants.d.ts +1 -0
  27. package/js/components/Icon/index.d.ts +41 -0
  28. package/js/components/InputHelper/Tests.d.ts +12 -0
  29. package/js/components/InputHelper/constants.d.ts +3 -0
  30. package/js/components/InputHelper/index.d.ts +26 -0
  31. package/js/components/InputLabel/Tests.d.ts +12 -0
  32. package/js/components/InputLabel/index.d.ts +25 -0
  33. package/js/components/Link/Tests.d.ts +8 -0
  34. package/js/components/Message/Tests.d.ts +14 -0
  35. package/js/components/Message/index.d.ts +75 -0
  36. package/js/components/ProgressCircular/Stories.d.ts +30 -0
  37. package/js/components/ProgressCircular/Tests.d.ts +11 -0
  38. package/js/components/ProgressCircular/index.d.ts +52 -0
  39. package/js/components/ProgressLinear/Stories.d.ts +11 -0
  40. package/js/components/ProgressLinear/Tests.d.ts +11 -0
  41. package/js/components/ProgressLinear/index.d.ts +27 -0
  42. package/js/components/RadioButton/Tests.d.ts +15 -0
  43. package/js/components/RadioButton/index.d.ts +45 -0
  44. package/js/components/RawClickable/Tests.d.ts +14 -0
  45. package/js/components/RawClickable/index.d.ts +14 -0
  46. package/js/components/Skeleton/SkeletonCircle.d.ts +32 -0
  47. package/js/components/Skeleton/SkeletonCircleTests.d.ts +12 -0
  48. package/js/components/Skeleton/SkeletonRectangle.d.ts +47 -0
  49. package/js/components/Skeleton/SkeletonRectangleTests.d.ts +13 -0
  50. package/js/components/Skeleton/SkeletonTypography.d.ts +37 -0
  51. package/js/components/Skeleton/SkeletonTypographyTests.d.ts +13 -0
  52. package/js/components/Skeleton/index.d.ts +3 -0
  53. package/js/components/Switch/Tests.d.ts +15 -0
  54. package/js/components/Switch/index.d.ts +47 -0
  55. package/js/components/Table/TableCell.d.ts +55 -0
  56. package/js/components/Table/TableCellTests.d.ts +11 -0
  57. package/js/components/Table/Tests.d.ts +11 -0
  58. package/js/components/Table/constants.d.ts +9 -0
  59. package/js/components/Text/Tests.d.ts +10 -0
  60. package/js/components/Text/index.d.ts +935 -0
  61. package/js/components/Thumbnail/Tests.d.ts +11 -0
  62. package/js/components/Thumbnail/index.d.ts +84 -0
  63. package/js/components/Thumbnail/types.d.ts +45 -0
  64. package/js/components/Thumbnail/utils.d.ts +79 -0
  65. package/js/components/Toolbar/Tests.d.ts +12 -0
  66. package/js/constants/enums/index.d.ts +9 -0
  67. package/js/constants/enums/index.js +10 -1
  68. package/js/constants/index.js +1 -1
  69. package/js/types/AriaAttributes.d.ts +29 -2
  70. package/js/types/PartialBy.d.ts +12 -0
  71. package/js/types/index.d.ts +2 -0
  72. package/js/types/jsx/PropsToOverride.d.ts +2 -0
  73. package/js/utils/classNames/bem/block.d.ts +3 -2
  74. package/js/utils/classNames/bem/element.d.ts +3 -2
  75. package/js/utils/classNames/bem/index.d.ts +5 -4
  76. package/package.json +32 -9
  77. package/stories/controls/color.d.ts +15 -0
  78. package/stories/controls/element.d.ts +16 -0
  79. package/stories/controls/focusPoint.d.ts +8 -0
  80. package/stories/controls/icons.d.ts +66 -0
  81. package/stories/controls/image.d.ts +96 -0
  82. package/stories/controls/selectArgType.d.ts +7 -0
  83. package/stories/controls/theme.d.ts +7 -0
  84. package/stories/controls/typography.d.ts +8 -0
  85. package/stories/controls/withUndefined.d.ts +1 -0
  86. package/stories/types.d.ts +48 -0
  87. package/stories/utils/combinations.d.ts +100 -0
  88. package/stories/utils/concatPath.d.ts +10 -0
  89. package/stories/utils/disableArgTypes.d.ts +7 -0
  90. package/stories/utils/initDemoShadowDOMPortal.d.ts +5 -0
  91. package/stories/utils/lorem.d.ts +7 -0
  92. package/stories/utils/toFlattenProps.d.ts +12 -0
  93. package/stories/utils/withCategory.d.ts +4 -0
  94. package/testing/commonTestsSuiteTL.d.ts +87 -0
  95. package/testing/index.d.ts +1 -0
  96. package/testing/queries.d.ts +4 -0
  97. package/js/utils/events/index.js +0 -2
@@ -0,0 +1,7 @@
1
+ export declare const themeArgType: {
2
+ control: string;
3
+ options: {
4
+ readonly light: "light";
5
+ readonly dark: "dark";
6
+ };
7
+ };
@@ -0,0 +1,8 @@
1
+ export declare const ALL_TYPOGRAPHY: ("caption" | "title" | "overline" | "body1" | "body2" | "subtitle1" | "subtitle2" | "headline" | "display1" | "custom-title1" | "custom-title2" | "custom-title3" | "custom-title4" | "custom-title5" | "custom-title6" | "custom-intro" | "custom-body-large" | "custom-body" | "custom-quote" | "custom-publish-info" | "custom-button")[];
2
+ export declare const allTypographyArgType: {
3
+ control: {
4
+ type: "select" | "inline-radio";
5
+ };
6
+ options: ("caption" | "title" | "overline" | "body1" | "body2" | "subtitle1" | "subtitle2" | "headline" | "display1" | "custom-title1" | "custom-title2" | "custom-title3" | "custom-title4" | "custom-title5" | "custom-title6" | "custom-intro" | "custom-body-large" | "custom-body" | "custom-quote" | "custom-publish-info" | "custom-button")[];
7
+ mapping: Record<string, "caption" | "title" | "overline" | "body1" | "body2" | "subtitle1" | "subtitle2" | "headline" | "display1" | "custom-title1" | "custom-title2" | "custom-title3" | "custom-title4" | "custom-title5" | "custom-title6" | "custom-intro" | "custom-body-large" | "custom-body" | "custom-quote" | "custom-publish-info" | "custom-button"> | undefined;
8
+ };
@@ -0,0 +1 @@
1
+ export declare const withUndefined: <E>(options: Array<E> | Record<string, E>) => (E | undefined)[];
@@ -0,0 +1,48 @@
1
+ import type { CombinationsOptions } from './utils/combinations';
2
+ /** Storybook decorator function */
3
+ type Decorator = (story: any, context: any) => any;
4
+ /** Framework-specific decorators (injectable by React/Vue consumers) */
5
+ interface StoryDecorators {
6
+ /** Decorator to wrap a story with a container element */
7
+ withWrapper?: (props: Record<string, any>, as?: any) => Decorator;
8
+ /** Decorator to render a story in a combinations matrix */
9
+ withCombinations?: (options: CombinationsOptions) => Decorator;
10
+ /** Decorator adding a themed background (light/dark) based on the `theme` arg */
11
+ withThemedBackground?: () => Decorator;
12
+ /** manages nested props */
13
+ withNestedProps?: () => Decorator;
14
+ /** Decorator wrapping story in a resizable box */
15
+ withResizableBox?: (options?: Record<string, any>) => Decorator;
16
+ }
17
+ /** A partial Storybook story object (args, argTypes, render, decorators, etc.) */
18
+ type StoryOverride = Record<string, any>;
19
+ /** Base options shared by all setup functions. */
20
+ interface SetupStoriesBaseOptions {
21
+ /** The component to create stories for */
22
+ component: any;
23
+ /** Base render */
24
+ render?: any;
25
+ /** Base args */
26
+ args?: any;
27
+ }
28
+ /**
29
+ * Generic options for setting up component stories.
30
+ */
31
+ export type SetupStoriesOptions<TConfig extends {
32
+ overrides?: string;
33
+ decorators?: keyof StoryDecorators;
34
+ components?: Record<string, any>;
35
+ } = Record<string, never>> = SetupStoriesBaseOptions & (TConfig extends {
36
+ overrides: infer O extends string;
37
+ } ? {
38
+ overrides?: Partial<Record<O, StoryOverride>>;
39
+ } : unknown) & (TConfig extends {
40
+ decorators: infer D extends keyof StoryDecorators;
41
+ } ? {
42
+ decorators: Pick<Required<StoryDecorators>, D> & StoryDecorators;
43
+ } : unknown) & (TConfig extends {
44
+ components: infer C;
45
+ } ? {
46
+ components: C;
47
+ } : unknown);
48
+ export {};
@@ -0,0 +1,100 @@
1
+ /** A tuple of [label, props] representing a single combination entry */
2
+ export type PropEntry = [key: string, value: unknown];
3
+ /** Object format for combinations: { 'label': { prop: value }, ... } */
4
+ export type PropCombination = Record<string, Record<string, unknown>>;
5
+ /** Array format for combinations: { key: 'propName', options: [...] } */
6
+ export type PropArrayCombination = {
7
+ key: string;
8
+ options: Array<any>;
9
+ };
10
+ /** Either format for defining combinations */
11
+ export type Combination = PropArrayCombination | PropCombination;
12
+ /** Style properties (compatible with both React and Vue) */
13
+ export type CSSProperties = Record<string, any>;
14
+ /** Options for the withCombinations decorator */
15
+ export type CombinationsOptions = {
16
+ /** Props combinations */
17
+ combinations: {
18
+ rows?: Combination;
19
+ cols?: Combination;
20
+ sections?: Combination;
21
+ };
22
+ /** Inject style on table */
23
+ tableStyle?: CSSProperties;
24
+ /** Inject style on first col */
25
+ firstColStyle?: CSSProperties;
26
+ /** Inject style on sections */
27
+ sectionStyle?: CSSProperties;
28
+ /** Inject style on cols */
29
+ colStyle?: CSSProperties;
30
+ /** Inject style on cells */
31
+ cellStyle?: CSSProperties;
32
+ /** Combinator function */
33
+ combinator?: (a: any, b: any) => any;
34
+ /** Exclude a combination */
35
+ excludeCombination?: (args: any) => boolean;
36
+ };
37
+ /**
38
+ * Convert an array of values into PropEntry tuples
39
+ */
40
+ export declare const toProps: <E>(arr: Array<E>, prop: string) => PropEntry[];
41
+ /**
42
+ * Type guard to check if a combination is in array format
43
+ */
44
+ export declare const isArrayConfig: (c?: Combination) => c is PropArrayCombination;
45
+ /**
46
+ * Convert a Combination config into an array of PropEntry tuples
47
+ */
48
+ export declare function toPropEntries(config?: Combination): PropEntry[];
49
+ /** Data for a single cell in the matrix */
50
+ export type CellData = {
51
+ key: string;
52
+ args: Record<string, any>;
53
+ excluded: boolean;
54
+ };
55
+ /** Data for a single row in the matrix */
56
+ export type RowData = {
57
+ key: string;
58
+ args: Record<string, any>;
59
+ excluded: boolean;
60
+ cells: CellData[];
61
+ };
62
+ /** Data for a single section in the matrix */
63
+ export type SectionData = {
64
+ key: string;
65
+ args: Record<string, any>;
66
+ cols: PropEntry[];
67
+ rows: RowData[];
68
+ };
69
+ /** Complete matrix data for rendering */
70
+ export type MatrixData = {
71
+ sections: SectionData[];
72
+ hasRows: boolean;
73
+ hasCols: boolean;
74
+ };
75
+ /** Default table style */
76
+ export declare const DEFAULT_TABLE_STYLE: CSSProperties;
77
+ /** Default combinator function */
78
+ export declare const defaultCombinator: {
79
+ <T extends {}, U>(target: T, source: U): T & U;
80
+ <T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
81
+ <T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
82
+ (target: object, ...sources: any[]): any;
83
+ };
84
+ /**
85
+ * Combinator that merges arrays instead of overwriting them.
86
+ * Useful for combining props like `marginAuto: ['left', 'top']` from rows and cols.
87
+ */
88
+ export declare const mergeArraysCombinator: import("lodash/fp").LodashMergeWith1x1;
89
+ /** Options for prepareMatrixData */
90
+ export type PrepareMatrixDataOptions = {
91
+ combinations: CombinationsOptions['combinations'];
92
+ baseArgs: Record<string, any>;
93
+ combinator?: (a: any, b: any) => any;
94
+ excludeCombination?: (args: any) => boolean;
95
+ };
96
+ /**
97
+ * Prepare the complete matrix data from combinations options.
98
+ * Returns all sections, rows, and cells pre-computed.
99
+ */
100
+ export declare function prepareMatrixData({ combinations, baseArgs, combinator, excludeCombination, }: PrepareMatrixDataOptions): MatrixData;
@@ -0,0 +1,10 @@
1
+ export type PathPart = string | number;
2
+ export type Path = PathPart | Array<PathPart>;
3
+ /**
4
+ * Concat flatten object path
5
+ *
6
+ * @example concatPath('foo', 'bar') // => 'foo.bar'
7
+ * @example concatPath(['foo', 0]) // => 'foo[0]'
8
+ * @example concatPath('foo', 0, ['bar']) // => 'foo[0].bar'
9
+ */
10
+ export declare const concatPath: (...prefix: Path[]) => string;
@@ -0,0 +1,7 @@
1
+ export declare function disableArgTypes(argTypes: string[]): {
2
+ [k: string]: {
3
+ table: {
4
+ disable: boolean;
5
+ };
6
+ };
7
+ };
@@ -0,0 +1,5 @@
1
+ /** Init a demo shadow DOM to use as portal container */
2
+ export declare const initDemoShadowDOMPortal: () => {
3
+ container: ShadowRoot;
4
+ teardown: () => void;
5
+ };
@@ -0,0 +1,7 @@
1
+ declare const types: {
2
+ readonly tiny: "Lorem ipsum quisque tincidunt lobortis dui non auctor. Donec porta, ligula volutpat\nvehicula aliquet, dui sapien tempus felis, sed.";
3
+ readonly short: "Lorem ipsum quisque tincidunt lobortis dui non auctor. Donec porta, ligula volutpat\nvehicula aliquet, dui sapien tempus felis, sed. Ullamco laboris nisi ut aliquid ex ea\ncommodi consequat. Inmensae subtilitatis, obscuris et malesuada fames. Me non paenitet nullum\nfestiviorem excogitasse ad hoc. Cum ceteris in veneratione tui montes, nascetur mus. Etiam\nhabebis sem dicantur magna mollis euismod. Quis aute iure reprehenderit in voluptate velit esse.\nPhasellus laoreet lorem vel dolor tempus vehicula. Ambitioni dedisse scripsisse iudicaretur.\nPaullum deliquit, ponderibus modulisque suis ratio utitur. Ab illo tempore, ab est sed\nimmemorabili. Nec dubitamus multa iter quae et nos invenerat.";
4
+ readonly long: "Lorem ipsum quisque tincidunt lobortis dui non auctor. Donec porta, ligula volutpat\nvehicula aliquet, dui sapien tempus felis, sed. Ullamco laboris nisi ut aliquid ex ea\ncommodi consequat. Inmensae subtilitatis, obscuris et malesuada fames. Me non paenitet nullum\nfestiviorem excogitasse ad hoc. Cum ceteris in veneratione tui montes, nascetur mus. Etiam\nhabebis sem dicantur magna mollis euismod. Quis aute iure reprehenderit in voluptate velit esse.\nPhasellus laoreet lorem vel dolor tempus vehicula. Ambitioni dedisse scripsisse iudicaretur.\nPaullum deliquit, ponderibus modulisque suis ratio utitur. Ab illo tempore, ab est sed\nimmemorabili. Nec dubitamus multa iter quae et nos invenerat. Tu quoque, Brute, fili mi, nihil\ntimor populi, nihil! Morbi fringilla convallis sapien, id pulvinar odio volutpat. Cras mattis\niudicium purus sit amet fermentum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus.\nQuisque ut dolor gravida, placerat libero vel, euismod. Unam incolunt Belgae, aliam Aquitani,\ntertiam. Cras mattis iudicium purus sit amet fermentum. Prima luce, cum quibus mons aliud\nconsensu ab eo. Vivamus sagittis lacus vel augue laoreet rutrum faucibus. Petierunt uti sibi\nconcilium totius Galliae in diem certam indicere. Etiam habebis sem dicantur magna mollis\neuismod. A communi observantia non est recedendum. Ut enim ad minim veniam, quis nostrud\nexercitation. Paullum deliquit, ponderibus modulisque suis ratio utitur. Hi omnes lingua,\ninstitutis, legibus inter se differunt. Magna pars studiorum, prodita quaerimus. Quisque ut\ndolor gravida, placerat libero vel, euismod. Tityre, tu patulae recubans sub tegmine fagi dolor.\nExcepteur sint obcaecat cupiditat non proident culpa. Plura mihi bona sunt, inclinet, amari\npetere vellent. Quae vero auctorem tractata ab fiducia dicuntur. Inmensae subtilitatis, obscuris\net malesuada fames. Quo usque tandem abutere, Catilina, patientia nostra? Nihilne te nocturnum\npraesidium Palati, nihil urbis vigiliae. Curabitur blandit tempus ardua ridiculus sed magna. Tu\nquoque, Brute, fili mi, nihil timor populi, nihil! Nihil hic munitissimus habendi senatus locus,\nnihil horum?Tu quoque, Brute, fili mi, nihil timor populi, nihil! Tityre, tu patulae recubans\nsub tegmine fagi dolor. Plura mihi bona sunt, inclinet, amari petere vellent. Ullamco laboris\nnisi ut aliquid ex ea commodi consequat. Pellentesque habitant morbi tristique senectus et\nnetus. Salutantibus vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur\nadipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Petierunt uti sibi\nconcilium totius Galliae in diem certam indicere. Contra legem facit qui id facit quod lex\nprohibet. Integer legentibus erat a ante historiarum dapibus. Petierunt uti sibi concilium\ntotius Galliae in diem certam indicere. Ab illo tempore, ab est sed immemorabili. Nihil hic\nmunitissimus habendi senatus locus, nihil horum? Quisque ut dolor gravida, placerat libero vel,\neuismod. Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut\nlabore et dolore magna aliqua. Nec dubitamus multa iter quae et nos invenerat. Quam temere in\nvitiis, legem sancimus haerentia. Donec sed odio operae, eu vulputate felis rhoncus. Idque\nCaesaris facere voluntate liceret: sese habere. Paullum deliquit, ponderibus modulisque suis\nratio utitur. Quae vero auctorem tractata ab fiducia dicuntur. Gallia est omnis divisa in partes\ntres, quarum. Etiam habebis sem dicantur magna mollis euismod. Fabio vel iudice vincam, sunt in\nculpa qui officia. Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor\nincidunt ut labore et dolore magna aliqua. Tu quoque, Brute, fili mi, nihil timor populi, nihil!\nInteger legentibus erat a ante historiarum dapibus. Tityre, tu patulae recubans sub tegmine fagi\ndolor. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Idque Caesaris facere voluntate\nliceret: sese habere. Quid securi etiam tamquam eu fugiat nulla pariatur. Pellentesque habitant\nmorbi tristique senectus et netus. Ut enim ad minim veniam, quis nostrud exercitation. Petierunt\nuti sibi concilium totius Galliae in diem certam indicere. Curabitur est gravida et libero vitae\ndictum. Qui ipsorum lingua Celtae, nostra Galli appellantur. Quam temere in vitiis, legem\nsancimus haerentia. Phasellus laoreet lorem vel dolor tempus vehicula. Ab illo tempore, ab est\nsed immemorabili. Praeterea iter est quasdam res quas ex communi. Quo usque tandem abutere,\nCatilina, patientia nostra? Non equidem invideo, miror magis posuere velit aliquet. Excepteur\nsint obcaecat cupiditat non proident culpa. Curabitur blandit tempus ardua ridiculus sed magna.\nPlura mihi bona sunt, inclinet, amari petere vellent. Quae vero auctorem tractata ab fiducia\ndicuntur. Me non paenitet nullum festiviorem excogitasse ad hoc. Unam incolunt Belgae, aliam\nAquitani, tertiam.";
5
+ };
6
+ export declare const loremIpsum: (type: keyof typeof types) => string;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ type Props = Record<string, any>;
2
+ type OneOrMoreProps = Props | Array<Props>;
3
+ /**
4
+ * Build a flat props object from the given nested props
5
+ *
6
+ * @example toFlattenProps({ foo: { bar: 4 } }) // => { 'foo.bar': 4 }
7
+ * @example toFlattenProps({ foo: [{ bar: 4 }, { bar: 5 }] }) // => { 'foo[0].bar': 4, 'foo[0].bar': 5 }
8
+ */
9
+ export declare function toFlattenProps(props: {
10
+ [prefix: string]: OneOrMoreProps;
11
+ }): Props;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Add table.category to the provided argTypes
3
+ */
4
+ export declare function withCategory(category: string, argTypes: Record<string, any>): Record<string, any>;
@@ -0,0 +1,87 @@
1
+ import { Screen } from '@testing-library/dom';
2
+ import { GenericProps } from '../js/types';
3
+ import { Theme } from '../js/constants';
4
+ export type SetupResult = {
5
+ [propName: keyof GenericProps]: any;
6
+ };
7
+ export type SetupRenderOptions = {
8
+ [propName: keyof GenericProps]: any;
9
+ };
10
+ export type SetupOptions<Props extends GenericProps> = {
11
+ render: (props: Props, options?: SetupRenderOptions) => Partial<SetupResult>;
12
+ screen: Screen;
13
+ } & SetupRenderOptions;
14
+ export type SetupFunction = (props?: GenericProps, options?: SetupRenderOptions) => Partial<SetupResult>;
15
+ /**
16
+ * Configuration for an element affected by a theme.
17
+ */
18
+ export type AffectConfig<E> = {
19
+ element: E;
20
+ classModifier?: 'color' | 'theme';
21
+ inverted?: boolean;
22
+ };
23
+ /**
24
+ * Type utility to negate a configuration.
25
+ */
26
+ export type Not<E> = {
27
+ not: E;
28
+ };
29
+ /**
30
+ * Configuration for applying a theme to the component.
31
+ */
32
+ export type ApplyTheme<S extends GenericProps, Props extends GenericProps> = {
33
+ /** Element(s) to which we apply the theme class */
34
+ affects: Array<AffectConfig<keyof S> | Not<AffectConfig<keyof S>>>;
35
+ /** Apply theme via theme prop */
36
+ viaProp: boolean;
37
+ /** Apply theme via theme context */
38
+ viaContext: boolean;
39
+ /** Apply a default theme if no prop or context was provided */
40
+ defaultTheme?: Theme;
41
+ /** Default props to apply when testing theme */
42
+ defaultProps?: Props;
43
+ };
44
+ /**
45
+ * Options for the common tests suite.
46
+ */
47
+ export interface Options<Props extends Partial<GenericProps>> {
48
+ baseClassName: string;
49
+ forwardClassName?: keyof GenericProps;
50
+ forwardAttributes?: keyof GenericProps;
51
+ forwardRef?: keyof GenericProps;
52
+ applyTheme?: ApplyTheme<GenericProps, Props>;
53
+ }
54
+ /**
55
+ * Get the test elements based on the theme configuration.
56
+ *
57
+ * @param applyTheme The theme configuration.
58
+ * @return The test elements configuration.
59
+ */
60
+ export declare const getTestElements: <S extends GenericProps, Props extends GenericProps>(applyTheme: ApplyTheme<S, Props>) => {
61
+ element: any;
62
+ getExpectedClassModifier: (theme: Theme) => string;
63
+ shouldHaveModifier: boolean;
64
+ apply: string;
65
+ }[];
66
+ /**
67
+ * Expect the theme to be applied to the element.
68
+ *
69
+ * @param wrappers The wrappers returned by the setup function.
70
+ * @param elementConfig The configuration of the element to check.
71
+ * @param theme The theme to check.
72
+ * @param override Override the default expectations.
73
+ */
74
+ export declare const expectTheme: (wrappers: any, { element, getExpectedClassModifier, shouldHaveModifier }: any, theme: Theme, override?: {
75
+ shouldHaveModifier?: boolean;
76
+ }) => void;
77
+ /**
78
+ * Run common tests on a component.
79
+ *
80
+ * - Check base class name and class name forwarding
81
+ * - Check props forwarding
82
+ * - Check theme application via props, context, and default theme
83
+ *
84
+ * @param setup The setup function returns the wrapper and the component.
85
+ * @param options The options for the common tests.
86
+ */
87
+ export declare function commonTestsSuiteTL<Props extends GenericProps>(setup: SetupFunction, options: Options<Props>): void;
@@ -0,0 +1 @@
1
+ export * from './commonTestsSuiteTL';
@@ -0,0 +1,4 @@
1
+ export declare const queryAllByClassName: (container: HTMLElement, className: string) => HTMLElement[];
2
+ export declare const queryByClassName: import("@testing-library/dom").QueryBy<[className: string]>, getAllByClassName: import("@testing-library/dom").GetAllBy<[className: string]>, getByClassName: import("@testing-library/dom").GetBy<[className: string]>, findAllByClassName: import("@testing-library/dom").FindAllBy<[className: string]>, findByClassName: import("@testing-library/dom").FindBy<[className: string]>;
3
+ export declare const queryAllByTagName: (container: HTMLElement, tagName: string) => HTMLElement[];
4
+ export declare const queryByTagName: import("@testing-library/dom").QueryBy<[tagName: string]>, getAllByTagName: import("@testing-library/dom").GetAllBy<[tagName: string]>, getByTagName: import("@testing-library/dom").GetBy<[tagName: string]>, findAllByTagName: import("@testing-library/dom").FindAllBy<[tagName: string]>, findByTagName: import("@testing-library/dom").FindBy<[tagName: string]>;
@@ -1,2 +0,0 @@
1
- export { onButtonPressed, onEnterPressed, onEscapePressed } from './keyboard.js';
2
- export { detectHorizontalSwipe } from './swipe.js';