@dust-tt/sparkle 0.2.275 → 0.2.276

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.
Files changed (48) hide show
  1. package/dist/cjs/index.js +103 -25
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/components/Dialog.js +1 -1
  4. package/dist/esm/components/Dialog.js.map +1 -1
  5. package/dist/esm/components/Input.d.ts.map +1 -1
  6. package/dist/esm/components/Input.js +20 -7
  7. package/dist/esm/components/Input.js.map +1 -1
  8. package/dist/esm/components/Label.js +1 -1
  9. package/dist/esm/components/Label.js.map +1 -1
  10. package/dist/esm/components/NavigationList.d.ts +18 -0
  11. package/dist/esm/components/NavigationList.d.ts.map +1 -0
  12. package/dist/esm/components/NavigationList.js +70 -0
  13. package/dist/esm/components/NavigationList.js.map +1 -0
  14. package/dist/esm/components/NewDropdown.js +2 -2
  15. package/dist/esm/components/NewDropdown.js.map +1 -1
  16. package/dist/esm/components/Popover.js +1 -1
  17. package/dist/esm/components/RadioGroup.d.ts.map +1 -1
  18. package/dist/esm/components/RadioGroup.js +4 -4
  19. package/dist/esm/components/RadioGroup.js.map +1 -1
  20. package/dist/esm/components/Spinner.js +1 -1
  21. package/dist/esm/components/Tree.d.ts +2 -1
  22. package/dist/esm/components/Tree.d.ts.map +1 -1
  23. package/dist/esm/components/Tree.js +8 -8
  24. package/dist/esm/components/Tree.js.map +1 -1
  25. package/dist/esm/components/index.d.ts +2 -1
  26. package/dist/esm/components/index.d.ts.map +1 -1
  27. package/dist/esm/components/index.js +2 -1
  28. package/dist/esm/components/index.js.map +1 -1
  29. package/dist/esm/stories/Input.stories.js +1 -1
  30. package/dist/esm/stories/Input.stories.js.map +1 -1
  31. package/dist/esm/stories/NavigationList.stories.d.ts +7 -0
  32. package/dist/esm/stories/NavigationList.stories.d.ts.map +1 -0
  33. package/dist/esm/stories/NavigationList.stories.js +140 -0
  34. package/dist/esm/stories/NavigationList.stories.js.map +1 -0
  35. package/dist/sparkle.css +95 -98
  36. package/package.json +1 -1
  37. package/src/components/Dialog.tsx +1 -1
  38. package/src/components/Input.tsx +44 -31
  39. package/src/components/Label.tsx +1 -1
  40. package/src/components/NavigationList.tsx +137 -0
  41. package/src/components/NewDropdown.tsx +2 -2
  42. package/src/components/Popover.tsx +1 -1
  43. package/src/components/RadioGroup.tsx +20 -22
  44. package/src/components/Spinner.tsx +1 -1
  45. package/src/components/Tree.tsx +10 -8
  46. package/src/components/index.ts +6 -1
  47. package/src/stories/Input.stories.tsx +14 -14
  48. package/src/stories/NavigationList.stories.tsx +173 -0
