@momentum-design/components 0.9.5 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js +236 -27
- package/dist/browser/index.js.map +4 -4
- package/dist/components/button/button.component.d.ts +227 -0
- package/dist/components/button/button.component.js +438 -0
- package/dist/components/button/button.constants.d.ts +46 -0
- package/dist/components/button/button.constants.js +44 -0
- package/dist/components/button/button.styles.d.ts +2 -0
- package/dist/components/button/button.styles.js +195 -0
- package/dist/components/button/button.types.d.ts +9 -0
- package/dist/components/button/button.types.js +1 -0
- package/dist/components/button/button.utils.d.ts +16 -0
- package/dist/components/button/button.utils.js +27 -0
- package/dist/components/button/index.d.ts +8 -0
- package/dist/components/button/index.js +5 -0
- package/dist/custom-elements.json +439 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/button/index.d.ts +35 -0
- package/dist/react/button/index.js +44 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utils/styles/index.js +3 -1
- package/package.json +1 -1
@@ -375,6 +375,445 @@
|
|
375
375
|
}
|
376
376
|
]
|
377
377
|
},
|
378
|
+
{
|
379
|
+
"kind": "javascript-module",
|
380
|
+
"path": "components/button/button.component.js",
|
381
|
+
"declarations": [
|
382
|
+
{
|
383
|
+
"kind": "class",
|
384
|
+
"description": "`mdc-button` is a component that can be configured in various ways to suit different use cases.\n\nButton Variants:\n- **Primary**: Solid background color.\n- **Secondary**: Transparent background with a solid border.\n- **Tertiary**: No background or border, appears as plain text but retains all button functionalities.\n\nButton Colors:\n- **Positive**: Green color.\n- **Negative**: Red color.\n- **Accent**: Blue color.\n- **Promotional**: Purple color.\n- **Default**: White color.\n\nButton Sizes (in REM units):\n- **Pill button**: 40, 32, 28, 24.\n- **Icon button**: 64, 52, 40, 32, 28, 24.\n- **Tertiary icon button**: 20.\n\nButton Types:\n- **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.\n- **Pill button with icons**: A button containing an icon either on the left or right side of the button.\n- **Icon button**: A button represented by just an icon without any text.\nThe type of button is inferred based on the presence of slot and/or prefix and postfix icons.",
|
385
|
+
"name": "Button",
|
386
|
+
"slots": [
|
387
|
+
{
|
388
|
+
"description": "Text label of the button.",
|
389
|
+
"name": ""
|
390
|
+
}
|
391
|
+
],
|
392
|
+
"members": [
|
393
|
+
{
|
394
|
+
"kind": "field",
|
395
|
+
"name": "active",
|
396
|
+
"type": {
|
397
|
+
"text": "boolean"
|
398
|
+
},
|
399
|
+
"default": "false",
|
400
|
+
"description": "The button's active state indicates whether it is currently toggled on (active) or off (inactive).\nWhen the active state is true, the button is considered to be in an active state, meaning it is toggled on.\nConversely, when the active state is false, the button is in an inactive state, indicating it is toggled off.",
|
401
|
+
"attribute": "active"
|
402
|
+
},
|
403
|
+
{
|
404
|
+
"kind": "field",
|
405
|
+
"name": "disabled",
|
406
|
+
"type": {
|
407
|
+
"text": "boolean"
|
408
|
+
},
|
409
|
+
"default": "false",
|
410
|
+
"description": "Indicates whether the button is disabled.\nThe button is currently disabled for user interaction; it is not focusable or clickable.",
|
411
|
+
"attribute": "disabled"
|
412
|
+
},
|
413
|
+
{
|
414
|
+
"kind": "field",
|
415
|
+
"name": "softDisabled",
|
416
|
+
"type": {
|
417
|
+
"text": "boolean"
|
418
|
+
},
|
419
|
+
"default": "false",
|
420
|
+
"description": "Indicates whether the button is soft disabled.\nWhen set to `true`, the button appears visually disabled but still allows\nfocus, click, and keyboard actions to be passed through.\n\n**Important:** When using soft disabled, consumers must ensure that\nthe button behaves like a disabled button, allowing only focus and\npreventing any interactions (clicks or keyboard actions) from triggering unintended actions.",
|
421
|
+
"attribute": "soft-disabled"
|
422
|
+
},
|
423
|
+
{
|
424
|
+
"kind": "field",
|
425
|
+
"name": "prefixIcon",
|
426
|
+
"type": {
|
427
|
+
"text": "string | undefined"
|
428
|
+
},
|
429
|
+
"description": "The name of the icon to display as a prefix.\nThe icon is displayed on the left side of the button.",
|
430
|
+
"attribute": "prefix-icon"
|
431
|
+
},
|
432
|
+
{
|
433
|
+
"kind": "field",
|
434
|
+
"name": "postfixIcon",
|
435
|
+
"type": {
|
436
|
+
"text": "string | undefined"
|
437
|
+
},
|
438
|
+
"description": "The name of the icon to display as a postfix.\nThe icon is displayed on the right side of the button.",
|
439
|
+
"attribute": "postfix-icon"
|
440
|
+
},
|
441
|
+
{
|
442
|
+
"kind": "field",
|
443
|
+
"name": "variant",
|
444
|
+
"type": {
|
445
|
+
"text": "ButtonVariant"
|
446
|
+
},
|
447
|
+
"description": "There are 3 variants of button: primary, secondary, tertiary. They are styled differently.\n- **Primary**: Solid background color.\n- **Secondary**: Transparent background with a solid border.\n- **Tertiary**: No background or border, appears as plain text but retains all button functionalities.",
|
448
|
+
"default": "primary",
|
449
|
+
"attribute": "variant"
|
450
|
+
},
|
451
|
+
{
|
452
|
+
"kind": "field",
|
453
|
+
"name": "size",
|
454
|
+
"type": {
|
455
|
+
"text": "PillButtonSize | IconButtonSize"
|
456
|
+
},
|
457
|
+
"description": "Button sizing is based on the button type.\n- **Pill button**: 40, 32, 28, 24.\n- **Icon button**: 64, 52, 40, 32, 28, 24.\n- Tertiary icon button cam also be 20.",
|
458
|
+
"default": "32",
|
459
|
+
"attribute": "size"
|
460
|
+
},
|
461
|
+
{
|
462
|
+
"kind": "field",
|
463
|
+
"name": "color",
|
464
|
+
"type": {
|
465
|
+
"text": "ButtonColor"
|
466
|
+
},
|
467
|
+
"description": "There are 5 colors for button: positive, negative, accent, promotional, default.",
|
468
|
+
"default": "default",
|
469
|
+
"attribute": "color"
|
470
|
+
},
|
471
|
+
{
|
472
|
+
"kind": "field",
|
473
|
+
"name": "tabIndex",
|
474
|
+
"type": {
|
475
|
+
"text": "number"
|
476
|
+
},
|
477
|
+
"default": "0",
|
478
|
+
"description": "The tabindex of the button.",
|
479
|
+
"attribute": "tabIndex",
|
480
|
+
"reflects": true
|
481
|
+
},
|
482
|
+
{
|
483
|
+
"kind": "field",
|
484
|
+
"name": "role",
|
485
|
+
"type": {
|
486
|
+
"text": "string"
|
487
|
+
},
|
488
|
+
"default": "'button'",
|
489
|
+
"description": "This property defines the ARIA role for the element. By default, it is set to 'button'.\nConsumers should override this role when:\n- The element is being used in a context where a different role is more appropriate.\n- Custom behaviors are implemented that require a specific ARIA role for accessibility purposes.",
|
490
|
+
"attribute": "role",
|
491
|
+
"reflects": true
|
492
|
+
},
|
493
|
+
{
|
494
|
+
"kind": "field",
|
495
|
+
"name": "type",
|
496
|
+
"type": {
|
497
|
+
"text": "ButtonType"
|
498
|
+
},
|
499
|
+
"description": "This property defines the type attribute for the button element.\nThe type attribute specifies the behavior of the button when it is clicked.\n- **submit**: The button submits the form data to the server.\n- **reset**: The button resets the form data to its initial state.\n- **button**: The button does nothing when clicked.",
|
500
|
+
"default": "button",
|
501
|
+
"attribute": "type",
|
502
|
+
"reflects": true
|
503
|
+
},
|
504
|
+
{
|
505
|
+
"kind": "method",
|
506
|
+
"name": "executeAction",
|
507
|
+
"privacy": "private"
|
508
|
+
},
|
509
|
+
{
|
510
|
+
"kind": "method",
|
511
|
+
"name": "modifyIconName",
|
512
|
+
"privacy": "private",
|
513
|
+
"parameters": [
|
514
|
+
{
|
515
|
+
"name": "active",
|
516
|
+
"type": {
|
517
|
+
"text": "boolean"
|
518
|
+
},
|
519
|
+
"description": "The active state."
|
520
|
+
}
|
521
|
+
],
|
522
|
+
"description": "Modifies the icon name based on the active state.\nIf the button is active, the icon name is suffixed with '-filled'.\nIf the button is inactive, the icon name is restored to its original value.\nIf '-filled' icon is not available, the icon name remains unchanged."
|
523
|
+
},
|
524
|
+
{
|
525
|
+
"kind": "method",
|
526
|
+
"name": "setClassBasedOnType",
|
527
|
+
"privacy": "private",
|
528
|
+
"parameters": [
|
529
|
+
{
|
530
|
+
"name": "type",
|
531
|
+
"type": {
|
532
|
+
"text": "string"
|
533
|
+
},
|
534
|
+
"description": "The type of the button."
|
535
|
+
}
|
536
|
+
],
|
537
|
+
"description": "Sets the class of 'icon' for icon buttons."
|
538
|
+
},
|
539
|
+
{
|
540
|
+
"kind": "method",
|
541
|
+
"name": "setVariant",
|
542
|
+
"privacy": "private",
|
543
|
+
"parameters": [
|
544
|
+
{
|
545
|
+
"name": "variant",
|
546
|
+
"type": {
|
547
|
+
"text": "ButtonVariant"
|
548
|
+
},
|
549
|
+
"description": "The variant to set."
|
550
|
+
}
|
551
|
+
],
|
552
|
+
"description": "Sets the variant attribute for the button component.\nIf the provided variant is not included in the BUTTON_VARIANTS,\nit defaults to the value specified in DEFAULTS.VARIANT."
|
553
|
+
},
|
554
|
+
{
|
555
|
+
"kind": "method",
|
556
|
+
"name": "setSize",
|
557
|
+
"privacy": "private",
|
558
|
+
"parameters": [
|
559
|
+
{
|
560
|
+
"name": "size",
|
561
|
+
"type": {
|
562
|
+
"text": "PillButtonSize | IconButtonSize"
|
563
|
+
},
|
564
|
+
"description": "The size to set."
|
565
|
+
}
|
566
|
+
],
|
567
|
+
"description": "Sets the size attribute for the button component.\nValidates the size based on the button type (icon, pill, or tertiary).\nDefaults to DEFAULTS.SIZE if invalid."
|
568
|
+
},
|
569
|
+
{
|
570
|
+
"kind": "method",
|
571
|
+
"name": "setColor",
|
572
|
+
"privacy": "private",
|
573
|
+
"parameters": [
|
574
|
+
{
|
575
|
+
"name": "color",
|
576
|
+
"type": {
|
577
|
+
"text": "ButtonColor"
|
578
|
+
},
|
579
|
+
"description": "The color to set."
|
580
|
+
}
|
581
|
+
],
|
582
|
+
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or for tertiary buttons."
|
583
|
+
},
|
584
|
+
{
|
585
|
+
"kind": "method",
|
586
|
+
"name": "setAriaPressed",
|
587
|
+
"privacy": "private",
|
588
|
+
"parameters": [
|
589
|
+
{
|
590
|
+
"name": "element",
|
591
|
+
"type": {
|
592
|
+
"text": "HTMLElement"
|
593
|
+
},
|
594
|
+
"description": "The target element."
|
595
|
+
},
|
596
|
+
{
|
597
|
+
"name": "active",
|
598
|
+
"type": {
|
599
|
+
"text": "boolean"
|
600
|
+
},
|
601
|
+
"description": "The active state."
|
602
|
+
}
|
603
|
+
],
|
604
|
+
"description": "Sets or removes the aria-pressed attribute based on the active state."
|
605
|
+
},
|
606
|
+
{
|
607
|
+
"kind": "method",
|
608
|
+
"name": "setSoftDisabled",
|
609
|
+
"privacy": "private",
|
610
|
+
"parameters": [
|
611
|
+
{
|
612
|
+
"name": "element",
|
613
|
+
"type": {
|
614
|
+
"text": "HTMLElement"
|
615
|
+
},
|
616
|
+
"description": "The button element."
|
617
|
+
},
|
618
|
+
{
|
619
|
+
"name": "softDisabled",
|
620
|
+
"type": {
|
621
|
+
"text": "boolean"
|
622
|
+
},
|
623
|
+
"description": "The soft-disabled state."
|
624
|
+
}
|
625
|
+
],
|
626
|
+
"description": "Sets the soft-disabled attribute for the button.\nWhen soft-disabled, the button looks to be disabled but remains focusable and clickable.\nAlso sets/removes aria-disabled attribute."
|
627
|
+
},
|
628
|
+
{
|
629
|
+
"kind": "method",
|
630
|
+
"name": "setDisabled",
|
631
|
+
"privacy": "private",
|
632
|
+
"parameters": [
|
633
|
+
{
|
634
|
+
"name": "element",
|
635
|
+
"type": {
|
636
|
+
"text": "HTMLElement"
|
637
|
+
},
|
638
|
+
"description": "The button element."
|
639
|
+
},
|
640
|
+
{
|
641
|
+
"name": "disabled",
|
642
|
+
"type": {
|
643
|
+
"text": "boolean"
|
644
|
+
},
|
645
|
+
"description": "The disabled state."
|
646
|
+
}
|
647
|
+
],
|
648
|
+
"description": "Sets the disabled attribute for the button.\nWhen disabled, the button is not focusable or clickable, and tabindex is set to -1.\nThe previous tabindex is stored and restored when enabled.\nAlso sets/removes aria-disabled attribute."
|
649
|
+
},
|
650
|
+
{
|
651
|
+
"kind": "method",
|
652
|
+
"name": "triggerClickEvent",
|
653
|
+
"privacy": "private"
|
654
|
+
},
|
655
|
+
{
|
656
|
+
"kind": "method",
|
657
|
+
"name": "handleKeyDown",
|
658
|
+
"privacy": "private",
|
659
|
+
"parameters": [
|
660
|
+
{
|
661
|
+
"name": "event",
|
662
|
+
"type": {
|
663
|
+
"text": "KeyboardEvent"
|
664
|
+
},
|
665
|
+
"description": "The keyboard event."
|
666
|
+
}
|
667
|
+
],
|
668
|
+
"description": "Handles the keydown event on the button.\nIf the key is 'Enter' or 'Space', the button is pressed.\nIf the key is 'Enter', the button is pressed. The native HTML button works in the same way."
|
669
|
+
},
|
670
|
+
{
|
671
|
+
"kind": "method",
|
672
|
+
"name": "handleKeyUp",
|
673
|
+
"privacy": "private",
|
674
|
+
"parameters": [
|
675
|
+
{
|
676
|
+
"name": "event",
|
677
|
+
"type": {
|
678
|
+
"text": "KeyboardEvent"
|
679
|
+
},
|
680
|
+
"description": "The keyboard event."
|
681
|
+
}
|
682
|
+
],
|
683
|
+
"description": "Handles the keyup event on the button.\nIf the key is 'Enter' or 'Space', the button is clicked.\nIf the key is 'Space', the button is pressed. The native HTML button works in the same way."
|
684
|
+
},
|
685
|
+
{
|
686
|
+
"kind": "method",
|
687
|
+
"name": "inferButtonType",
|
688
|
+
"privacy": "private",
|
689
|
+
"description": "Infers the type of button based on the presence of slot and/or prefix and postfix icons.",
|
690
|
+
"parameters": [
|
691
|
+
{
|
692
|
+
"description": "default slot of button",
|
693
|
+
"name": "slot"
|
694
|
+
}
|
695
|
+
]
|
696
|
+
}
|
697
|
+
],
|
698
|
+
"attributes": [
|
699
|
+
{
|
700
|
+
"name": "active",
|
701
|
+
"type": {
|
702
|
+
"text": "boolean"
|
703
|
+
},
|
704
|
+
"default": "false",
|
705
|
+
"description": "The button's active state indicates whether it is currently toggled on (active) or off (inactive).\nWhen the active state is true, the button is considered to be in an active state, meaning it is toggled on.\nConversely, when the active state is false, the button is in an inactive state, indicating it is toggled off.",
|
706
|
+
"fieldName": "active"
|
707
|
+
},
|
708
|
+
{
|
709
|
+
"name": "disabled",
|
710
|
+
"type": {
|
711
|
+
"text": "boolean"
|
712
|
+
},
|
713
|
+
"default": "false",
|
714
|
+
"description": "Indicates whether the button is disabled.\nThe button is currently disabled for user interaction; it is not focusable or clickable.",
|
715
|
+
"fieldName": "disabled"
|
716
|
+
},
|
717
|
+
{
|
718
|
+
"name": "soft-disabled",
|
719
|
+
"type": {
|
720
|
+
"text": "boolean"
|
721
|
+
},
|
722
|
+
"default": "false",
|
723
|
+
"description": "Indicates whether the button is soft disabled.\nWhen set to `true`, the button appears visually disabled but still allows\nfocus, click, and keyboard actions to be passed through.\n\n**Important:** When using soft disabled, consumers must ensure that\nthe button behaves like a disabled button, allowing only focus and\npreventing any interactions (clicks or keyboard actions) from triggering unintended actions.",
|
724
|
+
"fieldName": "softDisabled"
|
725
|
+
},
|
726
|
+
{
|
727
|
+
"name": "prefix-icon",
|
728
|
+
"type": {
|
729
|
+
"text": "string | undefined"
|
730
|
+
},
|
731
|
+
"description": "The name of the icon to display as a prefix.\nThe icon is displayed on the left side of the button.",
|
732
|
+
"fieldName": "prefixIcon"
|
733
|
+
},
|
734
|
+
{
|
735
|
+
"name": "postfix-icon",
|
736
|
+
"type": {
|
737
|
+
"text": "string | undefined"
|
738
|
+
},
|
739
|
+
"description": "The name of the icon to display as a postfix.\nThe icon is displayed on the right side of the button.",
|
740
|
+
"fieldName": "postfixIcon"
|
741
|
+
},
|
742
|
+
{
|
743
|
+
"name": "variant",
|
744
|
+
"type": {
|
745
|
+
"text": "ButtonVariant"
|
746
|
+
},
|
747
|
+
"description": "There are 3 variants of button: primary, secondary, tertiary. They are styled differently.\n- **Primary**: Solid background color.\n- **Secondary**: Transparent background with a solid border.\n- **Tertiary**: No background or border, appears as plain text but retains all button functionalities.",
|
748
|
+
"default": "primary",
|
749
|
+
"fieldName": "variant"
|
750
|
+
},
|
751
|
+
{
|
752
|
+
"name": "size",
|
753
|
+
"type": {
|
754
|
+
"text": "PillButtonSize | IconButtonSize"
|
755
|
+
},
|
756
|
+
"description": "Button sizing is based on the button type.\n- **Pill button**: 40, 32, 28, 24.\n- **Icon button**: 64, 52, 40, 32, 28, 24.\n- Tertiary icon button cam also be 20.",
|
757
|
+
"default": "32",
|
758
|
+
"fieldName": "size"
|
759
|
+
},
|
760
|
+
{
|
761
|
+
"name": "color",
|
762
|
+
"type": {
|
763
|
+
"text": "ButtonColor"
|
764
|
+
},
|
765
|
+
"description": "There are 5 colors for button: positive, negative, accent, promotional, default.",
|
766
|
+
"default": "default",
|
767
|
+
"fieldName": "color"
|
768
|
+
},
|
769
|
+
{
|
770
|
+
"name": "tabIndex",
|
771
|
+
"type": {
|
772
|
+
"text": "number"
|
773
|
+
},
|
774
|
+
"default": "0",
|
775
|
+
"description": "The tabindex of the button.",
|
776
|
+
"fieldName": "tabIndex"
|
777
|
+
},
|
778
|
+
{
|
779
|
+
"name": "role",
|
780
|
+
"type": {
|
781
|
+
"text": "string"
|
782
|
+
},
|
783
|
+
"default": "'button'",
|
784
|
+
"description": "This property defines the ARIA role for the element. By default, it is set to 'button'.\nConsumers should override this role when:\n- The element is being used in a context where a different role is more appropriate.\n- Custom behaviors are implemented that require a specific ARIA role for accessibility purposes.",
|
785
|
+
"fieldName": "role"
|
786
|
+
},
|
787
|
+
{
|
788
|
+
"name": "type",
|
789
|
+
"type": {
|
790
|
+
"text": "ButtonType"
|
791
|
+
},
|
792
|
+
"description": "This property defines the type attribute for the button element.\nThe type attribute specifies the behavior of the button when it is clicked.\n- **submit**: The button submits the form data to the server.\n- **reset**: The button resets the form data to its initial state.\n- **button**: The button does nothing when clicked.",
|
793
|
+
"default": "button",
|
794
|
+
"fieldName": "type"
|
795
|
+
}
|
796
|
+
],
|
797
|
+
"superclass": {
|
798
|
+
"name": "Component",
|
799
|
+
"module": "/src/models"
|
800
|
+
},
|
801
|
+
"tagName": "mdc-button",
|
802
|
+
"jsDoc": "/**\n * `mdc-button` is a component that can be configured in various ways to suit different use cases.\n *\n * Button Variants:\n * - **Primary**: Solid background color.\n * - **Secondary**: Transparent background with a solid border.\n * - **Tertiary**: No background or border, appears as plain text but retains all button functionalities.\n *\n * Button Colors:\n * - **Positive**: Green color.\n * - **Negative**: Red color.\n * - **Accent**: Blue color.\n * - **Promotional**: Purple color.\n * - **Default**: White color.\n *\n * Button Sizes (in REM units):\n * - **Pill button**: 40, 32, 28, 24.\n * - **Icon button**: 64, 52, 40, 32, 28, 24.\n * - **Tertiary icon button**: 20.\n *\n * Button Types:\n * - **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.\n * - **Pill button with icons**: A button containing an icon either on the left or right side of the button.\n * - **Icon button**: A button represented by just an icon without any text.\n * The type of button is inferred based on the presence of slot and/or prefix and postfix icons.\n *\n * @dependency mdc-icon\n *\n * @tagname mdc-button\n *\n * @slot - Text label of the button.\n */",
|
803
|
+
"customElement": true
|
804
|
+
}
|
805
|
+
],
|
806
|
+
"exports": [
|
807
|
+
{
|
808
|
+
"kind": "js",
|
809
|
+
"name": "default",
|
810
|
+
"declaration": {
|
811
|
+
"name": "Button",
|
812
|
+
"module": "components/button/button.component.js"
|
813
|
+
}
|
814
|
+
}
|
815
|
+
]
|
816
|
+
},
|
378
817
|
{
|
379
818
|
"kind": "javascript-module",
|
380
819
|
"path": "components/icon/icon.component.js",
|
package/dist/index.d.ts
CHANGED
@@ -5,6 +5,7 @@ import Avatar from './components/avatar';
|
|
5
5
|
import Badge from './components/badge';
|
6
6
|
import Presence from './components/presence';
|
7
7
|
import Text from './components/text';
|
8
|
+
import Button from './components/button';
|
8
9
|
import type { TextType } from './components/text/text.types';
|
9
|
-
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, };
|
10
|
+
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, };
|
10
11
|
export type { TextType, };
|
package/dist/index.js
CHANGED
@@ -5,4 +5,5 @@ import Avatar from './components/avatar';
|
|
5
5
|
import Badge from './components/badge';
|
6
6
|
import Presence from './components/presence';
|
7
7
|
import Text from './components/text';
|
8
|
-
|
8
|
+
import Button from './components/button';
|
9
|
+
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, };
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import Component from '../../components/button';
|
2
|
+
/**
|
3
|
+
* `mdc-button` is a component that can be configured in various ways to suit different use cases.
|
4
|
+
*
|
5
|
+
* Button Variants:
|
6
|
+
* - **Primary**: Solid background color.
|
7
|
+
* - **Secondary**: Transparent background with a solid border.
|
8
|
+
* - **Tertiary**: No background or border, appears as plain text but retains all button functionalities.
|
9
|
+
*
|
10
|
+
* Button Colors:
|
11
|
+
* - **Positive**: Green color.
|
12
|
+
* - **Negative**: Red color.
|
13
|
+
* - **Accent**: Blue color.
|
14
|
+
* - **Promotional**: Purple color.
|
15
|
+
* - **Default**: White color.
|
16
|
+
*
|
17
|
+
* Button Sizes (in REM units):
|
18
|
+
* - **Pill button**: 40, 32, 28, 24.
|
19
|
+
* - **Icon button**: 64, 52, 40, 32, 28, 24.
|
20
|
+
* - **Tertiary icon button**: 20.
|
21
|
+
*
|
22
|
+
* Button Types:
|
23
|
+
* - **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.
|
24
|
+
* - **Pill button with icons**: A button containing an icon either on the left or right side of the button.
|
25
|
+
* - **Icon button**: A button represented by just an icon without any text.
|
26
|
+
* The type of button is inferred based on the presence of slot and/or prefix and postfix icons.
|
27
|
+
*
|
28
|
+
* @dependency mdc-icon
|
29
|
+
*
|
30
|
+
* @tagname mdc-button
|
31
|
+
*
|
32
|
+
* @slot - Text label of the button.
|
33
|
+
*/
|
34
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
35
|
+
export default reactWrapper;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/button';
|
4
|
+
import { TAG_NAME } from '../../components/button/button.constants';
|
5
|
+
/**
|
6
|
+
* `mdc-button` is a component that can be configured in various ways to suit different use cases.
|
7
|
+
*
|
8
|
+
* Button Variants:
|
9
|
+
* - **Primary**: Solid background color.
|
10
|
+
* - **Secondary**: Transparent background with a solid border.
|
11
|
+
* - **Tertiary**: No background or border, appears as plain text but retains all button functionalities.
|
12
|
+
*
|
13
|
+
* Button Colors:
|
14
|
+
* - **Positive**: Green color.
|
15
|
+
* - **Negative**: Red color.
|
16
|
+
* - **Accent**: Blue color.
|
17
|
+
* - **Promotional**: Purple color.
|
18
|
+
* - **Default**: White color.
|
19
|
+
*
|
20
|
+
* Button Sizes (in REM units):
|
21
|
+
* - **Pill button**: 40, 32, 28, 24.
|
22
|
+
* - **Icon button**: 64, 52, 40, 32, 28, 24.
|
23
|
+
* - **Tertiary icon button**: 20.
|
24
|
+
*
|
25
|
+
* Button Types:
|
26
|
+
* - **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.
|
27
|
+
* - **Pill button with icons**: A button containing an icon either on the left or right side of the button.
|
28
|
+
* - **Icon button**: A button represented by just an icon without any text.
|
29
|
+
* The type of button is inferred based on the presence of slot and/or prefix and postfix icons.
|
30
|
+
*
|
31
|
+
* @dependency mdc-icon
|
32
|
+
*
|
33
|
+
* @tagname mdc-button
|
34
|
+
*
|
35
|
+
* @slot - Text label of the button.
|
36
|
+
*/
|
37
|
+
const reactWrapper = createComponent({
|
38
|
+
tagName: TAG_NAME,
|
39
|
+
elementClass: Component,
|
40
|
+
react: React,
|
41
|
+
events: {},
|
42
|
+
displayName: 'Button',
|
43
|
+
});
|
44
|
+
export default reactWrapper;
|
package/dist/react/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export { default as Avatar } from './avatar';
|
2
2
|
export { default as Badge } from './badge';
|
3
|
+
export { default as Button } from './button';
|
3
4
|
export { default as Icon } from './icon';
|
4
5
|
export { default as IconProvider } from './iconprovider';
|
5
6
|
export { default as Presence } from './presence';
|
package/dist/react/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export { default as Avatar } from './avatar';
|
2
2
|
export { default as Badge } from './badge';
|
3
|
+
export { default as Button } from './button';
|
3
4
|
export { default as Icon } from './icon';
|
4
5
|
export { default as IconProvider } from './iconprovider';
|
5
6
|
export { default as Presence } from './presence';
|
@@ -21,7 +21,9 @@ const hostFocusRingStyles = css `
|
|
21
21
|
--mdc-focus-ring-middle-offset: var(--mdc-focus-ring-inner-width);
|
22
22
|
--mdc-focus-ring-outer-offset: calc(var(--mdc-focus-ring-inner-width) + var(--mdc-focus-ring-middle-width));
|
23
23
|
}
|
24
|
-
|
24
|
+
:host([disabled]:focus) {
|
25
|
+
box-shadow: none;
|
26
|
+
}
|
25
27
|
:host(:focus) {
|
26
28
|
position: relative;
|
27
29
|
box-shadow:
|
package/package.json
CHANGED