components-test-pb 0.1.3 → 0.1.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.
Files changed (195) hide show
  1. package/dist/components/Button/src/Button.d.ts +2 -0
  2. package/dist/components/Button/src/Button.js +8 -0
  3. package/dist/components/Button/src/Button.types.d.ts +17 -0
  4. package/dist/components/Button/src/index.d.ts +5 -0
  5. package/dist/components/Button/src/index.js +4 -0
  6. package/dist/components/Button/src/renderButton.d.ts +3 -0
  7. package/dist/components/Button/src/renderButton.js +6 -0
  8. package/dist/{Components/Button → components/Button/src}/useButton.d.ts +1 -1
  9. package/dist/components/Button/src/useButton.js +15 -0
  10. package/dist/{Components/Button → components/Button/src}/useButtonStyles.styles.d.ts +2 -2
  11. package/dist/components/Button/src/useButtonStyles.styles.js +30 -0
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/components/index.js +1 -0
  14. package/dist/index.d.ts +4 -12
  15. package/dist/index.js +2 -7
  16. package/dist/utilities/index.d.ts +2 -2
  17. package/dist/utilities/index.js +1 -1
  18. package/dist/utilities/src/ARIA/index.d.ts +2 -0
  19. package/dist/utilities/src/ARIA/index.js +1 -0
  20. package/dist/utilities/src/ARIA/types.d.ts +18 -0
  21. package/dist/utilities/src/ARIA/useARIAButtonProps.d.ts +2 -0
  22. package/dist/utilities/src/ARIA/useARIAButtonProps.js +61 -0
  23. package/dist/utilities/src/compose/assertSlots.d.ts +5 -0
  24. package/dist/utilities/src/compose/assertSlots.js +13 -0
  25. package/dist/utilities/src/compose/index.d.ts +3 -0
  26. package/dist/utilities/src/compose/index.js +2 -0
  27. package/dist/utilities/src/compose/slot.d.ts +11 -0
  28. package/dist/utilities/src/compose/slot.js +25 -0
  29. package/dist/utilities/src/compose/types.d.ts +59 -0
  30. package/dist/utilities/src/index.d.ts +4 -0
  31. package/dist/utilities/src/index.js +2 -0
  32. package/package.json +4 -5
  33. package/src/components/Button/src/Button.tsx +10 -0
  34. package/src/components/Button/src/Button.types.ts +32 -0
  35. package/src/components/Button/src/index.ts +12 -0
  36. package/src/components/Button/src/renderButton.tsx +12 -0
  37. package/src/components/Button/src/useButton.ts +26 -0
  38. package/src/components/Button/src/useButtonStyles.styles.ts +77 -0
  39. package/src/components/index.ts +16 -0
  40. package/src/index.ts +36 -72
  41. package/src/utilities/index.ts +30 -2
  42. package/src/utilities/src/ARIA/index.ts +11 -0
  43. package/src/utilities/src/ARIA/types.ts +58 -0
  44. package/src/utilities/src/ARIA/useARIAButtonProps.ts +74 -0
  45. package/src/utilities/src/compose/assertSlots.ts +20 -0
  46. package/src/utilities/src/compose/index.ts +25 -0
  47. package/src/utilities/src/compose/slot.ts +49 -0
  48. package/src/utilities/src/compose/types.ts +120 -0
  49. package/src/utilities/src/index.ts +35 -0
  50. package/tsconfig.json +2 -2
  51. package/dist/Components/Button/Button.d.ts +0 -3
  52. package/dist/Components/Button/Button.js +0 -8
  53. package/dist/Components/Button/Button.types.d.ts +0 -15
  54. package/dist/Components/Button/index.d.ts +0 -5
  55. package/dist/Components/Button/index.js +0 -4
  56. package/dist/Components/Button/renderButton.d.ts +0 -3
  57. package/dist/Components/Button/renderButton.js +0 -6
  58. package/dist/Components/Button/useButton.js +0 -19
  59. package/dist/Components/Button/useButtonStyles.styles.js +0 -145
  60. package/dist/Components/Table/Table.d.ts +0 -3
  61. package/dist/Components/Table/Table.js +0 -8
  62. package/dist/Components/Table/Table.types.d.ts +0 -9
  63. package/dist/Components/Table/TableBody.d.ts +0 -3
  64. package/dist/Components/Table/TableBody.js +0 -8
  65. package/dist/Components/Table/TableBody.types.d.ts +0 -6
  66. package/dist/Components/Table/TableBody.types.js +0 -1
  67. package/dist/Components/Table/TableCell.d.ts +0 -3
  68. package/dist/Components/Table/TableCell.js +0 -8
  69. package/dist/Components/Table/TableCell.types.d.ts +0 -6
  70. package/dist/Components/Table/TableCell.types.js +0 -1
  71. package/dist/Components/Table/TableHeader.d.ts +0 -3
  72. package/dist/Components/Table/TableHeader.js +0 -8
  73. package/dist/Components/Table/TableHeader.types.d.ts +0 -6
  74. package/dist/Components/Table/TableHeader.types.js +0 -1
  75. package/dist/Components/Table/TableHeaderCell.d.ts +0 -3
  76. package/dist/Components/Table/TableHeaderCell.js +0 -8
  77. package/dist/Components/Table/TableHeaderCell.types.d.ts +0 -10
  78. package/dist/Components/Table/TableHeaderCell.types.js +0 -1
  79. package/dist/Components/Table/TableRow.d.ts +0 -3
  80. package/dist/Components/Table/TableRow.js +0 -8
  81. package/dist/Components/Table/TableRow.types.d.ts +0 -8
  82. package/dist/Components/Table/TableRow.types.js +0 -1
  83. package/dist/Components/Table/index.d.ts +0 -30
  84. package/dist/Components/Table/index.js +0 -24
  85. package/dist/Components/Table/renderTable.d.ts +0 -3
  86. package/dist/Components/Table/renderTable.js +0 -6
  87. package/dist/Components/Table/renderTableBody.d.ts +0 -3
  88. package/dist/Components/Table/renderTableBody.js +0 -6
  89. package/dist/Components/Table/renderTableCell.d.ts +0 -3
  90. package/dist/Components/Table/renderTableCell.js +0 -6
  91. package/dist/Components/Table/renderTableHeader.d.ts +0 -3
  92. package/dist/Components/Table/renderTableHeader.js +0 -6
  93. package/dist/Components/Table/renderTableHeaderCell.d.ts +0 -3
  94. package/dist/Components/Table/renderTableHeaderCell.js +0 -6
  95. package/dist/Components/Table/renderTableRow.d.ts +0 -3
  96. package/dist/Components/Table/renderTableRow.js +0 -6
  97. package/dist/Components/Table/useTable.d.ts +0 -2
  98. package/dist/Components/Table/useTable.js +0 -9
  99. package/dist/Components/Table/useTableBody.d.ts +0 -2
  100. package/dist/Components/Table/useTableBody.js +0 -6
  101. package/dist/Components/Table/useTableBodyStyles.styles.d.ts +0 -4
  102. package/dist/Components/Table/useTableBodyStyles.styles.js +0 -12
  103. package/dist/Components/Table/useTableCell.d.ts +0 -2
  104. package/dist/Components/Table/useTableCell.js +0 -6
  105. package/dist/Components/Table/useTableCellStyles.styles.d.ts +0 -4
  106. package/dist/Components/Table/useTableCellStyles.styles.js +0 -17
  107. package/dist/Components/Table/useTableHeader.d.ts +0 -2
  108. package/dist/Components/Table/useTableHeader.js +0 -6
  109. package/dist/Components/Table/useTableHeaderCell.d.ts +0 -2
  110. package/dist/Components/Table/useTableHeaderCell.js +0 -12
  111. package/dist/Components/Table/useTableHeaderCellStyles.styles.d.ts +0 -4
  112. package/dist/Components/Table/useTableHeaderCellStyles.styles.js +0 -27
  113. package/dist/Components/Table/useTableHeaderStyles.styles.d.ts +0 -4
  114. package/dist/Components/Table/useTableHeaderStyles.styles.js +0 -12
  115. package/dist/Components/Table/useTableRow.d.ts +0 -2
  116. package/dist/Components/Table/useTableRow.js +0 -8
  117. package/dist/Components/Table/useTableRowStyles.styles.d.ts +0 -4
  118. package/dist/Components/Table/useTableRowStyles.styles.js +0 -31
  119. package/dist/Components/Table/useTableStyles.styles.d.ts +0 -4
  120. package/dist/Components/Table/useTableStyles.styles.js +0 -22
  121. package/dist/Components/Text/Text.d.ts +0 -3
  122. package/dist/Components/Text/Text.js +0 -8
  123. package/dist/Components/Text/Text.types.d.ts +0 -11
  124. package/dist/Components/Text/Text.types.js +0 -1
  125. package/dist/Components/Text/index.d.ts +0 -5
  126. package/dist/Components/Text/index.js +0 -4
  127. package/dist/Components/Text/renderText.d.ts +0 -3
  128. package/dist/Components/Text/renderText.js +0 -6
  129. package/dist/Components/Text/useText.d.ts +0 -2
  130. package/dist/Components/Text/useText.js +0 -10
  131. package/dist/Components/Text/useTextStyles.styles.d.ts +0 -4
  132. package/dist/Components/Text/useTextStyles.styles.js +0 -74
  133. package/dist/Theme/tokens.d.ts +0 -81
  134. package/dist/Theme/tokens.js +0 -80
  135. package/dist/Types/compose/index.d.ts +0 -1
  136. package/dist/Types/compose/index.js +0 -1
  137. package/dist/Types/compose/types.d.ts +0 -34
  138. package/dist/Types/utils/index.d.ts +0 -1
  139. package/dist/Types/utils/index.js +0 -1
  140. package/dist/Types/utils/types.d.ts +0 -168
  141. package/dist/Types/utils/types.js +0 -2
  142. package/dist/utilities/useARIAButtonProps.d.ts +0 -16
  143. package/dist/utilities/useARIAButtonProps.js +0 -75
  144. package/src/Components/Button/Button.tsx +0 -13
  145. package/src/Components/Button/Button.types.ts +0 -26
  146. package/src/Components/Button/index.ts +0 -11
  147. package/src/Components/Button/renderButton.tsx +0 -9
  148. package/src/Components/Button/useButton.ts +0 -27
  149. package/src/Components/Button/useButtonStyles.styles.ts +0 -198
  150. package/src/Components/Table/Table.tsx +0 -13
  151. package/src/Components/Table/Table.types.ts +0 -13
  152. package/src/Components/Table/TableBody.tsx +0 -13
  153. package/src/Components/Table/TableBody.types.ts +0 -9
  154. package/src/Components/Table/TableCell.tsx +0 -13
  155. package/src/Components/Table/TableCell.types.ts +0 -9
  156. package/src/Components/Table/TableHeader.tsx +0 -13
  157. package/src/Components/Table/TableHeader.types.ts +0 -9
  158. package/src/Components/Table/TableHeaderCell.tsx +0 -13
  159. package/src/Components/Table/TableHeaderCell.types.ts +0 -13
  160. package/src/Components/Table/TableRow.tsx +0 -13
  161. package/src/Components/Table/TableRow.types.ts +0 -12
  162. package/src/Components/Table/index.ts +0 -35
  163. package/src/Components/Table/renderTable.tsx +0 -9
  164. package/src/Components/Table/renderTableBody.tsx +0 -9
  165. package/src/Components/Table/renderTableCell.tsx +0 -9
  166. package/src/Components/Table/renderTableHeader.tsx +0 -9
  167. package/src/Components/Table/renderTableHeaderCell.tsx +0 -9
  168. package/src/Components/Table/renderTableRow.tsx +0 -9
  169. package/src/Components/Table/useTable.ts +0 -14
  170. package/src/Components/Table/useTableBody.ts +0 -9
  171. package/src/Components/Table/useTableBodyStyles.styles.ts +0 -23
  172. package/src/Components/Table/useTableCell.ts +0 -9
  173. package/src/Components/Table/useTableCellStyles.styles.ts +0 -28
  174. package/src/Components/Table/useTableHeader.ts +0 -9
  175. package/src/Components/Table/useTableHeaderCell.ts +0 -19
  176. package/src/Components/Table/useTableHeaderCellStyles.styles.ts +0 -40
  177. package/src/Components/Table/useTableHeaderStyles.styles.ts +0 -23
  178. package/src/Components/Table/useTableRow.ts +0 -13
  179. package/src/Components/Table/useTableRowStyles.styles.ts +0 -45
  180. package/src/Components/Table/useTableStyles.styles.ts +0 -35
  181. package/src/Components/Text/Text.tsx +0 -13
  182. package/src/Components/Text/Text.types.ts +0 -21
  183. package/src/Components/Text/index.ts +0 -11
  184. package/src/Components/Text/renderText.tsx +0 -9
  185. package/src/Components/Text/useText.ts +0 -15
  186. package/src/Components/Text/useTextStyles.styles.ts +0 -103
  187. package/src/Theme/tokens.ts +0 -98
  188. package/src/Types/compose/index.ts +0 -12
  189. package/src/Types/compose/types.ts +0 -87
  190. package/src/Types/utils/index.ts +0 -30
  191. package/src/Types/utils/types.ts +0 -223
  192. package/src/utilities/useARIAButtonProps.ts +0 -106
  193. /package/dist/{Components/Button → components/Button/src}/Button.types.js +0 -0
  194. /package/dist/{Types/compose → utilities/src/ARIA}/types.js +0 -0
  195. /package/dist/{Components/Table/Table.types.js → utilities/src/compose/types.js} +0 -0