@@ -0,0 +1,140 @@
1
+ import { __read } from "tslib";
2
+ import React, { useEffect, useState } from "react";
3
+ import { NavigationList, NavigationListItem, NavigationListLabel, ScrollArea, ScrollBar, } from "../index_with_tw_base";
4
+ var meta = {
5
+ title: "Primitives/NavigationList",
6
+ };
7
+ export default meta;
8
+ var getRandomTitles = function (count) {
9
+ var shuffled = fakeTitles.sort(function () { return 0.5 - Math.random(); });
10
+ return shuffled.slice(0, count);
11
+ };
12
+ export var NewNavigationListDemo = function () {
13
+ var _a = __read(useState(null), 2), selectedIndex = _a[0], setSelectedIndex = _a[1];
14
+ var _b = __read(useState([]), 2), conversationTitles = _b[0], setConversationTitles = _b[1];
15
+ useEffect(function () {
16
+ // Generate random titles for each date section only once
17
+ setConversationTitles([
18
+ { label: "Today", items: getRandomTitles(5) },
19
+ { label: "Yesterday", items: getRandomTitles(10) },
20
+ ]);
21
+ console.log(conversationTitles); // Add this line
22
+ }, []);
23
+ // Flatten the items array to easily manage indices
24
+ var allItems = conversationTitles.flatMap(function (section) { return section.items; });
25
+ return (React.createElement("div", { className: "s-h-[400px] s-w-[200px] s-py-12" },
26
+ React.createElement(ScrollArea, null,
27
+ React.createElement(NavigationList, { className: "s-w-full" }, conversationTitles.map(function (section, sectionIndex) { return (React.createElement(React.Fragment, { key: sectionIndex },
28
+ React.createElement(NavigationListLabel, { label: section.label }),
29
+ section.items.map(function (title, index) {
30
+ var itemIndex = allItems.indexOf(title); // Calculate the global index
31
+ return (React.createElement(NavigationListItem, { key: index, selected: itemIndex === selectedIndex, onClick: function () { return setSelectedIndex(itemIndex); }, label: title, className: "s-w-full" }));
32
+ }))); })),
33
+ React.createElement(ScrollBar, null))));
34
+ };
35
+ var fakeTitles = [
36
+ "Project Kickoff Meeting",
37
+ "Budget Review Discussion",
38
+ "Weekly Sync with Team",
39
+ "AI Bot Training Session",
40
+ "Quarterly Planning Meeting",
41
+ "Feedback on Latest Design",
42
+ "Client Requirements Gathering",
43
+ "Sprint Retrospective",
44
+ "Daily Standup",
45
+ "Marketing Strategy Planning",
46
+ "Code Review Session",
47
+ "Product Launch Preparation",
48
+ "Onboarding New Team Members",
49
+ "Customer Feedback Analysis",
50
+ "Feature Prioritization Discussion",
51
+ "Technical Debt Assessment",
52
+ "Supply Chain Optimization",
53
+ "Sales Performance Review",
54
+ "Cross-Department Collaboration",
55
+ "Innovation Brainstorming",
56
+ "Risk Management Workshop",
57
+ "Holiday Schedule Planning",
58
+ "Compliance and Security Update",
59
+ "UI/UX Design Critique",
60
+ "End-of-Year Wrap Up",
61
+ "Resource Allocation Meeting",
62
+ "Vendor Negotiation Strategy",
63
+ "Crisis Management Scenario",
64
+ "SEO Best Practices Review",
65
+ "New Hire Orientation",
66
+ "Remote Work Policy Update",
67
+ "Company Values Workshop",
68
+ "Leadership Development Session",
69
+ "Diversity and Inclusion Training",
70
+ "Performance Improvement Plan",
71
+ "Customer Success Story Sharing",
72
+ "Community Engagement Strategy",
73
+ "Internal Product Demo",
74
+ "Cost Reduction Initiative",
75
+ "Change Management Planning",
76
+ "Employee Recognition Program",
77
+ "IT Infrastructure Upgrade",
78
+ "Content Marketing Planning",
79
+ "Team Building Activities",
80
+ "Data Privacy Compliance",
81
+ "Board Meeting Preparation",
82
+ "Investor Relations Update",
83
+ "KPI Tracking and Reporting",
84
+ "Industry Trends Analysis",
85
+ "Partnership Opportunities Exploration",
86
+ "Employee Wellness Program",
87
+ "Talent Acquisition Strategy",
88
+ "Brand Positioning Workshop",
89
+ "Social Media Campaign Planning",
90
+ "Competitive Analysis Review",
91
+ "Legal Compliance Training",
92
+ "Cybersecurity Awareness Session",
93
+ "Cultural Exchange Program",
94
+ "Product Roadmap Presentation",
95
+ "Customer Journey Mapping",
96
+ "Financial Forecasting Session",
97
+ "Brand Storytelling Workshop",
98
+ "AI Ethics and Governance Discussion",
99
+ "Operational Efficiency Assessment",
100
+ "Annual Report Drafting",
101
+ "Project Milestone Celebration",
102
+ "Quality Assurance Review",
103
+ "Public Relations Strategy",
104
+ "Team Performance Metrics",
105
+ "Innovation Lab Tour",
106
+ "Digital Transformation Roadmap",
107
+ "Sustainability Initiatives Planning",
108
+ "Internal Communications Strategy",
109
+ "Customer Advisory Board Meeting",
110
+ "Agile Methodology Training",
111
+ "E-commerce Platform Update",
112
+ "Risk Assessment and Mitigation",
113
+ "Employee Satisfaction Survey Results",
114
+ "Sales Funnel Optimization",
115
+ "Cross-Cultural Communication Training",
116
+ "Global Expansion Strategy",
117
+ "Cloud Migration Plan",
118
+ "Crisis Communication Strategy",
119
+ "Webinar Content Creation",
120
+ "Supply Chain Risk Management",
121
+ "Data Analytics and Insights",
122
+ "Customer Onboarding Process",
123
+ "Brand Awareness Campaign",
124
+ "Product Feature Request Review",
125
+ "Annual Budget Allocation",
126
+ "Employee Exit Interview",
127
+ "User Feedback Session",
128
+ "Strategic Partnership Negotiation",
129
+ "Market Entry Strategy",
130
+ "Employee Handbook Update",
131
+ "Stakeholder Engagement Plan",
132
+ "AI Chatbot Development",
133
+ "Customer Retention Strategy",
134
+ "Company Anniversary Celebration",
135
+ "Leadership Team Offsite",
136
+ "Innovation Challenge Kickoff",
137
+ "Employee Benefits Review",
138
+ "Business Continuity Planning",
139
+ ];
140
+ //# sourceMappingURL=NavigationList.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationList.stories.js","sourceRoot":"","sources":["../../../src/stories/NavigationList.stories.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25rem;
855
855
  }
