@charcoal-ui/styled 3.9.1 → 3.10.1-beta.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.
- package/dist/index.cjs.js +177 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +174 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.story.d.ts +0 -8
- package/dist/index.story.d.ts.map +1 -1
- package/dist/index.test.d.ts +5 -0
- package/dist/index.test.d.ts.map +1 -1
- package/dist/storyHelper.d.ts +2 -1
- package/dist/storyHelper.d.ts.map +1 -1
- package/dist/styles/assertiveRingCss.d.ts +2 -0
- package/dist/styles/assertiveRingCss.d.ts.map +1 -0
- package/dist/styles/disabledCss.d.ts +2 -0
- package/dist/styles/disabledCss.d.ts.map +1 -0
- package/dist/utils/CharcoalStyledTheme.d.ts +35 -0
- package/dist/utils/CharcoalStyledTheme.d.ts.map +1 -0
- package/dist/utils/addThemeUtils.d.ts +8 -0
- package/dist/utils/addThemeUtils.d.ts.map +1 -0
- package/dist/utils/gap.d.ts +7 -0
- package/dist/utils/gap.d.ts.map +1 -0
- package/dist/utils/helpers/SpacingType.d.ts +3 -0
- package/dist/utils/helpers/SpacingType.d.ts.map +1 -0
- package/dist/utils/helpers/pxIfNum.d.ts +2 -0
- package/dist/utils/helpers/pxIfNum.d.ts.map +1 -0
- package/dist/utils/margin.d.ts +11 -0
- package/dist/utils/margin.d.ts.map +1 -0
- package/dist/utils/padding.d.ts +11 -0
- package/dist/utils/padding.d.ts.map +1 -0
- package/dist/utils/typographyCss.d.ts +2 -0
- package/dist/utils/typographyCss.d.ts.map +1 -0
- package/package.json +8 -6
- package/src/__snapshots__/index.story.storyshot +88 -691
- package/src/__snapshots__/index.test.tsx.snap +177 -664
- package/src/index.story.tsx +81 -272
- package/src/index.test.tsx +55 -5
- package/src/index.ts +12 -1
- package/src/storyHelper.ts +8 -5
- package/src/styles/assertiveRingCss.ts +5 -0
- package/src/styles/disabledCss.ts +9 -0
- package/src/themeUtils.mdx +44 -0
- package/src/utils/CharcoalStyledTheme.ts +47 -0
- package/src/utils/addThemeUtils.ts +52 -0
- package/src/utils/gap.ts +28 -0
- package/src/utils/helpers/SpacingType.ts +3 -0
- package/src/utils/helpers/pxIfNum.ts +5 -0
- package/src/utils/margin.ts +58 -0
- package/src/utils/padding.ts +58 -0
- package/src/utils/typographyCss.ts +39 -0
package/src/utils/gap.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Spacing } from '@charcoal-ui/theme'
|
|
2
|
+
import { css, FlattenSimpleInterpolation } from 'styled-components'
|
|
3
|
+
import { pxIfNum } from './helpers/pxIfNum'
|
|
4
|
+
|
|
5
|
+
export function gap(v1: keyof Spacing): FlattenSimpleInterpolation
|
|
6
|
+
|
|
7
|
+
export function gap(
|
|
8
|
+
v1: keyof Spacing,
|
|
9
|
+
v2: keyof Spacing
|
|
10
|
+
): FlattenSimpleInterpolation
|
|
11
|
+
|
|
12
|
+
export function gap(v1: keyof Spacing, v2?: keyof Spacing) {
|
|
13
|
+
return css`
|
|
14
|
+
gap: ${v1}px ${pxIfNum(v2)};
|
|
15
|
+
`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function rowGap(v: keyof Spacing) {
|
|
19
|
+
return css`
|
|
20
|
+
row-gap: ${v}px;
|
|
21
|
+
`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function columnGap(v: keyof Spacing) {
|
|
25
|
+
return css`
|
|
26
|
+
column-gap: ${v}px;
|
|
27
|
+
`
|
|
28
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { css, FlattenSimpleInterpolation } from 'styled-components'
|
|
2
|
+
import { SpacingType } from './helpers/SpacingType'
|
|
3
|
+
import { pxIfNum } from './helpers/pxIfNum'
|
|
4
|
+
|
|
5
|
+
export function margin(arg1: SpacingType): FlattenSimpleInterpolation
|
|
6
|
+
|
|
7
|
+
export function margin(
|
|
8
|
+
arg1: SpacingType,
|
|
9
|
+
arg2: SpacingType
|
|
10
|
+
): FlattenSimpleInterpolation
|
|
11
|
+
|
|
12
|
+
export function margin(
|
|
13
|
+
arg1: SpacingType,
|
|
14
|
+
arg2: SpacingType,
|
|
15
|
+
arg3: SpacingType
|
|
16
|
+
): FlattenSimpleInterpolation
|
|
17
|
+
|
|
18
|
+
export function margin(
|
|
19
|
+
arg1: SpacingType,
|
|
20
|
+
arg2: SpacingType,
|
|
21
|
+
arg3: SpacingType,
|
|
22
|
+
arg4: SpacingType
|
|
23
|
+
): FlattenSimpleInterpolation
|
|
24
|
+
|
|
25
|
+
export function margin(
|
|
26
|
+
arg1: SpacingType,
|
|
27
|
+
arg2?: SpacingType,
|
|
28
|
+
arg3?: SpacingType,
|
|
29
|
+
arg4?: SpacingType
|
|
30
|
+
) {
|
|
31
|
+
return css`
|
|
32
|
+
margin: ${pxIfNum(arg1)} ${pxIfNum(arg2)} ${pxIfNum(arg3)} ${pxIfNum(arg4)};
|
|
33
|
+
`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function marginTop(v: SpacingType) {
|
|
37
|
+
return css`
|
|
38
|
+
margin-top: ${pxIfNum(v)};
|
|
39
|
+
`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function marginBottom(v: SpacingType) {
|
|
43
|
+
return css`
|
|
44
|
+
margin-bottom: ${pxIfNum(v)};
|
|
45
|
+
`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function marginLeft(v: SpacingType) {
|
|
49
|
+
return css`
|
|
50
|
+
margin-left: ${pxIfNum(v)};
|
|
51
|
+
`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function marginRight(v: SpacingType) {
|
|
55
|
+
return css`
|
|
56
|
+
margin-right: ${pxIfNum(v)};
|
|
57
|
+
`
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Spacing } from '@charcoal-ui/theme'
|
|
2
|
+
import { css, FlattenSimpleInterpolation } from 'styled-components'
|
|
3
|
+
import { pxIfNum } from './helpers/pxIfNum'
|
|
4
|
+
|
|
5
|
+
export function padding(arg1: keyof Spacing): FlattenSimpleInterpolation
|
|
6
|
+
|
|
7
|
+
export function padding(
|
|
8
|
+
arg1: keyof Spacing,
|
|
9
|
+
arg2: keyof Spacing
|
|
10
|
+
): FlattenSimpleInterpolation
|
|
11
|
+
|
|
12
|
+
export function padding(
|
|
13
|
+
arg1: keyof Spacing,
|
|
14
|
+
arg2: keyof Spacing,
|
|
15
|
+
arg3: keyof Spacing
|
|
16
|
+
): FlattenSimpleInterpolation
|
|
17
|
+
|
|
18
|
+
export function padding(
|
|
19
|
+
arg1: keyof Spacing,
|
|
20
|
+
arg2: keyof Spacing,
|
|
21
|
+
arg3: keyof Spacing,
|
|
22
|
+
arg4: keyof Spacing
|
|
23
|
+
): FlattenSimpleInterpolation
|
|
24
|
+
|
|
25
|
+
export function padding(
|
|
26
|
+
arg1: keyof Spacing,
|
|
27
|
+
arg2?: keyof Spacing,
|
|
28
|
+
arg3?: keyof Spacing,
|
|
29
|
+
arg4?: keyof Spacing
|
|
30
|
+
) {
|
|
31
|
+
return css`
|
|
32
|
+
padding: ${arg1}px ${pxIfNum(arg2)} ${pxIfNum(arg3)} ${pxIfNum(arg4)};
|
|
33
|
+
`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function paddingTop(v: keyof Spacing) {
|
|
37
|
+
return css`
|
|
38
|
+
padding-top: ${v}px;
|
|
39
|
+
`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function paddingBottom(v: keyof Spacing) {
|
|
43
|
+
return css`
|
|
44
|
+
padding-bottom: ${v}px;
|
|
45
|
+
`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function paddingLeft(v: keyof Spacing) {
|
|
49
|
+
return css`
|
|
50
|
+
padding-left: ${v}px;
|
|
51
|
+
`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function paddingRight(v: keyof Spacing) {
|
|
55
|
+
return css`
|
|
56
|
+
padding-right: ${v}px;
|
|
57
|
+
`
|
|
58
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
const boldCss = css`
|
|
4
|
+
font-weight: bold;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
const removeHalfLeadingCss = css`
|
|
8
|
+
&::before {
|
|
9
|
+
display: block;
|
|
10
|
+
width: 0;
|
|
11
|
+
height: 0;
|
|
12
|
+
content: '';
|
|
13
|
+
margin-top: -4px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&::after {
|
|
17
|
+
display: block;
|
|
18
|
+
width: 0;
|
|
19
|
+
height: 0;
|
|
20
|
+
content: '';
|
|
21
|
+
margin-bottom: -4px;
|
|
22
|
+
}
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export function typography(
|
|
26
|
+
size: 12 | 14 | 16 | 20,
|
|
27
|
+
bold = false,
|
|
28
|
+
preserveHalfLeading = false
|
|
29
|
+
) {
|
|
30
|
+
const cssObj = css`
|
|
31
|
+
font-size: ${size}px;
|
|
32
|
+
line-height: ${size + 8}px;
|
|
33
|
+
display: flow-root;
|
|
34
|
+
${bold === true && boldCss}
|
|
35
|
+
${preserveHalfLeading !== true && removeHalfLeadingCss}
|
|
36
|
+
`
|
|
37
|
+
|
|
38
|
+
return cssObj
|
|
39
|
+
}
|