@pandacss/studio 0.15.3 → 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 (59) 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 +28 -15
  23. package/styled-system/styles.css +50 -319
  24. package/styled-system/types/jsx.d.ts +10 -2
  25. package/virtual-panda.ts +2 -12
  26. package/src/components/analyzer/category-utilities.tsx +0 -156
  27. package/src/components/analyzer/data-combobox.tsx +0 -154
  28. package/src/components/analyzer/data-table.tsx +0 -39
  29. package/src/components/analyzer/external-icon.tsx +0 -8
  30. package/src/components/analyzer/file-details.tsx +0 -101
  31. package/src/components/analyzer/get-report-infos-from.ts +0 -80
  32. package/src/components/analyzer/quick-tooltip.tsx +0 -15
  33. package/src/components/analyzer/report-item-columns.tsx +0 -52
  34. package/src/components/analyzer/report-item-link.tsx +0 -98
  35. package/src/components/analyzer/section.tsx +0 -24
  36. package/src/components/analyzer/sort-icon.tsx +0 -10
  37. package/src/components/analyzer/text-with-count.tsx +0 -28
  38. package/src/components/analyzer/token-search-combobox.tsx +0 -39
  39. package/src/components/analyzer/truncated-text.tsx +0 -28
  40. package/src/components/analyzer/utility-details.tsx +0 -325
  41. package/src/components/color-item.tsx +0 -37
  42. package/src/components/token-analyzer.tsx +0 -397
  43. package/src/lib/analysis-data.ts +0 -17
  44. package/src/lib/get-report-item.tsx +0 -41
  45. package/src/pages/token-analyzer/file.astro +0 -11
  46. package/src/pages/token-analyzer/index.astro +0 -11
  47. package/src/pages/token-analyzer/utility.astro +0 -11
  48. package/styled-system/chunks/src__components__analyzer__category-utilities.css +0 -118
  49. package/styled-system/chunks/src__components__analyzer__data-combobox.css +0 -137
  50. package/styled-system/chunks/src__components__analyzer__data-table.css +0 -46
  51. package/styled-system/chunks/src__components__analyzer__file-details.css +0 -98
  52. package/styled-system/chunks/src__components__analyzer__report-item-columns.css +0 -39
  53. package/styled-system/chunks/src__components__analyzer__report-item-link.css +0 -78
  54. package/styled-system/chunks/src__components__analyzer__section.css +0 -30
  55. package/styled-system/chunks/src__components__analyzer__text-with-count.css +0 -34
  56. package/styled-system/chunks/src__components__analyzer__truncated-text.css +0 -18
  57. package/styled-system/chunks/src__components__analyzer__utility-details.css +0 -139
  58. package/styled-system/chunks/src__components__color-item.css +0 -22
  59. package/styled-system/chunks/src__components__token-analyzer.css +0 -220
