@pandacss/studio 0.0.0-dev-20230613163214

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 (250) hide show
  1. package/LICENSE.md +21 -0
  2. package/astro.config.ts +14 -0
  3. package/dist/studio.d.ts +13 -0
  4. package/dist/studio.js +2089 -0
  5. package/dist/studio.mjs +2087 -0
  6. package/index.ts +1 -0
  7. package/package.json +59 -0
  8. package/panda.config.ts +110 -0
  9. package/public/favicon.svg +13 -0
  10. package/src/components/analyzer/category-utilities.tsx +146 -0
  11. package/src/components/analyzer/data-combobox.tsx +125 -0
  12. package/src/components/analyzer/data-table.tsx +43 -0
  13. package/src/components/analyzer/external-icon.tsx +8 -0
  14. package/src/components/analyzer/file-details.tsx +101 -0
  15. package/src/components/analyzer/get-report-infos-from.ts +80 -0
  16. package/src/components/analyzer/quick-tooltip.tsx +15 -0
  17. package/src/components/analyzer/report-item-columns.tsx +52 -0
  18. package/src/components/analyzer/report-item-link.tsx +98 -0
  19. package/src/components/analyzer/section.tsx +24 -0
  20. package/src/components/analyzer/sort-icon.tsx +7 -0
  21. package/src/components/analyzer/text-with-count.tsx +28 -0
  22. package/src/components/analyzer/token-search-combobox.tsx +39 -0
  23. package/src/components/analyzer/truncated-text.tsx +26 -0
  24. package/src/components/analyzer/utility-details.tsx +312 -0
  25. package/src/components/color-constrast.tsx +131 -0
  26. package/src/components/color-item.tsx +37 -0
  27. package/src/components/color-wrapper.tsx +25 -0
  28. package/src/components/colors.tsx +96 -0
  29. package/src/components/empty-state.tsx +19 -0
  30. package/src/components/font-family.tsx +55 -0
  31. package/src/components/font-tokens.tsx +69 -0
  32. package/src/components/head.astro +35 -0
  33. package/src/components/icons.tsx +207 -0
  34. package/src/components/input.tsx +27 -0
  35. package/src/components/layer-styles.tsx +38 -0
  36. package/src/components/logo.tsx +34 -0
  37. package/src/components/nav-item.tsx +39 -0
  38. package/src/components/overview.tsx +65 -0
  39. package/src/components/radii.tsx +34 -0
  40. package/src/components/semantic-color.tsx +27 -0
  41. package/src/components/side-nav-item.astro +25 -0
  42. package/src/components/side-nav.astro +30 -0
  43. package/src/components/sizes.tsx +53 -0
  44. package/src/components/text-styles.tsx +33 -0
  45. package/src/components/theme-toggle.astro +56 -0
  46. package/src/components/token-analyzer.tsx +390 -0
  47. package/src/components/token-content.tsx +5 -0
  48. package/src/components/token-group.tsx +6 -0
  49. package/src/components/typography-playground.tsx +83 -0
  50. package/src/env.d.ts +1 -0
  51. package/src/icons/moon.tsx +15 -0
  52. package/src/icons/sun.tsx +19 -0
  53. package/src/layouts/Layout.astro +19 -0
  54. package/src/layouts/Sidebar.astro +35 -0
  55. package/src/lib/analysis-data.ts +17 -0
  56. package/src/lib/color-contrast-checker.ts +218 -0
  57. package/src/lib/color.ts +40 -0
  58. package/src/lib/constants.ts +140 -0
  59. package/src/lib/create-context.ts +27 -0
  60. package/src/lib/get-report-item.tsx +41 -0
  61. package/src/lib/group-in.ts +35 -0
  62. package/src/lib/panda.context.ts +23 -0
  63. package/src/lib/pick.ts +24 -0
  64. package/src/lib/sizes-sort.ts +10 -0
  65. package/src/lib/truncate.tsx +7 -0
  66. package/src/lib/use-color-docs.ts +101 -0
  67. package/src/pages/colors.astro +11 -0
  68. package/src/pages/font-sizes.astro +15 -0
  69. package/src/pages/font-weights.astro +15 -0
  70. package/src/pages/fonts.astro +11 -0
  71. package/src/pages/index.astro +8 -0
  72. package/src/pages/layer-styles.astro +11 -0
  73. package/src/pages/letter-spacings.astro +20 -0
  74. package/src/pages/line-heights.astro +21 -0
  75. package/src/pages/playground/contrast-checker.astro +11 -0
  76. package/src/pages/playground/typography.astro +11 -0
  77. package/src/pages/radii.astro +11 -0
  78. package/src/pages/sizes.astro +14 -0
  79. package/src/pages/spacing.astro +14 -0
  80. package/src/pages/text-styles.astro +11 -0
  81. package/src/pages/token-analyzer/file.astro +11 -0
  82. package/src/pages/token-analyzer/index.astro +11 -0
  83. package/src/pages/token-analyzer/utility.astro +11 -0
  84. package/styled-system/chunks/..__core____tests____composition.test.css +2 -0
  85. package/styled-system/chunks/src__components__analyzer__category-utilities.css +97 -0
  86. package/styled-system/chunks/src__components__analyzer__data-combobox.css +77 -0
  87. package/styled-system/chunks/src__components__analyzer__data-table.css +37 -0
  88. package/styled-system/chunks/src__components__analyzer__file-details.css +103 -0
  89. package/styled-system/chunks/src__components__analyzer__quick-tooltip.css +2 -0
  90. package/styled-system/chunks/src__components__analyzer__report-item-columns.css +29 -0
  91. package/styled-system/chunks/src__components__analyzer__report-item-link.css +109 -0
  92. package/styled-system/chunks/src__components__analyzer__section.css +29 -0
  93. package/styled-system/chunks/src__components__analyzer__text-with-count.css +33 -0
  94. package/styled-system/chunks/src__components__analyzer__truncated-text.css +13 -0
  95. package/styled-system/chunks/src__components__analyzer__utility-details.css +125 -0
  96. package/styled-system/chunks/src__components__color-constrast.css +114 -0
  97. package/styled-system/chunks/src__components__color-item.css +21 -0
  98. package/styled-system/chunks/src__components__color-wrapper.css +73 -0
  99. package/styled-system/chunks/src__components__colors.css +97 -0
  100. package/styled-system/chunks/src__components__empty-state.css +45 -0
  101. package/styled-system/chunks/src__components__font-family.css +85 -0
  102. package/styled-system/chunks/src__components__font-tokens.css +61 -0
  103. package/styled-system/chunks/src__components__input.css +68 -0
  104. package/styled-system/chunks/src__components__layer-styles.css +66 -0
  105. package/styled-system/chunks/src__components__nav-item.css +73 -0
  106. package/styled-system/chunks/src__components__overview.css +125 -0
  107. package/styled-system/chunks/src__components__radii.css +49 -0
  108. package/styled-system/chunks/src__components__semantic-color.css +45 -0
  109. package/styled-system/chunks/src__components__side-nav-item.css +33 -0
  110. package/styled-system/chunks/src__components__side-nav.css +49 -0
  111. package/styled-system/chunks/src__components__sizes.css +41 -0
  112. package/styled-system/chunks/src__components__text-styles.css +31 -0
  113. package/styled-system/chunks/src__components__theme-toggle.css +63 -0
  114. package/styled-system/chunks/src__components__token-analyzer.css +227 -0
  115. package/styled-system/chunks/src__components__token-content.css +13 -0
  116. package/styled-system/chunks/src__components__token-group.css +21 -0
  117. package/styled-system/chunks/src__components__token-search-combobox.css +2 -0
  118. package/styled-system/chunks/src__components__typography-playground.css +61 -0
  119. package/styled-system/chunks/src__layouts__Layout.css +2 -0
  120. package/styled-system/chunks/src__layouts__Sidebar.css +113 -0
  121. package/styled-system/chunks/src__pages__colors.css +2 -0
  122. package/styled-system/chunks/src__pages__font-sizes.css +2 -0
  123. package/styled-system/chunks/src__pages__font-weights.css +2 -0
  124. package/styled-system/chunks/src__pages__fonts.css +2 -0
  125. package/styled-system/chunks/src__pages__index.css +2 -0
  126. package/styled-system/chunks/src__pages__layer-styles.css +2 -0
  127. package/styled-system/chunks/src__pages__letter-spacings.css +2 -0
  128. package/styled-system/chunks/src__pages__line-heights.css +2 -0
  129. package/styled-system/chunks/src__pages__playground__contrast-checker.css +2 -0
  130. package/styled-system/chunks/src__pages__playground__typography.css +2 -0
  131. package/styled-system/chunks/src__pages__radii.css +2 -0
  132. package/styled-system/chunks/src__pages__sizes.css +2 -0
  133. package/styled-system/chunks/src__pages__spacing.css +2 -0
  134. package/styled-system/chunks/src__pages__text-styles.css +2 -0
  135. package/styled-system/chunks/src__pages__token-analyzer__file.css +2 -0
  136. package/styled-system/chunks/src__pages__token-analyzer__index.css +2 -0
  137. package/styled-system/chunks/src__pages__token-analyzer__utility.css +2 -0
  138. package/styled-system/css/conditions.mjs +147 -0
  139. package/styled-system/css/css.d.ts +2 -0
  140. package/styled-system/css/css.mjs +391 -0
  141. package/styled-system/css/cva.d.ts +5 -0
  142. package/styled-system/css/cva.mjs +63 -0
  143. package/styled-system/css/cx.d.ts +4 -0
  144. package/styled-system/css/cx.mjs +15 -0
  145. package/styled-system/css/index.d.ts +3 -0
  146. package/styled-system/css/index.mjs +3 -0
  147. package/styled-system/global.css +61 -0
  148. package/styled-system/helpers.mjs +251 -0
  149. package/styled-system/jsx/absolute-center.d.ts +8 -0
  150. package/styled-system/jsx/absolute-center.mjs +9 -0
  151. package/styled-system/jsx/aspect-ratio.d.ts +8 -0
  152. package/styled-system/jsx/aspect-ratio.mjs +9 -0
  153. package/styled-system/jsx/box.d.ts +8 -0
  154. package/styled-system/jsx/box.mjs +8 -0
  155. package/styled-system/jsx/center.d.ts +8 -0
  156. package/styled-system/jsx/center.mjs +9 -0
  157. package/styled-system/jsx/circle.d.ts +8 -0
  158. package/styled-system/jsx/circle.mjs +9 -0
  159. package/styled-system/jsx/container.d.ts +8 -0
  160. package/styled-system/jsx/container.mjs +8 -0
  161. package/styled-system/jsx/divider.d.ts +8 -0
  162. package/styled-system/jsx/divider.mjs +9 -0
  163. package/styled-system/jsx/factory.d.ts +2 -0
  164. package/styled-system/jsx/factory.mjs +59 -0
  165. package/styled-system/jsx/flex.d.ts +8 -0
  166. package/styled-system/jsx/flex.mjs +9 -0
  167. package/styled-system/jsx/float.d.ts +8 -0
  168. package/styled-system/jsx/float.mjs +9 -0
  169. package/styled-system/jsx/grid-item.d.ts +8 -0
  170. package/styled-system/jsx/grid-item.mjs +9 -0
  171. package/styled-system/jsx/grid.d.ts +8 -0
  172. package/styled-system/jsx/grid.mjs +9 -0
  173. package/styled-system/jsx/hstack.d.ts +8 -0
  174. package/styled-system/jsx/hstack.mjs +9 -0
  175. package/styled-system/jsx/index.d.ts +20 -0
  176. package/styled-system/jsx/index.mjs +19 -0
  177. package/styled-system/jsx/is-valid-prop.mjs +1010 -0
  178. package/styled-system/jsx/spacer.d.ts +8 -0
  179. package/styled-system/jsx/spacer.mjs +9 -0
  180. package/styled-system/jsx/square.d.ts +8 -0
  181. package/styled-system/jsx/square.mjs +9 -0
  182. package/styled-system/jsx/stack.d.ts +8 -0
  183. package/styled-system/jsx/stack.mjs +9 -0
  184. package/styled-system/jsx/styled-link.d.ts +8 -0
  185. package/styled-system/jsx/styled-link.mjs +8 -0
  186. package/styled-system/jsx/vstack.d.ts +8 -0
  187. package/styled-system/jsx/vstack.mjs +9 -0
  188. package/styled-system/jsx/wrap.d.ts +8 -0
  189. package/styled-system/jsx/wrap.mjs +9 -0
  190. package/styled-system/patterns/absolute-center.d.ts +14 -0
  191. package/styled-system/patterns/absolute-center.mjs +23 -0
  192. package/styled-system/patterns/aspect-ratio.d.ts +14 -0
  193. package/styled-system/patterns/aspect-ratio.mjs +25 -0
  194. package/styled-system/patterns/box.d.ts +14 -0
  195. package/styled-system/patterns/box.mjs +12 -0
  196. package/styled-system/patterns/center.d.ts +14 -0
  197. package/styled-system/patterns/center.mjs +18 -0
  198. package/styled-system/patterns/circle.d.ts +14 -0
  199. package/styled-system/patterns/circle.mjs +22 -0
  200. package/styled-system/patterns/container.d.ts +14 -0
  201. package/styled-system/patterns/container.mjs +18 -0
  202. package/styled-system/patterns/divider.d.ts +16 -0
  203. package/styled-system/patterns/divider.mjs +21 -0
  204. package/styled-system/patterns/flex.d.ts +20 -0
  205. package/styled-system/patterns/flex.mjs +23 -0
  206. package/styled-system/patterns/float.d.ts +17 -0
  207. package/styled-system/patterns/float.mjs +45 -0
  208. package/styled-system/patterns/grid-item.d.ts +19 -0
  209. package/styled-system/patterns/grid-item.mjs +20 -0
  210. package/styled-system/patterns/grid.d.ts +18 -0
  211. package/styled-system/patterns/grid.mjs +25 -0
  212. package/styled-system/patterns/hstack.d.ts +15 -0
  213. package/styled-system/patterns/hstack.mjs +20 -0
  214. package/styled-system/patterns/index.d.ts +18 -0
  215. package/styled-system/patterns/index.mjs +18 -0
  216. package/styled-system/patterns/spacer.d.ts +14 -0
  217. package/styled-system/patterns/spacer.mjs +18 -0
  218. package/styled-system/patterns/square.d.ts +14 -0
  219. package/styled-system/patterns/square.mjs +21 -0
  220. package/styled-system/patterns/stack.d.ts +17 -0
  221. package/styled-system/patterns/stack.mjs +20 -0
  222. package/styled-system/patterns/styled-link.d.ts +14 -0
  223. package/styled-system/patterns/styled-link.mjs +18 -0
  224. package/styled-system/patterns/vstack.d.ts +15 -0
  225. package/styled-system/patterns/vstack.mjs +20 -0
  226. package/styled-system/patterns/wrap.d.ts +18 -0
  227. package/styled-system/patterns/wrap.mjs +22 -0
  228. package/styled-system/reset.css +190 -0
  229. package/styled-system/static.css +5 -0
  230. package/styled-system/styles.css +938 -0
  231. package/styled-system/tokens/index.css +374 -0
  232. package/styled-system/tokens/index.d.ts +8 -0
  233. package/styled-system/tokens/index.mjs +1590 -0
  234. package/styled-system/tokens/keyframes.css +30 -0
  235. package/styled-system/tokens/tokens.d.ts +56 -0
  236. package/styled-system/types/composition.d.ts +110 -0
  237. package/styled-system/types/conditions.d.ts +135 -0
  238. package/styled-system/types/csstype.d.ts +20748 -0
  239. package/styled-system/types/global.d.ts +15 -0
  240. package/styled-system/types/helpers.d.ts +1 -0
  241. package/styled-system/types/index.d.ts +3 -0
  242. package/styled-system/types/jsx.d.ts +27 -0
  243. package/styled-system/types/parts.d.ts +5 -0
  244. package/styled-system/types/pattern.d.ts +52 -0
  245. package/styled-system/types/prop-type.d.ts +300 -0
  246. package/styled-system/types/recipe.d.ts +79 -0
  247. package/styled-system/types/selectors.d.ts +56 -0
  248. package/styled-system/types/style-props.d.ts +688 -0
  249. package/styled-system/types/system-types.d.ts +76 -0
  250. package/virtual-panda.ts +72 -0
