@pandacss/studio 0.15.2 → 0.15.4

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 (60) hide show
  1. package/package.json +8 -8
  2. package/src/lib/panda.context.ts +0 -2
  3. package/styled-system/chunks/src__components__color-wrapper.css +16 -25
  4. package/styled-system/chunks/src__components__colors.css +0 -1
  5. package/styled-system/chunks/src__components__empty-state.css +0 -1
  6. package/styled-system/chunks/src__components__font-family.css +0 -1
  7. package/styled-system/chunks/src__components__font-tokens.css +0 -1
  8. package/styled-system/chunks/src__components__input.css +10 -16
  9. package/styled-system/chunks/src__components__layer-styles.css +5 -7
  10. package/styled-system/chunks/src__components__nav-item.css +3 -5
  11. package/styled-system/chunks/src__components__overview.css +4 -7
  12. package/styled-system/chunks/src__components__radii.css +0 -1
  13. package/styled-system/chunks/src__components__semantic-color.css +0 -1
  14. package/styled-system/chunks/src__components__side-nav-item.css +4 -7
  15. package/styled-system/chunks/src__components__side-nav.css +0 -1
  16. package/styled-system/chunks/src__components__text-styles.css +0 -1
  17. package/styled-system/chunks/src__components__theme-toggle.css +2 -4
  18. package/styled-system/chunks/src__components__token-content.css +0 -1
  19. package/styled-system/chunks/src__components__token-group.css +0 -1
  20. package/styled-system/chunks/src__components__typography-playground.css +0 -1
  21. package/styled-system/chunks/src__layouts__Sidebar.css +4 -4
  22. package/styled-system/jsx/factory.mjs +29 -17
  23. package/styled-system/styles.css +50 -319
  24. package/styled-system/types/jsx.d.ts +10 -2
  25. package/styled-system/types/recipe.d.ts +10 -8
  26. package/virtual-panda.ts +2 -12
  27. package/src/components/analyzer/category-utilities.tsx +0 -156
  28. package/src/components/analyzer/data-combobox.tsx +0 -154
  29. package/src/components/analyzer/data-table.tsx +0 -39
  30. package/src/components/analyzer/external-icon.tsx +0 -8
  31. package/src/components/analyzer/file-details.tsx +0 -101
  32. package/src/components/analyzer/get-report-infos-from.ts +0 -80
  33. package/src/components/analyzer/quick-tooltip.tsx +0 -15
  34. package/src/components/analyzer/report-item-columns.tsx +0 -52
  35. package/src/components/analyzer/report-item-link.tsx +0 -98
  36. package/src/components/analyzer/section.tsx +0 -24
  37. package/src/components/analyzer/sort-icon.tsx +0 -10
  38. package/src/components/analyzer/text-with-count.tsx +0 -28
  39. package/src/components/analyzer/token-search-combobox.tsx +0 -39
  40. package/src/components/analyzer/truncated-text.tsx +0 -28
  41. package/src/components/analyzer/utility-details.tsx +0 -325
  42. package/src/components/color-item.tsx +0 -37
  43. package/src/components/token-analyzer.tsx +0 -397
  44. package/src/lib/analysis-data.ts +0 -17
  45. package/src/lib/get-report-item.tsx +0 -41
  46. package/src/pages/token-analyzer/file.astro +0 -11
  47. package/src/pages/token-analyzer/index.astro +0 -11
  48. package/src/pages/token-analyzer/utility.astro +0 -11
  49. package/styled-system/chunks/src__components__analyzer__category-utilities.css +0 -118
  50. package/styled-system/chunks/src__components__analyzer__data-combobox.css +0 -137
  51. package/styled-system/chunks/src__components__analyzer__data-table.css +0 -46
  52. package/styled-system/chunks/src__components__analyzer__file-details.css +0 -98
  53. package/styled-system/chunks/src__components__analyzer__report-item-columns.css +0 -39
  54. package/styled-system/chunks/src__components__analyzer__report-item-link.css +0 -78
  55. package/styled-system/chunks/src__components__analyzer__section.css +0 -30
  56. package/styled-system/chunks/src__components__analyzer__text-with-count.css +0 -34
  57. package/styled-system/chunks/src__components__analyzer__truncated-text.css +0 -18
  58. package/styled-system/chunks/src__components__analyzer__utility-details.css +0 -139
  59. package/styled-system/chunks/src__components__color-item.css +0 -22
  60. package/styled-system/chunks/src__components__token-analyzer.css +0 -220
