forstok-ui-lib 8.1.0 → 8.1.2

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.
@@ -97,6 +97,9 @@ import IconEmoji from '../../assets/images/icons/emoji.svg'
97
97
  import IconPrice from '../../assets/images/icons/price.svg'
98
98
  import IconThumb from '../../assets/images/icons/thumb.svg'
99
99
  import IconClipboard from '../../assets/images/icons/clipboard.svg'
100
+ import IconReload from '../../assets/images/icons/reload.svg'
101
+
102
+ import { IconMode, IconName } from './type'
100
103
 
101
104
  const NotificationStyled = css`
102
105
  width: 44px;
@@ -110,710 +113,148 @@ const NotificationStyled = css`
110
113
  justify-content: center;
111
114
  `
112
115
 
113
- const getIconContainerStyled = ({ $mode, $name, $width, onClick }:{ $mode?: string, $name: string, $width?: string | number, onClick?: (e: MouseEvent<HTMLElement>) => void }) => {
114
- let style = ``;
115
- switch ($name) {
116
- case 'search':
117
- style += `
118
- &:before {
119
- content: url(${IconSearch});
120
- }
121
- `
122
- break;
123
- case 'check':
124
- style += `
125
- &:before {
126
- content: url(${IconCheck});
127
- }
128
- `
129
- break;
130
- case 'check-grey':
131
- style += `
132
- &:before {
133
- content: url(${IconCheckGrey});
134
- }
135
- `
136
- break;
137
- case 'arrow-left-blue':
138
- style += `
139
- &:before {
140
- content: url(${IconArrowLeftBlue});
141
- }
142
- `
143
- break;
144
- case 'edit':
145
- style += `
146
- &:before {
147
- content: url(${IconEdit});
148
- }
149
- `
150
- break;
151
- case 'arrow':
152
- style += `
153
- &:before {
154
- content: url(${IconArrow});
155
- }
156
- `
157
- break;
158
- case 'discount':
159
- style += `
160
- &:before {
161
- content: url(${IconDiscount});
162
- }
163
- `
164
- break;
165
- case 'cash':
166
- style += `
167
- &:before {
168
- content: url(${IconCash});
169
- }
170
- `
171
- break;
172
- case 'credit':
173
- style += `
174
- &:before {
175
- content: url(${IconCredit});
176
- }
177
- `
178
- break;
179
- case 'debit':
180
- style += `
181
- &:before {
182
- content: url(${IconDebit});
183
- }
184
- `
185
- break;
186
- case 'bank':
187
- style += `
188
- &:before {
189
- content: url(${IconBank});
190
- }
191
- `
192
- break;
193
- case 'qris':
194
- style += `
195
- &:before {
196
- content: url(${IconQRIS});
197
- }
198
- `
199
- break;
200
- case 'wallet':
201
- style += `
202
- &:before {
203
- content: url(${IconWallet});
204
- }
205
- `
206
- break;
207
- case 'delivery':
208
- style += `
209
- &:before {
210
- content: url(${IconDelivery});
211
- }
212
- `
213
- break;
214
- case 'success':
215
- style += `
216
- &:before {
217
- content: url(${IconSuccess});
218
- }
219
- `
220
- break;
221
- case 'email':
222
- style += `
223
- &:before {
224
- content: url(${IconEmail});
225
- }
226
- `
227
- break;
228
- case 'print':
229
- style += `
230
- &:before {
231
- content: url(${IconPrint});
232
- }
233
- `
234
- break;
235
- case 'warning':
236
- style += `
237
- &:before {
238
- content: url(${IconWarning});
239
- }
240
- `
241
- break;
242
- case 'alert':
243
- style += `
244
- &:before {
245
- content: url(${IconAlert});
246
- }
247
- `
248
- break;
249
- case 'barcode':
250
- style += `
251
- &:before {
252
- content: url(${IconBarcode});
253
- }
254
- `
255
- break;
256
- case 'arrow-upload':
257
- style += `
258
- &:before {
259
- content: url(${IconArrowUpload});
260
- }
261
- `
262
- break;
263
- case 'trash':
264
- style += `
265
- &:before {
266
- content: url(${IconTrash});
267
- }
268
- `
269
- break;
270
- case 'arrow-left':
271
- style += `
272
- &:before {
273
- content: url(${IconArrowLeft});
274
- }
275
- `
276
- break;
277
- case 'arrow-left-double':
278
- style += `
279
- &:before {
280
- content: url(${IconArrowLeftDouble});
281
- }
282
- `
283
- break;
284
- case 'arrow-right':
285
- style += `
286
- &:before {
287
- content: url(${IconArrowRight});
288
- }
289
- `
290
- break;
291
- case 'arrow-right-double':
292
- style += `
293
- &:before {
294
- content: url(${IconArrowRightDouble});
295
- }
296
- `
297
- break;
298
- case 'arrow-down':
299
- style += `
300
- &:before {
301
- content: url(${IconArrowDown});
302
- }
303
- `
304
- break;
305
- case 'calendar':
306
- style += `
307
- &:before {
308
- content: url(${IconCalendar});
309
- }
310
- `
311
- break;
312
- case 'question':
313
- style += `
314
- &:before {
315
- content: url(${IconQuestion});
316
- filter: grayscale(100%);
317
- }
318
- `
319
- break;
320
- case 'sortby':
321
- style += `
322
- &:before {
323
- content: url(${IconSortby});
324
- }
325
- `
326
- break;
327
- case 'NotificationDownload' :
328
- style += `
329
- ${NotificationStyled}
330
- &:before {
331
- content: url(${IconNotificationDownload});
332
- }`
333
- break;
334
- case 'NotificationUpload' :
335
- style += `
336
- ${NotificationStyled}
337
- &:before {
338
- content: url(${IconNotificationUpload});
339
- }`
340
- break;
341
- case 'bar':
342
- style += `
343
- &:before {
344
- content: url(${IconBar});
345
- }`
346
- break;
347
- case 'close':
348
- style += `
349
- &:before {
350
- content: url(${IconClose});
351
- }`
352
- break;
353
- case 'person':
354
- style += `
355
- &:before {
356
- content: url(${IconPerson});
357
- }`
358
- break;
359
- case 'person-red':
360
- style += `
361
- &:before {
362
- content: url(${IconPersonRed});
363
- }`
364
- break;
365
- case 'cart':
366
- style += `
367
- &:before {
368
- content: url(${IconCart});
369
- }`
370
- break;
371
- case 'back':
372
- style += `
373
- &:before {
374
- content: url(${IconBack});
375
- }
376
- `
377
- break;
378
- case 'time':
379
- style += `
380
- &:before {
381
- content: url(${IconTime});
382
- }
383
- `
384
- break;
385
- case 'dot':
386
- style += `
387
- &:before {
388
- content: url(${IconDot});
389
- }
390
- `
391
- break;
392
- case 'dashboard-left-nav':
393
- style += `
394
- &:before {
395
- content: url(${IconDashboardLeftNav});
396
- }
397
- `
398
- break;
399
- case 'dashboard-active-left-nav':
400
- style += `
401
- &:before {
402
- content: url(${IconDashboardActiveLeftNav});
403
- }
404
- `
405
- break;
406
- case 'chat-left-nav':
407
- style += `
408
- &:before {
409
- content: url(${IconChatLeftNav});
410
- }
411
- `
412
- break;
413
- case 'chat-active-left-nav':
414
- style += `
415
- &:before {
416
- content: url(${IconChatActiveLeftNav});
417
- }
418
- `
419
- break;
420
- case 'ai-left-nav':
421
- style += `
422
- &:before {
423
- content: url(${IconAiLeftNav});
424
- }
425
- `
426
- break;
427
- case 'ai-active-left-nav':
428
- style += `
429
- &:before {
430
- content: url(${IconAiActiveLeftNav});
431
- }
432
- `
433
- break;
434
- case 'reporting-left-nav':
435
- style += `
436
- &:before {
437
- content: url(${IconReportingLeftNav});
438
- }
439
- `
440
- break;
441
- case 'reporting-active-left-nav':
442
- style += `
443
- &:before {
444
- content: url(${IconReportingActiveLeftNav});
445
- }
446
- `
447
- break;
448
-
449
- case 'activity-log-left-nav':
450
- style += `
451
- &:before {
452
- content: url(${IconActivityLogLeftNav});
453
- }
454
- `
455
- break;
456
- case 'activity-log-active-left-nav':
457
- style += `
458
- &:before {
459
- content: url(${IconActivityLogActiveLeftNav});
460
- }
461
- `
462
- break;
463
- case 'integration-left-nav':
464
- style += `
465
- &:before {
466
- content: url(${IconIntegrationLeftNav});
467
- }
468
- `
469
- break;
470
- case 'integration-active-left-nav':
471
- style += `
472
- &:before {
473
- content: url(${IconIntegrationActiveLeftNav});
474
- }
475
- `
476
- break;
477
- case 'setting-left-nav':
478
- style += `
479
- &:before {
480
- content: url(${IconSettingLeftNav});
481
- }
482
- `
483
- break;
484
- case 'setting-active-left-nav':
485
- style += `
486
- &:before {
487
- content: url(${IconSettingActiveLeftNav});
488
- }
489
- `
490
- break;
491
- case 'customer-left-nav':
492
- style += `
493
- &:before {
494
- content: url(${IconCustomerLeftNav});
495
- }
496
- `
497
- break;
498
- case 'customer-active-left-nav':
499
- style += `
500
- &:before {
501
- content: url(${IconCustomerActiveLeftNav});
502
- }
503
- `
504
- break;
505
- case 'marketing-left-nav':
506
- style += `
507
- &:before {
508
- content: url(${IconMarketingLeftNav});
509
- }
510
- `
511
- break;
512
- case 'marketing-active-left-nav':
513
- style += `
514
- &:before {
515
- content: url(${IconMarketingActiveLeftNav});
516
- }
517
- `
518
- break;
519
- case 'product-left-nav':
520
- style += `
521
- &:before {
522
- content: url(${IconProductLeftNav});
523
- }
524
- `
525
- break;
526
- case 'product-active-left-nav':
527
- style += `
528
- &:before {
529
- content: url(${IconProductActiveLeftNav});
530
- }
531
- `
532
- break;
533
- case 'inventory-left-nav':
534
- style += `
535
- &:before {
536
- content: url(${IconInventoryLeftNav});
537
- }
538
- `
539
- break;
540
- case 'inventory-active-left-nav':
541
- style += `
542
- &:before {
543
- content: url(${IconInventoryActiveLeftNav});
544
- }
545
- `
546
- break;
547
- case 'order-left-nav':
548
- style += `
549
- &:before {
550
- content: url(${IconOrderLeftNav});
551
- }
552
- `
553
- break;
554
- case 'order-active-left-nav':
555
- style += `
556
- &:before {
557
- content: url(${IconOrderActiveLeftNav});
558
- }
559
- `
560
- break;
561
- case 'price-left-nav':
562
- style += `
563
- &:before {
564
- content: url(${IconPriceLeftNav});
565
- }
566
- `
567
- break;
568
- case 'price-active-left-nav':
569
- style += `
570
- &:before {
571
- content: url(${IconPriceActiveLeftNav});
572
- }
573
- `
574
- break;
575
- case 'invoice-left-nav':
576
- style += `
577
- &:before {
578
- content: url(${IconInvoiceLeftNav});
579
- }
580
- `
581
- break;
582
- case 'invoice-active-left-nav':
583
- style += `
584
- &:before {
585
- content: url(${IconInvoiceActiveLeftNav});
586
- }
587
- `
588
- break;
589
- case 'warning-chat':
590
- style += `
591
- &:before {
592
- content: url(${IconWarningChat});
593
- }
594
- `
595
- break;
596
- case 'check-chat':
597
- style += `
598
- &:before {
599
- content: url(${IconCheckChat});
600
- }
601
- `
602
- break;
603
- case 'check-chat-blue':
604
- style += `
605
- &:before {
606
- content: url(${IconCheckChatBlue});
607
- }
608
- `
609
- break;
610
- case 'phone':
611
- style += `
612
- &:before {
613
- content: url(${IconPhone});
614
- }
615
- `
616
- break;
617
- case 'location':
618
- style += `
619
- &:before {
620
- content: url(${IconLocation});
621
- }
622
- `
623
- break;
624
- case 'agent':
625
- style += `
626
- &:before {
627
- content: url(${IconAgent});
628
- }
629
- `
630
- break;
631
- case 'report':
632
- style += `
633
- &:before {
634
- content: url(${IconReport});
635
- }
636
- `
637
- break;
638
- case 'gender':
639
- style += `
640
- &:before {
641
- content: url(${IconGender});
642
- }
643
- `
644
- break;
645
- case 'birthday':
646
- style += `
647
- &:before {
648
- content: url(${IconBirthday});
649
- }
650
- `
651
- break;
652
- case 'attach':
653
- style += `
654
- &:before {
655
- content: url(${IconAttach});
656
- }
657
- `
658
- break;
659
- case 'smile':
660
- style += `
661
- &:before {
662
- content: url(${IconSmile});
663
- }
664
- `
665
- break;
666
- case 'voucher-left-nav':
667
- style += `
668
- &:before {
669
- content: url(${IconVoucherLeftNav});
670
- }
671
- `
672
- break;
673
- case 'voucher-active-left-nav':
674
- style += `
675
- &:before {
676
- content: url(${IconVoucherActiveLeftNav});
677
- }
678
- `
679
- break;
680
- case 'analytic-left-nav':
681
- style += `
682
- &:before {
683
- content: url(${IconAnalyticLeftNav});
684
- }
685
- `
686
- break;
687
- case 'analytic-active-left-nav':
688
- style += `
689
- &:before {
690
- content: url(${IconAnalyticActiveLeftNav});
691
- }
692
- `
693
- break;
694
- case 'label-left-nav':
695
- style += `
696
- &:before {
697
- content: url(${IconLabelLeftNav});
698
- }
699
- `
700
- break;
701
- case 'label-active-left-nav':
702
- style += `
703
- &:before {
704
- content: url(${IconLabelActiveLeftNav});
705
- }
706
- `
707
- break;
708
- case 'questions':
709
- style += `
710
- &:before {
711
- content: url(${IconQuestions});
712
- }
713
- `
714
- break;
715
- case 'faq':
716
- style += `
717
- &:before {
718
- content: url(${IconFaq});
719
- }
720
- `
721
- break;
722
- case 'api':
723
- style += `
724
- &:before {
725
- content: url(${IconApi});
726
- }
727
- `
728
- break;
729
- case 'gift':
730
- style += `
731
- &:before {
732
- content: url(${IconGift});
733
- }
734
- `
735
- break;
736
- case 'document':
737
- style += `
738
- &:before {
739
- content: url(${IconDocument});
740
- }
741
- `
742
- break;
743
- case 'video':
744
- style += `
745
- &:before {
746
- content: url(${IconVideo});
747
- }
748
- `
749
- break;
750
- case 'image':
751
- style += `
752
- &:before {
753
- content: url(${IconImage});
754
- }
755
- `
756
- break;
757
- case 'emoji':
758
- style += `
759
- &:before {
760
- content: url(${IconEmoji});
761
- }
762
- `
763
- break;
764
- case 'price':
765
- style += `
766
- &:before {
767
- content: url(${IconPrice});
768
- }
769
- `
770
- break;
771
- case 'thumb':
772
- style += `
773
- &:before {
774
- content: url(${IconThumb});
775
- }
776
- `
777
- break;
778
- case 'clipboard':
779
- style += `
780
- &:before {
781
- content: url(${IconClipboard});
782
- }
783
- `
784
- break;
785
- default:
786
- break;
787
- }
788
- if ($width) {
789
- style += `
790
- &:before {
791
- width: ${$width};
792
- height: ${$width};
793
- }
794
- `
795
- }
796
- if (onClick) {
797
- style += `
798
- cursor: pointer;
799
- `
800
- }
801
- if ($mode === 'filter') {
802
- style += `
803
- position: relative;
804
- `
805
- } else if ($mode === 'disabled') {
806
- style += `
807
- &,
808
- &:before {
809
- opacity: .7;
810
- }
811
- `
812
- }
813
- return style;
116
+ const iconStyles = {
117
+ 'search': IconSearch,
118
+ 'check': IconCheck,
119
+ 'check-grey': IconCheckGrey,
120
+ 'arrow-left-blue': IconArrowLeftBlue,
121
+ 'edit': IconEdit,
122
+ 'arrow': IconArrow,
123
+ 'discount': IconDiscount,
124
+ 'cash': IconCash,
125
+ 'credit': IconCredit,
126
+ 'debit': IconDebit,
127
+ 'bank': IconBank,
128
+ 'qris': IconQRIS,
129
+ 'wallet': IconWallet,
130
+ 'delivery': IconDelivery,
131
+ 'success': IconSuccess,
132
+ 'email': IconEmail,
133
+ 'print': IconPrint,
134
+ 'warning': IconWarning,
135
+ 'alert': IconAlert,
136
+ 'barcode': IconBarcode,
137
+ 'arrow-upload': IconArrowUpload,
138
+ 'trash': IconTrash,
139
+ 'arrow-left': IconArrowLeft,
140
+ 'arrow-left-double': IconArrowLeftDouble,
141
+ 'arrow-right': IconArrowRight,
142
+ 'arrow-right-double': IconArrowRightDouble,
143
+ 'arrow-down': IconArrowDown,
144
+ 'calendar': IconCalendar,
145
+ 'question': IconQuestion,
146
+ 'sortby': IconSortby,
147
+ 'NotificationDownload': IconNotificationDownload,
148
+ 'NotificationUpload': IconNotificationUpload,
149
+ 'bar': IconBar,
150
+ 'close': IconClose,
151
+ 'person': IconPerson,
152
+ 'person-red': IconPersonRed,
153
+ 'cart': IconCart,
154
+ 'back': IconBack,
155
+ 'time': IconTime,
156
+ 'dot': IconDot,
157
+ 'dashboard-left-nav': IconDashboardLeftNav,
158
+ 'dashboard-active-left-nav': IconDashboardActiveLeftNav,
159
+ 'chat-left-nav': IconChatLeftNav,
160
+ 'chat-active-left-nav': IconChatActiveLeftNav,
161
+ 'ai-left-nav': IconAiLeftNav,
162
+ 'ai-active-left-nav': IconAiActiveLeftNav,
163
+ 'reporting-left-nav': IconReportingLeftNav,
164
+ 'reporting-active-left-nav': IconReportingActiveLeftNav,
165
+ 'activity-log-left-nav': IconActivityLogLeftNav,
166
+ 'activity-log-active-left-nav': IconActivityLogActiveLeftNav,
167
+ 'integration-left-nav': IconIntegrationLeftNav,
168
+ 'integration-active-left-nav': IconIntegrationActiveLeftNav,
169
+ 'setting-left-nav': IconSettingLeftNav,
170
+ 'setting-active-left-nav': IconSettingActiveLeftNav,
171
+ 'customer-left-nav': IconCustomerLeftNav,
172
+ 'customer-active-left-nav': IconCustomerActiveLeftNav,
173
+ 'marketing-left-nav': IconMarketingLeftNav,
174
+ 'marketing-active-left-nav': IconMarketingActiveLeftNav,
175
+ 'product-left-nav': IconProductLeftNav,
176
+ 'product-active-left-nav': IconProductActiveLeftNav,
177
+ 'inventory-left-nav': IconInventoryLeftNav,
178
+ 'inventory-active-left-nav': IconInventoryActiveLeftNav,
179
+ 'order-left-nav': IconOrderLeftNav,
180
+ 'order-active-left-nav': IconOrderActiveLeftNav,
181
+ 'price-left-nav': IconPriceLeftNav,
182
+ 'price-active-left-nav': IconPriceActiveLeftNav,
183
+ 'invoice-left-nav': IconInvoiceLeftNav,
184
+ 'invoice-active-left-nav': IconInvoiceActiveLeftNav,
185
+ 'warning-chat': IconWarningChat,
186
+ 'check-chat': IconCheckChat,
187
+ 'check-chat-blue': IconCheckChatBlue,
188
+ 'phone': IconPhone,
189
+ 'location': IconLocation,
190
+ 'agent': IconAgent,
191
+ 'report': IconReport,
192
+ 'gender': IconGender,
193
+ 'birthday': IconBirthday,
194
+ 'attach': IconAttach,
195
+ 'smile': IconSmile,
196
+ 'voucher-left-nav': IconVoucherLeftNav,
197
+ 'voucher-active-left-nav': IconVoucherActiveLeftNav,
198
+ 'analytic-left-nav': IconAnalyticLeftNav,
199
+ 'analytic-active-left-nav': IconAnalyticActiveLeftNav,
200
+ 'label-left-nav': IconLabelLeftNav,
201
+ 'label-active-left-nav': IconLabelActiveLeftNav,
202
+ 'questions': IconQuestions,
203
+ 'faq': IconFaq,
204
+ 'api': IconApi,
205
+ 'gift': IconGift,
206
+ 'document': IconDocument,
207
+ 'video': IconVideo,
208
+ 'image': IconImage,
209
+ 'emoji': IconEmoji,
210
+ 'price': IconPrice,
211
+ 'thumb': IconThumb,
212
+ 'clipboard': IconClipboard,
213
+ 'reload': IconReload
214
+ } as const
215
+ const modeStyles = {
216
+ filter: css`
217
+ position: relative;
218
+ `,
219
+ disabled: css`
220
+ &,
221
+ &:before {
222
+ opacity: .7;
223
+ }
224
+ `
814
225
  }
226
+ const getIconContainerStyled = ({ $mode, $name, $width, onClick }:{ $mode?: IconMode, $name: IconName, $width?: string | number, onClick?: (e: MouseEvent<HTMLElement>) => void }) => css`
227
+ ${$name && css`
228
+ &:before {
229
+ content: url(${iconStyles[$name]});
230
+ }
231
+ `}
232
+
233
+ ${$name === 'question' && css`
234
+ &:before {
235
+ filter: grayscale(100%);
236
+ }
237
+ `}
238
+
239
+ ${($name === 'NotificationDownload' || $name === 'NotificationUpload') && css`
240
+ ${NotificationStyled}
241
+ `}
242
+
243
+ ${$width && css`
244
+ &:before {
245
+ width: ${$width};
246
+ height: ${$width};
247
+ }
248
+ `}
249
+
250
+ ${onClick && css`
251
+ cursor: pointer;
252
+ `}
253
+
254
+ ${$mode && modeStyles[$mode]}
255
+ `
815
256
 
816
- export const IconContainer = styled.i<{ $mode?: string, $name: string, $width?: string | number }>`
257
+ export const IconContainer = styled.i<{ $mode?: IconMode, $name: IconName, $width?: string | number, onClick?: (e: MouseEvent<HTMLElement>) => void }>`
817
258
  display: inline-block;
818
259
  &:before {
819
260
  display: grid;