856
856
 
857
+ .-s-mr-2 {
858
+ margin-right: -0.5rem;
859
+ }
860
+
857
861
  .-s-mt-1 {
858
862
  margin-top: -0.25rem;
859
863
  }
860
864
 
865
+ .-s-mt-1\.5 {
866
+ margin-top: -0.375rem;
867
+ }
868
+
861
869
  .-s-mt-2 {
862
870
  margin-top: -0.5rem;
863
871
  }
@@ -890,6 +898,14 @@ select {
890
898
  margin-left: 0.5rem;
891
899
  }
892
900
 
901
+ .s-ml-3 {
902
+ margin-left: 0.75rem;
903
+ }
904
+
905
+ .s-ml-3\.5 {
906
+ margin-left: 0.875rem;
907
+ }
908
+
893
909
  .s-ml-\[3px\] {
894
910
  margin-left: 3px;
895
911
  }
@@ -1683,6 +1699,11 @@ select {
1683
1699
  column-gap: 0.25rem;
1684
1700
  }
1685
1701
 
1702
+ .s-gap-x-1\.5 {
1703
+ -moz-column-gap: 0.375rem;
1704
+ column-gap: 0.375rem;
1705
+ }
1706
+
1686
1707
  .s-gap-x-2 {
1687
1708
  -moz-column-gap: 0.5rem;
1688
1709
  column-gap: 0.5rem;
@@ -1943,6 +1964,11 @@ select {
1943
1964
  border-color: rgb(148 163 184 / var(--tw-border-opacity));
1944
1965
  }
1945
1966
 
1967
+ .s-border-border-warning {
1968
+ --tw-border-opacity: 1;
1969
+ border-color: rgb(254 202 202 / var(--tw-border-opacity));
1970
+ }
1971
+
1946
1972
  .s-border-cyan-100 {
1947
1973
  --tw-border-opacity: 1;
1948
1974
  border-color: rgb(207 250 254 / var(--tw-border-opacity));
@@ -2079,7 +2105,7 @@ select {
2079
2105
  }
2080
2106
 
2081
2107
  .s-border-primary-200\/0 {
2082
- border-color: rgb(191 219 254 / 0);
2108
+ border-color: rgb(226 232 240 / 0);
2083
2109
  }
2084
2110
 
2085
2111
  .s-border-purple-100 {
@@ -2161,21 +2187,6 @@ select {
2161
2187
  border-color: rgb(2 6 23 / 0.1);
2162
2188
  }
2163
2189
 
2164
- .s-border-stone-100 {
2165
- --tw-border-opacity: 1;
2166
- border-color: rgb(245 245 244 / var(--tw-border-opacity));
2167
- }
2168
-
2169
- .s-border-stone-200 {
2170
- --tw-border-opacity: 1;
2171
- border-color: rgb(231 229 228 / var(--tw-border-opacity));
2172
- }
2173
-
2174
- .s-border-stone-300 {
2175
- --tw-border-opacity: 1;
2176
- border-color: rgb(214 211 209 / var(--tw-border-opacity));
2177
- }
2178
-
2179
2190
  .s-border-structure-0 {
2180
2191
  --tw-border-opacity: 1;
2181
2192
  border-color: rgb(255 255 255 / var(--tw-border-opacity));
@@ -2195,10 +2206,6 @@ select {
2195
2206
  border-color: rgb(226 232 240 / var(--tw-border-opacity));
2196
2207
  }
2197
2208
 
2198
- .s-border-structure-200\/0 {
2199
- border-color: rgb(226 232 240 / 0);
2200
- }
2201
-
2202
2209
  .s-border-structure-300\/30 {
2203
2210
  border-color: rgb(203 213 225 / 0.3);
2204
2211
  }
@@ -2795,7 +2802,7 @@ select {
2795
2802
 
2796
2803
  .s-bg-primary {
2797
2804
  --tw-bg-opacity: 1;
2798
- background-color: rgb(59 130 246 / var(--tw-bg-opacity));
2805
+ background-color: rgb(30 41 59 / var(--tw-bg-opacity));
2799
2806
  }
2800
2807
 
2801
2808
  .s-bg-purple-100 {
@@ -3012,54 +3019,23 @@ select {
3012
3019
  background-color: rgb(2 6 23 / 0.3);
3013
3020
  }
3014
3021
 
3015
- .s-bg-stone-100 {
3016
- --tw-bg-opacity: 1;
3017
- background-color: rgb(245 245 244 / var(--tw-bg-opacity));
3018
- }
3019
-
3020
- .s-bg-stone-200 {
3021
- --tw-bg-opacity: 1;
3022
- background-color: rgb(231 229 228 / var(--tw-bg-opacity));
3023
- }
3024
-
3025
- .s-bg-stone-300 {
3026
- --tw-bg-opacity: 1;
3027
- background-color: rgb(214 211 209 / var(--tw-bg-opacity));
3028
- }
3029
-
3030
- .s-bg-stone-400 {
3031
- --tw-bg-opacity: 1;
3032
- background-color: rgb(168 162 158 / var(--tw-bg-opacity));
3033
- }
3034
-
3035
- .s-bg-stone-500 {
3036
- --tw-bg-opacity: 1;
3037
- background-color: rgb(120 113 108 / var(--tw-bg-opacity));
3038
- }
3039
-
3040
- .s-bg-stone-600 {
3041
- --tw-bg-opacity: 1;
3042
- background-color: rgb(87 83 78 / var(--tw-bg-opacity));
3043
- }
3044
-
3045
- .s-bg-stone-700 {
3022
+ .s-bg-structure-0 {
3046
3023
  --tw-bg-opacity: 1;
3047
- background-color: rgb(68 64 60 / var(--tw-bg-opacity));
3024
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
3048
3025
  }
3049
3026
 
3050
- .s-bg-stone-800 {
3027
+ .s-bg-structure-100 {
3051
3028
  --tw-bg-opacity: 1;
3052
- background-color: rgb(41 37 36 / var(--tw-bg-opacity));
3029
+ background-color: rgb(241 245 249 / var(--tw-bg-opacity));
3053
3030
  }
3054
3031
 
3055
- .s-bg-structure-0 {
3032
+ .s-bg-structure-150 {
3056
3033
  --tw-bg-opacity: 1;
3057
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
3034
+ background-color: rgb(233 239 245 / var(--tw-bg-opacity));
3058
3035
  }
3059
3036
 
3060
- .s-bg-structure-100 {
3061
- --tw-bg-opacity: 1;
3062
- background-color: rgb(241 245 249 / var(--tw-bg-opacity));
3037
+ .s-bg-structure-150\/0 {
3038
+ background-color: rgb(233 239 245 / 0);
3063
3039
  }
3064
3040
 
3065
3041
  .s-bg-structure-200 {
@@ -3211,10 +3187,6 @@ select {
3211
3187
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
3212
3188
  }
3213
3189
 
3214
- .s-bg-white\/0 {
3215
- background-color: rgb(255 255 255 / 0);
3216
- }
3217
-
3218
3190
  .s-bg-white\/80 {
3219
3191
  background-color: rgb(255 255 255 / 0.8);
3220
3192
  }
@@ -3444,6 +3416,11 @@ select {
3444
3416
  padding-bottom: 0.375rem;
3445
3417
  }
3446
3418
 
3419
+ .s-py-12 {
3420
+ padding-top: 3rem;
3421
+ padding-bottom: 3rem;
3422
+ }
3423
+
3447
3424
  .s-py-16 {
3448
3425
  padding-top: 4rem;
3449
3426
  padding-bottom: 4rem;
@@ -3855,6 +3832,11 @@ select {
3855
3832
  color: rgb(2 6 23 / var(--tw-text-opacity));
3856
3833
  }
3857
3834
 
3835
+ .s-text-foreground-warning {
3836
+ --tw-text-opacity: 1;
3837
+ color: rgb(239 68 68 / var(--tw-text-opacity));
3838
+ }
3839
+
3858
3840
  .s-text-fuchsia-700 {
3859
3841
  --tw-text-opacity: 1;
3860
3842
  color: rgb(162 28 175 / var(--tw-text-opacity));
@@ -3997,17 +3979,17 @@ select {
3997
3979
 
3998
3980
  .s-text-primary-400 {
3999
3981
  --tw-text-opacity: 1;
4000
- color: rgb(96 165 250 / var(--tw-text-opacity));
3982
+ color: rgb(148 163 184 / var(--tw-text-opacity));
4001
3983
  }
4002
3984
 
4003
3985
  .s-text-primary-950 {
4004
3986
  --tw-text-opacity: 1;
4005
- color: rgb(23 37 84 / var(--tw-text-opacity));
3987
+ color: rgb(2 6 23 / var(--tw-text-opacity));
4006
3988
  }
4007
3989
 
4008
3990
  .s-text-primary-dark {
4009
3991
  --tw-text-opacity: 1;
4010
- color: rgb(23 37 84 / var(--tw-text-opacity));
3992
+ color: rgb(2 6 23 / var(--tw-text-opacity));
4011
3993
  }
4012
3994
 
4013
3995
  .s-text-purple-700 {
@@ -4120,21 +4102,6 @@ select {
4120
4102
  color: rgb(2 6 23 / var(--tw-text-opacity));
4121
4103
  }
4122
4104
 
4123
- .s-text-stone-800 {
4124
- --tw-text-opacity: 1;
4125
- color: rgb(41 37 36 / var(--tw-text-opacity));
4126
- }
4127
-
4128
- .s-text-stone-900 {
4129
- --tw-text-opacity: 1;
4130
- color: rgb(28 25 23 / var(--tw-text-opacity));
4131
- }
4132
-
4133
- .s-text-stone-950 {
4134
- --tw-text-opacity: 1;
4135
- color: rgb(12 10 9 / var(--tw-text-opacity));
4136
- }
4137
-
4138
4105
  .s-text-structure-0 {
4139
4106
  --tw-text-opacity: 1;
4140
4107
  color: rgb(255 255 255 / var(--tw-text-opacity));
@@ -4605,7 +4572,7 @@ select {
4605
4572
 
4606
4573
  .hover\:s-border-primary-200:hover {
4607
4574
  --tw-border-opacity: 1;
4608
- border-color: rgb(191 219 254 / var(--tw-border-opacity));
4575
+ border-color: rgb(226 232 240 / var(--tw-border-opacity));
4609
4576
  }
4610
4577
 
4611
4578
  .hover\:s-border-structure-100:hover {
@@ -4630,12 +4597,17 @@ select {
4630
4597
 
4631
4598
  .hover\:s-bg-primary-100:hover {
4632
4599
  --tw-bg-opacity: 1;
4633
- background-color: rgb(219 234 254 / var(--tw-bg-opacity));
4600
+ background-color: rgb(241 245 249 / var(--tw-bg-opacity));
4634
4601
  }
4635
4602
 
4636
4603
  .hover\:s-bg-primary-light:hover {
4637
4604
  --tw-bg-opacity: 1;
4638
- background-color: rgb(29 78 216 / var(--tw-bg-opacity));
4605
+ background-color: rgb(51 65 85 / var(--tw-bg-opacity));
4606
+ }
4607
+
4608
+ .hover\:s-bg-structure-150:hover {
4609
+ --tw-bg-opacity: 1;
4610
+ background-color: rgb(233 239 245 / var(--tw-bg-opacity));
4639
4611
  }
4640
4612
 
4641
4613
  .hover\:s-bg-structure-200:hover {
@@ -4678,14 +4650,19 @@ select {
4678
4650
  color: rgb(59 130 246 / var(--tw-text-opacity));
4679
4651
  }
4680
4652
 
4653
+ .hover\:s-text-foreground:hover {
4654
+ --tw-text-opacity: 1;
4655
+ color: rgb(2 6 23 / var(--tw-text-opacity));
4656
+ }
4657
+
4681
4658
  .hover\:s-text-primary:hover {
4682
4659
  --tw-text-opacity: 1;
4683
- color: rgb(59 130 246 / var(--tw-text-opacity));
4660
+ color: rgb(30 41 59 / var(--tw-text-opacity));
4684
4661
  }
4685
4662
 
4686
4663
  .hover\:s-text-primary-900:hover {
4687
4664
  --tw-text-opacity: 1;
4688
- color: rgb(30 58 138 / var(--tw-text-opacity));
4665
+ color: rgb(15 23 42 / var(--tw-text-opacity));
4689
4666
  }
4690
4667
 
4691
4668
  .hover\:s-text-slate-100:hover {
@@ -4709,12 +4686,12 @@ select {
4709
4686
 
4710
4687
  .focus\:s-bg-primary-100:focus {
4711
4688
  --tw-bg-opacity: 1;
4712
- background-color: rgb(219 234 254 / var(--tw-bg-opacity));
4689
+ background-color: rgb(241 245 249 / var(--tw-bg-opacity));
4713
4690
  }
4714
4691
 
4715
4692
  .focus\:s-text-primary-950:focus {
4716
4693
  --tw-text-opacity: 1;
4717
- color: rgb(23 37 84 / var(--tw-text-opacity));
4694
+ color: rgb(2 6 23 / var(--tw-text-opacity));
4718
4695
  }
4719
4696
 
4720
4697
  .focus\:s-outline-none:focus {
@@ -4739,14 +4716,19 @@ select {
4739
4716
  --tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity));
4740
4717
  }
4741
4718
 
4719
+ .focus\:s-ring-ring-warning:focus {
4720
+ --tw-ring-opacity: 1;
4721
+ --tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity));
4722
+ }
4723
+
4742
4724
  .focus\:s-ring-warning-300:focus {
4743
4725
  --tw-ring-opacity: 1;
4744
4726
  --tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity));
4745
4727
  }
4746
4728
 
4747
- .focus-visible\:s-border-primary-400:focus-visible {
4729
+ .focus-visible\:s-border-border-dark:focus-visible {
4748
4730
  --tw-border-opacity: 1;
4749
- border-color: rgb(96 165 250 / var(--tw-border-opacity));
4731
+ border-color: rgb(226 232 240 / var(--tw-border-opacity));
4750
4732
  }
4751
4733
 
4752
4734
  .focus-visible\:s-outline-none:focus-visible {
@@ -4760,6 +4742,11 @@ select {
4760
4742
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
4761
4743
  }
4762
4744
 
4745
+ .focus-visible\:s-ring-ring:focus-visible {
4746
+ --tw-ring-opacity: 1;
4747
+ --tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity));
4748
+ }
4749
+
4763
4750
  .focus-visible\:s-ring-offset-2:focus-visible {
4764
4751
  --tw-ring-offset-width: 2px;
4765
4752
  }
@@ -4781,17 +4768,17 @@ select {
4781
4768
 
4782
4769
  .active\:s-bg-primary-200:active {
4783
4770
  --tw-bg-opacity: 1;
4784
- background-color: rgb(191 219 254 / var(--tw-bg-opacity));
4771
+ background-color: rgb(226 232 240 / var(--tw-bg-opacity));
4785
4772
  }
4786
4773
 
4787
4774
  .active\:s-bg-primary-300:active {
4788
4775
  --tw-bg-opacity: 1;
4789
- background-color: rgb(147 197 253 / var(--tw-bg-opacity));
4776
+ background-color: rgb(203 213 225 / var(--tw-bg-opacity));
4790
4777
  }
4791
4778
 
4792
4779
  .active\:s-bg-primary-dark:active {
4793
4780
  --tw-bg-opacity: 1;
4794
- background-color: rgb(23 37 84 / var(--tw-bg-opacity));
4781
+ background-color: rgb(2 6 23 / var(--tw-bg-opacity));
4795
4782
  }
4796
4783
 
4797
4784
  .active\:s-bg-structure-100:active {
@@ -4799,6 +4786,11 @@ select {
4799
4786
  background-color: rgb(241 245 249 / var(--tw-bg-opacity));
4800
4787
  }
4801
4788
 
4789
+ .active\:s-bg-structure-200:active {
4790
+ --tw-bg-opacity: 1;
4791
+ background-color: rgb(226 232 240 / var(--tw-bg-opacity));
4792
+ }
4793
+
4802
4794
  .active\:s-bg-warning-100:active {
4803
4795
  --tw-bg-opacity: 1;
4804
4796
  background-color: rgb(254 226 226 / var(--tw-bg-opacity));
@@ -4864,7 +4856,7 @@ select {
4864
4856
 
4865
4857
  .disabled\:s-bg-primary-muted:disabled {
4866
4858
  --tw-bg-opacity: 1;
4867
- background-color: rgb(96 165 250 / var(--tw-bg-opacity));
4859
+ background-color: rgb(148 163 184 / var(--tw-bg-opacity));
4868
4860
  }
4869
4861
 
4870
4862
  .disabled\:s-bg-warning-muted:disabled {
@@ -4879,12 +4871,12 @@ select {
4879
4871
 
4880
4872
  .disabled\:s-text-primary-400:disabled {
4881
4873
  --tw-text-opacity: 1;
4882
- color: rgb(96 165 250 / var(--tw-text-opacity));
4874
+ color: rgb(148 163 184 / var(--tw-text-opacity));
4883
4875
  }
4884
4876
 
4885
4877
  .disabled\:s-text-primary-muted:disabled {
4886
4878
  --tw-text-opacity: 1;
4887
- color: rgb(96 165 250 / var(--tw-text-opacity));
4879
+ color: rgb(148 163 184 / var(--tw-text-opacity));
4888
4880
  }
4889
4881
 
4890
4882
  .disabled\:s-opacity-50:disabled {
@@ -5000,9 +4992,14 @@ select {
5000
4992
  background-color: rgb(100 116 139 / var(--tw-bg-opacity));
5001
4993
  }
5002
4994
 
4995
+ .data-\[disabled\]\:s-text-muted-foreground[data-disabled] {
4996
+ --tw-text-opacity: 1;
4997
+ color: rgb(100 116 139 / var(--tw-text-opacity));
4998
+ }
4999
+
5003
5000
  .data-\[disabled\]\:s-text-primary-400[data-disabled] {
5004
5001
  --tw-text-opacity: 1;
5005
- color: rgb(96 165 250 / var(--tw-text-opacity));
5002
+ color: rgb(148 163 184 / var(--tw-text-opacity));
5006
5003
  }
5007
5004
 
5008
5005
  .data-\[state\=checked\]\:s-text-white[data-state=checked] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.275",
3
+ "version": "0.2.276",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -95,7 +95,7 @@ export function Dialog({
95
95
  {props.onCancel && (
96
96
  <Button
97
97
  label={props.cancelLabel ?? "Cancel"}
98
- variant="ghost"
98
+ variant="outline"
99
99
  onClick={props.onCancel}
100
100
  />
101
101
  )}
@@ -1,3 +1,4 @@
1
+ import { cva } from "class-variance-authority";
1
2
  import React, { forwardRef } from "react";
2
3
 
3
4
  import { cn } from "@sparkle/lib/utils";
@@ -13,51 +14,63 @@ export interface InputProps
13
14
  label?: string;
14
15
  }
15
16
 
16
- const inputStyleClasses = cn(
17
- "s-text-sm s-bg-background s-rounded-xl s-border s-border-border-dark s-flex s-h-9 s-w-full s-px-3 s-py-1.5 ",
18
- "file:s-border-0 file:s-bg-transparent file:s-text-sm file:s-font-medium file:s-text-foreground",
19
- "placeholder:s-text-muted-foreground",
20
- "focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-offset-2 focus-visible:s-ring-ring focus-visible:s-border-primary-400",
21
- "disabled:s-cursor-not-allowed disabled:s-opacity-50 disabled:s-text-muted-foreground"
17
+ const INPUT_STATES = ["error", "disabled", "default"];
18
+
19
+ type InputStateType = (typeof INPUT_STATES)[number];
20
+
21
+ const stateVariantStyles: Record<InputStateType, string> = {
22
+ default: "focus-visible:s-ring-ring",
23
+ disabled:
24
+ "disabled:s-cursor-not-allowed disabled:s-opacity-50 disabled:s-text-muted-foreground",
25
+ error: "s-border-border-warning focus:s-ring-ring-warning",
26
+ };
27
+ const inputStyleClasses = cva(
28
+ cn(
29
+ "s-text-sm s-bg-background s-rounded-xl s-border s-border-border-dark s-flex s-h-9 s-w-full s-px-3 s-py-1.5 ",
30
+ "file:s-border-0 file:s-bg-transparent file:s-text-sm file:s-font-medium file:s-text-foreground",
31
+ "placeholder:s-text-muted-foreground",
32
+ "focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-offset-2 focus-visible:s-border-border-dark"
33
+ ),
34
+ {
35
+ variants: {
36
+ state: stateVariantStyles,
37
+ },
38
+ defaultVariants: {
39
+ state: "default",
40
+ },
41
+ }
22
42
  );
23
43
 
24
44
  export const Input = forwardRef<HTMLInputElement, InputProps>(
25
45
  (
26
- { className, error, value, label, showErrorLabel = false, ...props },
46
+ {
47
+ className,
48
+ error,
49
+ value,
50
+ label,
51
+ disabled,
52
+ showErrorLabel = false,
53
+ ...props
54
+ },
27
55
  ref
28
56
  ) => {
57
+ const state = error ? "error" : disabled ? "disabled" : "default";
29
58
  return (
30
59
  <div className="s-flex s-flex-col s-gap-1 s-px-1">
31
- {label && (
32
- <Label
33
- htmlFor={props.name}
34
- className="s-pb-1 s-text-element-700 dark:s-text-element-700-dark"
35
- >
36
- {label}
37
- </Label>
38
- )}
60
+ {label && <Label htmlFor={props.name}>{label}</Label>}
39
61
  <input
40
62
  ref={ref}
41
- className={cn(
42
- inputStyleClasses,
43
- className,
44
- !error
45
- ? cn(
46
- "s-ring-structure-200 focus:s-ring-action-300",
47
- "dark:s-ring-structure-300-dark dark:focus:s-ring-action-300-dark"
48
- )
49
- : cn(
50
- "s-ring-warning-200 focus:s-ring-warning-300",
51
- "dark:s-ring-warning-200-dark dark:focus:s-ring-warning-300-dark"
52
- )
53
- )}
63
+ className={cn(inputStyleClasses({ state }), className)}
54
64
  data-1p-ignore={props.type !== "password"}
55
65
  value={value ?? undefined}
66
+ disabled={disabled}
56
67
  {...props}
57
68
  />
58
- <div className="s-ml-2 s-text-sm s-text-warning-500">
59
- {showErrorLabel && error ? error : null}
60
- </div>
69
+ {showErrorLabel && error && (
70
+ <div className="s-ml-3.5 s-text-xs s-text-foreground-warning">
71
+ {error}
72
+ </div>
73
+ )}
61
74
  </div>
62
75
  );
63
76
  }
@@ -4,7 +4,7 @@ import * as React from "react";
4
4
  import { cn } from "@sparkle/lib/utils";
5
5
 
6
6
  const labelVariants = cn(
7
- "s-text-sm s-text-foreground s-leading-none",
7
+ "s-text-sm s-font-medium s-text-foreground s-leading-none",
8
8
  "peer-disabled:s-cursor-not-allowed peer-disabled:s-opacity-70"
9
9
  );
10
10