@indico-data/design-system 2.49.0 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/tanstackTable/TankstackTable.types.d.ts +40 -0
- package/lib/components/tanstackTable/TanstackTable.stories.d.ts +15 -0
- package/lib/components/tanstackTable/TanstakTable.d.ts +4 -0
- package/lib/components/tanstackTable/__tests__/TanstackTable.test.d.ts +1 -0
- package/lib/components/tanstackTable/__tests__/__mocks__/test-mock-data.d.ts +8 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.d.ts +17 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.stories.d.ts +10 -0
- package/lib/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/ActionBar/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/NoResults.d.ts +7 -0
- package/lib/components/tanstackTable/components/NoResults/__tests__/NoResult.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +12 -0
- package/lib/components/tanstackTable/components/TableBody/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableHeader/TableHeader.d.ts +6 -0
- package/lib/components/tanstackTable/components/TableHeader/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/TablePagination.d.ts +9 -0
- package/lib/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/index.d.ts +1 -0
- package/lib/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.d.ts +7 -0
- package/lib/components/tanstackTable/docs/withRowClick/WithRowClick.stories.d.ts +7 -0
- package/lib/components/tanstackTable/helpers.d.ts +830 -0
- package/lib/components/tanstackTable/index.d.ts +2 -0
- package/lib/components/tanstackTable/mock-data/mock-data.d.ts +14 -0
- package/lib/components/tanstackTable/mock-data/table-configuration.d.ts +3 -0
- package/lib/components/tanstackTable/useTanstackTable.d.ts +16 -0
- package/lib/index.css +407 -80
- package/lib/index.d.ts +62 -17
- package/lib/index.esm.css +407 -80
- package/lib/index.esm.js +20455 -56
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20455 -55
- package/lib/index.js.map +1 -1
- package/lib/stylesAndAnimations/utilityClasses/UtilityClassesData.d.ts +7 -0
- package/lib/stylesAndAnimations/utilityClasses/UtilityClassesTable.d.ts +1 -0
- package/lib/stylesAndAnimations/utilityClasses/UtilityClassesTable.stories.d.ts +6 -0
- package/package.json +2 -1
- package/src/components/tanstackTable/TankstackTable.types.ts +39 -0
- package/src/components/tanstackTable/TanstackTable.mdx +122 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +260 -0
- package/src/components/tanstackTable/TanstakTable.tsx +157 -0
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +87 -0
- package/src/components/tanstackTable/__tests__/__mocks__/test-mock-data.tsx +83 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.mdx +10 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.scss +30 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.stories.tsx +98 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +51 -0
- package/src/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.tsx +87 -0
- package/src/components/tanstackTable/components/ActionBar/index.ts +1 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.scss +24 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.tsx +22 -0
- package/src/components/tanstackTable/components/NoResults/__tests__/NoResult.test.tsx +25 -0
- package/src/components/tanstackTable/components/NoResults/index.ts +1 -0
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +87 -0
- package/src/components/tanstackTable/components/TableBody/index.ts +1 -0
- package/src/components/tanstackTable/components/TableHeader/TableHeader.tsx +49 -0
- package/src/components/tanstackTable/components/TableHeader/index.ts +1 -0
- package/src/components/tanstackTable/components/TablePagination/TablePagination.tsx +45 -0
- package/src/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.tsx +18 -0
- package/src/components/tanstackTable/components/TablePagination/index.ts +1 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.mdx +34 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.tsx +40 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.mdx +48 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.stories.tsx +32 -0
- package/src/components/tanstackTable/helpers.ts +45 -0
- package/src/components/tanstackTable/index.ts +2 -0
- package/src/components/tanstackTable/mock-data/mock-data.ts +256 -0
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +219 -0
- package/src/components/tanstackTable/styles/_variables.scss +35 -0
- package/src/components/tanstackTable/styles/table.scss +204 -0
- package/src/components/tanstackTable/styles/test.scss +19 -0
- package/src/components/tanstackTable/tanstack-table.d.ts +18 -0
- package/src/components/tanstackTable/useTanstackTable.tsx +42 -0
- package/src/index.ts +1 -0
- package/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.tsx +1 -0
- package/src/storybookDocs/Permafrost.mdx +22 -11
- package/src/styles/_borders.scss +2 -1
- package/src/styles/index.scss +1 -0
- package/src/stylesAndAnimations/borders/BorderColor.tsx +14 -6
- package/src/stylesAndAnimations/utilityClasses/UtilityClasses.mdx +24 -0
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesData.ts +230 -0
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.stories.tsx +13 -0
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.tsx +146 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
export type UtilityClassData = {
|
|
2
|
+
className: string;
|
|
3
|
+
css: string;
|
|
4
|
+
category: string;
|
|
5
|
+
resolvedCss?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const utilityClassesData: UtilityClassData[] = [
|
|
9
|
+
// Border Utilities
|
|
10
|
+
{
|
|
11
|
+
className: 'border-primary',
|
|
12
|
+
css: 'border-color: var(--pf-primary-color);',
|
|
13
|
+
category: 'Border',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
className: 'border-secondary',
|
|
17
|
+
css: 'border-color: var(--pf-secondary-color);',
|
|
18
|
+
category: 'Border',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
className: 'border-tertiary',
|
|
22
|
+
css: 'border-color: var(--pf-tertiary-color);',
|
|
23
|
+
category: 'Border',
|
|
24
|
+
},
|
|
25
|
+
{ className: 'border-gray', css: 'border-color: var(--pf-gray-color);', category: 'Border' },
|
|
26
|
+
{ className: 'border-red', css: 'border-color: var(--pf-red-color);', category: 'Border' },
|
|
27
|
+
{ className: 'border-orange', css: 'border-color: var(--pf-orange-color);', category: 'Border' },
|
|
28
|
+
{ className: 'border-yellow', css: 'border-color: var(--pf-yellow-color);', category: 'Border' },
|
|
29
|
+
{ className: 'border-green', css: 'border-color: var(--pf-green-color);', category: 'Border' },
|
|
30
|
+
{ className: 'border-purple', css: 'border-color: var(--pf-purple-color);', category: 'Border' },
|
|
31
|
+
{ className: 'border-thin', css: 'border-width: var(--pf-border-thin);', category: 'Border' },
|
|
32
|
+
{ className: 'border-sm', css: 'border-width: var(--pf-border-sm);', category: 'Border' },
|
|
33
|
+
{ className: 'border-md', css: 'border-width: var(--pf-border-md);', category: 'Border' },
|
|
34
|
+
{ className: 'border-lg', css: 'border-width: var(--pf-border-lg);', category: 'Border' },
|
|
35
|
+
{ className: 'border-xl', css: 'border-width: var(--pf-border-xl);', category: 'Border' },
|
|
36
|
+
{ className: 'border-dashed', css: 'border-style: dashed;', category: 'Border' },
|
|
37
|
+
{ className: 'border-dotted', css: 'border-style: dotted;', category: 'Border' },
|
|
38
|
+
{ className: 'border-double', css: 'border-style: double;', category: 'Border' },
|
|
39
|
+
{ className: 'border-solid', css: 'border-style: solid;', category: 'Border' },
|
|
40
|
+
{ className: 'rounded', css: 'border-radius: var(--pf-rounded);', category: 'Border' },
|
|
41
|
+
{ className: 'rounded-0', css: 'border-radius: var(--pf-rounded-0);', category: 'Border' },
|
|
42
|
+
{ className: 'rounded-sm', css: 'border-radius: var(--pf-rounded-sm);', category: 'Border' },
|
|
43
|
+
{ className: 'rounded-md', css: 'border-radius: var(--pf-rounded-md);', category: 'Border' },
|
|
44
|
+
{ className: 'rounded-lg', css: 'border-radius: var(--pf-rounded-lg);', category: 'Border' },
|
|
45
|
+
{ className: 'rounded-xl', css: 'border-radius: var(--pf-rounded-xl);', category: 'Border' },
|
|
46
|
+
{ className: 'rounded-pill', css: 'border-radius: var(--pf-rounded-pill);', category: 'Border' },
|
|
47
|
+
{
|
|
48
|
+
className: 'rounded-circle',
|
|
49
|
+
css: 'border-radius: var(--pf-rounded-circle);',
|
|
50
|
+
category: 'Border',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
className: 'rounded-shaped',
|
|
54
|
+
css: 'border-radius: var(--pf-rounded-shaped);',
|
|
55
|
+
category: 'Border',
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// Color Utilities
|
|
59
|
+
{ className: 'color-primary', css: 'color: var(--pf-primary-color);', category: 'Color' },
|
|
60
|
+
{ className: 'color-secondary', css: 'color: var(--pf-secondary-color);', category: 'Color' },
|
|
61
|
+
{ className: 'color-tertiary', css: 'color: var(--pf-tertiary-color);', category: 'Color' },
|
|
62
|
+
{ className: 'color-gray', css: 'color: var(--pf-gray-color);', category: 'Color' },
|
|
63
|
+
{ className: 'color-red', css: 'color: var(--pf-red-color);', category: 'Color' },
|
|
64
|
+
{ className: 'color-orange', css: 'color: var(--pf-orange-color);', category: 'Color' },
|
|
65
|
+
{ className: 'color-yellow', css: 'color: var(--pf-yellow-color);', category: 'Color' },
|
|
66
|
+
{ className: 'color-green', css: 'color: var(--pf-green-color);', category: 'Color' },
|
|
67
|
+
{ className: 'color-purple', css: 'color: var(--pf-purple-color);', category: 'Color' },
|
|
68
|
+
{ className: 'color-success', css: 'color: var(--pf-success-color);', category: 'Color' },
|
|
69
|
+
{ className: 'color-info', css: 'color: var(--pf-info-color);', category: 'Color' },
|
|
70
|
+
{ className: 'color-neutral', css: 'color: var(--pf-neutral-color);', category: 'Color' },
|
|
71
|
+
{ className: 'color-warning', css: 'color: var(--pf-warning-color);', category: 'Color' },
|
|
72
|
+
{ className: 'color-error', css: 'color: var(--pf-error-color);', category: 'Color' },
|
|
73
|
+
{ className: 'color-brand', css: 'color: var(--pf-brand-color);', category: 'Color' },
|
|
74
|
+
|
|
75
|
+
// Typography Utilities
|
|
76
|
+
{
|
|
77
|
+
className: 'text-h1',
|
|
78
|
+
css: 'font-size: var(--pf-font-size-h1); font-weight: var(--pf-font-weight-bold);',
|
|
79
|
+
category: 'Typography',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
className: 'text-h2',
|
|
83
|
+
css: 'font-size: var(--pf-font-size-h2); font-weight: var(--pf-font-weight-bold);',
|
|
84
|
+
category: 'Typography',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
className: 'text-h3',
|
|
88
|
+
css: 'font-size: var(--pf-font-size-h3); font-weight: var(--pf-font-weight-bold);',
|
|
89
|
+
category: 'Typography',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
className: 'text-h4',
|
|
93
|
+
css: 'font-size: var(--pf-font-size-h4); font-weight: var(--pf-font-weight-bold);',
|
|
94
|
+
category: 'Typography',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
className: 'text-h5',
|
|
98
|
+
css: 'font-size: var(--pf-font-size-h5); font-weight: var(--pf-font-weight-bold);',
|
|
99
|
+
category: 'Typography',
|
|
100
|
+
},
|
|
101
|
+
{ className: 'text-body', css: 'font-size: var(--pf-font-size-body);', category: 'Typography' },
|
|
102
|
+
{
|
|
103
|
+
className: 'text-body-2',
|
|
104
|
+
css: 'font-size: var(--pf-font-size-body2);',
|
|
105
|
+
category: 'Typography',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
className: 'subtitle',
|
|
109
|
+
css: 'font-size: var(--pf-font-size-subtitle);',
|
|
110
|
+
category: 'Typography',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
className: 'subtitle-2',
|
|
114
|
+
css: 'font-size: var(--pf-font-size-subtitle2);',
|
|
115
|
+
category: 'Typography',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
className: 'text-caption',
|
|
119
|
+
css: 'font-size: var(--pf-font-size-caption);',
|
|
120
|
+
category: 'Typography',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
className: 'text-overline',
|
|
124
|
+
css: 'font-size: var(--pf-font-size-overline); text-transform: uppercase;',
|
|
125
|
+
category: 'Typography',
|
|
126
|
+
},
|
|
127
|
+
{ className: 'text-capitalize', css: 'text-transform: capitalize;', category: 'Typography' },
|
|
128
|
+
{ className: 'text-uppercase', css: 'text-transform: uppercase;', category: 'Typography' },
|
|
129
|
+
{ className: 'text-lowercase', css: 'text-transform: lowercase;', category: 'Typography' },
|
|
130
|
+
{ className: 'text-decoration--none', css: 'text-decoration: none;', category: 'Typography' },
|
|
131
|
+
{
|
|
132
|
+
className: 'text-decoration--underline',
|
|
133
|
+
css: 'text-decoration: underline;',
|
|
134
|
+
category: 'Typography',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
className: 'text-decoration--line-through',
|
|
138
|
+
css: 'text-decoration: line-through;',
|
|
139
|
+
category: 'Typography',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
className: 'text-decoration--overline',
|
|
143
|
+
css: 'text-decoration: overline;',
|
|
144
|
+
category: 'Typography',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
className: 'text-weight--thin',
|
|
148
|
+
css: 'font-weight: var(--pf-font-weight-thin);',
|
|
149
|
+
category: 'Typography',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
className: 'text-weight--light',
|
|
153
|
+
css: 'font-weight: var(--pf-font-weight-light);',
|
|
154
|
+
category: 'Typography',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
className: 'text-weight--regular',
|
|
158
|
+
css: 'font-weight: var(--pf-font-weight-regular);',
|
|
159
|
+
category: 'Typography',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
className: 'text-weight--medium',
|
|
163
|
+
css: 'font-weight: var(--pf-font-weight-medium);',
|
|
164
|
+
category: 'Typography',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
className: 'text-weight--bold',
|
|
168
|
+
css: 'font-weight: var(--pf-font-weight-bold);',
|
|
169
|
+
category: 'Typography',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
className: 'text-weight--heavy',
|
|
173
|
+
css: 'font-weight: var(--pf-font-weight-heavy);',
|
|
174
|
+
category: 'Typography',
|
|
175
|
+
},
|
|
176
|
+
{ className: 'text-align--left', css: 'text-align: left;', category: 'Typography' },
|
|
177
|
+
{ className: 'text-align--center', css: 'text-align: center;', category: 'Typography' },
|
|
178
|
+
{ className: 'text-align--right', css: 'text-align: right;', category: 'Typography' },
|
|
179
|
+
{ className: 'text-opacity--0', css: 'opacity: 0;', category: 'Typography' },
|
|
180
|
+
{ className: 'text-opacity--50', css: 'opacity: 0.5;', category: 'Typography' },
|
|
181
|
+
{ className: 'text-opacity--100', css: 'opacity: 1;', category: 'Typography' },
|
|
182
|
+
{ className: 'text-break--word', css: 'overflow-wrap: break-word;', category: 'Typography' },
|
|
183
|
+
|
|
184
|
+
// Sizing Utilities
|
|
185
|
+
{ className: 'ma-auto', css: 'margin: auto;', category: 'Sizing' },
|
|
186
|
+
{ className: 'ma-0', css: 'margin: var(--pf-margin-0);', category: 'Sizing' },
|
|
187
|
+
{ className: 'ma-1', css: 'margin: var(--pf-margin-1);', category: 'Sizing' },
|
|
188
|
+
{ className: 'ma-2', css: 'margin: var(--pf-margin-2);', category: 'Sizing' },
|
|
189
|
+
{ className: 'ma-3', css: 'margin: var(--pf-margin-3);', category: 'Sizing' },
|
|
190
|
+
{ className: 'ma-4', css: 'margin: var(--pf-margin-4);', category: 'Sizing' },
|
|
191
|
+
{ className: 'ma-5', css: 'margin: var(--pf-margin-5);', category: 'Sizing' },
|
|
192
|
+
{ className: 'ma-6', css: 'margin: var(--pf-margin-6);', category: 'Sizing' },
|
|
193
|
+
{ className: 'ma-7', css: 'margin: var(--pf-margin-7);', category: 'Sizing' },
|
|
194
|
+
{ className: 'ma-8', css: 'margin: var(--pf-margin-8);', category: 'Sizing' },
|
|
195
|
+
{ className: 'ma-9', css: 'margin: var(--pf-margin-9);', category: 'Sizing' },
|
|
196
|
+
{ className: 'ma-10', css: 'margin: var(--pf-margin-10);', category: 'Sizing' },
|
|
197
|
+
{ className: 'ma-11', css: 'margin: var(--pf-margin-11);', category: 'Sizing' },
|
|
198
|
+
{ className: 'ma-12', css: 'margin: var(--pf-margin-12);', category: 'Sizing' },
|
|
199
|
+
{ className: 'ma-13', css: 'margin: var(--pf-margin-13);', category: 'Sizing' },
|
|
200
|
+
{ className: 'ma-14', css: 'margin: var(--pf-margin-14);', category: 'Sizing' },
|
|
201
|
+
{ className: 'ma-15', css: 'margin: var(--pf-margin-15);', category: 'Sizing' },
|
|
202
|
+
{ className: 'ma-16', css: 'margin: var(--pf-margin-16);', category: 'Sizing' },
|
|
203
|
+
{ className: 'pa-0', css: 'padding: var(--pf-padding-0);', category: 'Sizing' },
|
|
204
|
+
{ className: 'pa-1', css: 'padding: var(--pf-padding-1);', category: 'Sizing' },
|
|
205
|
+
{ className: 'pa-2', css: 'padding: var(--pf-padding-2);', category: 'Sizing' },
|
|
206
|
+
{ className: 'pa-3', css: 'padding: var(--pf-padding-3);', category: 'Sizing' },
|
|
207
|
+
{ className: 'pa-4', css: 'padding: var(--pf-padding-4);', category: 'Sizing' },
|
|
208
|
+
{ className: 'pa-5', css: 'padding: var(--pf-padding-5);', category: 'Sizing' },
|
|
209
|
+
{ className: 'pa-6', css: 'padding: var(--pf-padding-6);', category: 'Sizing' },
|
|
210
|
+
{ className: 'pa-7', css: 'padding: var(--pf-padding-7);', category: 'Sizing' },
|
|
211
|
+
{ className: 'pa-8', css: 'padding: var(--pf-padding-8);', category: 'Sizing' },
|
|
212
|
+
{ className: 'pa-9', css: 'padding: var(--pf-padding-9);', category: 'Sizing' },
|
|
213
|
+
{ className: 'pa-10', css: 'padding: var(--pf-padding-10);', category: 'Sizing' },
|
|
214
|
+
{ className: 'pa-11', css: 'padding: var(--pf-padding-11);', category: 'Sizing' },
|
|
215
|
+
{ className: 'pa-12', css: 'padding: var(--pf-padding-12);', category: 'Sizing' },
|
|
216
|
+
{ className: 'pa-13', css: 'padding: var(--pf-padding-13);', category: 'Sizing' },
|
|
217
|
+
{ className: 'pa-14', css: 'padding: var(--pf-padding-14);', category: 'Sizing' },
|
|
218
|
+
{ className: 'pa-15', css: 'padding: var(--pf-padding-15);', category: 'Sizing' },
|
|
219
|
+
{ className: 'pa-16', css: 'padding: var(--pf-padding-16);', category: 'Sizing' },
|
|
220
|
+
|
|
221
|
+
// Icon Sizes
|
|
222
|
+
{ className: 'icon-xs', css: 'font-size: var(--pf-icon-size-xs);', category: 'Icon' },
|
|
223
|
+
{ className: 'icon-sm', css: 'font-size: var(--pf-icon-size-sm);', category: 'Icon' },
|
|
224
|
+
{ className: 'icon-md', css: 'font-size: var(--pf-icon-size-md);', category: 'Icon' },
|
|
225
|
+
{ className: 'icon-lg', css: 'font-size: var(--pf-icon-size-lg);', category: 'Icon' },
|
|
226
|
+
{ className: 'icon-xl', css: 'font-size: var(--pf-icon-size-xl);', category: 'Icon' },
|
|
227
|
+
|
|
228
|
+
// Drop Shadows
|
|
229
|
+
{ className: 'dropshadow', css: 'box-shadow: var(--pf-dropshadow);', category: 'Effect' },
|
|
230
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { UtilityClassesTable } from './UtilityClassesTable';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof UtilityClassesTable> = {
|
|
5
|
+
title: 'remove/Utility Classes/Table',
|
|
6
|
+
component: UtilityClassesTable,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof UtilityClassesTable>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Table, Select, Input, Container, Row, Col } from '@/components';
|
|
3
|
+
import { MultiValue, SingleValue, ActionMeta } from 'react-select';
|
|
4
|
+
import { UtilityClassData, utilityClassesData } from './UtilityClassesData';
|
|
5
|
+
|
|
6
|
+
const categories = Array.from(new Set(utilityClassesData.map((item) => item.category)));
|
|
7
|
+
|
|
8
|
+
// Resolve CSS variables using getComputedStyle
|
|
9
|
+
const resolveCssVariables = (css: string): string => {
|
|
10
|
+
const tempElement = document.createElement('div');
|
|
11
|
+
document.body.appendChild(tempElement);
|
|
12
|
+
const style = getComputedStyle(tempElement);
|
|
13
|
+
|
|
14
|
+
const resolvedCss = css.replace(/var\((--pf-[\w-]+)\)/g, (_, variable) => {
|
|
15
|
+
return style.getPropertyValue(variable).trim() || variable;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
document.body.removeChild(tempElement);
|
|
19
|
+
return resolvedCss;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const formatCss = (css: string): string => {
|
|
23
|
+
return css
|
|
24
|
+
.split(';')
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.map((line) => line.trim() + ';')
|
|
27
|
+
.join('\n');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const UtilityClassesTable = () => {
|
|
31
|
+
const [classNameSearch, setClassNameSearch] = useState('');
|
|
32
|
+
const [cssSearch, setCssSearch] = useState('');
|
|
33
|
+
const [selectedCategories, setSelectedCategories] = useState<string[]>([]);
|
|
34
|
+
const [rowData, setRowData] = useState<UtilityClassData[]>([]);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const resolved = utilityClassesData.map((item) => ({
|
|
38
|
+
...item,
|
|
39
|
+
resolvedCss: resolveCssVariables(item.css),
|
|
40
|
+
}));
|
|
41
|
+
setRowData(resolved);
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const handleCategoryChange = (
|
|
45
|
+
newValue:
|
|
46
|
+
| MultiValue<{ value: string; label: string }>
|
|
47
|
+
| SingleValue<{ value: string; label: string }>,
|
|
48
|
+
) => {
|
|
49
|
+
setSelectedCategories(Array.isArray(newValue) ? newValue.map((option) => option.value) : []);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const filteredData = rowData.filter(
|
|
53
|
+
(item) =>
|
|
54
|
+
(selectedCategories.length === 0 || selectedCategories.includes(item.category)) &&
|
|
55
|
+
item.className.toLowerCase().includes(classNameSearch.toLowerCase()) &&
|
|
56
|
+
(item.css.toLowerCase().includes(cssSearch.toLowerCase()) ||
|
|
57
|
+
item.resolvedCss?.toLowerCase().includes(cssSearch.toLowerCase())),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Container>
|
|
62
|
+
<Row className="mb-4">
|
|
63
|
+
<Col sm={4}>
|
|
64
|
+
<Input
|
|
65
|
+
id="classNameSearch"
|
|
66
|
+
name="classNameSearch"
|
|
67
|
+
label="Class Name"
|
|
68
|
+
value={classNameSearch}
|
|
69
|
+
onChange={(e) => setClassNameSearch(e.target.value)}
|
|
70
|
+
/>
|
|
71
|
+
</Col>
|
|
72
|
+
<Col sm={4}>
|
|
73
|
+
<Input
|
|
74
|
+
id="cssSearch"
|
|
75
|
+
name="cssSearch"
|
|
76
|
+
label="CSS"
|
|
77
|
+
value={cssSearch}
|
|
78
|
+
onChange={(e) => setCssSearch(e.target.value)}
|
|
79
|
+
/>
|
|
80
|
+
</Col>
|
|
81
|
+
<Col sm={4}>
|
|
82
|
+
<div className="form-control">
|
|
83
|
+
<div data-testid={`category-label`} className={`form-label mb-2`}>
|
|
84
|
+
<label htmlFor={`categoryFilter`}>Category</label>
|
|
85
|
+
</div>
|
|
86
|
+
<Select
|
|
87
|
+
id="categoryFilter"
|
|
88
|
+
name="categoryFilter"
|
|
89
|
+
options={categories.map((category) => ({ value: category, label: category }))}
|
|
90
|
+
onChange={handleCategoryChange}
|
|
91
|
+
value={categories
|
|
92
|
+
.filter((category) => selectedCategories.includes(category))
|
|
93
|
+
.map((category) => ({ value: category, label: category }))}
|
|
94
|
+
placeholder=""
|
|
95
|
+
isMulti
|
|
96
|
+
isClearable
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</Col>
|
|
100
|
+
</Row>
|
|
101
|
+
|
|
102
|
+
<Table
|
|
103
|
+
columns={[
|
|
104
|
+
{ name: 'Class Name', selector: (row) => row.className, sortable: true, width: '225px' },
|
|
105
|
+
{
|
|
106
|
+
name: 'CSS Applied',
|
|
107
|
+
selector: (row) => formatCss(row.css),
|
|
108
|
+
sortable: true,
|
|
109
|
+
cell: (row) => (
|
|
110
|
+
<pre
|
|
111
|
+
style={{
|
|
112
|
+
fontFamily: 'monospace',
|
|
113
|
+
whiteSpace: 'pre-wrap',
|
|
114
|
+
fontSize: '12px',
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{formatCss(row.css)}
|
|
118
|
+
</pre>
|
|
119
|
+
),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'Resolved CSS',
|
|
123
|
+
selector: (row) => formatCss(row.resolvedCss || ''),
|
|
124
|
+
sortable: true,
|
|
125
|
+
cell: (row) => (
|
|
126
|
+
<pre
|
|
127
|
+
style={{
|
|
128
|
+
fontFamily: 'monospace',
|
|
129
|
+
whiteSpace: 'pre-wrap',
|
|
130
|
+
fontSize: '12px',
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{formatCss(row.resolvedCss || '')}
|
|
134
|
+
</pre>
|
|
135
|
+
),
|
|
136
|
+
},
|
|
137
|
+
{ name: 'Category', selector: (row) => row.category, sortable: true, width: '114px' },
|
|
138
|
+
]}
|
|
139
|
+
data={filteredData}
|
|
140
|
+
dense
|
|
141
|
+
noDataComponent="-- No Classes Found --"
|
|
142
|
+
pagination={false}
|
|
143
|
+
/>
|
|
144
|
+
</Container>
|
|
145
|
+
);
|
|
146
|
+
};
|