@@ -1,23 +0,0 @@
1
- import { makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableBodySlots, TableBodyState } from './TableBody.types.js';
4
-
5
- export const tableBodyClassNames: SlotClassNames<TableBodySlots> = {
6
- root: 'TableBody'
7
- };
8
-
9
- const useRootBaseClassName = makeResetStyles({
10
- display: 'table-row-group',
11
- });
12
-
13
- export const useTableBodyStyles = (state: TableBodyState): TableBodyState => {
14
- const rootBaseClassName = useRootBaseClassName();
15
-
16
- state.root.className = mergeClasses(
17
- tableBodyClassNames.root,
18
- rootBaseClassName,
19
- state.root.className,
20
- );
21
-
22
- return state;
23
- };
@@ -1,9 +0,0 @@
1
- import type { TableCellProps, TableCellState } from './TableCell.types.js';
2
-
3
- export const useTableCell = (props: TableCellProps): TableCellState => {
4
- return {
5
- components: { root: 'td' },
6
-
7
- root: { ...props } as TableCellState['root'],
8
- };
9
- };
@@ -1,28 +0,0 @@
1
- import { makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableCellSlots, TableCellState } from './TableCell.types.js';
4
- import { Tokens } from '../../Theme/tokens.js';
5
-
6
- export const tableCellClassNames: SlotClassNames<TableCellSlots> = {
7
- root: 'TableCell'
8
- };
9
-
10
- const useRootBaseClassName = makeResetStyles({
11
- textAlign: 'left',
12
- paddingTop: Tokens.spacingS,
13
- paddingBottom: Tokens.spacingS,
14
- paddingLeft: Tokens.spacingM,
15
- paddingRight: Tokens.spacingM,
16
- });
17
-
18
- export const useTableCellStyles = (state: TableCellState): TableCellState => {
19
- const rootBaseClassName = useRootBaseClassName();
20
-
21
- state.root.className = mergeClasses(
22
- tableCellClassNames.root,
23
- rootBaseClassName,
24
- state.root.className,
25
- );
26
-
27
- return state;
28
- };
@@ -1,9 +0,0 @@
1
- import type { TableHeaderProps, TableHeaderState } from './TableHeader.types.js';
2
-
3
- export const useTableHeader = (props: TableHeaderProps): TableHeaderState => {
4
- return {
5
- components: { root: 'thead' },
6
-
7
- root: { ...props } as TableHeaderState['root'],
8
- };
9
- };
@@ -1,19 +0,0 @@
1
- import type { TableHeaderCellProps, TableHeaderCellState } from './TableHeaderCell.types.js';
2
-
3
- export const useTableHeaderCell = (props: TableHeaderCellProps): TableHeaderCellState => {
4
- const { sortDirection, ...rest } = props;
5
-
6
- const root = { ...rest } as TableHeaderCellState['root'];
7
-
8
- if (sortDirection) {
9
- root['aria-sort'] = sortDirection;
10
- }
11
-
12
- return {
13
- sortDirection,
14
-
15
- components: { root: 'th' },
16
-
17
- root,
18
- };
19
- };
@@ -1,40 +0,0 @@
1
- import { makeStyles, makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell.types.js';
4
- import { Tokens } from '../../Theme/tokens.js';
5
-
6
- export const tableHeaderCellClassNames: SlotClassNames<TableHeaderCellSlots> = {
7
- root: 'TableHeaderCell'
8
- };
9
-
10
- const useRootBaseClassName = makeResetStyles({
11
- fontWeight: Tokens.fontWeightSemibold,
12
- textAlign: 'left',
13
- paddingTop: Tokens.spacingS,
14
- paddingBottom: Tokens.spacingS,
15
- paddingLeft: Tokens.spacingM,
16
- paddingRight: Tokens.spacingM,
17
- });
18
-
19
- const useRootStyles = makeStyles({
20
- ascending: {
21
- cursor: 'pointer',
22
- },
23
- descending: {
24
- cursor: 'pointer',
25
- },
26
- });
27
-
28
- export const useTableHeaderCellStyles = (state: TableHeaderCellState): TableHeaderCellState => {
29
- const rootBaseClassName = useRootBaseClassName();
30
- const rootStyles = useRootStyles();
31
-
32
- state.root.className = mergeClasses(
33
- tableHeaderCellClassNames.root,
34
- rootBaseClassName,
35
- state.sortDirection && rootStyles[state.sortDirection],
36
- state.root.className,
37
- );
38
-
39
- return state;
40
- };
@@ -1,23 +0,0 @@
1
- import { makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableHeaderSlots, TableHeaderState } from './TableHeader.types.js';
4
-
5
- export const tableHeaderClassNames: SlotClassNames<TableHeaderSlots> = {
6
- root: 'TableHeader'
7
- };
8
-
9
- const useRootBaseClassName = makeResetStyles({
10
- display: 'table-header-group',
11
- });
12
-
13
- export const useTableHeaderStyles = (state: TableHeaderState): TableHeaderState => {
14
- const rootBaseClassName = useRootBaseClassName();
15
-
16
- state.root.className = mergeClasses(
17
- tableHeaderClassNames.root,
18
- rootBaseClassName,
19
- state.root.className,
20
- );
21
-
22
- return state;
23
- };
@@ -1,13 +0,0 @@
1
- import type { TableRowProps, TableRowState } from './TableRow.types.js';
2
-
3
- export const useTableRow = (props: TableRowProps): TableRowState => {
4
- const { appearance, ...rest } = props;
5
-
6
- return {
7
- appearance: appearance ?? 'none',
8
-
9
- components: { root: 'tr' },
10
-
11
- root: { ...rest } as TableRowState['root'],
12
- };
13
- };
@@ -1,45 +0,0 @@
1
- import { makeStyles, makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableRowSlots, TableRowState } from './TableRow.types.js';
4
- import { Tokens } from '../../Theme/tokens.js';
5
-
6
- export const tableRowClassNames: SlotClassNames<TableRowSlots> = {
7
- root: 'TableRow'
8
- };
9
-
10
- const useRootBaseClassName = makeResetStyles({
11
- borderBottom: `${Tokens.strokeWidthThin} solid ${Tokens.colorNeutralStroke1}`,
12
- transitionDuration: Tokens.durationNormal,
13
- transitionProperty: 'background',
14
- transitionTimingFunction: Tokens.curveEasy,
15
- });
16
-
17
- const useRootStyles = makeStyles({
18
- none: {
19
- ':hover': {
20
- backgroundColor: Tokens.colorNeutralBackground1Hover,
21
- },
22
- },
23
- brand: {
24
- backgroundColor: Tokens.colorBrandBackground,
25
- color: Tokens.colorBrandForeground1,
26
-
27
- ':hover': {
28
- backgroundColor: Tokens.colorBrandBackgroundHover,
29
- },
30
- },
31
- });
32
-
33
- export const useTableRowStyles = (state: TableRowState): TableRowState => {
34
- const rootBaseClassName = useRootBaseClassName();
35
- const rootStyles = useRootStyles();
36
-
37
- state.root.className = mergeClasses(
38
- tableRowClassNames.root,
39
- rootBaseClassName,
40
- rootStyles[state.appearance],
41
- state.root.className,
42
- );
43
-
44
- return state;
45
- };
@@ -1,35 +0,0 @@
1
- import { makeStyles, makeResetStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TableSlots, TableState } from './Table.types.js';
4
- import { Tokens } from '../../Theme/tokens.js';
5
-
6
- export const tableClassNames: SlotClassNames<TableSlots> = {
7
- root: 'Table'
8
- };
9
-
10
- const useRootBaseClassName = makeResetStyles({
11
- borderCollapse: 'collapse',
12
- width: '100%',
13
- fontFamily: Tokens.fontFamilyBase,
14
- fontSize: Tokens.fontSize300,
15
- lineHeight: Tokens.lineHeight300,
16
- });
17
-
18
- const useRootStyles = makeStyles({
19
- small: {},
20
- medium: {},
21
- });
22
-
23
- export const useTableStyles = (state: TableState): TableState => {
24
- const rootBaseClassName = useRootBaseClassName();
25
- const rootStyles = useRootStyles();
26
-
27
- state.root.className = mergeClasses(
28
- tableClassNames.root,
29
- rootBaseClassName,
30
- rootStyles[state.size],
31
- state.root.className,
32
- );
33
-
34
- return state;
35
- };
@@ -1,13 +0,0 @@
1
- import type { FC } from '../../Types/utils/types.js';
2
- import type { TextProps } from './Text.types.js';
3
- import { useText } from './useText.js';
4
- import { renderText } from './renderText.js';
5
- import { useTextStyles } from './useTextStyles.styles.js';
6
-
7
- export const Text: FC<TextProps> = (props) => {
8
- const state = useText(props);
9
-
10
- useTextStyles(state);
11
-
12
- return renderText(state);
13
- };
@@ -1,21 +0,0 @@
1
- import type { ComponentProps, ComponentState, Slot } from '../../Types/compose/types.js';
2
-
3
- export type TextSlots = {
4
- root: Slot<'span', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'pre' | 'strong' | 'b' | 'em' | 'i'>;
5
- };
6
-
7
- export type TextProps = ComponentProps<TextSlots> & {
8
- font?: 'base' | 'monospace' | 'numeric';
9
- size?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000;
10
- weight?: 'regular' | 'medium' | 'semibold' | 'bold';
11
- }
12
-
13
- export type TextPresetProps = Omit<TextProps, 'font' | 'size' | 'weight'>;
14
-
15
- export type TextState = ComponentState<TextSlots> &
16
- Required<
17
- Pick<
18
- TextProps,
19
- 'font' | 'size' | 'weight'
20
- >
21
- >;
@@ -1,11 +0,0 @@
1
- export type {
2
- TextSlots,
3
- TextProps,
4
- TextPresetProps,
5
- TextState,
6
- } from './Text.types.js';
7
-
8
- export { Text } from './Text.js';
9
- export { useText } from './useText.js';
10
- export { renderText } from './renderText.js';
11
- export { useTextStyles } from './useTextStyles.styles.js';
@@ -1,9 +0,0 @@
1
- import type { Element } from '../../Types/utils/types.js';
2
- import type { TextState } from './Text.types.js';
3
-
4
- export const renderText = (state: TextState): Element => {
5
- const Root = state.components.root;
6
- const { as: _as, ...rootProps } = state.root;
7
-
8
- return <Root {...rootProps} />;
9
- };
@@ -1,15 +0,0 @@
1
- import type { TextProps, TextState } from './Text.types.js';
2
-
3
- export const useText = (props: TextProps): TextState => {
4
- const { font, size, weight, ...rest } = props;
5
-
6
- return {
7
- font: font ?? 'base',
8
- size: size ?? 300,
9
- weight: weight ?? 'regular',
10
-
11
- components: { root: rest.as ?? 'span' },
12
-
13
- root: { as: rest.as ?? 'span', ...rest } as TextState['root'],
14
- };
15
- };
@@ -1,103 +0,0 @@
1
- import { makeStyles, mergeClasses } from 'css-engine-test-pb';
2
- import { SlotClassNames } from '../../Types/compose/types.js';
3
- import { TextSlots, TextState } from './Text.types.js';
4
- import { Tokens } from '../../Theme/tokens.js';
5
-
6
-
7
- export const textClassNames: SlotClassNames<TextSlots> = {
8
- root: 'Text'
9
- };
10
-
11
- const useStyles = makeStyles({
12
- root: {
13
- fontFamily: 'Neue Montreal',
14
- fontSize: Tokens.fontSize300,
15
- lineHeight: Tokens.lineHeight300,
16
- fontWeight: Tokens.fontWeightRegular,
17
- display: 'inline',
18
- whiteSpace: 'normal',
19
- overflow: 'visible',
20
- textOverflow: 'clip'
21
- },
22
- size100: {
23
- fontSize: Tokens.fontSize100,
24
- lineHeight: Tokens.lineHeight100
25
- },
26
- size200: {
27
- fontSize: Tokens.fontSize200,
28
- lineHeight: Tokens.lineHeight200
29
- },
30
- size300: {
31
-
32
- },
33
- size400: {
34
- fontSize: Tokens.fontSize400,
35
- lineHeight: Tokens.lineHeight400
36
- },
37
- size500: {
38
- fontSize: Tokens.fontSize500,
39
- lineHeight: Tokens.lineHeight500
40
- },
41
- size600: {
42
- fontSize: Tokens.fontSize600,
43
- lineHeight: Tokens.lineHeight600
44
- },
45
- size700: {
46
- fontSize: Tokens.fontSize700,
47
- lineHeight: Tokens.lineHeight700
48
- },
49
- size800: {
50
- fontSize: Tokens.fontSize800,
51
- lineHeight: Tokens.lineHeight800
52
- },
53
- size900: {
54
- fontSize: Tokens.fontSize900,
55
- lineHeight: Tokens.lineHeight900
56
- },
57
- size1000: {
58
- fontSize: Tokens.fontSize1000,
59
- lineHeight: Tokens.lineHeight1000
60
- },
61
- monospace: {
62
- fontFamily: Tokens.fontFamilyMonospace
63
- },
64
- numeric: {
65
- fontFamily: Tokens.fontFamilyNumeric
66
- },
67
- weightMedium: {
68
- fontWeight: Tokens.fontWeightMedium
69
- },
70
- weightSemibold: {
71
- fontWeight: Tokens.fontWeightSemibold
72
- },
73
- weightBold: {
74
- fontWeight: Tokens.fontWeightBold
75
- }
76
- });
77
-
78
- export const useTextStyles = (state: TextState): TextState => {
79
-
80
- const styles = useStyles();
81
-
82
- state.root.className = mergeClasses(
83
- textClassNames.root,
84
- styles.root,
85
- state.size === 100 && styles.size100,
86
- state.size === 200 && styles.size200,
87
- state.size === 300 && styles.size300,
88
- state.size === 400 && styles.size400,
89
- state.size === 500 && styles.size500,
90
- state.size === 600 && styles.size600,
91
- state.size === 700 && styles.size700,
92
- state.size === 800 && styles.size800,
93
- state.size === 900 && styles.size900,
94
- state.size === 1000 && styles.size1000,
95
- state.font === 'monospace' && styles.monospace,
96
- state.font === 'numeric' && styles.numeric,
97
- state.weight === 'medium' && styles.weightMedium,
98
- state.weight === 'semibold' && styles.weightSemibold,
99
- state.weight === 'bold' && styles.weightBold
100
- );
101
-
102
- return state;
103
- }
@@ -1,98 +0,0 @@
1
- export const Tokens = {
2
- fontFamilyBase: 'Neue Montreal',
3
- fontFamilyMonospace: "'Courier New', Courier, monospace",
4
- fontFamilyNumeric: 'Neue Montreal',
5
-
6
- fontSize100: '10px',
7
- fontSize200: '12px',
8
- fontSize300: '14px',
9
- fontSize400: '16px',
10
- fontSize500: '20px',
11
- fontSize600: '24px',
12
- fontSize700: '28px',
13
- fontSize800: '32px',
14
- fontSize900: '40px',
15
- fontSize1000: '68px',
16
-
17
- lineHeight100: '14px',
18
- lineHeight200: '16px',
19
- lineHeight300: '20px',
20
- lineHeight400: '22px',
21
- lineHeight500: '28px',
22
- lineHeight600: '32px',
23
- lineHeight700: '36px',
24
- lineHeight800: '40px',
25
- lineHeight900: '52px',
26
- lineHeight1000: '92px',
27
-
28
- fontWeightRegular: 450,
29
- fontWeightMedium: 530,
30
- fontWeightSemibold: 700,
31
- fontWeightBold: 800,
32
-
33
- borderRadiusNone: '0px',
34
- borderRadiusSmall: '2px',
35
- borderRadiusMedium: '4px',
36
- borderRadiusLarge: '6px',
37
- borderRadiusXLarge: '8px',
38
- borderRadiusCircular: '9999px',
39
-
40
- strokeWidthThin: '1px',
41
- strokeWidthThick: '2px',
42
- strokeWidthThicker: '4px',
43
-
44
- spacingXXS: '2px',
45
- spacingXS: '4px',
46
- spacingSNudge: '6px',
47
- spacingS: '8px',
48
- spacingMNudge: '10px',
49
- spacingM: '12px',
50
- spacingL: '16px',
51
- spacingXL: '20px',
52
- spacingXXL: '24px',
53
- spacingXXXL: '32px',
54
-
55
- colorNeutralForeground1: '#242424',
56
- colorNeutralForegroundDisabled: '#bdbdbd',
57
- colorNeutralForegroundOnBrand: '#ffffff',
58
-
59
- colorNeutralBackground1: '#ffffff',
60
- colorNeutralBackground1Hover: '#f5f5f5',
61
- colorNeutralBackground1Pressed: '#e0e0e0',
62
- colorNeutralBackground3: '#f5f5f5',
63
- colorNeutralBackgroundDisabled: '#f0f0f0',
64
-
65
- colorNeutralStroke1: '#cccccc',
66
- colorNeutralStroke1Hover: '#b3b3b3',
67
- colorNeutralStroke1Pressed: '#999999',
68
- colorNeutralStrokeDisabled: '#e0e0e0',
69
-
70
- colorBrandBackground: '#312dfb',
71
- colorBrandBackgroundHover: '#2b28e2',
72
- colorBrandBackgroundPressed: '#2522c9',
73
-
74
- colorBrandStroke1: '#312dfb',
75
- colorBrandStroke1Hover: '#2b28e2',
76
- colorBrandStroke1Pressed: '#2522c9',
77
-
78
- colorBrandForeground1: '#ffffff',
79
- colorBrandForeground1Hover: '#ffffff',
80
- colorBrandForeground1Pressed: '#ffffff',
81
-
82
- colorSubtleBackground: 'transparent',
83
- colorSubtleBackgroundHover: '#f5f5f5',
84
- colorSubtleBackgroundPressed: '#e0e0e0',
85
-
86
- colorTransparentBackground: 'transparent',
87
- colorTransparentStroke: 'transparent',
88
-
89
- durationNormal: '150ms',
90
- durationFast: '100ms',
91
- durationSlow: '300ms',
92
- curveEasy: 'cubic-bezier(0.33,0,0.67,1)',
93
- curveDecelerate: 'cubic-bezier(0,0,0,1)',
94
- curveAccelerate: 'cubic-bezier(1,0,1,1)',
95
-
96
- } as const;
97
-
98
- export type Tokens = typeof Tokens;
@@ -1,12 +0,0 @@
1
- export type {
2
- SlotShorthandValue,
3
- SlotPropsRecord,
4
- UnknownSlotProps,
5
- Slot,
6
- IsSingleton,
7
- AsIntrinsicElement,
8
- ExtractSlotProps,
9
- ComponentProps,
10
- ComponentState,
11
- SlotClassNames,
12
- } from './types.js';
@@ -1,87 +0,0 @@
1
- import type {
2
- ChildNode,
3
- ComponentType,
4
- IntrinsicElementKeys,
5
- IntrinsicElementProps,
6
- PropsWithoutChildren,
7
- ReplaceNullWithUndefined,
8
- HTMLAttributes,
9
- Element,
10
- } from '../utils/types.js';
11
-
12
- export type SlotShorthandValue = Element | string | number;
13
-
14
- export type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
15
-
16
- export type UnknownSlotProps = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {
17
- as?: IntrinsicElementKeys;
18
- children?: ChildNode;
19
- };
20
-
21
- type WithSlotShorthandValue<Props> =
22
- | Props
23
- | ('children' extends keyof Props ? Extract<SlotShorthandValue, Props['children']> : never);
24
-
25
- type EmptyIntrinsicElements =
26
- | 'area'
27
- | 'base'
28
- | 'br'
29
- | 'col'
30
- | 'embed'
31
- | 'hr'
32
- | 'img'
33
- | 'input'
34
- | 'link'
35
- | 'meta'
36
- | 'param'
37
- | 'source'
38
- | 'track'
39
- | 'wbr';
40
-
41
- type SlotIntrinsicElementProps<Type extends IntrinsicElementKeys> = Type extends EmptyIntrinsicElements
42
- ? PropsWithoutChildren<IntrinsicElementProps<Type>>
43
- : IntrinsicElementProps<Type>;
44
-
45
- export type Slot<
46
- Type extends IntrinsicElementKeys | ComponentType<any> | UnknownSlotProps,
47
- AlternateAs extends IntrinsicElementKeys = never,
48
- > = IsSingleton<Extract<Type, string>> extends true
49
- ?
50
- | WithSlotShorthandValue<
51
- Type extends IntrinsicElementKeys
52
- ? { as?: Type } & SlotIntrinsicElementProps<Type>
53
- : Type extends ComponentType<infer Props>
54
- ? Props extends UnknownSlotProps
55
- ? Props
56
- : Props
57
- : Type
58
- >
59
- | (AlternateAs extends unknown
60
- ? { as: AlternateAs } & SlotIntrinsicElementProps<AlternateAs>
61
- : never)
62
- | null
63
- : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
64
-
65
- export type IsSingleton<T extends string> = { [K in T]: Exclude<T, K> extends never ? true : false }[T];
66
-
67
- export type AsIntrinsicElement<As extends IntrinsicElementKeys> = { as?: As };
68
-
69
- export type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
70
-
71
- export type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> =
72
- Omit<Slots, Primary & 'root'> &
73
- ExtractSlotProps<Slots[Primary]>;
74
-
75
- export type ComponentState<Slots extends SlotPropsRecord> = {
76
- components: {
77
- [Key in keyof Slots]-?: IntrinsicElementKeys | ComponentType;
78
- };
79
- } & {
80
- [Key in keyof Slots]: ReplaceNullWithUndefined<
81
- Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>
82
- >;
83
- };
84
-
85
- export type SlotClassNames<Slots> = {
86
- [SlotName in keyof Slots]-?: string;
87
- };
@@ -1,30 +0,0 @@
1
- export type {
2
- ElementProps,
3
- Element,
4
- ElementChild,
5
- FC,
6
- HTMLAttributes,
7
- CSSProperties,
8
-
9
- DistributiveOmit,
10
- DistributivePick,
11
- UnionToIntersection,
12
- ReplaceNullWithUndefined,
13
- PropsWithoutChildren,
14
-
15
- FunctionComponent,
16
- ComponentType,
17
- ChildNode,
18
-
19
- AnchorNativeProps,
20
- ButtonNativeProps,
21
- FormNativeProps,
22
- InputNativeProps,
23
- TextareaNativeProps,
24
- SelectNativeProps,
25
- ImgNativeProps,
26
- LabelNativeProps,
27
-
28
- IntrinsicElementKeys,
29
- IntrinsicElementProps,
30
- } from './types.js';