@@ -0,0 +1,131 @@
1
+ import { useState } from 'react'
2
+ import { HStack, Stack, VStack, panda } from '../../styled-system/jsx'
3
+ import { getContrastPairs, getContrastRatio } from '../lib/color'
4
+ import context from '../lib/panda.context'
5
+ import { ErrorIcon, SuccessIcon } from './icons'
6
+ import { TokenContent } from './token-content'
7
+ import { TokenGroup } from './token-group'
8
+
9
+ function TestScore(props: { score: { WCAG_AA: boolean; WCAG_AAA: boolean }; size: 'regular' | 'large' }) {
10
+ const { score, size } = props
11
+ return (
12
+ <>
13
+ <HStack justify="space-between" fontWeight="medium">
14
+ <HStack gap="2">
15
+ <span>{score.WCAG_AA ? <SuccessIcon /> : <ErrorIcon />}</span>
16
+ <span>AA</span>
17
+ </HStack>
18
+ <span>{size === 'regular' ? '4.5:1' : '3:1'}</span>
19
+ </HStack>
20
+ <HStack justify="space-between" fontWeight="medium">
21
+ <HStack gap="2">
22
+ <span>{score.WCAG_AAA ? <SuccessIcon /> : <ErrorIcon />}</span>
23
+ <span>AAA</span>
24
+ </HStack>
25
+ <span>{size === 'regular' ? '7:1' : '4.5:1'}</span>
26
+ </HStack>
27
+ </>
28
+ )
29
+ }
30
+
31
+ export function ColorContrastChecker() {
32
+ const colorsMap = context.getCategory('colors')
33
+ const values = Array.from(colorsMap.values())
34
+
35
+ const colors = values
36
+ .filter((color) => !color.isConditional && !color.extensions.isVirtual)
37
+ .map((color) => ({
38
+ label: color.extensions.prop,
39
+ value: color.value,
40
+ }))
41
+
42
+ const [foreground, setForeGround] = useState('#000000')
43
+ const [background, setBackground] = useState('#ffffff')
44
+
45
+ const activeForeground = (colors.find((col) => col.label === foreground)?.value || foreground) as string
46
+ const activeBackground = (colors.find((col) => col.label === background)?.value || background) as string
47
+
48
+ const wcag = getContrastPairs(activeForeground, activeBackground)
49
+ const constrastRatio = getContrastRatio(activeForeground, activeBackground)
50
+
51
+ return (
52
+ <TokenGroup>
53
+ <TokenContent>
54
+ <HStack gap="3" p="2">
55
+ <panda.div
56
+ display="flex"
57
+ flexDirection="column"
58
+ borderWidth="1px"
59
+ borderColor="card"
60
+ flex="1"
61
+ pt="16"
62
+ style={{ background: activeForeground }}
63
+ >
64
+ <select value={foreground} onChange={(e: any) => setForeGround(e.currentTarget.value)}>
65
+ {colors.map((color) => (
66
+ <option key={color.label} value={color.label}>
67
+ {color.label}
68
+ </option>
69
+ ))}
70
+ </select>
71
+ </panda.div>
72
+ <panda.div
73
+ display="flex"
74
+ flexDirection="column"
75
+ borderWidth="1px"
76
+ borderColor="card"
77
+ flex="1"
78
+ pt="16"
79
+ style={{ background: activeBackground }}
80
+ >
81
+ <select value={background} onChange={(e: any) => setBackground(e.currentTarget.value)}>
82
+ {colors.map((color) => (
83
+ <option key={color.label} value={color.label}>
84
+ {color.label}
85
+ </option>
86
+ ))}
87
+ </select>
88
+ </panda.div>
89
+ </HStack>
90
+
91
+ <HStack
92
+ justify="center"
93
+ fontWeight="semibold"
94
+ fontSize="2xl"
95
+ p="2"
96
+ outline="none"
97
+ borderWidth="1px"
98
+ borderColor="card"
99
+ suppressContentEditableWarning
100
+ contentEditable
101
+ style={{ background: activeBackground, color: activeForeground }}
102
+ >
103
+ example text showing contrast
104
+ </HStack>
105
+
106
+ <div>
107
+ <VStack textAlign="center" gap="2.5">
108
+ <panda.span fontWeight="bold" fontSize="4xl">
109
+ {constrastRatio ? `${constrastRatio?.toFixed(2).replace(/[.,]00$/, '')}:1` : ':'}
110
+ </panda.span>
111
+ <panda.span fontWeight="semibold" opacity="0.5">
112
+ Contrast ratio
113
+ </panda.span>
114
+ </VStack>
115
+ {wcag && (
116
+ <panda.div display="flex" gap="5" marginTop="10">
117
+ <Stack flex="1" gap="4">
118
+ <panda.span fontWeight="semibold">Normal Text</panda.span>
119
+ <TestScore score={wcag[0]} size="regular" />
120
+ </Stack>
121
+ <Stack flex="1" gap="4">
122
+ <panda.span fontWeight="semibold">Large Text</panda.span>
123
+ <TestScore score={wcag[1]} size="large" />
124
+ </Stack>
125
+ </panda.div>
126
+ )}
127
+ </div>
128
+ </TokenContent>
129
+ </TokenGroup>
130
+ )
131
+ }
@@ -0,0 +1,37 @@
1
+ import type { PropsWithChildren } from 'react'
2
+ import { panda } from '../../styled-system/jsx'
3
+ import type { JsxStyleProps } from '../../styled-system/types'
4
+ import { tokenDictionary } from '../lib/analysis-data'
5
+ import { getReportItemFromTokenName, getUtilityLink } from '../lib/get-report-item'
6
+ import { ColorWrapper } from './color-wrapper'
7
+
8
+ export const ColorItem = ({
9
+ tokenName,
10
+ children,
11
+ ...props
12
+ }: PropsWithChildren<{ tokenName: string } & JsxStyleProps>) => {
13
+ const token = tokenDictionary.getByName('colors.' + tokenName)
14
+ const value = token?.value ?? tokenName
15
+ const reportItem = getReportItemFromTokenName(tokenName)
16
+
17
+ if (!reportItem) return null
18
+
19
+ return (
20
+ <panda.a href={getUtilityLink({ value: reportItem.value })} key={tokenName} {...props}>
21
+ <ColorWrapper
22
+ w="auto"
23
+ minW="80px"
24
+ h="40px"
25
+ mb="2"
26
+ style={{ background: value, border: '1px solid rgba(0,0,0,0.1)' }}
27
+ />
28
+ {children}
29
+
30
+ {tokenName !== value && (
31
+ <panda.div opacity={0.1}>
32
+ <panda.span>{value}</panda.span>
33
+ </panda.div>
34
+ )}
35
+ </panda.a>
36
+ )
37
+ }
@@ -0,0 +1,25 @@
1
+ import { type HTMLPandaProps, panda } from '../../styled-system/jsx'
2
+
3
+ export function ColorWrapper(props: HTMLPandaProps<'div'>) {
4
+ return (
5
+ <panda.div
6
+ width="full"
7
+ height="10"
8
+ borderRadius="sm"
9
+ position="relative"
10
+ overflow="hidden"
11
+ shadow="inset"
12
+ _before={{
13
+ content: "''",
14
+ position: 'absolute',
15
+ borderRadius: 'sm',
16
+ width: '100%',
17
+ height: '100%',
18
+ backgroundSize: '24px',
19
+ zIndex: '-1',
20
+ backgroundImage: 'check',
21
+ }}
22
+ {...props}
23
+ />
24
+ )
25
+ }
@@ -0,0 +1,96 @@
1
+ import { Grid, HStack, Stack, panda } from '../../styled-system/jsx'
2
+ import { ColorWrapper } from '../components/color-wrapper'
3
+ import { TokenContent } from '../components/token-content'
4
+ import { TokenGroup } from '../components/token-group'
5
+ import { useColorDocs } from '../lib/use-color-docs'
6
+ import { Input } from './input'
7
+ import { SemanticColorDisplay } from './semantic-color'
8
+
9
+ const UNCATEGORIZED_ID = 'uncategorized' as const
10
+
11
+ export function Colors() {
12
+ const { filterQuery, setFilterQuery, semanticTokens, hasResults, uncategorizedColors, categorizedColors } =
13
+ useColorDocs()
14
+
15
+ const renderSemanticTokens = () => {
16
+ return semanticTokens.map(([name, colors], i) => {
17
+ return (
18
+ <Stack gap="1" key={i} width="full">
19
+ <HStack gap="1">
20
+ <SemanticColorDisplay
21
+ value={colors[colors.extensions.condition].value}
22
+ condition={colors.extensions.condition}
23
+ />
24
+ <SemanticColorDisplay value={colors.base.value} condition="base" />
25
+ </HStack>
26
+
27
+ <panda.span fontWeight="medium">{name}</panda.span>
28
+ </Stack>
29
+ )
30
+ })
31
+ }
32
+ const renderColors = (values: any[]) => {
33
+ return values?.map((color, i) => {
34
+ return (
35
+ <Stack gap="1" key={i}>
36
+ <ColorWrapper style={{ background: color.value }} />
37
+ <Stack mt="2" gap="0.5">
38
+ <panda.div fontWeight="medium">{color.extensions.prop}</panda.div>
39
+ <panda.div opacity="0.7" fontSize="sm" textTransform="uppercase">
40
+ {color.value}
41
+ </panda.div>
42
+ </Stack>
43
+ </Stack>
44
+ )
45
+ })
46
+ }
47
+
48
+ return (
49
+ <TokenGroup>
50
+ <panda.div mb="3.5" position="sticky" top="0" zIndex="1">
51
+ <Input
52
+ value={filterQuery}
53
+ onChange={(e) => setFilterQuery(e.target.value)}
54
+ placeholder="Filter tokens by text, property or value"
55
+ />
56
+ </panda.div>
57
+ <TokenContent>
58
+ <Stack gap="10">
59
+ {!!categorizedColors.length &&
60
+ categorizedColors.map(([category, colors]) => (
61
+ <div key={category}>
62
+ <panda.span fontWeight="medium" textTransform="capitalize" fontSize="xl">
63
+ {category}
64
+ </panda.span>
65
+
66
+ <Grid gap="4" minChildWidth="13rem" my="5" mx="0" key={category}>
67
+ {renderColors(colors)}
68
+ </Grid>
69
+ </div>
70
+ ))}
71
+ {!!uncategorizedColors?.length && (
72
+ <div>
73
+ <panda.span fontWeight="medium" textTransform="capitalize" fontSize="xl">
74
+ {UNCATEGORIZED_ID}
75
+ </panda.span>
76
+ <Grid gap="4" minChildWidth="13rem" my="5" mx="0">
77
+ {renderColors(uncategorizedColors)}
78
+ </Grid>
79
+ </div>
80
+ )}
81
+ {!!semanticTokens.length && (
82
+ <div>
83
+ <panda.span fontWeight="medium" textTransform="capitalize" fontSize="xl">
84
+ Semantic tokens
85
+ </panda.span>
86
+ <Grid gap="4" minChildWidth="13rem" my="5" mx="0">
87
+ {renderSemanticTokens()}
88
+ </Grid>
89
+ </div>
90
+ )}
91
+ {!hasResults && <div>No result found! 🐼</div>}
92
+ </Stack>
93
+ </TokenContent>
94
+ </TokenGroup>
95
+ )
96
+ }
@@ -0,0 +1,19 @@
1
+ import { panda, Stack } from '../../styled-system/jsx'
2
+
3
+ type EmptyStateProps = {
4
+ title: string
5
+ children: React.ReactNode
6
+ icon: React.ReactElement
7
+ }
8
+
9
+ export function EmptyState({ title, children, icon }: EmptyStateProps) {
10
+ return (
11
+ <Stack align="center" gap="5" justify="center" height="full" minHeight="40vh">
12
+ <panda.span fontSize="5xl">{icon}</panda.span>
13
+ <Stack opacity="0.8" align="center">
14
+ <panda.span fontWeight="semibold">{title}</panda.span>
15
+ <p>{children}</p>
16
+ </Stack>
17
+ </Stack>
18
+ )
19
+ }
@@ -0,0 +1,55 @@
1
+ import { Flex, HStack, Square, Stack, panda } from '../../styled-system/jsx'
2
+ import context from '../lib/panda.context'
3
+
4
+ const fonts = context.getCategory('fonts')
5
+
6
+ const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i))
7
+ const symbols = Array.from({ length: 10 }, (_, i) => String.fromCharCode(48 + i))
8
+ const specials = ['@', '#', '$', '%', '&', '!', '?', '+', '-']
9
+
10
+ export const FontFamily = () => {
11
+ const values = Array.from(fonts.values())
12
+ return (
13
+ <Stack gap="10">
14
+ {values.map((font) => (
15
+ <Stack key={font.name} gap="8">
16
+ <HStack gap="10" style={{ fontFamily: font.value }}>
17
+ <panda.p fontSize="100px" fontWeight="bold" lineHeight="1">
18
+ Ag
19
+ </panda.p>
20
+
21
+ <Flex wrap="wrap" fontSize="24px" mt="8">
22
+ {letters.map((letter) => (
23
+ <Square textTransform="uppercase" size="8" key={letter}>
24
+ {letter}
25
+ </Square>
26
+ ))}
27
+ {letters.map((letter) => (
28
+ <Square textTransform="lowercase" size="8" key={letter}>
29
+ {letter}
30
+ </Square>
31
+ ))}
32
+ {symbols.map((sym) => (
33
+ <Square textTransform="lowercase" size="8" key={sym}>
34
+ {sym}
35
+ </Square>
36
+ ))}
37
+ {specials.map((sym) => (
38
+ <Square textTransform="lowercase" size="8" key={sym}>
39
+ {sym}
40
+ </Square>
41
+ ))}
42
+ </Flex>
43
+ </HStack>
44
+
45
+ <Stack>
46
+ <panda.span fontWeight="semibold">{font.extensions.prop}</panda.span>
47
+ <panda.span fontFamily={font.value} opacity="0.7">
48
+ {font.value}
49
+ </panda.span>
50
+ </Stack>
51
+ </Stack>
52
+ ))}
53
+ </Stack>
54
+ )
55
+ }
@@ -0,0 +1,69 @@
1
+ import { Fragment, useState } from 'react'
2
+ import { HStack, panda, Stack } from '../../styled-system/jsx'
3
+ import { TokenContent } from '../components/token-content'
4
+ import { TokenGroup } from '../components/token-group'
5
+ import { Input, Textarea } from './input'
6
+
7
+ type FontTokensProps = {
8
+ text?: string
9
+ largeText?: boolean
10
+ token: string
11
+ fontTokens: Map<string, any>
12
+ css?: any
13
+ }
14
+
15
+ export function FontTokens(props: FontTokensProps) {
16
+ const { text: textProp = 'Hello World', largeText = false, token, fontTokens } = props
17
+ const [text, setText] = useState(textProp)
18
+
19
+ const values = Array.from(fontTokens.values())
20
+
21
+ return (
22
+ <TokenGroup>
23
+ <panda.div mb="3.5" position="sticky" top="0" zIndex={1}>
24
+ {largeText ? (
25
+ <Textarea
26
+ resize="vertical"
27
+ onChange={(event) => {
28
+ setText(event.currentTarget.value)
29
+ }}
30
+ rows={5}
31
+ value={text}
32
+ placeholder="Preview Text"
33
+ />
34
+ ) : (
35
+ <Input
36
+ value={text}
37
+ onChange={(event) => {
38
+ setText(event.currentTarget.value)
39
+ }}
40
+ placeholder="Preview Text"
41
+ />
42
+ )}
43
+ </panda.div>
44
+
45
+ <TokenContent>
46
+ {values.map((fontToken) => (
47
+ <Fragment key={fontToken.extensions.prop}>
48
+ <Stack gap="3.5">
49
+ <HStack gap="1">
50
+ <panda.span fontWeight="medium">{fontToken.extensions.prop}</panda.span>
51
+ <panda.span opacity="0.4">({fontToken.value})</panda.span>
52
+ </HStack>
53
+ <panda.span
54
+ fontSize="4xl"
55
+ lineHeight="normal"
56
+ className="render"
57
+ style={{
58
+ [token]: fontToken.value,
59
+ }}
60
+ >
61
+ {text}
62
+ </panda.span>
63
+ </Stack>
64
+ </Fragment>
65
+ ))}
66
+ </TokenContent>
67
+ </TokenGroup>
68
+ )
69
+ }
@@ -0,0 +1,35 @@
1
+ <meta charset="utf-8" />
2
+ <meta name="viewport" content="width=device-width" />
3
+ <meta name="theme-color" content="hsl(256, 44%, 15%)" media="(prefers-color-scheme: dark)" />
4
+ <meta name="theme-color" content="hsl(273, 37%, 93%)" media="(prefers-color-scheme: light)" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <link rel="alternate icon" type="image/x-icon" href="/favicon.ico" />
7
+ <link rel="sitemap" href="/sitemap-index.xml" />
8
+
9
+ <script is:inline>
10
+ const root = document.documentElement
11
+ const storageKey = 'panda:studio:theme'
12
+
13
+ const theme = (() => {
14
+ if (typeof localStorage !== 'undefined' && localStorage.getItem(storageKey)) {
15
+ return localStorage.getItem(storageKey)
16
+ }
17
+ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
18
+ return 'dark'
19
+ }
20
+ return 'light'
21
+ })()
22
+
23
+ const isDark = theme === 'dark'
24
+ root.classList[isDark ? 'add' : 'remove']('dark')
25
+ root.classList[isDark ? 'remove' : 'add']('light')
26
+
27
+ if (typeof localStorage !== 'undefined') {
28
+ // Watch the document element and persist user preference when it changes.
29
+ const observer = new MutationObserver(() => {
30
+ const isDark = root.classList.contains('dark')
31
+ localStorage.setItem(storageKey, isDark ? 'dark' : 'light')
32
+ })
33
+ observer.observe(root, { attributes: true, attributeFilter: ['class'] })
34
+ }
35
+ </script>
@@ -0,0 +1,207 @@
1
+ export function ErrorIcon() {
2
+ return (
3
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="red">
4
+ <rect width="13.9361" height="2.9863" transform="matrix(0.704896 0.709311 -0.704896 0.709311 4.10498 2)"></rect>
5
+ <rect width="2.9863" height="13.9361" transform="matrix(0.704896 0.709311 -0.704896 0.709311 11.8938 2)"></rect>
6
+ </svg>
7
+ )
8
+ }
9
+
10
+ export function SuccessIcon() {
11
+ return (
12
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="green" xmlns="http://www.w3.org/2000/svg">
13
+ <rect
14
+ width="7.4659"
15
+ height="3.26633"
16
+ transform="matrix(0.69978 0.714359 -0.69978 0.714359 2.28577 6.99997)"
17
+ ></rect>
18
+ <rect width="3.26633" height="14.9318" transform="matrix(0.69978 0.714359 -0.69978 0.714359 13.7142 2)"></rect>
19
+ </svg>
20
+ )
21
+ }
22
+
23
+ export function ColorIcon() {
24
+ return (
25
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
26
+ <path
27
+ d="M14 16C14 17.77 13.23 19.37 12 20.46C10.9053 21.4541 9.47871 22.0033 8 22C4.69 22 2 19.31 2 16C2 13.24 3.88 10.9 6.42 10.21C6.76425 11.0756 7.30469 11.8494 7.9988 12.4706C8.6929 13.0918 9.52171 13.5435 10.42 13.79C10.92 13.93 11.45 14 12 14C12.55 14 13.08 13.93 13.58 13.79C13.85 14.47 14 15.22 14 16Z"
28
+ stroke="currentColor"
29
+ strokeWidth="1.5"
30
+ strokeLinecap="round"
31
+ strokeLinejoin="round"
32
+ />
33
+ <path
34
+ d="M18 8C18.0016 9.3166 17.5695 10.5971 16.7706 11.6436C15.9717 12.6901 14.8504 13.4444 13.58 13.79C13.08 13.93 12.55 14 12 14C11.45 14 10.92 13.93 10.42 13.79C9.14956 13.4444 8.02827 12.6901 7.22937 11.6436C6.43047 10.5971 5.99843 9.3166 6 8C6 4.69 8.69 2 12 2C15.31 2 18 4.69 18 8Z"
35
+ stroke="currentColor"
36
+ strokeWidth="1.5"
37
+ strokeLinecap="round"
38
+ strokeLinejoin="round"
39
+ />
40
+ <path
41
+ d="M22 16C22 19.31 19.31 22 16 22C14.5213 22.0033 13.0947 21.4541 12 20.46C13.23 19.37 14 17.77 14 16C14 15.22 13.85 14.47 13.58 13.79C15.41 13.29 16.89 11.95 17.58 10.21C20.12 10.9 22 13.24 22 16Z"
42
+ stroke="currentColor"
43
+ strokeWidth="1.5"
44
+ strokeLinecap="round"
45
+ strokeLinejoin="round"
46
+ />
47
+ </svg>
48
+ )
49
+ }
50
+
51
+ export function TextStylesIcon() {
52
+ return (
53
+ <svg width="48" height="1em" viewBox="0 0 48 30">
54
+ <path
55
+ d="M0 29.16H4.56L6.96 22.36H19.88L22.28 29.16H26.84L16.48 0H10.36L0 29.16ZM8 18.96L11.28 9.96L13.32 4H13.56L15.6 9.96L18.8 18.96H8Z"
56
+ fill="currentColor"
57
+ />
58
+ <path
59
+ d="M35.7959 29.52C39.3559 29.52 41.9959 27.68 42.9959 24.96H43.2359V29.16H47.3559V8H43.3959L43.2359 12.16H42.9959C41.9959 9.44 39.3559 7.64 35.7959 7.64C30.6359 7.64 27.1559 11.48 27.1559 18.56C27.1559 25.64 30.6359 29.52 35.7959 29.52ZM37.2359 26.12C33.7159 26.12 31.3959 23.52 31.3959 18.56C31.3959 13.56 33.7159 11 37.2359 11C41.1559 11 43.1959 14.12 43.1959 17.36V19.76C43.1959 23.04 41.1559 26.12 37.2359 26.12Z"
60
+ fill="currentColor"
61
+ />
62
+ </svg>
63
+ )
64
+ }
65
+
66
+ export function LayerStylesIcon() {
67
+ return (
68
+ <svg width="1em" height="1em" viewBox="0 0 24 24">
69
+ <title>paint-brush</title>
70
+ <g
71
+ strokeLinecap="square"
72
+ strokeLinejoin="miter"
73
+ strokeWidth="2"
74
+ fill="none"
75
+ stroke="currentColor"
76
+ strokeMiterlimit="10"
77
+ >
78
+ <polyline
79
+ points="15.021,18.879 22.092,11.808 19.971,9.686 17.142,9.686 17.142,6.858 12.192,1.908 5.121,8.979 "
80
+ strokeLinecap="butt"
81
+ stroke="currentColor"
82
+ />
83
+ <path d="M4.414,9.686 c-1.202,1.202-1.202,3.041,0,4.243l1.414,1.414l-4.172,4.172c-0.707,0.707-0.849,1.838-0.283,2.687 c0.778,1.061,2.192,1.061,3.041,0.212l4.243-4.243l1.414,1.414c1.202,1.202,3.041,1.202,4.243,0l0.707-0.707L5.121,8.979 L4.414,9.686z"></path>
84
+ </g>
85
+ </svg>
86
+ )
87
+ }
88
+
89
+ export function TypographyIcon() {
90
+ return (
91
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
92
+ <path
93
+ d="M2.67 7.17V5.35C2.67 4.2 3.6 3.28 4.74 3.28H19.26C20.41 3.28 21.33 4.21 21.33 5.35V7.17M12 20.72V4.11M8.06 20.72H15.94"
94
+ stroke="currentColor"
95
+ strokeWidth="1.5"
96
+ strokeLinecap="round"
97
+ strokeLinejoin="round"
98
+ />
99
+ </svg>
100
+ )
101
+ }
102
+
103
+ export function SpacingIcon() {
104
+ return (
105
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
106
+ <path
107
+ d="M3 22H21M3 2H21M12 6V18M14.83 7.72L12 4.89L9.17 7.72M14.83 15.89L12 18.72L9.17 15.89"
108
+ stroke="currentColor"
109
+ strokeWidth="1.5"
110
+ strokeLinecap="round"
111
+ strokeLinejoin="round"
112
+ />
113
+ </svg>
114
+ )
115
+ }
116
+ export function FontWeightIcon() {
117
+ return (
118
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
119
+ <path
120
+ d="M4.88 4.5C4.88 3.4 5.78 2.5 6.88 2.5H12C14.62 2.5 16.75 4.63 16.75 7.25C16.75 9.87 14.62 12 12 12H4.88V4.5ZM4.88 12H14.38C17 12 19.13 14.13 19.13 16.75C19.13 19.37 17 21.5 14.38 21.5H6.88C5.78 21.5 4.88 20.6 4.88 19.5V12V12Z"
121
+ stroke="currentColor"
122
+ strokeWidth="1.5"
123
+ strokeLinecap="round"
124
+ strokeLinejoin="round"
125
+ />
126
+ </svg>
127
+ )
128
+ }
129
+ export function SizesIcon() {
130
+ return (
131
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
132
+ <path
133
+ d="M11.47 6H16.47M11.47 18H15.47M11.47 13.95L16.47 14M11.47 10H14.47M8.44 7H2.53M21.47 19V5C21.47 3 20.47 2 18.47 2H14.47C12.47 2 11.47 3 11.47 5V19C11.47 21 12.47 22 14.47 22H18.47C20.47 22 21.47 21 21.47 19ZM5.49 2C3.86 2 2.53 3.33 2.53 4.95V17.91C2.53 18.36 2.72 19.04 2.95 19.43L3.77 20.79C4.71 22.36 6.26 22.36 7.2 20.79L8.02 19.43C8.25 19.04 8.44 18.36 8.44 17.91V4.95C8.44 3.33 7.11 2 5.49 2Z"
134
+ stroke="currentColor"
135
+ strokeWidth="1.5"
136
+ strokeLinecap="round"
137
+ />
138
+ </svg>
139
+ )
140
+ }
141
+
142
+ export function LetterSpacingIcon() {
143
+ return (
144
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
145
+ <path
146
+ d="M7 10.74V13.94M12 9V15.68M17 10.74V13.94M9 22H15C20 22 22 20 22 15V9C22 4 20 2 15 2H9C4 2 2 4 2 9V15C2 20 4 22 9 22Z"
147
+ stroke="currentColor"
148
+ strokeWidth="1.5"
149
+ strokeLinecap="round"
150
+ strokeLinejoin="round"
151
+ />
152
+ </svg>
153
+ )
154
+ }
155
+ export function FontSizesIcon() {
156
+ return (
157
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
158
+ <path
159
+ d="M1.99001 5.93001V4.42001C1.99001 3.40001 2.82001 2.57001 3.84001 2.57001H16.76C17.78 2.57001 18.61 3.40001 18.61 4.42001V5.93001M10.3 18.1V3.32001M6.90001 18.1H12.48M13.68 10.34H20.69C21.42 10.34 22.01 10.93 22.01 11.66V12.46M16.08 21.43V10.87M13.94 21.43H18.22"
160
+ stroke="currentColor"
161
+ strokeWidth="1.5"
162
+ strokeLinecap="round"
163
+ strokeLinejoin="round"
164
+ />
165
+ </svg>
166
+ )
167
+ }
168
+ export function LineHeightIcon() {
169
+ return (
170
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
171
+ <path
172
+ d="M6 6.25V8.25M10 6.25V8.25M6 16V18M10 16V18M14 7.25H18M14 17H18M2 12H22M9 22H15C20 22 22 20 22 15V9C22 4 20 2 15 2H9C4 2 2 4 2 9V15C2 20 4 22 9 22Z"
173
+ stroke="currentColor"
174
+ strokeWidth="1.5"
175
+ strokeLinecap="round"
176
+ strokeLinejoin="round"
177
+ />
178
+ </svg>
179
+ )
180
+ }
181
+ export function ColorContrastIcon() {
182
+ return (
183
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
184
+ <path
185
+ d="M10 4.5V18C10 19.08 9.56 20.07 8.86 20.79L8.82 20.83C8.73 20.92 8.63 21.01 8.54 21.08C8.24 21.34 7.9 21.54 7.55 21.68C7.44 21.73 7.33 21.77 7.22 21.81C6.83 21.94 6.41 22 6 22C5.73 22 5.46 21.97 5.2 21.92C5.07 21.89 4.94 21.86 4.81 21.82C4.65 21.77 4.5 21.72 4.35 21.65C4.35 21.64 4.35 21.64 4.34 21.65C4.06 21.51 3.79 21.35 3.54 21.16L3.53 21.15C3.4 21.05 3.28 20.95 3.17 20.83C3.06 20.71 2.95 20.59 2.84 20.46C2.65 20.21 2.49 19.94 2.35 19.66C2.36 19.65 2.36 19.65 2.35 19.65C2.35 19.65 2.35 19.64 2.34 19.63C2.28 19.49 2.23 19.34 2.18 19.19C2.14199 19.0612 2.10863 18.9312 2.08 18.8C2.03 18.54 2 18.27 2 18V4.5C2 3 3 2 4.5 2H7.5C9 2 10 3 10 4.5Z"
186
+ stroke="currentColor"
187
+ strokeWidth="1.5"
188
+ strokeLinecap="round"
189
+ strokeLinejoin="round"
190
+ />
191
+ <path
192
+ d="M22 16.5V19.5C22 21 21 22 19.5 22H6C6.41 22 6.83 21.94 7.22 21.81C7.33 21.77 7.44 21.73 7.55 21.68C7.9 21.54 8.24 21.34 8.54 21.08C8.63 21.01 8.73 20.92 8.82 20.83L8.86 20.79L15.66 14H19.5C21 14 22 15 22 16.5V16.5ZM4.81 21.82C4.21 21.64 3.64 21.31 3.17 20.83C2.69 20.36 2.36 19.79 2.18 19.19C2.37413 19.8078 2.71464 20.3695 3.17254 20.8275C3.63045 21.2854 4.1922 21.6259 4.81 21.82V21.82Z"
193
+ stroke="currentColor"
194
+ strokeWidth="1.5"
195
+ strokeLinecap="round"
196
+ strokeLinejoin="round"
197
+ />
198
+ <path
199
+ d="M18.37 11.29L15.66 14L8.86 20.79C9.56 20.07 10 19.08 10 18V8.34001L12.71 5.63001C13.77 4.57001 15.19 4.57001 16.25 5.63001L18.37 7.75001C19.43 8.81001 19.43 10.23 18.37 11.29ZM6 19C6.26522 19 6.51957 18.8947 6.70711 18.7071C6.89464 18.5196 7 18.2652 7 18C7 17.7348 6.89464 17.4804 6.70711 17.2929C6.51957 17.1054 6.26522 17 6 17C5.73478 17 5.48043 17.1054 5.29289 17.2929C5.10536 17.4804 5 17.7348 5 18C5 18.2652 5.10536 18.5196 5.29289 18.7071C5.48043 18.8947 5.73478 19 6 19Z"
200
+ stroke="currentColor"
201
+ strokeWidth="1.5"
202
+ strokeLinecap="round"
203
+ strokeLinejoin="round"
204
+ />
205
+ </svg>
206
+ )
207
+ }