|
1 | 1 | import * as React from 'react';
|
2 | 2 |
|
3 |
| -import { colors } from '@utilitywarehouse/colour-system'; |
| 3 | +import { components as componentTokens } from '@utilitywarehouse/design-tokens'; |
4 | 4 |
|
5 | 5 | import type { LabelProps } from './Label.props';
|
6 | 6 |
|
7 | 7 | import { createBox } from '../Box';
|
8 | 8 |
|
9 | 9 | import { DATA_ATTRIBUTE_SELECTORS } from '../../helpers';
|
10 | 10 | import { styled } from '../../theme';
|
11 |
| -import { fontWeights, fonts } from '../../tokens'; |
12 | 11 | import type { PropsWithSx } from '../../types';
|
13 |
| -import { pxToRem } from '../../utils'; |
14 | 12 |
|
15 | 13 | const componentName = 'Label';
|
16 | 14 | const BaseBox = createBox<'label'>({ componentName });
|
17 | 15 |
|
| 16 | +// const { |
| 17 | +// light: { |
| 18 | +// label: { fontFamily, fontSize, fontWeight, fontWeightNested, lineHeight, color, colorDisabled }, |
| 19 | +// }, |
| 20 | +// } = componentTokens; |
| 21 | + |
| 22 | +// const StyledElement = styled(BaseBox)({ |
| 23 | +// fontFamily, |
| 24 | +// fontSize, |
| 25 | +// lineHeight, |
| 26 | +// color, |
| 27 | +// fontWeight, |
| 28 | +// ':where([data-disabled],[data-disabled] &)': { |
| 29 | +// color: colorDisabled, |
| 30 | +// }, |
| 31 | +// ':where([data-nested])': { |
| 32 | +// fontWeight: fontWeightNested, |
| 33 | +// }, |
| 34 | +// [DATA_ATTRIBUTE_SELECTORS.disableUserSelect]: { |
| 35 | +// userSelect: 'none', |
| 36 | +// }, |
| 37 | +// }); |
| 38 | + |
| 39 | +const { |
| 40 | + light: { label }, |
| 41 | +} = componentTokens; |
| 42 | + |
18 | 43 | const StyledElement = styled(BaseBox)({
|
19 |
| - fontFamily: fonts.secondary, |
20 |
| - fontSize: pxToRem(16), |
21 |
| - lineHeight: 1.5, |
22 |
| - '--label-color': colors.grey1000, |
23 |
| - '--label-color-disabled': colors.grey400, |
24 |
| - '--label-font-weight': fontWeights.secondary.semibold, |
25 |
| - '--label-font-weight-nested': fontWeights.secondary.regular, |
26 |
| - color: 'var(--label-color)', |
27 |
| - fontWeight: 'var(--label-font-weight)', |
| 44 | + fontFamily: label.fontFamily, |
| 45 | + fontSize: label.fontSize, |
| 46 | + fontWeight: label.fontWeight, |
| 47 | + // fontWeight: label.fontWeight.default, |
| 48 | + lineHeight: label.lineHeight, |
| 49 | + color: label.color, |
| 50 | + // color: label.color.default, |
28 | 51 | ':where([data-disabled],[data-disabled] &)': {
|
29 |
| - '--label-color': 'var(--label-color-disabled)', |
| 52 | + color: label.colorDisabled, |
| 53 | + // color: label.color.disabled, |
| 54 | + // color: label.disabled.color, |
30 | 55 | },
|
31 | 56 | ':where([data-nested])': {
|
32 |
| - '--label-font-weight': 'var(--label-font-weight-nested)', |
| 57 | + fontWeight: label.fontWeightNested, |
| 58 | + // fontWeight: label.fontWeight.nested, |
| 59 | + // fontWeight: label.nested.fontWeight, |
33 | 60 | },
|
34 | 61 | [DATA_ATTRIBUTE_SELECTORS.disableUserSelect]: {
|
35 | 62 | userSelect: 'none',
|
36 | 63 | },
|
37 | 64 | });
|
38 | 65 |
|
| 66 | +// const tokens = { |
| 67 | +// fontWeightSemibold: 600, |
| 68 | +// labelFontFamily: fontFamily, |
| 69 | +// labelFontSize: fontSize, |
| 70 | +// labelFontWeight: fontWeight, |
| 71 | +// }; |
| 72 | +// |
| 73 | +// const StyledElement = styled(BaseBox)({ |
| 74 | +// fontFamily: tokens.labelFontFamily, |
| 75 | +// fontSize: tokens.labelFontSize, |
| 76 | +// fontWeight: tokens.labelFontWeight, |
| 77 | +// lineHeight, |
| 78 | +// color, |
| 79 | +// ':where([data-disabled],[data-disabled] &)': { |
| 80 | +// color: colorDisabled, |
| 81 | +// }, |
| 82 | +// ':where([data-nested])': { |
| 83 | +// fontWeight: fontWeightNested, |
| 84 | +// }, |
| 85 | +// [DATA_ATTRIBUTE_SELECTORS.disableUserSelect]: { |
| 86 | +// userSelect: 'none', |
| 87 | +// }, |
| 88 | +// }); |
| 89 | + |
| 90 | +// const labelTokens = { |
| 91 | +// 'label-font-weight-nested': 400, |
| 92 | +// 'label-font-weight': 600, |
| 93 | +// 'label-color': '#121212', |
| 94 | +// 'label-letter-spacing': 0, |
| 95 | +// 'label-line-height': 1.5, |
| 96 | +// 'label-color-disabled': '#a0a0a0', |
| 97 | +// 'label-font-family': "'Work Sans', Arial, sans-serif", |
| 98 | +// 'label-font-size': '1rem', |
| 99 | +// }; |
| 100 | +// const StyledElement = styled(BaseBox)({ |
| 101 | +// fontFamily: labelTokens['label-font-family'], |
| 102 | +// fontSize:labelTokens['label-font-size'], |
| 103 | +// lineHeight, |
| 104 | +// color, |
| 105 | +// fontWeight, |
| 106 | +// ':where([data-disabled],[data-disabled] &)': { |
| 107 | +// color: colorDisabled, |
| 108 | +// }, |
| 109 | +// ':where([data-nested])': { |
| 110 | +// fontWeight: fontWeightNested, |
| 111 | +// }, |
| 112 | +// [DATA_ATTRIBUTE_SELECTORS.disableUserSelect]: { |
| 113 | +// userSelect: 'none', |
| 114 | +// }, |
| 115 | +// }); |
| 116 | + |
39 | 117 | /**
|
40 | 118 | * The Label component is used for labelling form elements, such as radio inputs.
|
41 | 119 | */
|
|
0 commit comments