@dust-tt/sparkle 0.2.447 → 0.2.449-pr
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/cjs/index.js +1 -1
- package/dist/esm/components/AttachmentChip.d.ts +1 -1
- package/dist/esm/components/AttachmentChip.d.ts.map +1 -1
- package/dist/esm/components/AttachmentChip.js +1 -1
- package/dist/esm/components/AttachmentChip.js.map +1 -1
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +12 -6
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Notification.d.ts +2 -2
- package/dist/esm/components/Notification.d.ts.map +1 -1
- package/dist/esm/components/Notification.js +25 -3
- package/dist/esm/components/Notification.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/{components → stories}/AttachmentChip.stories.d.ts +1 -1
- package/dist/esm/stories/AttachmentChip.stories.d.ts.map +1 -0
- package/dist/esm/{components → stories}/AttachmentChip.stories.js +1 -1
- package/dist/esm/stories/AttachmentChip.stories.js.map +1 -0
- package/dist/esm/stories/Notification.stories.js +8 -1
- package/dist/esm/stories/Notification.stories.js.map +1 -1
- package/dist/sparkle.css +76 -49
- package/package.json +1 -1
- package/src/components/AttachmentChip.tsx +2 -2
- package/src/components/Button.tsx +15 -6
- package/src/components/Notification.tsx +38 -19
- package/src/components/index.ts +1 -0
- package/src/{components → stories}/AttachmentChip.stories.tsx +1 -2
- package/src/stories/Notification.stories.tsx +10 -0
- package/dist/esm/components/AttachmentChip.stories.d.ts.map +0 -1
- package/dist/esm/components/AttachmentChip.stories.js.map +0 -1
package/dist/sparkle.css
CHANGED
|
@@ -588,6 +588,27 @@ select {
|
|
|
588
588
|
outline: 1px auto -webkit-focus-ring-color;
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
+
.s-label-xs {
|
|
592
|
+
font-size: 12px;
|
|
593
|
+
line-height: 16px;
|
|
594
|
+
letter-spacing: normal;
|
|
595
|
+
font-weight: 700;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.s-label-sm {
|
|
599
|
+
font-size: 14px;
|
|
600
|
+
line-height: 20px;
|
|
601
|
+
letter-spacing: -0.28px;
|
|
602
|
+
font-weight: 700;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.s-label-base {
|
|
606
|
+
font-size: 16px;
|
|
607
|
+
line-height: 24px;
|
|
608
|
+
letter-spacing: -0.32px;
|
|
609
|
+
font-weight: 700;
|
|
610
|
+
}
|
|
611
|
+
|
|
591
612
|
.s-heading-base {
|
|
592
613
|
font-size: 16px;
|
|
593
614
|
line-height: 24px;
|
|
@@ -1675,10 +1696,6 @@ select {
|
|
|
1675
1696
|
max-width: 56rem;
|
|
1676
1697
|
}
|
|
1677
1698
|
|
|
1678
|
-
.s-max-w-\[180px\] {
|
|
1679
|
-
max-width: 180px;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
1699
|
.s-max-w-\[380px\] {
|
|
1683
1700
|
max-width: 380px;
|
|
1684
1701
|
}
|
|
@@ -2740,22 +2757,22 @@ select {
|
|
|
2740
2757
|
|
|
2741
2758
|
.s-bg-amber-600 {
|
|
2742
2759
|
--tw-bg-opacity: 1;
|
|
2743
|
-
background-color: rgb(
|
|
2760
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
2744
2761
|
}
|
|
2745
2762
|
|
|
2746
2763
|
.s-bg-amber-700 {
|
|
2747
2764
|
--tw-bg-opacity: 1;
|
|
2748
|
-
background-color: rgb(
|
|
2765
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
2749
2766
|
}
|
|
2750
2767
|
|
|
2751
2768
|
.s-bg-amber-800 {
|
|
2752
2769
|
--tw-bg-opacity: 1;
|
|
2753
|
-
background-color: rgb(
|
|
2770
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
2754
2771
|
}
|
|
2755
2772
|
|
|
2756
2773
|
.s-bg-amber-900 {
|
|
2757
2774
|
--tw-bg-opacity: 1;
|
|
2758
|
-
background-color: rgb(
|
|
2775
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
2759
2776
|
}
|
|
2760
2777
|
|
|
2761
2778
|
.s-bg-amber-950 {
|
|
@@ -3034,22 +3051,22 @@ select {
|
|
|
3034
3051
|
|
|
3035
3052
|
.s-bg-golden-600 {
|
|
3036
3053
|
--tw-bg-opacity: 1;
|
|
3037
|
-
background-color: rgb(
|
|
3054
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
3038
3055
|
}
|
|
3039
3056
|
|
|
3040
3057
|
.s-bg-golden-700 {
|
|
3041
3058
|
--tw-bg-opacity: 1;
|
|
3042
|
-
background-color: rgb(
|
|
3059
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
3043
3060
|
}
|
|
3044
3061
|
|
|
3045
3062
|
.s-bg-golden-800 {
|
|
3046
3063
|
--tw-bg-opacity: 1;
|
|
3047
|
-
background-color: rgb(
|
|
3064
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
3048
3065
|
}
|
|
3049
3066
|
|
|
3050
3067
|
.s-bg-golden-900 {
|
|
3051
3068
|
--tw-bg-opacity: 1;
|
|
3052
|
-
background-color: rgb(
|
|
3069
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
3053
3070
|
}
|
|
3054
3071
|
|
|
3055
3072
|
.s-bg-golden-950 {
|
|
@@ -3314,22 +3331,22 @@ select {
|
|
|
3314
3331
|
|
|
3315
3332
|
.s-bg-info-600 {
|
|
3316
3333
|
--tw-bg-opacity: 1;
|
|
3317
|
-
background-color: rgb(
|
|
3334
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
3318
3335
|
}
|
|
3319
3336
|
|
|
3320
3337
|
.s-bg-info-700 {
|
|
3321
3338
|
--tw-bg-opacity: 1;
|
|
3322
|
-
background-color: rgb(
|
|
3339
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
3323
3340
|
}
|
|
3324
3341
|
|
|
3325
3342
|
.s-bg-info-800 {
|
|
3326
3343
|
--tw-bg-opacity: 1;
|
|
3327
|
-
background-color: rgb(
|
|
3344
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
3328
3345
|
}
|
|
3329
3346
|
|
|
3330
3347
|
.s-bg-info-900 {
|
|
3331
3348
|
--tw-bg-opacity: 1;
|
|
3332
|
-
background-color: rgb(
|
|
3349
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
3333
3350
|
}
|
|
3334
3351
|
|
|
3335
3352
|
.s-bg-info-950 {
|
|
@@ -4137,8 +4154,8 @@ select {
|
|
|
4137
4154
|
}
|
|
4138
4155
|
|
|
4139
4156
|
.s-from-amber-800 {
|
|
4140
|
-
--tw-gradient-from: #
|
|
4141
|
-
--tw-gradient-to: rgb(
|
|
4157
|
+
--tw-gradient-from: #AF5511 var(--tw-gradient-from-position);
|
|
4158
|
+
--tw-gradient-to: rgb(175 85 17 / 0) var(--tw-gradient-to-position);
|
|
4142
4159
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
4143
4160
|
}
|
|
4144
4161
|
|
|
@@ -4263,7 +4280,7 @@ select {
|
|
|
4263
4280
|
}
|
|
4264
4281
|
|
|
4265
4282
|
.s-to-amber-800 {
|
|
4266
|
-
--tw-gradient-to: #
|
|
4283
|
+
--tw-gradient-to: #AF5511 var(--tw-gradient-to-position);
|
|
4267
4284
|
}
|
|
4268
4285
|
|
|
4269
4286
|
.s-to-blue-500 {
|
|
@@ -4742,17 +4759,17 @@ select {
|
|
|
4742
4759
|
|
|
4743
4760
|
.s-text-amber-700 {
|
|
4744
4761
|
--tw-text-opacity: 1;
|
|
4745
|
-
color: rgb(
|
|
4762
|
+
color: rgb(226 119 22 / var(--tw-text-opacity));
|
|
4746
4763
|
}
|
|
4747
4764
|
|
|
4748
4765
|
.s-text-amber-800 {
|
|
4749
4766
|
--tw-text-opacity: 1;
|
|
4750
|
-
color: rgb(
|
|
4767
|
+
color: rgb(175 85 17 / var(--tw-text-opacity));
|
|
4751
4768
|
}
|
|
4752
4769
|
|
|
4753
4770
|
.s-text-amber-900 {
|
|
4754
4771
|
--tw-text-opacity: 1;
|
|
4755
|
-
color: rgb(
|
|
4772
|
+
color: rgb(112 53 12 / var(--tw-text-opacity));
|
|
4756
4773
|
}
|
|
4757
4774
|
|
|
4758
4775
|
.s-text-amber-950 {
|
|
@@ -4806,7 +4823,7 @@ select {
|
|
|
4806
4823
|
|
|
4807
4824
|
.s-text-brand-orange-golden {
|
|
4808
4825
|
--tw-text-opacity: 1;
|
|
4809
|
-
color: rgb(
|
|
4826
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
4810
4827
|
}
|
|
4811
4828
|
|
|
4812
4829
|
.s-text-brand-red-rose {
|
|
@@ -4905,17 +4922,17 @@ select {
|
|
|
4905
4922
|
|
|
4906
4923
|
.s-text-golden-600 {
|
|
4907
4924
|
--tw-text-opacity: 1;
|
|
4908
|
-
color: rgb(
|
|
4925
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
4909
4926
|
}
|
|
4910
4927
|
|
|
4911
4928
|
.s-text-golden-800 {
|
|
4912
4929
|
--tw-text-opacity: 1;
|
|
4913
|
-
color: rgb(
|
|
4930
|
+
color: rgb(175 85 17 / var(--tw-text-opacity));
|
|
4914
4931
|
}
|
|
4915
4932
|
|
|
4916
4933
|
.s-text-golden-900 {
|
|
4917
4934
|
--tw-text-opacity: 1;
|
|
4918
|
-
color: rgb(
|
|
4935
|
+
color: rgb(112 53 12 / var(--tw-text-opacity));
|
|
4919
4936
|
}
|
|
4920
4937
|
|
|
4921
4938
|
.s-text-golden-950 {
|
|
@@ -5038,14 +5055,19 @@ select {
|
|
|
5038
5055
|
color: rgb(255 170 13 / var(--tw-text-opacity));
|
|
5039
5056
|
}
|
|
5040
5057
|
|
|
5058
|
+
.s-text-info-600 {
|
|
5059
|
+
--tw-text-opacity: 1;
|
|
5060
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
5061
|
+
}
|
|
5062
|
+
|
|
5041
5063
|
.s-text-info-800 {
|
|
5042
5064
|
--tw-text-opacity: 1;
|
|
5043
|
-
color: rgb(
|
|
5065
|
+
color: rgb(175 85 17 / var(--tw-text-opacity));
|
|
5044
5066
|
}
|
|
5045
5067
|
|
|
5046
5068
|
.s-text-info-900 {
|
|
5047
5069
|
--tw-text-opacity: 1;
|
|
5048
|
-
color: rgb(
|
|
5070
|
+
color: rgb(112 53 12 / var(--tw-text-opacity));
|
|
5049
5071
|
}
|
|
5050
5072
|
|
|
5051
5073
|
.s-text-info-950 {
|
|
@@ -6688,17 +6710,17 @@ select {
|
|
|
6688
6710
|
|
|
6689
6711
|
:is(.s-dark .dark\:s-border-amber-100-night) {
|
|
6690
6712
|
--tw-border-opacity: 1;
|
|
6691
|
-
border-color: rgb(
|
|
6713
|
+
border-color: rgb(112 53 12 / var(--tw-border-opacity));
|
|
6692
6714
|
}
|
|
6693
6715
|
|
|
6694
6716
|
:is(.s-dark .dark\:s-border-amber-200-night) {
|
|
6695
6717
|
--tw-border-opacity: 1;
|
|
6696
|
-
border-color: rgb(
|
|
6718
|
+
border-color: rgb(175 85 17 / var(--tw-border-opacity));
|
|
6697
6719
|
}
|
|
6698
6720
|
|
|
6699
6721
|
:is(.s-dark .dark\:s-border-amber-300-night) {
|
|
6700
6722
|
--tw-border-opacity: 1;
|
|
6701
|
-
border-color: rgb(
|
|
6723
|
+
border-color: rgb(226 119 22 / var(--tw-border-opacity));
|
|
6702
6724
|
}
|
|
6703
6725
|
|
|
6704
6726
|
:is(.s-dark .dark\:s-border-blue-100-night) {
|
|
@@ -6779,17 +6801,17 @@ select {
|
|
|
6779
6801
|
|
|
6780
6802
|
:is(.s-dark .dark\:s-border-golden-100-night) {
|
|
6781
6803
|
--tw-border-opacity: 1;
|
|
6782
|
-
border-color: rgb(
|
|
6804
|
+
border-color: rgb(112 53 12 / var(--tw-border-opacity));
|
|
6783
6805
|
}
|
|
6784
6806
|
|
|
6785
6807
|
:is(.s-dark .dark\:s-border-golden-200-night) {
|
|
6786
6808
|
--tw-border-opacity: 1;
|
|
6787
|
-
border-color: rgb(
|
|
6809
|
+
border-color: rgb(175 85 17 / var(--tw-border-opacity));
|
|
6788
6810
|
}
|
|
6789
6811
|
|
|
6790
6812
|
:is(.s-dark .dark\:s-border-golden-300-night) {
|
|
6791
6813
|
--tw-border-opacity: 1;
|
|
6792
|
-
border-color: rgb(
|
|
6814
|
+
border-color: rgb(226 119 22 / var(--tw-border-opacity));
|
|
6793
6815
|
}
|
|
6794
6816
|
|
|
6795
6817
|
:is(.s-dark .dark\:s-border-gray-100-night) {
|
|
@@ -6854,17 +6876,17 @@ select {
|
|
|
6854
6876
|
|
|
6855
6877
|
:is(.s-dark .dark\:s-border-info-100-night) {
|
|
6856
6878
|
--tw-border-opacity: 1;
|
|
6857
|
-
border-color: rgb(
|
|
6879
|
+
border-color: rgb(112 53 12 / var(--tw-border-opacity));
|
|
6858
6880
|
}
|
|
6859
6881
|
|
|
6860
6882
|
:is(.s-dark .dark\:s-border-info-200-night) {
|
|
6861
6883
|
--tw-border-opacity: 1;
|
|
6862
|
-
border-color: rgb(
|
|
6884
|
+
border-color: rgb(175 85 17 / var(--tw-border-opacity));
|
|
6863
6885
|
}
|
|
6864
6886
|
|
|
6865
6887
|
:is(.s-dark .dark\:s-border-info-300-night) {
|
|
6866
6888
|
--tw-border-opacity: 1;
|
|
6867
|
-
border-color: rgb(
|
|
6889
|
+
border-color: rgb(226 119 22 / var(--tw-border-opacity));
|
|
6868
6890
|
}
|
|
6869
6891
|
|
|
6870
6892
|
:is(.s-dark .dark\:s-border-lime-100-night) {
|
|
@@ -7084,22 +7106,22 @@ select {
|
|
|
7084
7106
|
|
|
7085
7107
|
:is(.s-dark .dark\:s-bg-amber-100-night) {
|
|
7086
7108
|
--tw-bg-opacity: 1;
|
|
7087
|
-
background-color: rgb(
|
|
7109
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
7088
7110
|
}
|
|
7089
7111
|
|
|
7090
7112
|
:is(.s-dark .dark\:s-bg-amber-200-night) {
|
|
7091
7113
|
--tw-bg-opacity: 1;
|
|
7092
|
-
background-color: rgb(
|
|
7114
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
7093
7115
|
}
|
|
7094
7116
|
|
|
7095
7117
|
:is(.s-dark .dark\:s-bg-amber-300-night) {
|
|
7096
7118
|
--tw-bg-opacity: 1;
|
|
7097
|
-
background-color: rgb(
|
|
7119
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
7098
7120
|
}
|
|
7099
7121
|
|
|
7100
7122
|
:is(.s-dark .dark\:s-bg-amber-400-night) {
|
|
7101
7123
|
--tw-bg-opacity: 1;
|
|
7102
|
-
background-color: rgb(
|
|
7124
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
7103
7125
|
}
|
|
7104
7126
|
|
|
7105
7127
|
:is(.s-dark .dark\:s-bg-amber-50-night) {
|
|
@@ -7328,22 +7350,22 @@ select {
|
|
|
7328
7350
|
|
|
7329
7351
|
:is(.s-dark .dark\:s-bg-golden-100-night) {
|
|
7330
7352
|
--tw-bg-opacity: 1;
|
|
7331
|
-
background-color: rgb(
|
|
7353
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
7332
7354
|
}
|
|
7333
7355
|
|
|
7334
7356
|
:is(.s-dark .dark\:s-bg-golden-200-night) {
|
|
7335
7357
|
--tw-bg-opacity: 1;
|
|
7336
|
-
background-color: rgb(
|
|
7358
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
7337
7359
|
}
|
|
7338
7360
|
|
|
7339
7361
|
:is(.s-dark .dark\:s-bg-golden-300-night) {
|
|
7340
7362
|
--tw-bg-opacity: 1;
|
|
7341
|
-
background-color: rgb(
|
|
7363
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
7342
7364
|
}
|
|
7343
7365
|
|
|
7344
7366
|
:is(.s-dark .dark\:s-bg-golden-400-night) {
|
|
7345
7367
|
--tw-bg-opacity: 1;
|
|
7346
|
-
background-color: rgb(
|
|
7368
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
7347
7369
|
}
|
|
7348
7370
|
|
|
7349
7371
|
:is(.s-dark .dark\:s-bg-golden-50-night) {
|
|
@@ -7608,22 +7630,22 @@ select {
|
|
|
7608
7630
|
|
|
7609
7631
|
:is(.s-dark .dark\:s-bg-info-100-night) {
|
|
7610
7632
|
--tw-bg-opacity: 1;
|
|
7611
|
-
background-color: rgb(
|
|
7633
|
+
background-color: rgb(112 53 12 / var(--tw-bg-opacity));
|
|
7612
7634
|
}
|
|
7613
7635
|
|
|
7614
7636
|
:is(.s-dark .dark\:s-bg-info-200-night) {
|
|
7615
7637
|
--tw-bg-opacity: 1;
|
|
7616
|
-
background-color: rgb(
|
|
7638
|
+
background-color: rgb(175 85 17 / var(--tw-bg-opacity));
|
|
7617
7639
|
}
|
|
7618
7640
|
|
|
7619
7641
|
:is(.s-dark .dark\:s-bg-info-300-night) {
|
|
7620
7642
|
--tw-bg-opacity: 1;
|
|
7621
|
-
background-color: rgb(
|
|
7643
|
+
background-color: rgb(226 119 22 / var(--tw-bg-opacity));
|
|
7622
7644
|
}
|
|
7623
7645
|
|
|
7624
7646
|
:is(.s-dark .dark\:s-bg-info-400-night) {
|
|
7625
7647
|
--tw-bg-opacity: 1;
|
|
7626
|
-
background-color: rgb(
|
|
7648
|
+
background-color: rgb(254 156 26 / var(--tw-bg-opacity));
|
|
7627
7649
|
}
|
|
7628
7650
|
|
|
7629
7651
|
:is(.s-dark .dark\:s-bg-info-50-night) {
|
|
@@ -8819,6 +8841,11 @@ select {
|
|
|
8819
8841
|
color: rgb(238 242 255 / var(--tw-text-opacity));
|
|
8820
8842
|
}
|
|
8821
8843
|
|
|
8844
|
+
:is(.s-dark .dark\:s-text-info-400-night) {
|
|
8845
|
+
--tw-text-opacity: 1;
|
|
8846
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
8847
|
+
}
|
|
8848
|
+
|
|
8822
8849
|
:is(.s-dark .dark\:s-text-info-500-night) {
|
|
8823
8850
|
--tw-text-opacity: 1;
|
|
8824
8851
|
color: rgb(255 170 13 / var(--tw-text-opacity));
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { Icon } from "./Icon";
|
|
|
6
6
|
|
|
7
7
|
interface AttachmentChipProps {
|
|
8
8
|
label: string;
|
|
9
|
-
icon
|
|
9
|
+
icon?: React.ComponentType;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ export function AttachmentChip({
|
|
|
22
22
|
"s-border-border s-bg-background",
|
|
23
23
|
"dark:s-border-border-night dark:s-bg-background-night",
|
|
24
24
|
"s-text-foreground dark:s-text-foreground-night",
|
|
25
|
-
"s-max-w-
|
|
25
|
+
"s-max-w-44",
|
|
26
26
|
className
|
|
27
27
|
)}
|
|
28
28
|
>
|
|
@@ -89,15 +89,22 @@ const styleVariants: Record<ButtonVariantType, string> = {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
const sizeVariants: Record<ButtonSizeType, string> = {
|
|
92
|
-
mini: "s-h-7 s-p-1.5 s-rounded-lg s-
|
|
93
|
-
xs: "s-h-7 s-px-2.5 s-rounded-lg s-
|
|
94
|
-
sm: "s-h-9 s-px-3 s-rounded-xl s-
|
|
95
|
-
md: "s-h-12 s-px-4 s-py-2 s-rounded-2xl s-
|
|
92
|
+
mini: "s-h-7 s-p-1.5 s-rounded-lg s-label-xs s-gap-1.5",
|
|
93
|
+
xs: "s-h-7 s-px-2.5 s-rounded-lg s-label-xs s-gap-1.5",
|
|
94
|
+
sm: "s-h-9 s-px-3 s-rounded-xl s-label-sm s-gap-2",
|
|
95
|
+
md: "s-h-12 s-px-4 s-py-2 s-rounded-2xl s-label-base s-gap-2.5",
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const labelVariants: Record<ButtonSizeType, string> = {
|
|
99
|
+
mini: "s-label-xs",
|
|
100
|
+
xs: "s-label-xs",
|
|
101
|
+
sm: "s-label-sm",
|
|
102
|
+
md: "s-label-base",
|
|
96
103
|
};
|
|
97
104
|
|
|
98
105
|
const buttonVariants = cva(
|
|
99
106
|
cn(
|
|
100
|
-
"s-inline-flex s-items-center s-justify-center s-whitespace-nowrap s-
|
|
107
|
+
"s-inline-flex s-items-center s-justify-center s-whitespace-nowrap s-ring-offset-background s-transition-colors",
|
|
101
108
|
"focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-ring focus-visible:s-ring-offset-2",
|
|
102
109
|
"dark:focus-visible:s-ring-0 dark:focus-visible:s-ring-offset-1"
|
|
103
110
|
),
|
|
@@ -219,7 +226,9 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
219
226
|
)}
|
|
220
227
|
|
|
221
228
|
{showContainer && (
|
|
222
|
-
<div
|
|
229
|
+
<div
|
|
230
|
+
className={cn("s-flex s-items-center s-gap-2", labelVariants[size])}
|
|
231
|
+
>
|
|
223
232
|
{label}
|
|
224
233
|
{showCounter && (
|
|
225
234
|
<Counter
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { toast, Toaster } from "sonner";
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
5
|
+
import {
|
|
6
|
+
CheckCircleIcon,
|
|
7
|
+
InformationCircleIcon,
|
|
8
|
+
XCircleIcon,
|
|
9
|
+
} from "@sparkle/icons";
|
|
10
|
+
import { assertNever, cn } from "@sparkle/lib/utils";
|
|
6
11
|
|
|
7
12
|
import { Icon } from "./Icon";
|
|
8
13
|
|
|
@@ -11,7 +16,7 @@ const NOTIFICATION_DELAY = 5000;
|
|
|
11
16
|
export type NotificationType = {
|
|
12
17
|
title?: string;
|
|
13
18
|
description?: string;
|
|
14
|
-
type: "success" | "error";
|
|
19
|
+
type: "success" | "error" | "info";
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
const NotificationsContext = React.createContext<(n: NotificationType) => void>(
|
|
@@ -21,11 +26,34 @@ export interface NotificationProps {
|
|
|
21
26
|
className?: string;
|
|
22
27
|
description?: string;
|
|
23
28
|
title?: string;
|
|
24
|
-
variant: "success" | "error";
|
|
29
|
+
variant: "success" | "error" | "info";
|
|
25
30
|
onClick?: () => void;
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
function NotificationContent({ type, title, description }: NotificationType) {
|
|
34
|
+
const icon = (() => {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "success":
|
|
37
|
+
return CheckCircleIcon;
|
|
38
|
+
case "error":
|
|
39
|
+
return XCircleIcon;
|
|
40
|
+
case "info":
|
|
41
|
+
return InformationCircleIcon;
|
|
42
|
+
default:
|
|
43
|
+
assertNever(type);
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
|
|
47
|
+
const variantClassName = cva("s-pt-0.5", {
|
|
48
|
+
variants: {
|
|
49
|
+
type: {
|
|
50
|
+
success: "s-text-success-600 dark:s-text-success-400-night",
|
|
51
|
+
error: "s-text-warning-500 dark:s-text-warning-500-night",
|
|
52
|
+
info: "s-text-info-600 dark:s-text-info-400-night",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
29
57
|
return (
|
|
30
58
|
<div
|
|
31
59
|
className={cn(
|
|
@@ -35,21 +63,12 @@ function NotificationContent({ type, title, description }: NotificationType) {
|
|
|
35
63
|
"s-p-4 s-shadow-xl"
|
|
36
64
|
)}
|
|
37
65
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/>
|
|
45
|
-
) : (
|
|
46
|
-
<Icon
|
|
47
|
-
size="lg"
|
|
48
|
-
visual={XCircleIcon}
|
|
49
|
-
className="s-pt-0.5 s-text-warning-500 dark:s-text-warning-500-night"
|
|
50
|
-
aria-hidden="true"
|
|
51
|
-
/>
|
|
52
|
-
)}
|
|
66
|
+
<Icon
|
|
67
|
+
size="lg"
|
|
68
|
+
visual={icon}
|
|
69
|
+
className={variantClassName({ type })}
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
/>
|
|
53
72
|
<div className="s-flex s-flex-col">
|
|
54
73
|
<div
|
|
55
74
|
className={cn(
|
package/src/components/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
import { AttachmentChip } from "@sparkle/components";
|
|
4
5
|
import { DocumentIcon, DocumentTextIcon } from "@sparkle/icons";
|
|
5
6
|
import { NotionLogo } from "@sparkle/logo";
|
|
6
7
|
|
|
7
|
-
import { AttachmentChip } from "./AttachmentChip";
|
|
8
|
-
|
|
9
8
|
const meta = {
|
|
10
9
|
title: "Components/AttachmentChip",
|
|
11
10
|
component: AttachmentChip,
|
|
@@ -44,6 +44,16 @@ const NotificationExample = () => {
|
|
|
44
44
|
}
|
|
45
45
|
label="Show Error"
|
|
46
46
|
/>
|
|
47
|
+
<Button
|
|
48
|
+
onClick={() =>
|
|
49
|
+
sendNotification({
|
|
50
|
+
title: "Info",
|
|
51
|
+
description: "Some information",
|
|
52
|
+
type: "info",
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
label="Show Info"
|
|
56
|
+
/>
|
|
47
57
|
</div>
|
|
48
58
|
);
|
|
49
59
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentChip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentChip.stories.tsx"],"names":[],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