myshell-react-lib 0.1.2 → 0.1.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.
- package/dist/index.cjs +445 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -31
- package/dist/index.d.ts +32 -31
- package/dist/index.js +445 -324
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icon.tsx +6 -0
- package/src/components/icons/outline/FilterIcon.tsx +0 -1
- package/src/components/secondary-navigation-bar.tsx +41 -20
- package/src/stories/SecondaryNavigationBar.stories.tsx +4 -4
package/package.json
CHANGED
package/src/components/icon.tsx
CHANGED
|
@@ -46,6 +46,12 @@ const iconVariants = cva('inline-flex shrink-0', {
|
|
|
46
46
|
bolder: 'text-Colors-Foreground-Bolder',
|
|
47
47
|
inverse: 'text-Colors-Foreground-Static-White',
|
|
48
48
|
critical: 'text-Colors-Foreground-Critical-Default',
|
|
49
|
+
brand: 'text-Colors-Text-Brand-Default',
|
|
50
|
+
'critical-bolder': 'text-Colors-Text-Critical-Bolder',
|
|
51
|
+
warning: 'text-Colors-Text-Warning-Default',
|
|
52
|
+
'warning-bolder': 'text-Colors-Text-Warning-Bolder',
|
|
53
|
+
success: 'text-Colors-Text-Success-Default',
|
|
54
|
+
'success-bolder': 'text-Colors-Text-Success-Bolder',
|
|
49
55
|
},
|
|
50
56
|
rotate: {
|
|
51
57
|
'45': 'rotate-45',
|
|
@@ -12,7 +12,6 @@ function FilterIcon({ className }: { className?: string }) {
|
|
|
12
12
|
fillRule="evenodd"
|
|
13
13
|
clipRule="evenodd"
|
|
14
14
|
d="M10.0278 2.84729C7.67712 2.84729 5.37221 3.04531 3.12895 3.42572C2.37055 3.55432 1.83336 4.2145 1.83336 4.96859V5.84598C1.83336 6.51468 2.099 7.15598 2.57185 7.62882L7.13715 12.1941C7.37358 12.4305 7.5064 12.7511 7.5064 13.0855V18.6055C7.5064 18.8239 7.61951 19.0268 7.80535 19.1417C7.99118 19.2565 8.22323 19.267 8.41863 19.1693L11.1553 17.8009C12.0095 17.3738 12.5491 16.5008 12.5491 15.5458V13.0855C12.5491 12.7511 12.6819 12.4305 12.9183 12.1941L17.4837 7.62882C17.9565 7.15598 18.2221 6.51468 18.2221 5.84598V4.96857C18.2221 4.21448 17.6849 3.5543 16.9265 3.4257C14.6833 3.0453 12.3784 2.84729 10.0278 2.84729ZM3.33973 4.66863C5.51363 4.29998 7.74805 4.10794 10.0278 4.10794C12.3075 4.10794 14.5419 4.29998 16.7158 4.66861C16.8531 4.69189 16.9615 4.8142 16.9615 4.96857V5.84598C16.9615 6.18033 16.8286 6.50098 16.5922 6.7374L12.0269 11.3026C11.5541 11.7755 11.2884 12.4168 11.2884 13.0855V15.5458C11.2884 16.0233 11.0186 16.4598 10.5915 16.6734L8.76707 17.5856V13.0855C8.76707 12.4168 8.50143 11.7755 8.02859 11.3026L3.46328 6.7374C3.22685 6.50098 3.09403 6.18033 3.09403 5.84598V4.96859C3.09403 4.81422 3.20244 4.69191 3.33973 4.66863ZM15.1424 12.0035C14.9222 11.7833 14.5651 11.7833 14.3448 12.0035C14.1246 12.2238 14.1246 12.5809 14.3448 12.8011L16.3756 14.8318L14.3448 16.8625C14.1246 17.0828 14.1246 17.4399 14.3448 17.6601C14.5651 17.8804 14.9222 17.8804 15.1424 17.6601L17.1732 15.6294L19.2039 17.6601C19.4242 17.8804 19.7813 17.8804 20.0015 17.6601C20.2218 17.4399 20.2218 17.0828 20.0015 16.8625L17.9708 14.8318L20.0015 12.8011C20.2218 12.5809 20.2218 12.2238 20.0015 12.0035C19.7813 11.7833 19.4242 11.7833 19.2039 12.0035L17.1732 14.0342L15.1424 12.0035Z"
|
|
15
|
-
fill="#3E5CFA"
|
|
16
15
|
/>
|
|
17
16
|
</svg>
|
|
18
17
|
);
|
|
@@ -4,12 +4,11 @@ import { LucideIcon } from 'lucide-react';
|
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { useMedia } from 'react-use';
|
|
6
6
|
|
|
7
|
-
import { HeroIcon } from '
|
|
7
|
+
import { HeroIcon } from '@/common/constants/types/common';
|
|
8
8
|
import { cn } from '@/lib/utils';
|
|
9
9
|
|
|
10
10
|
import { Avatar } from './avatar';
|
|
11
|
-
import { Button } from './button
|
|
12
|
-
import { Icon, IconComponent } from './icon';
|
|
11
|
+
import { Button } from './button';
|
|
13
12
|
import { IconButton } from './button/icon-button';
|
|
14
13
|
import { Link } from './link';
|
|
15
14
|
import { SearchBar } from './search-bar';
|
|
@@ -18,15 +17,22 @@ import { Display, Text } from './typography';
|
|
|
18
17
|
import FilterIcon from './icons/outline/FilterIcon';
|
|
19
18
|
|
|
20
19
|
type IIcons = {
|
|
21
|
-
icon: HeroIcon | LucideIcon |
|
|
20
|
+
icon: HeroIcon | LucideIcon | React.ElementType;
|
|
22
21
|
onClick?: () => void;
|
|
23
22
|
};
|
|
24
23
|
type IActions = {
|
|
25
24
|
label: string;
|
|
26
25
|
onClick?: () => void;
|
|
27
|
-
icon?: HeroIcon | LucideIcon |
|
|
28
|
-
variant?:
|
|
29
|
-
|
|
26
|
+
icon?: HeroIcon | LucideIcon | React.ElementType;
|
|
27
|
+
variant?:
|
|
28
|
+
| 'primary'
|
|
29
|
+
| 'secondary'
|
|
30
|
+
| 'tertiary'
|
|
31
|
+
| 'static'
|
|
32
|
+
| 'link'
|
|
33
|
+
| 'plain'
|
|
34
|
+
| 'solid';
|
|
35
|
+
color?: 'default' | 'brand' | 'error';
|
|
30
36
|
};
|
|
31
37
|
type ISecondaryNavigationBar = {
|
|
32
38
|
/**
|
|
@@ -109,6 +115,7 @@ type ISecondaryNavigationBar = {
|
|
|
109
115
|
};
|
|
110
116
|
onSearchChange?: (value: string) => void;
|
|
111
117
|
onClear?: () => void;
|
|
118
|
+
onBack?: () => void;
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
function SecondaryNavigationBar({
|
|
@@ -127,6 +134,7 @@ function SecondaryNavigationBar({
|
|
|
127
134
|
avatar,
|
|
128
135
|
onSearchChange,
|
|
129
136
|
onClear,
|
|
137
|
+
onBack,
|
|
130
138
|
}: ISecondaryNavigationBar) {
|
|
131
139
|
const isMobile = useMedia('(max-width: 768px)');
|
|
132
140
|
const navbarRef = useRef<HTMLDivElement>(null);
|
|
@@ -150,14 +158,13 @@ function SecondaryNavigationBar({
|
|
|
150
158
|
|
|
151
159
|
return () => window.removeEventListener('scroll', handleScroll);
|
|
152
160
|
}, [hasBackground]);
|
|
153
|
-
const currentClearText = clearText || 'Clear Filters';
|
|
154
161
|
|
|
155
162
|
return (
|
|
156
163
|
<div
|
|
157
164
|
ref={navbarRef}
|
|
158
165
|
className={cn(
|
|
159
166
|
'w-full flex flex-col md:flex-row justify-center items-center px-4 md:px-6',
|
|
160
|
-
!isMobile && border && 'border-b border-
|
|
167
|
+
!isMobile && border && 'border-b border-default',
|
|
161
168
|
showBackground && 'bg-Colors-Background-Normal-Primary-Default'
|
|
162
169
|
)}
|
|
163
170
|
>
|
|
@@ -169,16 +176,30 @@ function SecondaryNavigationBar({
|
|
|
169
176
|
<div
|
|
170
177
|
className={cn('flex items-center', avatar?.logo && 'min-w-[76px]')}
|
|
171
178
|
>
|
|
172
|
-
{backUrl && (
|
|
179
|
+
{(backUrl || onBack) && (
|
|
173
180
|
<div className="flex justify-start items-center">
|
|
174
|
-
|
|
181
|
+
{backUrl ? (
|
|
182
|
+
<Link
|
|
183
|
+
href={backUrl}
|
|
184
|
+
className="flex justify-center items-center"
|
|
185
|
+
>
|
|
186
|
+
<IconButton
|
|
187
|
+
variant={!hasBackground ? 'primary' : 'plain'}
|
|
188
|
+
color={!hasBackground ? 'gray' : 'brand'}
|
|
189
|
+
size="md"
|
|
190
|
+
icon={ArrowLeftIcon}
|
|
191
|
+
/>
|
|
192
|
+
</Link>
|
|
193
|
+
) : (
|
|
175
194
|
<IconButton
|
|
176
195
|
variant={!hasBackground ? 'primary' : 'plain'}
|
|
177
196
|
color={!hasBackground ? 'gray' : 'brand'}
|
|
178
197
|
size="md"
|
|
179
198
|
icon={ArrowLeftIcon}
|
|
199
|
+
onClick={onBack}
|
|
180
200
|
/>
|
|
181
|
-
|
|
201
|
+
)}
|
|
202
|
+
|
|
182
203
|
{!isMobile && title && (
|
|
183
204
|
<Separator orientation="vertical" className="h-5 ml-1.5 mr-3" />
|
|
184
205
|
)}
|
|
@@ -234,8 +255,8 @@ function SecondaryNavigationBar({
|
|
|
234
255
|
icons.map((icon, index) => (
|
|
235
256
|
<IconButton
|
|
236
257
|
key={index}
|
|
237
|
-
variant={!hasBackground ? '
|
|
238
|
-
color={!hasBackground ? '
|
|
258
|
+
variant={!hasBackground ? 'tertiary' : 'plain'}
|
|
259
|
+
color={!hasBackground ? 'default' : 'brand'}
|
|
239
260
|
size="md"
|
|
240
261
|
icon={icon.icon}
|
|
241
262
|
onClick={icon.onClick}
|
|
@@ -252,18 +273,18 @@ function SecondaryNavigationBar({
|
|
|
252
273
|
<>
|
|
253
274
|
{showClear && !isMobile && (
|
|
254
275
|
<Button
|
|
255
|
-
aria-label={
|
|
276
|
+
aria-label={clearText || 'Clear Filters'}
|
|
256
277
|
size="md"
|
|
257
|
-
variant="
|
|
278
|
+
variant="secondary"
|
|
258
279
|
color="default"
|
|
259
|
-
className="hidden md:flex relative text-sm
|
|
280
|
+
className="hidden md:flex relative text-sm font-medium ml-2 mr-3 px-4 justify-center items-center"
|
|
260
281
|
onClick={onClear}
|
|
261
282
|
>
|
|
262
283
|
<div className="relative mr-1.5">
|
|
263
|
-
<FilterIcon className="w-5 h-5" />
|
|
284
|
+
<FilterIcon className="w-5 h-5 fill-cc-Button-Secondary-fg-default" />
|
|
264
285
|
</div>
|
|
265
286
|
<span className="hidden md:block">
|
|
266
|
-
{
|
|
287
|
+
{clearText || 'Clear Filters'}
|
|
267
288
|
</span>
|
|
268
289
|
</Button>
|
|
269
290
|
)}
|
|
@@ -283,7 +304,7 @@ function SecondaryNavigationBar({
|
|
|
283
304
|
{showClear && isMobile && (
|
|
284
305
|
<IconButton
|
|
285
306
|
className="flex-shrink-0 flex relative text-sm font-medium px-4 justify-center items-center ml-3"
|
|
286
|
-
aria-label={
|
|
307
|
+
aria-label={clearText || 'Clear Filters'}
|
|
287
308
|
size="md"
|
|
288
309
|
variant="primary"
|
|
289
310
|
color="default"
|
|
@@ -106,8 +106,8 @@ export const SecondaryNavigationBarDemo: Story = {
|
|
|
106
106
|
actions={[
|
|
107
107
|
{
|
|
108
108
|
label: 'Cancel',
|
|
109
|
-
variant: '
|
|
110
|
-
color: '
|
|
109
|
+
variant: 'tertiary',
|
|
110
|
+
color: 'default',
|
|
111
111
|
onClick: () => {
|
|
112
112
|
console.log('click');
|
|
113
113
|
},
|
|
@@ -115,7 +115,7 @@ export const SecondaryNavigationBarDemo: Story = {
|
|
|
115
115
|
{
|
|
116
116
|
label: 'Cancel',
|
|
117
117
|
variant: 'primary',
|
|
118
|
-
color: '
|
|
118
|
+
color: 'default',
|
|
119
119
|
onClick: () => {
|
|
120
120
|
console.log('click');
|
|
121
121
|
},
|
|
@@ -131,7 +131,7 @@ export const SecondaryNavigationBarDemo: Story = {
|
|
|
131
131
|
{
|
|
132
132
|
label: 'Label',
|
|
133
133
|
variant: 'plain',
|
|
134
|
-
color: '
|
|
134
|
+
color: 'default',
|
|
135
135
|
onClick: () => {
|
|
136
136
|
console.log('click');
|
|
137
137
|
},
|