@@ -1,98 +0,0 @@
1
- import type { ReportItemJSON } from '@pandacss/types'
2
- import { panda } from '../../../styled-system/jsx'
3
- import { styledLink } from '../../../styled-system/patterns'
4
- import { analysisData } from '../../lib/analysis-data'
5
- import {
6
- getReportItem,
7
- getUtilityLink,
8
- getReportRange,
9
- getReportRelativeFilePath,
10
- openReportItemInEditor,
11
- type SearchableReportItemAttributes,
12
- } from '../../lib/get-report-item'
13
- import { ExternalIcon } from './external-icon'
14
- import { QuickTooltip } from './quick-tooltip'
15
- import { TextWithCount } from './text-with-count'
16
- import { TruncatedText } from './truncated-text'
17
-
18
- export const ReportItemLink = (reportItem: Partial<ReportItemJSON>) => {
19
- const value = String(reportItem.value)
20
- const withTokenName = analysisData.details.globalMaps.byTokenName[value] ?? []
21
- const count = withTokenName?.filter((id) => getReportItem(id)?.propName === reportItem.propName)?.length
22
-
23
- return (
24
- <panda.a className={styledLink({})} href={getUtilityLink(reportItem)}>
25
- <TextWithCount count={count}>
26
- {reportItem.propName}.<TruncatedText text={value} />
27
- </TextWithCount>
28
- </panda.a>
29
- )
30
- }
31
-
32
- const mapsByReportItemAttribute = {
33
- propName: analysisData.details.globalMaps.byPropertyName,
34
- value: analysisData.details.globalMaps.byTokenName,
35
- category: analysisData.details.globalMaps.byCategory,
36
- from: analysisData.details.globalMaps.byInstanceName,
37
- filepath: analysisData.details.byFilepath,
38
- }
39
-
40
- /** Takes a single search param */
41
- export const UtilityLink = (search: SearchableReportItemAttributes) => {
42
- const value = search.value ?? search.propName ?? search.category ?? search.filepath ?? search.from
43
-
44
- let list: number[] | undefined
45
- if (search.value) {
46
- list = mapsByReportItemAttribute.value[String(search.value)]
47
- } else if (search.propName) {
48
- list = mapsByReportItemAttribute.propName[search.propName]
49
- } else if (search.category) {
50
- list = mapsByReportItemAttribute.category[search.category]
51
- } else if (search.filepath) {
52
- list = mapsByReportItemAttribute.filepath[search.filepath]
53
- } else if (search.from) {
54
- list = mapsByReportItemAttribute.from[search.from]
55
- }
56
-
57
- return (
58
- <panda.a
59
- className={styledLink({ color: String(value).endsWith('!') ? 'red.400' : undefined })}
60
- href={getUtilityLink(search)}
61
- >
62
- <TextWithCount count={(list ?? []).length}>
63
- <TruncatedText text={String(value)} />
64
- </TextWithCount>
65
- </panda.a>
66
- )
67
- }
68
-
69
- export const ReportItemOpenInEditorLink = ({ withRange, ...reportItem }: ReportItemJSON & { withRange?: boolean }) => {
70
- return (
71
- <panda.div display="flex" alignItems="center">
72
- <panda.a
73
- className={styledLink({ alignSelf: 'flex-start', mr: '2' })}
74
- href={getUtilityLink({ filepath: reportItem.filepath })}
75
- >
76
- {getReportRelativeFilePath(reportItem.filepath)}
77
- {withRange ? getReportRange(reportItem) : ''}
78
- </panda.a>
79
- <QuickTooltip
80
- tooltip={
81
- <panda.span p="2" bgColor="card" border="1px solid token(colors.border)" shadow="sm" rounded="md">
82
- Click to open in editor
83
- </panda.span>
84
- }
85
- >
86
- <panda.div
87
- pos="relative"
88
- maxW="14px"
89
- flexShrink={0}
90
- cursor="pointer"
91
- onClickCapture={() => openReportItemInEditor(reportItem)}
92
- >
93
- <ExternalIcon />
94
- </panda.div>
95
- </QuickTooltip>
96
- </panda.div>
97
- )
98
- }
@@ -1,24 +0,0 @@
1
- import type { PropsWithChildren, ReactNode } from 'react'
2
- import { panda, Stack } from '../../../styled-system/jsx'
3
- import type { JsxStyleProps } from '../../../styled-system/types'
4
-
5
- export const Section = ({
6
- title,
7
- subTitle,
8
- children,
9
- ...props
10
- }: PropsWithChildren<{ title: ReactNode; subTitle?: ReactNode } & JsxStyleProps>) => {
11
- return (
12
- <Stack p="4" gap="4" w="100%">
13
- {title && (
14
- <panda.div w="full" display="flex">
15
- <panda.h3>{title}</panda.h3>
16
- {subTitle}
17
- </panda.div>
18
- )}
19
- <panda.div p="4" w="100%" rounded="md" {...props}>
20
- {children}
21
- </panda.div>
22
- </Stack>
23
- )
24
- }
@@ -1,10 +0,0 @@
1
- export const SortIcon = () => {
2
- return (
3
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
4
- <path
5
- d="M15.344 17.778a.75.75 0 0 0-.75-.75h-5.16a.75.75 0 0 0 0 1.5h5.16a.75.75 0 0 0 .75-.75zm2.206-4a.75.75 0 0 0-.75-.75H7.204a.75.75 0 0 0 0 1.5H16.8a.75.75 0 0 0 .75-.75zm2.45-4a.75.75 0 0 0-.75-.75H4.75a.75.75 0 0 0 0 1.5h14.5a.75.75 0 0 0 .75-.75zm2-4a.75.75 0 0 0-.75-.75H2.75a.75.75 0 0 0 0 1.5h18.5a.75.75 0 0 0 .75-.75z"
6
- stroke="currentColor"
7
- />
8
- </svg>
9
- )
10
- }
@@ -1,28 +0,0 @@
1
- import type { PropsWithChildren } from 'react'
2
- import { panda } from '../../../styled-system/jsx'
3
- import type { JsxStyleProps } from '../../../styled-system/types'
4
-
5
- export const TextWithCount = ({ children, count, ...props }: PropsWithChildren<{ count: number } & JsxStyleProps>) => {
6
- return (
7
- <panda.div display="inline-flex" alignItems="center" {...props}>
8
- <panda.span>{children}</panda.span>
9
- <Sup>({count})</Sup>
10
- </panda.div>
11
- )
12
- }
13
-
14
- const Sup = ({ children, className }: PropsWithChildren<{ className?: string }>) => {
15
- return (
16
- <panda.sup
17
- fontSize="75%"
18
- lineHeight={0}
19
- position="relative"
20
- top="-0.35em"
21
- opacity="0.5"
22
- ml="1"
23
- className={className}
24
- >
25
- {children}
26
- </panda.sup>
27
- )
28
- }
@@ -1,39 +0,0 @@
1
- import { analysisData } from '../../lib/analysis-data'
2
- import { getUtilityLink, getReportRelativeFilePath } from '../../lib/get-report-item'
3
- import { DataCombobox, type DataComboboxProps } from './data-combobox'
4
-
5
- const searchList = new Map<string, string>()
6
- const tokenNames = Object.keys(analysisData.details.globalMaps.byTokenName)
7
- const propertyNames = Object.keys(analysisData.details.globalMaps.byPropertyName)
8
- const categories = Object.keys(analysisData.details.globalMaps.byCategory)
9
- const filepaths = Object.keys(analysisData.details.byFilepath)
10
- tokenNames.sort().forEach((key) => {
11
- searchList.set(key, 'value')
12
- })
13
- propertyNames.sort().forEach((key) => {
14
- searchList.set(key, 'propName')
15
- })
16
- categories.sort().forEach((key) => {
17
- searchList.set(key, 'category')
18
- })
19
- filepaths.sort().forEach((key) => {
20
- searchList.set(getReportRelativeFilePath(key), 'filepath')
21
- })
22
-
23
- export const TokenSearchCombobox = (props: Omit<DataComboboxProps, 'options' | 'onSelect'>) => {
24
- return (
25
- <DataCombobox
26
- placeholder={`Search for a token name (${tokenNames.length}), property name (${propertyNames.length}), category (${categories.length}), file path (${filepaths.length})...`}
27
- {...props}
28
- options={Array.from(searchList.entries()).map(([key, value]) => ({ label: `[${value}]: ${key}`, value: key }))}
29
- onSelect={(option) => {
30
- if (!option.value) return
31
-
32
- const type = searchList.get(option.value)
33
- if (!type) return
34
-
35
- window.location.href = getUtilityLink({ [type]: option.value })
36
- }}
37
- />
38
- )
39
- }
@@ -1,28 +0,0 @@
1
- import { panda } from '../../../styled-system/jsx'
2
- import type { JsxStyleProps } from '../../../styled-system/types'
3
- import { truncate } from '../../lib/truncate'
4
- import { QuickTooltip } from './quick-tooltip'
5
-
6
- export const TruncatedText = ({
7
- text,
8
- characters = 24,
9
- ...props
10
- }: { text: string; characters?: number } & JsxStyleProps) => {
11
- if (text.length > characters) {
12
- return (
13
- <QuickTooltip
14
- tooltip={
15
- <panda.span p="2" bgColor="card" border="1px solid rgba(0, 0, 0, 0.1)">
16
- {truncate(text, 80)}
17
- </panda.span>
18
- }
19
- >
20
- <panda.span color="text" {...props}>
21
- {text.substring(0, characters) + '...'}
22
- </panda.span>
23
- </QuickTooltip>
24
- )
25
- }
26
-
27
- return <panda.span {...props}>{text}</panda.span>
28
- }
@@ -1,325 +0,0 @@
1
- import {
2
- Portal,
3
- Select,
4
- SelectContent,
5
- SelectLabel,
6
- SelectOption,
7
- SelectPositioner,
8
- SelectTrigger,
9
- } from '@ark-ui/react'
10
- import { useState } from 'react'
11
-
12
- import { css, cx } from '../../../styled-system/css'
13
- import { Flex, Wrap, panda } from '../../../styled-system/jsx'
14
- import { styledLink } from '../../../styled-system/patterns'
15
-
16
- import { analysisData } from '../../lib/analysis-data'
17
- import { createContext } from '../../lib/create-context'
18
- import { getFileLink, getReportRelativeFilePath, type SearchableReportItemAttributes } from '../../lib/get-report-item'
19
- import { TokenSearchCombobox } from './token-search-combobox'
20
- import { DataCombobox, type DataComboboxOption } from './data-combobox'
21
- import { DataTable } from './data-table'
22
- import { getReportInfosFrom } from './get-report-infos-from'
23
- import { reportItemColumns } from './report-item-columns'
24
- import { Section } from './section'
25
- import { TextWithCount } from './text-with-count'
26
- import { XMarkIcon } from '../icons'
27
-
28
- export const UtilityDetails = () => {
29
- const search = new URLSearchParams(window.location.search)
30
- const initialParams = Object.fromEntries(search.entries()) as SearchableReportItemAttributes
31
- const [params, setParams] = useState(initialParams)
32
- // console.log({ params, globalMaps: analysisData.details.globalMaps })
33
-
34
- const infos = getReportInfosFrom(params)
35
- // console.log(infos)
36
-
37
- return (
38
- <panda.div>
39
- <panda.div display="flex">
40
- <panda.a href="/token-analyzer">
41
- <panda.span fontWeight="bold">{'<'} </panda.span>Back
42
- </panda.a>
43
- <panda.div ml="auto">
44
- <TokenSearchCombobox placeholder="Global search" />
45
- </panda.div>
46
- </panda.div>
47
- <panda.div p="4" mt="4">
48
- <DetailsProvider value={[infos, setParams]}>
49
- <UtilityFilters />
50
- <hr />
51
- {infos.reportItemList.length ? (
52
- <UtilityDetailsContent />
53
- ) : !infos.hasParam ? (
54
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
55
- Use at least one filter
56
- </panda.div>
57
- ) : (
58
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
59
- No results
60
- </panda.div>
61
- )}
62
- </DetailsProvider>
63
- </panda.div>
64
- </panda.div>
65
- )
66
- }
67
-
68
- type Infos = ReturnType<typeof getReportInfosFrom>
69
- const [DetailsProvider, useDetails] = createContext<[Infos, React.Dispatch<React.SetStateAction<Infos['params']>>]>({
70
- name: 'UtilityDetailsContext',
71
- })
72
-
73
- const updateSearchParam = (key: string, value: string | undefined) => {
74
- const search = new URLSearchParams(window.location.search)
75
- if (value === undefined) {
76
- search.delete(key)
77
- } else {
78
- search.set(key, value)
79
- }
80
- window.history.pushState(Object.fromEntries(search.entries()), '', `${window.location.pathname}?${search.toString()}`)
81
- }
82
-
83
- const uniq = (arr: string[]) => Array.from(new Set(arr))
84
- const toOption = (value: string | object) =>
85
- (typeof value === 'string' ? { value, label: value } : value) as DataComboboxOption
86
- const toFilepathOption = (filepath: string) => ({ value: filepath, label: getReportRelativeFilePath(filepath) })
87
-
88
- const UtilityFilters = () => {
89
- const [infos, setParams] = useDetails()
90
- const [resetKey, setResetKey] = useState(0)
91
-
92
- const allTokenNames = Object.keys(analysisData.details.globalMaps.byTokenName)
93
- const filteredTokenNames = uniq(infos.reportItemList.map((item) => String(item.value)))
94
- const tokenNames = filteredTokenNames.length > 0 ? filteredTokenNames : allTokenNames
95
-
96
- const allCategories = Object.keys(analysisData.details.globalMaps.byCategory)
97
- const filteredCategories = uniq(infos.reportItemList.map((item) => item.category))
98
- const categories = filteredCategories.length > 0 ? filteredCategories : allCategories
99
-
100
- const allPropertyNames = Object.keys(analysisData.details.globalMaps.byPropertyName)
101
- const filteredPropertyNames = uniq(infos.reportItemList.map((item) => item.propName))
102
- const propertyNames = filteredPropertyNames.length > 0 ? filteredPropertyNames : allPropertyNames
103
-
104
- const allFrom = Object.keys(analysisData.details.globalMaps.byInstanceName)
105
- const filteredFrom = uniq(infos.reportItemList.map((item) => item.from))
106
- const from = filteredFrom.length > 0 ? filteredFrom : allFrom
107
-
108
- const allFilepath = Object.keys(analysisData.details.byFilepath).map(toFilepathOption)
109
- const filteredFilepath = uniq(infos.reportItemList.map((item) => item.filepath)).map(toFilepathOption)
110
- const filepath = filteredFilepath.length > 0 ? filteredFilepath : allFilepath
111
-
112
- return (
113
- <panda.div mb="4">
114
- <Flex>
115
- <panda.h3>Filters</panda.h3>
116
- {infos.hasParam && (
117
- <panda.button
118
- ml="auto"
119
- cursor="pointer"
120
- userSelect="none"
121
- bg="card"
122
- px="3"
123
- py="2"
124
- rounded="md"
125
- _hover={{ opacity: 0.8 }}
126
- onClick={() => {
127
- updateSearchParam('value', undefined)
128
- updateSearchParam('category', undefined)
129
- updateSearchParam('propName', undefined)
130
- updateSearchParam('from', undefined)
131
- updateSearchParam('filepath', undefined)
132
- setParams({})
133
- setResetKey((k) => k + 1)
134
- }}
135
- >
136
- <panda.span display="flex" gap="2" alignItems="center">
137
- <XMarkIcon width="16" height="16" /> Clear filters
138
- </panda.span>
139
- </panda.button>
140
- )}
141
- </Flex>
142
- <Wrap key={resetKey}>
143
- <DataCombobox
144
- label="Token name"
145
- options={tokenNames.map(toOption)}
146
- onSelect={(e) => {
147
- updateSearchParam('value', e.value)
148
- return setParams((params) => ({ ...params, ['value']: e.value }))
149
- }}
150
- defaultValue={String(infos.params.value ?? '')}
151
- />
152
- <DataCombobox
153
- label="Property name"
154
- options={propertyNames.map(toOption)}
155
- onSelect={(e) => {
156
- updateSearchParam('propName', e.value)
157
- return setParams((params) => ({ ...params, ['propName']: e.value }))
158
- }}
159
- defaultValue={String(infos.params.propName ?? '')}
160
- />
161
- <DataCombobox
162
- label="Category"
163
- options={categories.map(toOption)}
164
- onSelect={(e) => {
165
- updateSearchParam('category', e.value)
166
- return setParams((params) => ({ ...params, ['category']: e.value }))
167
- }}
168
- defaultValue={String(infos.params.category ?? '')}
169
- />
170
- <DataCombobox
171
- label="Instance name (from)"
172
- options={from.map(toOption)}
173
- onSelect={(e) => {
174
- updateSearchParam('from', e.value)
175
- return setParams((params) => ({ ...params, ['from']: e.value }))
176
- }}
177
- defaultValue={String(infos.params.from ?? '')}
178
- />
179
- <DataCombobox
180
- label="Filepath"
181
- options={filepath.map(toOption)}
182
- onSelect={(e) => {
183
- updateSearchParam('filepath', e.value)
184
- return setParams((params) => ({ ...params, ['filepath']: e.value }))
185
- }}
186
- defaultValue={String(infos.params.filepath ?? '')}
187
- />
188
- </Wrap>
189
- </panda.div>
190
- )
191
- }
192
-
193
- const UtilityDetailsContent = () => {
194
- const [infos] = useDetails()
195
-
196
- return (
197
- <>
198
- <ReportItemMatchingFiltersTable {...infos} />
199
- <UsedInFiles />
200
- </>
201
- )
202
- }
203
-
204
- const UsedInFiles = () => {
205
- const [infos] = useDetails()
206
- const files = uniq(infos.reportItemList.map((item) => item.filepath))
207
-
208
- return (
209
- <panda.div>
210
- <panda.h3>
211
- <TextWithCount count={files.length}>Used in files</TextWithCount>
212
- </panda.h3>
213
- <panda.div display="flex" flexDirection="column">
214
- {files.map((filepath) => (
215
- <panda.a
216
- mt="1"
217
- key={filepath}
218
- className={styledLink({})}
219
- href={getFileLink({ filepath })}
220
- onClick={(e) => e.stopPropagation()}
221
- >
222
- <TextWithCount count={infos.reportItemList.filter((item) => item.filepath === filepath).length}>
223
- {getReportRelativeFilePath(filepath)}
224
- </TextWithCount>
225
- </panda.a>
226
- ))}
227
- </panda.div>
228
- </panda.div>
229
- )
230
- }
231
-
232
- const selectOptionClass = css({
233
- padding: '4px 8px',
234
- rounded: 'md',
235
- '& li': {
236
- cursor: 'pointer',
237
- _hover: { opacity: 0.8 },
238
- },
239
- })
240
-
241
- const ReportItemMatchingFiltersTable = (infos: Infos) => {
242
- const tokenName = infos.params.value
243
- const defaultOption = { label: `matching search filters`, value: 'reportItemList' }
244
- const columns = reportItemColumns.filter((col) => (infos.params as any)[col.accessor] === undefined)
245
-
246
- return (
247
- <>
248
- <Select defaultValue={defaultOption}>
249
- {({ selectedOption }) => {
250
- const value = (selectedOption?.value ?? defaultOption.value) as keyof Omit<Infos, 'params' | 'hasParam'>
251
- // console.log({ value, list: infos[value] })
252
-
253
- return (
254
- <Section
255
- title={
256
- <>
257
- <SelectLabel>By </SelectLabel>
258
- <SelectTrigger asChild>
259
- <button>{selectedOption?.label}</button>
260
- </SelectTrigger>
261
- </>
262
- }
263
- subTitle={
264
- <panda.span fontSize="md" fontWeight="bold" ml="auto">
265
- Found ({infos[value].length}) matches{' '}
266
- </panda.span>
267
- }
268
- bg="card"
269
- >
270
- <DataTable list={infos[value]} columns={columns} />
271
- <>
272
- <Portal>
273
- <SelectPositioner>
274
- <SelectContent className={cx(selectOptionClass, css({ listStyle: 'none' }))}>
275
- <SelectOption
276
- className={selectOptionClass}
277
- value={defaultOption.value}
278
- label={defaultOption.label}
279
- />
280
- {infos.params.value && (
281
- <SelectOption
282
- className={selectOptionClass}
283
- label={`token name (${tokenName})`}
284
- value="byTokenName"
285
- />
286
- )}
287
- {infos.params.propName && (
288
- <SelectOption
289
- className={selectOptionClass}
290
- value="byPropName"
291
- label={`property name (${infos.params.propName})`}
292
- />
293
- )}
294
- {infos.params.category && (
295
- <SelectOption
296
- className={selectOptionClass}
297
- value="byCategory"
298
- label={`category (${infos.params.category})`}
299
- />
300
- )}
301
- {infos.params.from && (
302
- <SelectOption
303
- className={selectOptionClass}
304
- value="byInstanceName"
305
- label={`from (${infos.params.from})`}
306
- />
307
- )}
308
- {infos.params.filepath && (
309
- <SelectOption
310
- className={selectOptionClass}
311
- value="byFilepath"
312
- label={`filepath (${getReportRelativeFilePath(infos.params.filepath)})`}
313
- />
314
- )}
315
- </SelectContent>
316
- </SelectPositioner>
317
- </Portal>
318
- </>
319
- </Section>
320
- )
321
- }}
322
- </Select>
323
- </>
324
- )
325
- }
@@ -1,37 +0,0 @@
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.7}>
32
- <panda.span>{value}</panda.span>
33
- </panda.div>
34
- )}
35
- </panda.a>
36
- )
37
- }