@sfgov/design-system 0.0.0-0969b8a
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/LICENSE +21 -0
- package/README.md +7 -0
- package/css/base.css +2 -0
- package/css/base.css.map +1 -0
- package/css/components.css +2 -0
- package/css/components.css.map +1 -0
- package/css/fonts.css +2 -0
- package/css/fonts.css.map +1 -0
- package/css/icons.css +2 -0
- package/css/icons.css.map +1 -0
- package/css/overrides.css +2 -0
- package/css/overrides.css.map +1 -0
- package/css/sfds.css +2 -0
- package/css/sfds.css.map +1 -0
- package/css/src/base.css +26 -0
- package/css/src/components/button.css +61 -0
- package/css/src/components/details.css +10 -0
- package/css/src/components/grid.css +12 -0
- package/css/src/components/index.css +4 -0
- package/css/src/components/kbd.css +5 -0
- package/css/src/components.css +1 -0
- package/css/src/fonts.css +1 -0
- package/css/src/icons.css +7 -0
- package/css/src/overrides.css +3 -0
- package/css/src/sfds.css +6 -0
- package/css/src/theme.js +104 -0
- package/css/src/tokens/breakpoints.js +5 -0
- package/css/src/tokens/colors.js +116 -0
- package/css/src/tokens/index.js +8 -0
- package/css/src/tokens/spacing.js +27 -0
- package/css/src/tokens/typography.js +66 -0
- package/css/src/tokens/widths.js +11 -0
- package/css/src/typography.css +103 -0
- package/css/src/utilities.css +1 -0
- package/css/typography.css +2 -0
- package/css/typography.css.map +1 -0
- package/css/utilities.css +2 -0
- package/css/utilities.css.map +1 -0
- package/css/utilities.json +7350 -0
- package/elements/index.d.mts +30 -0
- package/elements/index.d.mts.map +1 -0
- package/elements/index.d.ts +30 -0
- package/elements/index.d.ts.map +1 -0
- package/elements/index.js +1 -0
- package/elements/index.mjs +1 -0
- package/elements/src/index.js +7 -0
- package/elements/src/sfgov-icon.js +109 -0
- package/icons/index.json +439 -0
- package/icons/svg/accessibility.svg +4 -0
- package/icons/svg/alert.svg +5 -0
- package/icons/svg/archive.svg +4 -0
- package/icons/svg/arrow-down.svg +3 -0
- package/icons/svg/arrow-left.svg +3 -0
- package/icons/svg/arrow-right.svg +3 -0
- package/icons/svg/arrow-up.svg +3 -0
- package/icons/svg/building.svg +7 -0
- package/icons/svg/calendar.svg +3 -0
- package/icons/svg/caution.svg +3 -0
- package/icons/svg/chart.svg +6 -0
- package/icons/svg/check.svg +3 -0
- package/icons/svg/chevron-down.svg +3 -0
- package/icons/svg/chevron-left.svg +3 -0
- package/icons/svg/chevron-right.svg +3 -0
- package/icons/svg/chevron-up.svg +3 -0
- package/icons/svg/clock.svg +4 -0
- package/icons/svg/close.svg +3 -0
- package/icons/svg/document.svg +3 -0
- package/icons/svg/globe.svg +3 -0
- package/icons/svg/hamburger-button.svg +5 -0
- package/icons/svg/index.json +346 -0
- package/icons/svg/info.svg +5 -0
- package/icons/svg/location.svg +4 -0
- package/icons/svg/mail.svg +3 -0
- package/icons/svg/minus.svg +3 -0
- package/icons/svg/pencil.svg +3 -0
- package/icons/svg/phone.svg +3 -0
- package/icons/svg/plus.svg +3 -0
- package/icons/svg/question.svg +4 -0
- package/icons/svg/search.svg +3 -0
- package/icons/svg/wip.svg +3 -0
- package/lib/markdownlint/frontmatter.js +51 -0
- package/lib/markdownlint/no-empty.js +19 -0
- package/lib/tailwind/details.js +14 -0
- package/package.json +359 -0
- package/react/README.md +36 -0
- package/react/index.d.mts +5725 -0
- package/react/index.d.mts.map +1 -0
- package/react/index.d.ts +5725 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +1 -0
- package/react/index.mjs +1 -0
- package/react/src/components/Box.tsx +6 -0
- package/react/src/components/Button.tsx +94 -0
- package/react/src/components/Container.tsx +19 -0
- package/react/src/components/Flex.tsx +16 -0
- package/react/src/components/GlobalStyle.tsx +35 -0
- package/react/src/components/GoogleFonts.tsx +67 -0
- package/react/src/components/Grid.tsx +15 -0
- package/react/src/components/SSRStyle.tsx +47 -0
- package/react/src/components/SVGIcon.tsx +42 -0
- package/react/src/components/Text.tsx +78 -0
- package/react/src/components/Tile.tsx +93 -0
- package/react/src/components/index.ts +11 -0
- package/react/src/components/page/AboutSection.tsx +90 -0
- package/react/src/components/page/AgencyHeader.tsx +56 -0
- package/react/src/components/page/ArchiveInformation.tsx +43 -0
- package/react/src/components/page/ContactSection.tsx +92 -0
- package/react/src/components/page/Section.tsx +53 -0
- package/react/src/components/page/Spotlight.tsx +70 -0
- package/react/src/components/page/index.ts +6 -0
- package/react/src/constants.ts +48 -0
- package/react/src/icons/IconAccessibility.jsx +3 -0
- package/react/src/icons/IconAlert.jsx +3 -0
- package/react/src/icons/IconArchive.jsx +3 -0
- package/react/src/icons/IconArrowDown.jsx +3 -0
- package/react/src/icons/IconArrowLeft.jsx +3 -0
- package/react/src/icons/IconArrowRight.jsx +3 -0
- package/react/src/icons/IconArrowUp.jsx +3 -0
- package/react/src/icons/IconBuilding.jsx +3 -0
- package/react/src/icons/IconCalendar.jsx +3 -0
- package/react/src/icons/IconCaution.jsx +3 -0
- package/react/src/icons/IconChart.jsx +3 -0
- package/react/src/icons/IconCheck.jsx +3 -0
- package/react/src/icons/IconChevronDown.jsx +3 -0
- package/react/src/icons/IconChevronLeft.jsx +3 -0
- package/react/src/icons/IconChevronRight.jsx +3 -0
- package/react/src/icons/IconChevronUp.jsx +3 -0
- package/react/src/icons/IconClock.jsx +3 -0
- package/react/src/icons/IconClose.jsx +3 -0
- package/react/src/icons/IconDocument.jsx +3 -0
- package/react/src/icons/IconGlobe.jsx +3 -0
- package/react/src/icons/IconHamburgerButton.jsx +3 -0
- package/react/src/icons/IconInfo.jsx +3 -0
- package/react/src/icons/IconLocation.jsx +3 -0
- package/react/src/icons/IconMail.jsx +3 -0
- package/react/src/icons/IconMinus.jsx +3 -0
- package/react/src/icons/IconPencil.jsx +3 -0
- package/react/src/icons/IconPhone.jsx +3 -0
- package/react/src/icons/IconPlus.jsx +3 -0
- package/react/src/icons/IconQuestion.jsx +3 -0
- package/react/src/icons/IconSearch.jsx +3 -0
- package/react/src/icons/IconWIP.jsx +3 -0
- package/react/src/icons/index.js +31 -0
- package/react/src/icons/index.json +346 -0
- package/react/src/icons.tsx +34 -0
- package/react/src/index.ts +4 -0
- package/react/src/stitches.config.ts +85 -0
- package/react/src/theme/breakpoints.ts +14 -0
- package/react/src/theme/colors.ts +34 -0
- package/react/src/theme/index.tsx +31 -0
- package/react/src/theme/space.ts +16 -0
- package/react/src/theme/typography.ts +136 -0
- package/react/src/types.ts +31 -0
- package/react/src/utils.tsx +25 -0
- package/svgo.config.js +27 -0
- package/tailwind.config.js +5 -0
- package/tailwind.preset.js +128 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createStitches } from '@stitches/react'
|
|
2
|
+
import * as Stitches from '@stitches/react'
|
|
3
|
+
import { theme as inputTheme, media } from './theme'
|
|
4
|
+
import { identity } from './utils'
|
|
5
|
+
|
|
6
|
+
export const {
|
|
7
|
+
config,
|
|
8
|
+
css,
|
|
9
|
+
createTheme,
|
|
10
|
+
keyframes,
|
|
11
|
+
getCssText,
|
|
12
|
+
globalCss,
|
|
13
|
+
reset,
|
|
14
|
+
styled
|
|
15
|
+
} = createStitches({
|
|
16
|
+
prefix: 'sfgov',
|
|
17
|
+
theme: inputTheme,
|
|
18
|
+
media,
|
|
19
|
+
utils: {
|
|
20
|
+
// colors
|
|
21
|
+
bg: alias('backgroundColor'),
|
|
22
|
+
fg: alias('color'),
|
|
23
|
+
// borders
|
|
24
|
+
bc: alias('borderColor'),
|
|
25
|
+
br: alias('borderRadius'),
|
|
26
|
+
// layout
|
|
27
|
+
cols: alias('columnCount'),
|
|
28
|
+
gapX: alias('columnGap'),
|
|
29
|
+
gapY: alias('rowGap'),
|
|
30
|
+
// spacing
|
|
31
|
+
m: alias('margin'),
|
|
32
|
+
mt: alias('marginTop'),
|
|
33
|
+
mr: alias('marginRight'),
|
|
34
|
+
mb: alias('marginBottom'),
|
|
35
|
+
ml: alias('marginLeft'),
|
|
36
|
+
mx: alias(['marginLeft', 'marginRight']),
|
|
37
|
+
my: alias(['marginTop', 'marginBottom']),
|
|
38
|
+
p: alias('padding'),
|
|
39
|
+
pt: alias('paddingTop'),
|
|
40
|
+
pr: alias('paddingRight'),
|
|
41
|
+
pb: alias('paddingBottom'),
|
|
42
|
+
pl: alias('paddingLeft'),
|
|
43
|
+
px: alias(['paddingLeft', 'paddingRight']),
|
|
44
|
+
py: alias(['paddingTop', 'paddingBottom'])
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
type StitchesCSSProp = keyof Stitches.CSSProperties
|
|
49
|
+
|
|
50
|
+
export type CSS = Stitches.CSS<typeof config>
|
|
51
|
+
|
|
52
|
+
type CSSProp = keyof CSS
|
|
53
|
+
type CSSTransform<V extends CSSProp, Input = any> = (v: Input) => V
|
|
54
|
+
type AliasFunction<Input = any> = (v: Input) => Stitches.CSS
|
|
55
|
+
|
|
56
|
+
function alias <Input = any> (key: StitchesCSSProp, transform?: CSSTransform<typeof key, Input>): AliasFunction
|
|
57
|
+
function alias <Input = any> (keys: StitchesCSSProp[], transform?: CSSTransform<(typeof keys)[number], Input>): AliasFunction
|
|
58
|
+
function alias <Input = Stitches.CSS> (key: string, transform?: (v: Input) => Record<typeof key, Input>): AliasFunction
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create an alias function that outputs one or more style properties from a single value:
|
|
62
|
+
*
|
|
63
|
+
* ```js
|
|
64
|
+
* createStitches({
|
|
65
|
+
* utils: {
|
|
66
|
+
* // { m: 0 } → { margin: 0 }
|
|
67
|
+
* m: alias('margin')
|
|
68
|
+
* // { mx: 'auto' } -> { marginLeft: 'auto', marginRight: 'auto' }
|
|
69
|
+
* mx: alias(['marginLeft', 'marginRight'])
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @param keyOrKeys A single CSS style property or array of them
|
|
75
|
+
* @param transform Optionally transform the input value with this function
|
|
76
|
+
*/
|
|
77
|
+
function alias <Input = any> (
|
|
78
|
+
keyOrKeys: StitchesCSSProp | StitchesCSSProp[] | string,
|
|
79
|
+
transform?: Function
|
|
80
|
+
) {
|
|
81
|
+
const t = transform || identity
|
|
82
|
+
return Array.isArray(keyOrKeys)
|
|
83
|
+
? (v: Input) => keyOrKeys.reduce((o, p) => Object.assign(o, { [p]: t(v) }), {})
|
|
84
|
+
: (v: Input) => ({ [keyOrKeys]: t(v) })
|
|
85
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// required keys of our breakpoint object
|
|
2
|
+
export type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
3
|
+
|
|
4
|
+
export const breakpoints: Record<BreakpointName, string> = {
|
|
5
|
+
xs: '375px',
|
|
6
|
+
sm: '640px',
|
|
7
|
+
md: '768px',
|
|
8
|
+
lg: '1024px',
|
|
9
|
+
xl: '1280px'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const media = Object.fromEntries(
|
|
13
|
+
Object.entries(breakpoints).map(([name, value]) => [name, `(min-width: ${value})`])
|
|
14
|
+
) as Record<BreakpointName, string>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
white: '#fff',
|
|
3
|
+
black: '#212123',
|
|
4
|
+
action: '$blueBright',
|
|
5
|
+
blueL1: '#edf4f7',
|
|
6
|
+
blueL2: '#a9d6ea',
|
|
7
|
+
blueBright: '#495ed4',
|
|
8
|
+
blueDark: '#0c1464',
|
|
9
|
+
greenL1: '#e9f7ec',
|
|
10
|
+
greenL2: '#c0e2c5',
|
|
11
|
+
greenL3: '#00866a',
|
|
12
|
+
greenL4: '#1b674d',
|
|
13
|
+
greyL1: '#f6f6f6',
|
|
14
|
+
greyL2: '#e2e2e2',
|
|
15
|
+
greyL3: '#c2c2c2',
|
|
16
|
+
greyL4: '#a1a1a1',
|
|
17
|
+
greyDark: '#424244',
|
|
18
|
+
purpleL1: '#edebf6',
|
|
19
|
+
purpleL2: '#cccced',
|
|
20
|
+
purpleL3: '#7d61b3',
|
|
21
|
+
purpleL4: '#543a89',
|
|
22
|
+
redL1: '#f5e9e5',
|
|
23
|
+
redL2: '#efcabb',
|
|
24
|
+
redL3: '#c55236',
|
|
25
|
+
redL4: '#9b3921',
|
|
26
|
+
slateL1: '#eff3f4',
|
|
27
|
+
slateL2: '#5a7a92',
|
|
28
|
+
slateL3: '#1d4d70',
|
|
29
|
+
slateL4: '#002b48',
|
|
30
|
+
yellowL1: '#f8f1df',
|
|
31
|
+
yellowL2: '#f9e3a3',
|
|
32
|
+
yellowL3: '#f4c435',
|
|
33
|
+
yellowL4: '#e0a81a'
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { colors } from './colors'
|
|
2
|
+
import { BreakpointName, breakpoints, media } from './breakpoints'
|
|
3
|
+
import { fonts, fontSizes, fontWeights, lineHeights, letterSpacings, textStyles } from './typography'
|
|
4
|
+
import { space } from './space'
|
|
5
|
+
import { pxMap } from '../utils'
|
|
6
|
+
|
|
7
|
+
export type { BreakpointName }
|
|
8
|
+
export { breakpoints, media, textStyles }
|
|
9
|
+
|
|
10
|
+
export const theme = {
|
|
11
|
+
colors,
|
|
12
|
+
media,
|
|
13
|
+
space,
|
|
14
|
+
sizes: {
|
|
15
|
+
...breakpoints,
|
|
16
|
+
...space
|
|
17
|
+
},
|
|
18
|
+
borderWidths: {
|
|
19
|
+
...pxMap([
|
|
20
|
+
0,
|
|
21
|
+
1,
|
|
22
|
+
2,
|
|
23
|
+
3
|
|
24
|
+
])
|
|
25
|
+
},
|
|
26
|
+
fonts,
|
|
27
|
+
fontSizes,
|
|
28
|
+
fontWeights,
|
|
29
|
+
lineHeights,
|
|
30
|
+
letterSpacings
|
|
31
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { CSS } from '@stitches/react'
|
|
2
|
+
import { defaultFonts } from '../constants'
|
|
3
|
+
|
|
4
|
+
export const fonts = {
|
|
5
|
+
body: '$sans',
|
|
6
|
+
sans: '$RobotoFlex',
|
|
7
|
+
slab: '$RobotoSlab',
|
|
8
|
+
monospace: '$RobotoMono',
|
|
9
|
+
chinese: '$NotoSansTC',
|
|
10
|
+
...Object.fromEntries(
|
|
11
|
+
defaultFonts.map(font => [
|
|
12
|
+
font.name.replace(/ +/g, ''),
|
|
13
|
+
`${[font.name, ...font.fallbacks
|
|
14
|
+
].join(', ')}`])
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const textStyles: Record<string, CSS> = {
|
|
19
|
+
body: {
|
|
20
|
+
fontFamily: '$body',
|
|
21
|
+
fontSize: '16px',
|
|
22
|
+
fontWeight: '$normal',
|
|
23
|
+
lineHeight: '24px'
|
|
24
|
+
},
|
|
25
|
+
small: {
|
|
26
|
+
fontFamily: '$body',
|
|
27
|
+
fontSize: '14px',
|
|
28
|
+
lineHeight: '18px'
|
|
29
|
+
},
|
|
30
|
+
bigDesc: {
|
|
31
|
+
fontFamily: '$body',
|
|
32
|
+
fontSize: '20px',
|
|
33
|
+
fontWeight: '$bold',
|
|
34
|
+
lineHeight: '28px'
|
|
35
|
+
},
|
|
36
|
+
bigDescDesktop: {
|
|
37
|
+
fontFamily: '$body',
|
|
38
|
+
fontSize: '24px',
|
|
39
|
+
fontWeight: '$bold',
|
|
40
|
+
lineHeight: '32px'
|
|
41
|
+
},
|
|
42
|
+
titleXs: {
|
|
43
|
+
fontFamily: '$sans',
|
|
44
|
+
fontSize: '20px',
|
|
45
|
+
fontWeight: '$bold',
|
|
46
|
+
lineHeight: '24px'
|
|
47
|
+
},
|
|
48
|
+
titleSm: {
|
|
49
|
+
fontFamily: '$sans',
|
|
50
|
+
fontSize: '24px',
|
|
51
|
+
fontWeight: '$bold',
|
|
52
|
+
lineHeight: '28px'
|
|
53
|
+
},
|
|
54
|
+
titleMd: {
|
|
55
|
+
fontFamily: '$slab',
|
|
56
|
+
fontSize: '24px',
|
|
57
|
+
fontWeight: '$bold',
|
|
58
|
+
lineHeight: '28px'
|
|
59
|
+
},
|
|
60
|
+
titleLg: {
|
|
61
|
+
fontFamily: '$slab',
|
|
62
|
+
fontSize: '28px',
|
|
63
|
+
fontWeight: '$bold',
|
|
64
|
+
lineHeight: '32px'
|
|
65
|
+
},
|
|
66
|
+
titleXl: {
|
|
67
|
+
fontFamily: '$slab',
|
|
68
|
+
fontSize: '32px',
|
|
69
|
+
fontWeight: '$bold',
|
|
70
|
+
lineHeight: '36px'
|
|
71
|
+
},
|
|
72
|
+
displaySm: {
|
|
73
|
+
fontFamily: '$slab',
|
|
74
|
+
fontSize: '36px',
|
|
75
|
+
fontWeight: '$light',
|
|
76
|
+
lineHeight: '40px'
|
|
77
|
+
},
|
|
78
|
+
displayLg: {
|
|
79
|
+
fontFamily: '$slab',
|
|
80
|
+
fontSize: '44px',
|
|
81
|
+
fontWeight: '$light',
|
|
82
|
+
lineHeight: '48px'
|
|
83
|
+
},
|
|
84
|
+
titleMdDesktop: {
|
|
85
|
+
fontFamily: '$slab',
|
|
86
|
+
fontSize: '32px',
|
|
87
|
+
fontWeight: '$bold',
|
|
88
|
+
lineHeight: '36px'
|
|
89
|
+
},
|
|
90
|
+
titleLgDesktop: {
|
|
91
|
+
fontFamily: '$slab',
|
|
92
|
+
fontSize: '44px',
|
|
93
|
+
fontWeight: '$bold',
|
|
94
|
+
lineHeight: '52px'
|
|
95
|
+
},
|
|
96
|
+
titleXlDesktop: {
|
|
97
|
+
fontFamily: '$slab',
|
|
98
|
+
fontSize: '60px',
|
|
99
|
+
fontWeight: '$bold',
|
|
100
|
+
lineHeight: '64px'
|
|
101
|
+
},
|
|
102
|
+
displaySmDesktop: {
|
|
103
|
+
fontFamily: '$slab',
|
|
104
|
+
fontSize: '48px',
|
|
105
|
+
fontWeight: '$light',
|
|
106
|
+
lineHeight: '52px'
|
|
107
|
+
},
|
|
108
|
+
displayLgDesktop: {
|
|
109
|
+
fontFamily: '$slab',
|
|
110
|
+
fontSize: '72px',
|
|
111
|
+
fontWeight: '$light',
|
|
112
|
+
lineHeight: '76px'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const fontWeights = {
|
|
117
|
+
light: 300,
|
|
118
|
+
normal: 400,
|
|
119
|
+
bold: 700,
|
|
120
|
+
boldChinese: 500,
|
|
121
|
+
...collect('fontWeight')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const fontSizes = collect('fontSize')
|
|
125
|
+
export const lineHeights = collect('lineHeight')
|
|
126
|
+
export const letterSpacings = collect('letterSpacing')
|
|
127
|
+
|
|
128
|
+
function collect (prop: keyof CSS) {
|
|
129
|
+
const map = {}
|
|
130
|
+
for (const [name, style] of Object.entries(textStyles)) {
|
|
131
|
+
if (prop in style) {
|
|
132
|
+
map[name] = style[prop]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return map
|
|
136
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react'
|
|
2
|
+
|
|
3
|
+
export type LinkProps = ComponentProps<'link'>
|
|
4
|
+
|
|
5
|
+
export type FontWeightName = 'light' | 'normal' | 'bold' | 'semibold'
|
|
6
|
+
export type FixedFontWeightMap = Partial<Record<FontWeightName, number>>
|
|
7
|
+
|
|
8
|
+
// "8..144,300;8..144,400;8..144,700"
|
|
9
|
+
type OpticalWeights = Partial<Record<FontWeightName, [number[], number]>>
|
|
10
|
+
|
|
11
|
+
export type OpticalGoogleFont = {
|
|
12
|
+
optical: true
|
|
13
|
+
weights: OpticalWeights
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GoogleFontOptions = {
|
|
17
|
+
optical: false
|
|
18
|
+
} | OpticalGoogleFont
|
|
19
|
+
|
|
20
|
+
export type FontSpec = {
|
|
21
|
+
name: string
|
|
22
|
+
fallbacks?: string[]
|
|
23
|
+
weights: FixedFontWeightMap
|
|
24
|
+
googleFont?: GoogleFontOptions
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type FontSpecProps = {
|
|
28
|
+
fonts?: FontSpec[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GlobalCSSProps = FontSpecProps
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { Component, ComponentProps, ComponentType } from 'react'
|
|
2
|
+
|
|
3
|
+
export function identity (v: any) {
|
|
4
|
+
return v
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function pxMap (values: number[]): Record<number, string> {
|
|
8
|
+
return values.reduce((o, n) => Object.assign(o, { [n]: px(n) }), {})
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function px (n: number | string) {
|
|
12
|
+
return (typeof n === 'string') ? n : n === 0 ? '0' : `${n}px`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function withFixedProps (
|
|
16
|
+
Component: ComponentType<any>,
|
|
17
|
+
fixed: Partial<ComponentProps<typeof Component>>
|
|
18
|
+
) {
|
|
19
|
+
type Unfixed = Omit<ComponentProps<typeof Component>, keyof typeof fixed>
|
|
20
|
+
return function FixedProps (props: Unfixed) {
|
|
21
|
+
return <Component {...fixed} {...props} />
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type VariantProps<T, P extends {} = T extends ComponentType ? ComponentProps<T> : T> = T & JSX.IntrinsicAttributes
|
package/svgo.config.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @type {import('svgo/lib/svgo').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
multipass: true,
|
|
4
|
+
js2svg: {
|
|
5
|
+
pretty: true,
|
|
6
|
+
indent: 2
|
|
7
|
+
},
|
|
8
|
+
plugins: [
|
|
9
|
+
'removeDimensions',
|
|
10
|
+
{ name: 'removeViewBox', active: false },
|
|
11
|
+
{
|
|
12
|
+
name: 'removeAttrs',
|
|
13
|
+
params: {
|
|
14
|
+
attrs: ['fill', 'stroke', 'id', 'clipPath', 'clip-path', 'clipRule']
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
'removeUselessDefs',
|
|
18
|
+
'removeXMLNS',
|
|
19
|
+
'collapseGroups',
|
|
20
|
+
{
|
|
21
|
+
name: 'addAttributesToSVGElement',
|
|
22
|
+
params: {
|
|
23
|
+
attributes: ['fill="currentcolor"']
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const theme = require('./css/src/theme')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
theme,
|
|
5
|
+
|
|
6
|
+
important: true,
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This is where we disable Tailwind's "core plugins", most of
|
|
10
|
+
* which generate utility classes. There are a *lot* of these
|
|
11
|
+
* turned on by default. Disabling them here saves us many
|
|
12
|
+
* kilobytes in generated CSS.
|
|
13
|
+
*
|
|
14
|
+
* See: <https://tailwindcss.com/docs/configuration#core-plugins>
|
|
15
|
+
*/
|
|
16
|
+
corePlugins: [
|
|
17
|
+
// TODO [^3]: add preflight (https://tailwindcss.com/docs/preflight)
|
|
18
|
+
'accessibility',
|
|
19
|
+
'alignContent',
|
|
20
|
+
'alignItems',
|
|
21
|
+
'appearance',
|
|
22
|
+
'backgroundColor',
|
|
23
|
+
'borderColor',
|
|
24
|
+
'borderRadius',
|
|
25
|
+
'borderStyle',
|
|
26
|
+
'borderWidth',
|
|
27
|
+
'cursor',
|
|
28
|
+
'display',
|
|
29
|
+
'flex',
|
|
30
|
+
'flexDirection',
|
|
31
|
+
'flexShrink',
|
|
32
|
+
'flexWrap',
|
|
33
|
+
'fontFamily',
|
|
34
|
+
'fontSize',
|
|
35
|
+
'fontSmoothing',
|
|
36
|
+
'fontWeight',
|
|
37
|
+
'gap',
|
|
38
|
+
'gridColumn',
|
|
39
|
+
'gridRow',
|
|
40
|
+
'gridTemplateColumns',
|
|
41
|
+
'gridTemplateRows',
|
|
42
|
+
'height',
|
|
43
|
+
'inset',
|
|
44
|
+
'justifyContent',
|
|
45
|
+
'justifyItems',
|
|
46
|
+
'letterSpacing',
|
|
47
|
+
'listStyleType',
|
|
48
|
+
'margin',
|
|
49
|
+
'maxWidth',
|
|
50
|
+
'opacity',
|
|
51
|
+
'overflow',
|
|
52
|
+
'padding',
|
|
53
|
+
'pointerEvents',
|
|
54
|
+
'position',
|
|
55
|
+
'space',
|
|
56
|
+
'textAlign',
|
|
57
|
+
'textColor',
|
|
58
|
+
'textDecoration',
|
|
59
|
+
'verticalAlign',
|
|
60
|
+
'visibility',
|
|
61
|
+
'whitespace',
|
|
62
|
+
'width',
|
|
63
|
+
'zIndex'
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* This is where we tell Tailwind which variants to make available
|
|
68
|
+
* for each "core plugin". Most plugins get responsive variants out
|
|
69
|
+
* of the box, but we can shrink the size of our CSS significantly
|
|
70
|
+
* by turning off responsive variants for ones that we don't need
|
|
71
|
+
* to change at different screen widths.
|
|
72
|
+
*
|
|
73
|
+
* See: <https://tailwindcss.com/docs/configuring-variants>
|
|
74
|
+
*/
|
|
75
|
+
variants: {
|
|
76
|
+
// TODO [^3]: nix 'focus'
|
|
77
|
+
accessibility: ['responsive', 'focus', 'hocus'],
|
|
78
|
+
appearance: [],
|
|
79
|
+
// TODO [^3]: nix 'focus' + 'hover'
|
|
80
|
+
backgroundColor: ['focus', 'focus-within', 'hover', 'hocus', 'group-hocus', 'details'],
|
|
81
|
+
// TODO [^3]: nix 'focus' + 'hover'
|
|
82
|
+
borderColor: ['focus', 'hover', 'hocus', 'group-hocus', 'details'],
|
|
83
|
+
borderWidth: ['hocus'],
|
|
84
|
+
cursor: [],
|
|
85
|
+
display: ['responsive', 'group-hocus', 'details'],
|
|
86
|
+
fill: [],
|
|
87
|
+
fontWeight: ['responsive'],
|
|
88
|
+
fontSize: ['responsive'],
|
|
89
|
+
fontSmoothing: [],
|
|
90
|
+
fontStyle: [],
|
|
91
|
+
flexDirection: ['responsive'],
|
|
92
|
+
flexWrap: [],
|
|
93
|
+
gap: ['responsive'],
|
|
94
|
+
gridColumn: ['responsive'],
|
|
95
|
+
gridRow: ['responsive'],
|
|
96
|
+
gridTemplateColumns: ['responsive'],
|
|
97
|
+
gridTemplateRows: ['responsive'],
|
|
98
|
+
height: ['responsive'],
|
|
99
|
+
inset: ['responsive'],
|
|
100
|
+
letterSpacing: ['responsive'],
|
|
101
|
+
lineHeight: ['responsive'],
|
|
102
|
+
listStyleType: ['responsive'],
|
|
103
|
+
listStylePosition: [],
|
|
104
|
+
overflow: [], // TODO [^2.3]: add 'hocus', 'group-hocus'
|
|
105
|
+
padding: ['responsive'],
|
|
106
|
+
pointerEvents: [],
|
|
107
|
+
position: ['responsive'],
|
|
108
|
+
margin: ['responsive'],
|
|
109
|
+
maxWidth: ['responsive'],
|
|
110
|
+
space: ['responsive'],
|
|
111
|
+
stroke: [],
|
|
112
|
+
strokeWidth: [],
|
|
113
|
+
// TODO [^3]: nix 'focus' + 'hover'
|
|
114
|
+
textColor: ['focus', 'hover', 'hocus', 'group-hocus', 'details'],
|
|
115
|
+
// TODO [^3]: nix 'focus' + 'hover'
|
|
116
|
+
textDecoration: ['focus', 'hover', 'hocus'],
|
|
117
|
+
userSelect: [],
|
|
118
|
+
verticalAlign: ['responsive'],
|
|
119
|
+
visibility: ['responsive', 'group-hocus'],
|
|
120
|
+
width: ['responsive'],
|
|
121
|
+
zIndex: ['responsive']
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
plugins: [
|
|
125
|
+
require('tailwindcss-interaction-variants'),
|
|
126
|
+
require('./lib/tailwind/details')
|
|
127
|
+
]
|
|
128
|
+
}
|