@@ -1,154 +0,0 @@
1
- import {
2
- Combobox,
3
- ComboboxContent,
4
- ComboboxControl,
5
- ComboboxInput,
6
- ComboboxLabel,
7
- ComboboxOption,
8
- ComboboxPositioner,
9
- ComboboxTrigger,
10
- Portal,
11
- } from '@ark-ui/react'
12
- import { useEffect, useState } from 'react'
13
- import { css } from '../../../styled-system/css'
14
- import { Flex, panda } from '../../../styled-system/jsx'
15
- import { ChevronDownIcon, XMarkIcon } from '../icons'
16
- import { inputRecipe } from '../input'
17
-
18
- export type DataComboboxOption = {
19
- value: string
20
- label: string
21
- }
22
-
23
- export type DataComboboxProps = {
24
- options: DataComboboxOption[]
25
- label?: React.ReactNode
26
- placeholder?: string
27
- filterFn?: (value: string) => DataComboboxOption[]
28
- defaultValue?: string
29
- onSelect?: (option: any) => void
30
- }
31
-
32
- export const DataCombobox = ({ options: allOptions, label, ...props }: DataComboboxProps) => {
33
- const [options, setOptions] = useState(allOptions)
34
- const filterFn =
35
- props.filterFn ||
36
- ((value: string) => allOptions.filter((item) => item.label.toLowerCase().includes(value.toLowerCase())))
37
-
38
- // sync available options from parent
39
- useEffect(() => {
40
- setOptions(allOptions)
41
- }, [allOptions])
42
-
43
- return (
44
- <Combobox openOnClick {...props} className={css({ m: 4 })}>
45
- {(state: any) => {
46
- return (
47
- <>
48
- <ComboboxControl>
49
- <panda.div display="flex" flexDirection="column" gap="2">
50
- {label && (
51
- <ComboboxLabel>
52
- <panda.span fontWeight="bold">{label}</panda.span>
53
- </ComboboxLabel>
54
- )}
55
- <panda.div display="flex" position="relative" isolation="isolate">
56
- <ComboboxInput
57
- defaultValue={props.defaultValue}
58
- placeholder={props.placeholder ?? 'Search...'}
59
- className={inputRecipe()}
60
- onChange={(e) => {
61
- const value = e.target.value
62
- if (!value) {
63
- props?.onSelect?.({ relatedTarget: null })
64
- setOptions(allOptions)
65
- state.clearValue()
66
- return
67
- }
68
-
69
- setOptions(filterFn(value))
70
- }}
71
- />
72
- <Flex
73
- top="0px"
74
- right="0px"
75
- align="center"
76
- justify="center"
77
- position="absolute"
78
- zIndex="2"
79
- height="full"
80
- >
81
- {state.selectedValue && (
82
- <panda.span
83
- display="flex"
84
- px="2"
85
- cursor="pointer"
86
- userSelect="none"
87
- onClick={() => state.clearValue()}
88
- alignItems="center"
89
- >
90
- <XMarkIcon />
91
- </panda.span>
92
- )}
93
- <ComboboxTrigger>
94
- <panda.span
95
- ml="auto"
96
- p="2"
97
- display="flex"
98
- cursor="pointer"
99
- borderLeft="solid 1px"
100
- borderColor="border"
101
- color="text"
102
- >
103
- <panda.span
104
- data-expanded={state.isOpen ? '' : undefined}
105
- transform={{ _expanded: 'rotate(180deg)' }}
106
- transition="all .2s ease"
107
- >
108
- <ChevronDownIcon />
109
- </panda.span>
110
- </panda.span>
111
- </ComboboxTrigger>
112
- </Flex>
113
- </panda.div>
114
- </panda.div>
115
- </ComboboxControl>
116
- <Portal>
117
- <ComboboxPositioner>
118
- <ComboboxContent
119
- className={css({
120
- maxHeight: '300px',
121
- overflow: 'auto',
122
- padding: '4px 8px',
123
- bg: 'card',
124
- listStyle: 'none',
125
- rounded: 'md',
126
- border: '1px solid token(colors.border)',
127
- shadow: 'sm',
128
- })}
129
- >
130
- {/* TODO virtualization */}
131
- {options.map((option) => (
132
- <ComboboxOption
133
- key={option.label + '-' + option.value}
134
- value={option.value}
135
- label={option.label}
136
- className={css({
137
- padding: '4px 8px',
138
- rounded: 'md',
139
- wordWrap: 'break-word',
140
- _highlighted: {
141
- bg: 'border',
142
- },
143
- })}
144
- />
145
- ))}
146
- </ComboboxContent>
147
- </ComboboxPositioner>
148
- </Portal>
149
- </>
150
- )
151
- }}
152
- </Combobox>
153
- )
154
- }
@@ -1,39 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import { Grid, panda } from '../../../styled-system/jsx'
3
- import { flex } from '../../../styled-system/patterns'
4
-
5
- export type Column<T> = { header: string; accessor: string; cell?: (item: T) => ReactNode }
6
-
7
- // TODO tanstack/table ? hide/show columns + sort
8
- export function DataTable<T>({ list, columns }: { list: T[]; columns: ReadonlyArray<Column<T>> }) {
9
- return (
10
- <panda.div>
11
- <Grid
12
- gridTemplateColumns="80px repeat(auto-fit, minmax(30px, 1fr))"
13
- w="full"
14
- fontWeight="bold"
15
- fontSize="lg"
16
- mb="2"
17
- >
18
- {columns.map((column) => {
19
- return <panda.div key={column.header}>{column.header}</panda.div>
20
- })}
21
- </Grid>
22
- <panda.div className={flex({ direction: 'column', gap: '2' })}>
23
- {list.map((item, index) => {
24
- return (
25
- <Grid gridTemplateColumns="80px repeat(auto-fit, minmax(30px, 1fr))" w="full" key={index}>
26
- {columns.map((column) => {
27
- return (
28
- <panda.div key={column.accessor} wordBreak="break-word">
29
- {column.cell?.(item) ?? (item as any)[column.accessor]}
30
- </panda.div>
31
- )
32
- })}
33
- </Grid>
34
- )
35
- })}
36
- </panda.div>
37
- </panda.div>
38
- )
39
- }
@@ -1,8 +0,0 @@
1
- /** @see https://iconmonstr.com/share-11-svg/ */
2
- export const ExternalIcon = () => {
3
- return (
4
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
5
- <path d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z" />
6
- </svg>
7
- )
8
- }
@@ -1,101 +0,0 @@
1
- import type { ReportItemJSON } from '@pandacss/types'
2
- import { panda, Wrap } from '../../../styled-system/jsx'
3
- import { styledLink } from '../../../styled-system/patterns'
4
- import { createContext } from '../../lib/create-context'
5
- import { analysisData } from '../../lib/analysis-data'
6
- import { getReportItem, getUtilityLink, getReportRelativeFilePath } from '../../lib/get-report-item'
7
- import { ByCategory } from './category-utilities'
8
- import { ColorItem } from '../color-item'
9
- import { TokenSearchCombobox } from './token-search-combobox'
10
- import { TextWithCount } from './text-with-count'
11
- import { TruncatedText } from './truncated-text'
12
-
13
- export const FileDetails = () => {
14
- const search = new URLSearchParams(window.location.search)
15
- const filepath = search.get('filepath')
16
-
17
- const byFilepath = analysisData.details.byFilepath[filepath as keyof typeof analysisData.details.byFilepath] ?? []
18
- const reportItemList = byFilepath.map(getReportItem)
19
-
20
- return (
21
- <panda.div>
22
- <panda.div display="flex">
23
- <panda.a href="/token-analyzer">
24
- <panda.span fontWeight="bold">{'<'} </panda.span>Back
25
- </panda.a>
26
- <panda.div ml="auto">
27
- <TokenSearchCombobox placeholder="Global search" />
28
- </panda.div>
29
- </panda.div>
30
- <panda.div p="4" mt="4">
31
- {!filepath ? (
32
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
33
- No file selected
34
- </panda.div>
35
- ) : reportItemList.length > 0 ? (
36
- <FileProvider value={{ filepath, localMaps: analysisData.details.byFilePathMaps[filepath], reportItemList }}>
37
- <FileDetailsContent />
38
- </FileProvider>
39
- ) : (
40
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
41
- No results
42
- </panda.div>
43
- )}
44
- </panda.div>
45
- </panda.div>
46
- )
47
- }
48
-
49
- const [FileProvider, useFileContext] = createContext<{
50
- filepath: string
51
- localMaps: (typeof analysisData.details.byFilePathMaps)[string]
52
- reportItemList: Array<ReportItemJSON>
53
- }>({
54
- name: 'UtilityFileContext',
55
- })
56
-
57
- const FileDetailsContent = () => {
58
- const { filepath, localMaps, reportItemList } = useFileContext()
59
- const colors = Object.entries(localMaps.colorsUsed)
60
-
61
- return (
62
- <>
63
- <panda.h3 mb="4">
64
- Usage in file :{' '}
65
- <panda.a
66
- mt="1"
67
- key={filepath}
68
- className={styledLink({})}
69
- href={getUtilityLink({ filepath })}
70
- onClick={(e) => e.stopPropagation()}
71
- >
72
- <TextWithCount count={reportItemList.length}>{getReportRelativeFilePath(filepath)}</TextWithCount>
73
- </panda.a>
74
- </panda.h3>
75
- <ByCategory byCategory={localMaps.byCategory} />
76
- {colors.length ? (
77
- <panda.div mt="8">
78
- <panda.h3>
79
- <TextWithCount count={colors.length}>Color palette</TextWithCount>
80
- </panda.h3>
81
- <Wrap gap="2" mt="4">
82
- {colors.map(([key]) => {
83
- return (
84
- <ColorItem
85
- tokenName={key}
86
- key={key}
87
- py="2"
88
- px="4"
89
- transition="all 0.2s ease"
90
- _hover={{ bgColor: 'gray.100' }}
91
- >
92
- <TruncatedText text={key} />
93
- </ColorItem>
94
- )
95
- })}
96
- </Wrap>
97
- </panda.div>
98
- ) : null}
99
- </>
100
- )
101
- }
@@ -1,80 +0,0 @@
1
- import type { ReportItemJSON } from '@pandacss/types'
2
- import { analysisData } from '../../lib/analysis-data'
3
- import { getReportItem, type SearchableReportItemAttributes } from '../../lib/get-report-item'
4
-
5
- export const getReportInfosFrom = (params: SearchableReportItemAttributes) => {
6
- let byTokenName: Array<ReportItemJSON['id']> = []
7
- let byCategory: Array<ReportItemJSON['id']> = []
8
- let byPropName: Array<ReportItemJSON['id']> = []
9
- let byInstanceName: Array<ReportItemJSON['id']> = []
10
- let byFilepath: Array<ReportItemJSON['id']> = []
11
- let hasParam = false
12
-
13
- if (params.value) {
14
- byTokenName =
15
- analysisData.details.globalMaps.byTokenName[
16
- params.value as keyof typeof analysisData.details.globalMaps.byTokenName
17
- ] ?? []
18
- hasParam = true
19
- }
20
-
21
- if (params.category) {
22
- byCategory =
23
- analysisData.details.globalMaps.byCategory[
24
- params.category as keyof typeof analysisData.details.globalMaps.byCategory
25
- ] ?? []
26
- hasParam = true
27
- }
28
-
29
- if (params.propName) {
30
- byPropName =
31
- analysisData.details.globalMaps.byPropertyName[
32
- params.propName as keyof typeof analysisData.details.globalMaps.byPropertyName
33
- ] ?? []
34
- hasParam = true
35
- }
36
-
37
- if (params.from) {
38
- byInstanceName =
39
- analysisData.details.globalMaps.byInstanceName[
40
- params.from as keyof typeof analysisData.details.globalMaps.byInstanceName
41
- ] ?? []
42
- hasParam = true
43
- }
44
-
45
- if (params.filepath) {
46
- byFilepath = analysisData.details.byFilepath[params.filepath as keyof typeof analysisData.details.byFilepath] ?? []
47
- hasParam = true
48
- }
49
-
50
- return {
51
- params,
52
- hasParam,
53
- byTokenName: byTokenName.map(getReportItem),
54
- byCategory: byCategory.map(getReportItem),
55
- byPropName: byPropName.map(getReportItem),
56
- byInstanceName: byInstanceName.map(getReportItem),
57
- byFilepath: byFilepath.map(getReportItem),
58
- reportItemList: combineIntersections(byTokenName, byCategory, byPropName, byInstanceName, byFilepath).map(
59
- getReportItem,
60
- ),
61
- }
62
- }
63
- function combineIntersections<T>(...lists: Array<T[]>) {
64
- return lists.reduce((acc, current) => {
65
- if (!acc.length) return current
66
-
67
- if (!current.length) return acc
68
-
69
- return intersection(acc, current)
70
- }, [] as T[])
71
- }
72
- function intersection<T = any>(left: Array<T>, right: Array<T>) {
73
- const _intersection = new Set()
74
- for (const elem of right) {
75
- if (left.includes(elem)) {
76
- _intersection.add(elem)
77
- }
78
- }
79
- return Array.from(_intersection) as Array<T>
80
- }
@@ -1,15 +0,0 @@
1
- import { Portal, Tooltip, TooltipContent, TooltipPositioner, TooltipTrigger } from '@ark-ui/react'
2
- import type { ReactElement, ReactNode } from 'react'
3
-
4
- export const QuickTooltip = ({ children, tooltip }: { children: ReactElement; tooltip: ReactNode }) => {
5
- return (
6
- <Tooltip openDelay={0} closeDelay={100} positioning={{ placement: 'bottom-start', gutter: 20 }}>
7
- <TooltipTrigger>{children}</TooltipTrigger>
8
- <Portal>
9
- <TooltipPositioner>
10
- <TooltipContent>{tooltip}</TooltipContent>
11
- </TooltipPositioner>
12
- </Portal>
13
- </Tooltip>
14
- )
15
- }
@@ -1,52 +0,0 @@
1
- import type { ReportItemJSON } from '@pandacss/types'
2
- import { panda } from '../../../styled-system/jsx'
3
- import { ReportItemOpenInEditorLink, UtilityLink } from './report-item-link'
4
- import { QuickTooltip } from './quick-tooltip'
5
-
6
- export const reportItemColumns = [
7
- {
8
- header: '#',
9
- accessor: 'id',
10
- cell: (item: ReportItemJSON) => <panda.span onClick={() => console.log(item)}>{item.id}</panda.span>,
11
- },
12
- { header: 'from', accessor: 'from', cell: (item: ReportItemJSON) => <UtilityLink from={item.from} /> },
13
- {
14
- header: 'category',
15
- accessor: 'category',
16
- cell: (item: ReportItemJSON) => <UtilityLink category={item.category} />,
17
- },
18
- {
19
- header: 'property name',
20
- accessor: 'propName',
21
- cell: (item: ReportItemJSON) => <UtilityLink propName={item.propName} />,
22
- },
23
- {
24
- header: 'token name',
25
- accessor: 'value',
26
- cell: (item: ReportItemJSON) => {
27
- return (
28
- <panda.div display="flex" alignItems="center">
29
- {!item.isKnown && (
30
- <QuickTooltip
31
- tooltip={
32
- <panda.span p="2" bgColor="card" border="1px solid token(colors.border)" shadow="sm" rounded="md">
33
- unknown token
34
- </panda.span>
35
- }
36
- >
37
- <panda.span mr="2" userSelect="none">
38
- {'❌'}
39
- </panda.span>
40
- </QuickTooltip>
41
- )}
42
- <UtilityLink value={item.value} />
43
- </panda.div>
44
- )
45
- },
46
- },
47
- {
48
- header: 'filepath',
49
- accessor: 'filepath',
50
- cell: (item: ReportItemJSON) => <ReportItemOpenInEditorLink withRange {...item} />,
51
- },
52
- ] as const // TODO satisifes Column[]
@@ -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
- }