@bloxwap/hig 0.0.0-stage → 0.2.0
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/LICENSE +5 -0
- package/README.md +44 -2
- package/chart/README.md +23 -0
- package/chart/dist/index.d.ts +8 -0
- package/chart/dist/index.js +12 -0
- package/contracts/README.md +3 -0
- package/contracts/dist/announcements.d.ts +12 -0
- package/contracts/dist/announcements.js +8 -0
- package/contracts/dist/feedback.d.ts +40 -0
- package/contracts/dist/feedback.js +1 -0
- package/contracts/dist/index.d.ts +41 -0
- package/contracts/dist/index.js +52 -0
- package/contracts/dist/messages.d.ts +162 -0
- package/contracts/dist/messages.js +68 -0
- package/feedback/README.md +7 -0
- package/feedback/assets/error.wav +0 -0
- package/feedback/assets/manifest.json +68 -0
- package/feedback/assets/success.wav +0 -0
- package/feedback/assets/tick.wav +0 -0
- package/feedback/assets/toggle.wav +0 -0
- package/feedback/dist/browser-haptic.d.ts +23 -0
- package/feedback/dist/browser-haptic.js +41 -0
- package/feedback/dist/contract.d.ts +96 -0
- package/feedback/dist/contract.js +58 -0
- package/feedback/dist/native.d.ts +27 -0
- package/feedback/dist/native.js +63 -0
- package/feedback/dist/preferences.d.ts +8 -0
- package/feedback/dist/preferences.js +24 -0
- package/feedback/dist/react.d.ts +19 -0
- package/feedback/dist/react.js +23 -0
- package/feedback/dist/web-haptic.d.ts +6 -0
- package/feedback/dist/web-haptic.js +6 -0
- package/feedback/dist/web-sound.d.ts +5 -0
- package/feedback/dist/web-sound.js +32 -0
- package/feedback/dist/web.d.ts +3 -0
- package/feedback/dist/web.js +4 -0
- package/native/README.md +11 -0
- package/native/android/build.gradle +28 -0
- package/native/android/src/main/java/com/bloxwap/hig/HIGAdjustableView.java +173 -0
- package/native/android/src/main/java/com/bloxwap/hig/HIGAdjustableViewManager.java +23 -0
- package/native/android/src/main/java/com/bloxwap/hig/HIGPackage.java +24 -0
- package/native/dist/animated-number-model.d.ts +24 -0
- package/native/dist/animated-number-model.js +110 -0
- package/native/dist/animated-number.d.ts +9 -0
- package/native/dist/animated-number.js +93 -0
- package/native/dist/brand.d.ts +7 -0
- package/native/dist/brand.js +6 -0
- package/native/dist/button.d.ts +29 -0
- package/native/dist/button.js +34 -0
- package/native/dist/checkbox.d.ts +3 -0
- package/native/dist/checkbox.js +11 -0
- package/native/dist/data.d.ts +40 -0
- package/native/dist/data.js +27 -0
- package/native/dist/field.d.ts +15 -0
- package/native/dist/field.js +13 -0
- package/native/dist/gesture-sheet.d.ts +73 -0
- package/native/dist/gesture-sheet.js +151 -0
- package/native/dist/navigation.d.ts +47 -0
- package/native/dist/navigation.js +16 -0
- package/native/dist/overlay.d.ts +36 -0
- package/native/dist/overlay.js +65 -0
- package/native/dist/provider.d.ts +43 -0
- package/native/dist/provider.js +52 -0
- package/native/dist/radio-group.d.ts +5 -0
- package/native/dist/radio-group.js +53 -0
- package/native/dist/recipes.d.ts +42 -0
- package/native/dist/recipes.js +19 -0
- package/native/dist/roles.d.ts +6 -0
- package/native/dist/roles.js +4 -0
- package/native/dist/select.d.ts +3 -0
- package/native/dist/select.js +9 -0
- package/native/dist/selection-types.d.ts +22 -0
- package/native/dist/selection-types.js +1 -0
- package/native/dist/selection.d.ts +7 -0
- package/native/dist/selection.js +6 -0
- package/native/dist/slider.d.ts +11 -0
- package/native/dist/slider.js +41 -0
- package/native/dist/status.d.ts +75 -0
- package/native/dist/status.js +72 -0
- package/native/dist/surface.d.ts +18 -0
- package/native/dist/surface.js +41 -0
- package/native/dist/switch-row.d.ts +8 -0
- package/native/dist/switch-row.js +18 -0
- package/native/dist/switch.d.ts +10 -0
- package/native/dist/switch.js +23 -0
- package/native/dist/text-content.d.ts +5 -0
- package/native/dist/text-content.js +6 -0
- package/native-fonts/README.md +17 -0
- package/native-fonts/dist/index.d.ts +164 -0
- package/native-fonts/dist/index.js +164 -0
- package/native-fonts/fonts/BloxwapMono-Bold.ttf +0 -0
- package/native-fonts/fonts/BloxwapMono-ExtraBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapMono-Medium.ttf +0 -0
- package/native-fonts/fonts/BloxwapMono-SemiBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapMono.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans-Black.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans-Bold.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans-ExtraBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans-Medium.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans-SemiBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapSans.ttf +0 -0
- package/native-fonts/fonts/BloxwapSansKR-SemiBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapSansKR.ttf +0 -0
- package/native-fonts/fonts/BloxwapSansSC-SemiBold.ttf +0 -0
- package/native-fonts/fonts/BloxwapSansSC.ttf +0 -0
- package/native-fonts/fonts/OFL.txt +93 -0
- package/native-fonts/fonts/manifest.json +164 -0
- package/og-fonts/README.md +34 -0
- package/og-fonts/dist/index.d.ts +116 -0
- package/og-fonts/dist/index.js +102 -0
- package/og-fonts/dist/node.d.ts +11 -0
- package/og-fonts/dist/node.js +39 -0
- package/og-fonts/fonts/BloxwapMono-Medium.ttf +0 -0
- package/og-fonts/fonts/BloxwapSans-Black.ttf +0 -0
- package/og-fonts/fonts/BloxwapSans-Bold.ttf +0 -0
- package/og-fonts/fonts/BloxwapSans-Medium.ttf +0 -0
- package/og-fonts/fonts/BloxwapSans.ttf +0 -0
- package/og-fonts/fonts/OFL.txt +93 -0
- package/og-fonts/fonts/manifest.json +65 -0
- package/package.json +358 -4
- package/react/README.md +9 -0
- package/react/dist/animated-number-model.d.ts +20 -0
- package/react/dist/animated-number-model.js +92 -0
- package/react/dist/animated-number.d.ts +8 -0
- package/react/dist/animated-number.js +71 -0
- package/react/dist/base.css +9 -0
- package/react/dist/brand.d.ts +7 -0
- package/react/dist/brand.js +4 -0
- package/react/dist/button.d.ts +14 -0
- package/react/dist/button.js +20 -0
- package/react/dist/data.d.ts +63 -0
- package/react/dist/data.js +23 -0
- package/react/dist/dialog.d.ts +29 -0
- package/react/dist/dialog.js +21 -0
- package/react/dist/field.d.ts +15 -0
- package/react/dist/field.js +19 -0
- package/react/dist/gesture-sheet.d.ts +41 -0
- package/react/dist/gesture-sheet.js +128 -0
- package/react/dist/navigation.d.ts +48 -0
- package/react/dist/navigation.js +69 -0
- package/react/dist/overlay.d.ts +17 -0
- package/react/dist/overlay.js +18 -0
- package/react/dist/provider.d.ts +25 -0
- package/react/dist/provider.js +50 -0
- package/react/dist/recipes/activity-list.d.ts +8 -0
- package/react/dist/recipes/activity-list.js +6 -0
- package/react/dist/recipes/balance-card.d.ts +6 -0
- package/react/dist/recipes/balance-card.js +5 -0
- package/react/dist/recipes/code-window.d.ts +4 -0
- package/react/dist/recipes/code-window.js +4 -0
- package/react/dist/recipes/install-command.d.ts +5 -0
- package/react/dist/recipes/install-command.js +8 -0
- package/react/dist/recipes/market-row.d.ts +25 -0
- package/react/dist/recipes/market-row.js +8 -0
- package/react/dist/recipes/marketing-hero.d.ts +7 -0
- package/react/dist/recipes/marketing-hero.js +5 -0
- package/react/dist/recipes/trade-entry.d.ts +11 -0
- package/react/dist/recipes/trade-entry.js +12 -0
- package/react/dist/recipes.d.ts +8 -0
- package/react/dist/recipes.js +9 -0
- package/react/dist/select.d.ts +4 -0
- package/react/dist/select.js +172 -0
- package/react/dist/selection.d.ts +27 -0
- package/react/dist/selection.js +16 -0
- package/react/dist/slider.d.ts +11 -0
- package/react/dist/slider.js +10 -0
- package/react/dist/status.d.ts +53 -0
- package/react/dist/status.js +43 -0
- package/react/dist/styles.css +228 -0
- package/react/dist/surface.d.ts +291 -0
- package/react/dist/surface.js +9 -0
- package/tokens/README.md +9 -0
- package/tokens/assets/bloxwap-icon.svg +1 -0
- package/tokens/dist/index.d.ts +429 -0
- package/tokens/dist/index.js +507 -0
- package/tokens/dist/manifest.json +197 -0
- package/tokens/dist/theme.d.ts +11 -0
- package/tokens/dist/theme.js +22 -0
- package/tokens/dist/tokens.css +119 -0
package/package.json
CHANGED
|
@@ -1,6 +1,360 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloxwap/hig",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Bloxwap Human Interface Guidelines: tokens, contracts, React and React Native components, chart adapter, feedback and fonts in one package.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./tokens": {
|
|
9
|
+
"types": "./tokens/dist/index.d.ts",
|
|
10
|
+
"import": "./tokens/dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./tokens/css": "./tokens/dist/tokens.css",
|
|
13
|
+
"./tokens/manifest": "./tokens/dist/manifest.json",
|
|
14
|
+
"./tokens/mark.svg": "./tokens/assets/bloxwap-icon.svg",
|
|
15
|
+
"./contracts": {
|
|
16
|
+
"types": "./contracts/dist/index.d.ts",
|
|
17
|
+
"import": "./contracts/dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./contracts/feedback": {
|
|
20
|
+
"types": "./contracts/dist/feedback.d.ts",
|
|
21
|
+
"import": "./contracts/dist/feedback.js"
|
|
22
|
+
},
|
|
23
|
+
"./contracts/announcements": {
|
|
24
|
+
"types": "./contracts/dist/announcements.d.ts",
|
|
25
|
+
"import": "./contracts/dist/announcements.js"
|
|
26
|
+
},
|
|
27
|
+
"./contracts/messages": {
|
|
28
|
+
"types": "./contracts/dist/messages.d.ts",
|
|
29
|
+
"import": "./contracts/dist/messages.js"
|
|
30
|
+
},
|
|
31
|
+
"./native-fonts": {
|
|
32
|
+
"types": "./native-fonts/dist/index.d.ts",
|
|
33
|
+
"import": "./native-fonts/dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./native-fonts/manifest": "./native-fonts/fonts/manifest.json",
|
|
36
|
+
"./native-fonts/fonts/*": "./native-fonts/fonts/*",
|
|
37
|
+
"./og-fonts": {
|
|
38
|
+
"types": "./og-fonts/dist/index.d.ts",
|
|
39
|
+
"import": "./og-fonts/dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./og-fonts/node": {
|
|
42
|
+
"types": "./og-fonts/dist/node.d.ts",
|
|
43
|
+
"node": "./og-fonts/dist/node.js"
|
|
44
|
+
},
|
|
45
|
+
"./og-fonts/manifest": "./og-fonts/fonts/manifest.json",
|
|
46
|
+
"./og-fonts/fonts/*": "./og-fonts/fonts/*",
|
|
47
|
+
"./feedback": {
|
|
48
|
+
"types": "./feedback/dist/contract.d.ts",
|
|
49
|
+
"import": "./feedback/dist/contract.js"
|
|
50
|
+
},
|
|
51
|
+
"./feedback/web": {
|
|
52
|
+
"types": "./feedback/dist/web.d.ts",
|
|
53
|
+
"import": "./feedback/dist/web.js"
|
|
54
|
+
},
|
|
55
|
+
"./feedback/native": {
|
|
56
|
+
"types": "./feedback/dist/native.d.ts",
|
|
57
|
+
"import": "./feedback/dist/native.js"
|
|
58
|
+
},
|
|
59
|
+
"./feedback/react": {
|
|
60
|
+
"types": "./feedback/dist/react.d.ts",
|
|
61
|
+
"import": "./feedback/dist/react.js"
|
|
62
|
+
},
|
|
63
|
+
"./feedback/preferences": {
|
|
64
|
+
"types": "./feedback/dist/preferences.d.ts",
|
|
65
|
+
"import": "./feedback/dist/preferences.js"
|
|
66
|
+
},
|
|
67
|
+
"./feedback/assets/*": "./feedback/assets/*",
|
|
68
|
+
"./feedback/web-sound": {
|
|
69
|
+
"types": "./feedback/dist/web-sound.d.ts",
|
|
70
|
+
"import": "./feedback/dist/web-sound.js"
|
|
71
|
+
},
|
|
72
|
+
"./feedback/browser-haptic": {
|
|
73
|
+
"types": "./feedback/dist/browser-haptic.d.ts",
|
|
74
|
+
"import": "./feedback/dist/browser-haptic.js"
|
|
75
|
+
},
|
|
76
|
+
"./feedback/web-haptic": {
|
|
77
|
+
"types": "./feedback/dist/web-haptic.d.ts",
|
|
78
|
+
"import": "./feedback/dist/web-haptic.js"
|
|
79
|
+
},
|
|
80
|
+
"./react/provider": {
|
|
81
|
+
"types": "./react/dist/provider.d.ts",
|
|
82
|
+
"import": "./react/dist/provider.js"
|
|
83
|
+
},
|
|
84
|
+
"./react/button": {
|
|
85
|
+
"types": "./react/dist/button.d.ts",
|
|
86
|
+
"import": "./react/dist/button.js"
|
|
87
|
+
},
|
|
88
|
+
"./react/surface": {
|
|
89
|
+
"types": "./react/dist/surface.d.ts",
|
|
90
|
+
"import": "./react/dist/surface.js"
|
|
91
|
+
},
|
|
92
|
+
"./react/field": {
|
|
93
|
+
"types": "./react/dist/field.d.ts",
|
|
94
|
+
"import": "./react/dist/field.js"
|
|
95
|
+
},
|
|
96
|
+
"./react/selection": {
|
|
97
|
+
"types": "./react/dist/selection.d.ts",
|
|
98
|
+
"import": "./react/dist/selection.js"
|
|
99
|
+
},
|
|
100
|
+
"./react/overlay": {
|
|
101
|
+
"types": "./react/dist/overlay.d.ts",
|
|
102
|
+
"import": "./react/dist/overlay.js"
|
|
103
|
+
},
|
|
104
|
+
"./react/navigation": {
|
|
105
|
+
"types": "./react/dist/navigation.d.ts",
|
|
106
|
+
"import": "./react/dist/navigation.js"
|
|
107
|
+
},
|
|
108
|
+
"./react/status": {
|
|
109
|
+
"types": "./react/dist/status.d.ts",
|
|
110
|
+
"import": "./react/dist/status.js"
|
|
111
|
+
},
|
|
112
|
+
"./react/data": {
|
|
113
|
+
"types": "./react/dist/data.d.ts",
|
|
114
|
+
"import": "./react/dist/data.js"
|
|
115
|
+
},
|
|
116
|
+
"./react/brand": {
|
|
117
|
+
"types": "./react/dist/brand.d.ts",
|
|
118
|
+
"import": "./react/dist/brand.js"
|
|
119
|
+
},
|
|
120
|
+
"./react/recipes": {
|
|
121
|
+
"types": "./react/dist/recipes.d.ts",
|
|
122
|
+
"import": "./react/dist/recipes.js"
|
|
123
|
+
},
|
|
124
|
+
"./react/recipes/market-row": {
|
|
125
|
+
"types": "./react/dist/recipes/market-row.d.ts",
|
|
126
|
+
"import": "./react/dist/recipes/market-row.js"
|
|
127
|
+
},
|
|
128
|
+
"./react/recipes/balance-card": {
|
|
129
|
+
"types": "./react/dist/recipes/balance-card.d.ts",
|
|
130
|
+
"import": "./react/dist/recipes/balance-card.js"
|
|
131
|
+
},
|
|
132
|
+
"./react/recipes/trade-entry": {
|
|
133
|
+
"types": "./react/dist/recipes/trade-entry.d.ts",
|
|
134
|
+
"import": "./react/dist/recipes/trade-entry.js"
|
|
135
|
+
},
|
|
136
|
+
"./react/recipes/install-command": {
|
|
137
|
+
"types": "./react/dist/recipes/install-command.d.ts",
|
|
138
|
+
"import": "./react/dist/recipes/install-command.js"
|
|
139
|
+
},
|
|
140
|
+
"./react/recipes/code-window": {
|
|
141
|
+
"types": "./react/dist/recipes/code-window.d.ts",
|
|
142
|
+
"import": "./react/dist/recipes/code-window.js"
|
|
143
|
+
},
|
|
144
|
+
"./react/recipes/marketing-hero": {
|
|
145
|
+
"types": "./react/dist/recipes/marketing-hero.d.ts",
|
|
146
|
+
"import": "./react/dist/recipes/marketing-hero.js"
|
|
147
|
+
},
|
|
148
|
+
"./react/recipes/activity-list": {
|
|
149
|
+
"types": "./react/dist/recipes/activity-list.d.ts",
|
|
150
|
+
"import": "./react/dist/recipes/activity-list.js"
|
|
151
|
+
},
|
|
152
|
+
"./react/css": "./react/dist/styles.css",
|
|
153
|
+
"./react/css/base": "./react/dist/base.css",
|
|
154
|
+
"./react/animated-number": {
|
|
155
|
+
"types": "./react/dist/animated-number.d.ts",
|
|
156
|
+
"import": "./react/dist/animated-number.js"
|
|
157
|
+
},
|
|
158
|
+
"./react/gesture-sheet": {
|
|
159
|
+
"types": "./react/dist/gesture-sheet.d.ts",
|
|
160
|
+
"import": "./react/dist/gesture-sheet.js"
|
|
161
|
+
},
|
|
162
|
+
"./chart": {
|
|
163
|
+
"types": "./chart/dist/index.d.ts",
|
|
164
|
+
"import": "./chart/dist/index.js"
|
|
165
|
+
},
|
|
166
|
+
"./native/provider": {
|
|
167
|
+
"types": "./native/dist/provider.d.ts",
|
|
168
|
+
"import": "./native/dist/provider.js"
|
|
169
|
+
},
|
|
170
|
+
"./native/button": {
|
|
171
|
+
"types": "./native/dist/button.d.ts",
|
|
172
|
+
"import": "./native/dist/button.js"
|
|
173
|
+
},
|
|
174
|
+
"./native/surface": {
|
|
175
|
+
"types": "./native/dist/surface.d.ts",
|
|
176
|
+
"import": "./native/dist/surface.js"
|
|
177
|
+
},
|
|
178
|
+
"./native/field": {
|
|
179
|
+
"types": "./native/dist/field.d.ts",
|
|
180
|
+
"import": "./native/dist/field.js"
|
|
181
|
+
},
|
|
182
|
+
"./native/selection": {
|
|
183
|
+
"types": "./native/dist/selection.d.ts",
|
|
184
|
+
"import": "./native/dist/selection.js"
|
|
185
|
+
},
|
|
186
|
+
"./native/overlay": {
|
|
187
|
+
"types": "./native/dist/overlay.d.ts",
|
|
188
|
+
"import": "./native/dist/overlay.js"
|
|
189
|
+
},
|
|
190
|
+
"./native/navigation": {
|
|
191
|
+
"types": "./native/dist/navigation.d.ts",
|
|
192
|
+
"import": "./native/dist/navigation.js"
|
|
193
|
+
},
|
|
194
|
+
"./native/status": {
|
|
195
|
+
"types": "./native/dist/status.d.ts",
|
|
196
|
+
"import": "./native/dist/status.js"
|
|
197
|
+
},
|
|
198
|
+
"./native/data": {
|
|
199
|
+
"types": "./native/dist/data.d.ts",
|
|
200
|
+
"import": "./native/dist/data.js"
|
|
201
|
+
},
|
|
202
|
+
"./native/brand": {
|
|
203
|
+
"types": "./native/dist/brand.d.ts",
|
|
204
|
+
"import": "./native/dist/brand.js"
|
|
205
|
+
},
|
|
206
|
+
"./native/recipes": {
|
|
207
|
+
"types": "./native/dist/recipes.d.ts",
|
|
208
|
+
"import": "./native/dist/recipes.js"
|
|
209
|
+
},
|
|
210
|
+
"./native/switch": {
|
|
211
|
+
"types": "./native/dist/switch.d.ts",
|
|
212
|
+
"import": "./native/dist/switch.js"
|
|
213
|
+
},
|
|
214
|
+
"./native/checkbox": {
|
|
215
|
+
"types": "./native/dist/checkbox.d.ts",
|
|
216
|
+
"import": "./native/dist/checkbox.js"
|
|
217
|
+
},
|
|
218
|
+
"./native/radio-group": {
|
|
219
|
+
"types": "./native/dist/radio-group.d.ts",
|
|
220
|
+
"import": "./native/dist/radio-group.js"
|
|
221
|
+
},
|
|
222
|
+
"./native/select": {
|
|
223
|
+
"types": "./native/dist/select.d.ts",
|
|
224
|
+
"import": "./native/dist/select.js"
|
|
225
|
+
},
|
|
226
|
+
"./native/slider": {
|
|
227
|
+
"types": "./native/dist/slider.d.ts",
|
|
228
|
+
"import": "./native/dist/slider.js"
|
|
229
|
+
},
|
|
230
|
+
"./native/segmented-control": {
|
|
231
|
+
"types": "./native/dist/radio-group.d.ts",
|
|
232
|
+
"import": "./native/dist/radio-group.js"
|
|
233
|
+
},
|
|
234
|
+
"./native/gesture-sheet": {
|
|
235
|
+
"types": "./native/dist/gesture-sheet.d.ts",
|
|
236
|
+
"import": "./native/dist/gesture-sheet.js"
|
|
237
|
+
},
|
|
238
|
+
"./native/animated-number": {
|
|
239
|
+
"types": "./native/dist/animated-number.d.ts",
|
|
240
|
+
"import": "./native/dist/animated-number.js"
|
|
241
|
+
},
|
|
242
|
+
"./package.json": "./package.json"
|
|
243
|
+
},
|
|
244
|
+
"files": [
|
|
245
|
+
"README.md",
|
|
246
|
+
"LICENSE",
|
|
247
|
+
"tokens/dist",
|
|
248
|
+
"tokens/assets",
|
|
249
|
+
"tokens/README.md",
|
|
250
|
+
"contracts/dist",
|
|
251
|
+
"contracts/assets",
|
|
252
|
+
"contracts/README.md",
|
|
253
|
+
"native-fonts/dist",
|
|
254
|
+
"native-fonts/fonts",
|
|
255
|
+
"native-fonts/README.md",
|
|
256
|
+
"og-fonts/dist",
|
|
257
|
+
"og-fonts/fonts",
|
|
258
|
+
"og-fonts/README.md",
|
|
259
|
+
"feedback/dist",
|
|
260
|
+
"feedback/assets",
|
|
261
|
+
"feedback/README.md",
|
|
262
|
+
"react/dist",
|
|
263
|
+
"react/README.md",
|
|
264
|
+
"chart/dist",
|
|
265
|
+
"chart/README.md",
|
|
266
|
+
"native/dist",
|
|
267
|
+
"native/android/build.gradle",
|
|
268
|
+
"native/android/src",
|
|
269
|
+
"native/README.md"
|
|
270
|
+
],
|
|
271
|
+
"sideEffects": [
|
|
272
|
+
"**/*.css"
|
|
273
|
+
],
|
|
274
|
+
"peerDependencies": {
|
|
275
|
+
"react": "^19.1.0",
|
|
276
|
+
"@bloxwap/sfx": "^0.2.0",
|
|
277
|
+
"@bloxwap/haptic": "^0.2.0 || ^0.3.0",
|
|
278
|
+
"expo-audio": "~1.1.1 || ~55.0.18 || ~58.0.10",
|
|
279
|
+
"expo-haptics": "~15.0.7 || ~55.0.18 || ~58.0.7",
|
|
280
|
+
"react-dom": "^19.1.0",
|
|
281
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
282
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
283
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
284
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
285
|
+
"vaul": "^1.1.2",
|
|
286
|
+
"@bloxwap/chart": "^0.3.0",
|
|
287
|
+
"react-native": "^0.81.5 || ^0.83.10 || ^0.88.0",
|
|
288
|
+
"react-native-svg": "15.12.1 || 15.15.3 || 15.16.0",
|
|
289
|
+
"@react-native-community/slider": "5.0.1 || 5.1.2 || 5.2.1",
|
|
290
|
+
"react-native-safe-area-context": "~5.6.0 || ~5.10.1",
|
|
291
|
+
"@gorhom/bottom-sheet": "^5.2.14",
|
|
292
|
+
"react-native-reanimated": "^4.1.1",
|
|
293
|
+
"react-native-worklets": "^0.5.1 || ^0.7.4 || ^0.13.0",
|
|
294
|
+
"react-native-gesture-handler": "^2.28.0 || ^3.3.0"
|
|
295
|
+
},
|
|
296
|
+
"peerDependenciesMeta": {
|
|
297
|
+
"react": {
|
|
298
|
+
"optional": true
|
|
299
|
+
},
|
|
300
|
+
"@bloxwap/sfx": {
|
|
301
|
+
"optional": true
|
|
302
|
+
},
|
|
303
|
+
"@bloxwap/haptic": {
|
|
304
|
+
"optional": true
|
|
305
|
+
},
|
|
306
|
+
"expo-audio": {
|
|
307
|
+
"optional": true
|
|
308
|
+
},
|
|
309
|
+
"expo-haptics": {
|
|
310
|
+
"optional": true
|
|
311
|
+
},
|
|
312
|
+
"react-dom": {
|
|
313
|
+
"optional": true
|
|
314
|
+
},
|
|
315
|
+
"@radix-ui/react-dialog": {
|
|
316
|
+
"optional": true
|
|
317
|
+
},
|
|
318
|
+
"@radix-ui/react-dropdown-menu": {
|
|
319
|
+
"optional": true
|
|
320
|
+
},
|
|
321
|
+
"@radix-ui/react-popover": {
|
|
322
|
+
"optional": true
|
|
323
|
+
},
|
|
324
|
+
"@radix-ui/react-tooltip": {
|
|
325
|
+
"optional": true
|
|
326
|
+
},
|
|
327
|
+
"vaul": {
|
|
328
|
+
"optional": true
|
|
329
|
+
},
|
|
330
|
+
"react-native": {
|
|
331
|
+
"optional": true
|
|
332
|
+
},
|
|
333
|
+
"react-native-svg": {
|
|
334
|
+
"optional": true
|
|
335
|
+
},
|
|
336
|
+
"@react-native-community/slider": {
|
|
337
|
+
"optional": true
|
|
338
|
+
},
|
|
339
|
+
"react-native-safe-area-context": {
|
|
340
|
+
"optional": true
|
|
341
|
+
},
|
|
342
|
+
"@gorhom/bottom-sheet": {
|
|
343
|
+
"optional": true
|
|
344
|
+
},
|
|
345
|
+
"react-native-reanimated": {
|
|
346
|
+
"optional": true
|
|
347
|
+
},
|
|
348
|
+
"react-native-worklets": {
|
|
349
|
+
"optional": true
|
|
350
|
+
},
|
|
351
|
+
"react-native-gesture-handler": {
|
|
352
|
+
"optional": true
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"repository": {
|
|
356
|
+
"type": "git",
|
|
357
|
+
"url": "https://github.com/bloxwap/hig",
|
|
358
|
+
"directory": "packages/hig"
|
|
359
|
+
}
|
|
360
|
+
}
|
package/react/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @bloxwap/hig/react
|
|
2
|
+
|
|
3
|
+
Version 0.2.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
|
|
4
|
+
|
|
5
|
+
Set a brand accent with `<HIGProvider primaryColor='#ff0000'>` from
|
|
6
|
+
`@bloxwap/hig/react/provider`. It accepts opaque sRGB hex (`#RGB` or `#RRGGBB`),
|
|
7
|
+
sets action/focus colours, and selects black or white text on primary fills.
|
|
8
|
+
Omit it to keep Bloxwap green. Nested providers inherit the accent.
|
|
9
|
+
Status and buy/sell colours stay independent. See [the colour guide](../../../docs/foundations/platform.md#primary-brand-colour).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AnimatedNumberToken {
|
|
2
|
+
key: string;
|
|
3
|
+
text: string;
|
|
4
|
+
digit: boolean;
|
|
5
|
+
value?: number;
|
|
6
|
+
place?: number;
|
|
7
|
+
section?: 'number' | 'exponent';
|
|
8
|
+
}
|
|
9
|
+
export interface AnimatedNumberModel {
|
|
10
|
+
reading: string;
|
|
11
|
+
tokens: readonly AnimatedNumberToken[];
|
|
12
|
+
animatable: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AnimatedNumberTransitionToken extends AnimatedNumberToken {
|
|
15
|
+
oldText?: string;
|
|
16
|
+
oldValue?: number;
|
|
17
|
+
changed: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function createAnimatedNumberModel(value: number | null | undefined, locale: string, options?: Intl.NumberFormatOptions): AnimatedNumberModel;
|
|
20
|
+
export declare function createAnimatedNumberTransitions(previous: AnimatedNumberModel | null, next: AnimatedNumberModel): readonly AnimatedNumberTransitionToken[];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const staticModel = (reading) => ({ reading, animatable: false, tokens: [{ key: 'static:0', text: reading, digit: false }] });
|
|
2
|
+
function digitsFor(formatter) {
|
|
3
|
+
const resolved = formatter.resolvedOptions();
|
|
4
|
+
const digitFormatter = new Intl.NumberFormat(resolved.locale, { numberingSystem: resolved.numberingSystem, useGrouping: false });
|
|
5
|
+
const glyphs = Array.from({ length: 10 }, (_, digit) => { const text = digitFormatter.format(digit); const parts = digitFormatter.formatToParts(digit); return parts.length === 1 && parts[0].type === 'integer' && parts[0].value === text ? text : ''; });
|
|
6
|
+
return new Set(glyphs).size === 10 && glyphs.every(Boolean) ? glyphs : null;
|
|
7
|
+
}
|
|
8
|
+
function decodeDigits(text, glyphs) {
|
|
9
|
+
const digits = [];
|
|
10
|
+
let offset = 0;
|
|
11
|
+
while (offset < text.length) {
|
|
12
|
+
let match = -1;
|
|
13
|
+
for (let digit = 0; digit < 10; digit++)
|
|
14
|
+
if (text.startsWith(glyphs[digit], offset) && (match < 0 || glyphs[digit].length > glyphs[match].length))
|
|
15
|
+
match = digit;
|
|
16
|
+
if (match < 0)
|
|
17
|
+
return null;
|
|
18
|
+
digits.push({ text: glyphs[match], value: match });
|
|
19
|
+
offset += glyphs[match].length;
|
|
20
|
+
}
|
|
21
|
+
return digits.length ? digits : null;
|
|
22
|
+
}
|
|
23
|
+
export function createAnimatedNumberModel(value, locale, options) {
|
|
24
|
+
if (value == null || !Number.isFinite(value))
|
|
25
|
+
return staticModel('—');
|
|
26
|
+
const formatter = new Intl.NumberFormat(locale, options), reading = formatter.format(value);
|
|
27
|
+
if (Number.isInteger(value) && !Number.isSafeInteger(value))
|
|
28
|
+
return staticModel(reading);
|
|
29
|
+
const parts = formatter.formatToParts(value);
|
|
30
|
+
if (parts.map(part => part.value).join('') !== reading)
|
|
31
|
+
return staticModel(reading);
|
|
32
|
+
const glyphs = digitsFor(formatter);
|
|
33
|
+
if (!glyphs)
|
|
34
|
+
return staticModel(reading);
|
|
35
|
+
const decoded = parts.map(part => part.type === 'integer' || part.type === 'fraction' || part.type === 'exponentInteger' ? decodeDigits(part.value, glyphs) : null);
|
|
36
|
+
if (decoded.some((digits, index) => !digits && (parts[index].type === 'integer' || parts[index].type === 'fraction' || parts[index].type === 'exponentInteger')))
|
|
37
|
+
return staticModel(reading);
|
|
38
|
+
const count = (type) => decoded.reduce((total, digits, index) => total + (parts[index].type === type ? digits?.length ?? 0 : 0), 0);
|
|
39
|
+
const integerCount = count('integer'), exponentCount = count('exponentInteger');
|
|
40
|
+
let integerIndex = 0, fractionIndex = 0, exponentIndex = 0;
|
|
41
|
+
const tokens = [];
|
|
42
|
+
for (let index = 0; index < parts.length; index++) {
|
|
43
|
+
const part = parts[index], digits = decoded[index];
|
|
44
|
+
if (!digits) {
|
|
45
|
+
tokens.push({ key: `literal:${index}`, text: part.value, digit: false });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const section = part.type === 'exponentInteger' ? 'exponent' : 'number';
|
|
49
|
+
for (const digit of digits) {
|
|
50
|
+
let place;
|
|
51
|
+
if (part.type === 'integer')
|
|
52
|
+
place = integerCount - integerIndex++ - 1;
|
|
53
|
+
else if (part.type === 'fraction')
|
|
54
|
+
place = --fractionIndex;
|
|
55
|
+
else
|
|
56
|
+
place = exponentCount - exponentIndex++ - 1;
|
|
57
|
+
tokens.push({ key: `digit:${section}:${place}`, text: digit.text, digit: true, value: digit.value, place, section });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return tokens.some(token => token.digit) ? { reading, tokens, animatable: true } : staticModel(reading);
|
|
61
|
+
}
|
|
62
|
+
export function createAnimatedNumberTransitions(previous, next) {
|
|
63
|
+
if (!previous?.animatable || !next.animatable)
|
|
64
|
+
return next.tokens.map(token => ({ ...token, changed: false }));
|
|
65
|
+
const oldDigits = new Map(previous.tokens.filter(token => token.digit).map(token => [token.key, token]));
|
|
66
|
+
const nextDigits = new Set(next.tokens.filter(token => token.digit).map(token => token.key));
|
|
67
|
+
const result = next.tokens.map(token => { const old = token.digit ? oldDigits.get(token.key) : undefined; return { ...token, oldText: old && old.text !== token.text ? old.text : undefined, oldValue: old?.value, changed: token.digit && old?.text !== token.text }; });
|
|
68
|
+
for (let index = 0; index < previous.tokens.length; index++) {
|
|
69
|
+
const old = previous.tokens[index];
|
|
70
|
+
if (!old.digit || nextDigits.has(old.key))
|
|
71
|
+
continue;
|
|
72
|
+
let insertion = -1;
|
|
73
|
+
for (let nextIndex = index + 1; nextIndex < previous.tokens.length; nextIndex++) {
|
|
74
|
+
const anchor = result.findIndex(token => token.key === previous.tokens[nextIndex].key);
|
|
75
|
+
if (anchor >= 0) {
|
|
76
|
+
insertion = anchor;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (insertion < 0)
|
|
81
|
+
for (let nextIndex = index - 1; nextIndex >= 0; nextIndex--) {
|
|
82
|
+
const anchor = result.findIndex(token => token.key === previous.tokens[nextIndex].key);
|
|
83
|
+
if (anchor >= 0) {
|
|
84
|
+
insertion = anchor + 1;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (insertion >= 0)
|
|
89
|
+
result.splice(insertion, 0, { ...old, text: '', oldText: old.text, changed: true });
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type NumberProps } from './data.js';
|
|
3
|
+
export type AnimatedNumberTrend = -1 | 0 | 1 | ((oldValue: number, newValue: number) => -1 | 0 | 1);
|
|
4
|
+
export interface AnimatedNumberProps extends NumberProps {
|
|
5
|
+
duration?: number;
|
|
6
|
+
trend?: AnimatedNumberTrend;
|
|
7
|
+
}
|
|
8
|
+
export declare function AnimatedNumberReadout({ duration, trend, ...props }: AnimatedNumberProps): React.JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { createAnimatedNumberModel, createAnimatedNumberTransitions } from './animated-number-model.js';
|
|
5
|
+
import { useHIG } from './provider.js';
|
|
6
|
+
import * as en from '@bloxwap/hig/contracts/messages';
|
|
7
|
+
export function AnimatedNumberReadout({ duration = 180, trend, ...props }) {
|
|
8
|
+
const { locale, direction, reducedMotion, messages } = useHIG();
|
|
9
|
+
const element = useRef(null);
|
|
10
|
+
const previous = useRef(null);
|
|
11
|
+
const generation = useRef(0);
|
|
12
|
+
const active = useRef([]);
|
|
13
|
+
const signature = JSON.stringify([locale, direction, props.options ?? {}]);
|
|
14
|
+
const frame = useMemo(() => {
|
|
15
|
+
const model = createAnimatedNumberModel(props.value, locale, props.options), prior = previous.current, changed = !!prior && prior.signature === signature && !Object.is(prior.value, props.value);
|
|
16
|
+
let movement = 0;
|
|
17
|
+
if (changed && prior && model.animatable && prior.model.animatable && Number.isFinite(prior.value) && Number.isFinite(props.value)) {
|
|
18
|
+
const requested = typeof trend === 'function' ? trend(prior.value, props.value) : trend ?? Math.sign(props.value - prior.value);
|
|
19
|
+
movement = requested === -1 || requested === 1 ? requested : 0;
|
|
20
|
+
}
|
|
21
|
+
return { model, changed, movement, tokens: createAnimatedNumberTransitions(changed ? prior?.model ?? null : null, model) };
|
|
22
|
+
}, [props.value, signature]);
|
|
23
|
+
const [settled, setSettled] = useState(null);
|
|
24
|
+
const known = props.value != null && Number.isFinite(props.value), reading = known ? `${props.prefix ?? ''}${frame.model.reading}${props.suffix ?? ''}` : frame.model.reading, staleText = messages.stale ?? en.stale, accessible = `${props.label ? `${props.label}: ` : ''}${reading}${props.stale ? ` ${staleText}` : ''}`;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const id = ++generation.current;
|
|
27
|
+
const cancel = () => { const running = active.current; active.current = []; for (const animation of running) {
|
|
28
|
+
animation.onfinish = null;
|
|
29
|
+
animation.cancel();
|
|
30
|
+
} };
|
|
31
|
+
cancel();
|
|
32
|
+
previous.current = { value: props.value, signature, model: frame.model };
|
|
33
|
+
if (!frame.changed)
|
|
34
|
+
return;
|
|
35
|
+
if (reducedMotion || !Number.isFinite(duration) || duration <= 0 || !frame.model.animatable) {
|
|
36
|
+
setSettled(frame);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const places = element.current?.querySelectorAll('[data-hig-animated-number-change]');
|
|
40
|
+
if (!places) {
|
|
41
|
+
setSettled(frame);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const created = [], changes = frame.tokens.filter(token => token.changed);
|
|
45
|
+
for (const [index, place] of Array.from(places).entries()) {
|
|
46
|
+
const token = changes[index], movement = frame.movement || (token?.value !== undefined && token.oldValue !== undefined ? token.value > token.oldValue ? 1 : token.value < token.oldValue ? -1 : 0 : 0), old = place.querySelector('.hig-animated-number-old'), next = place.querySelector('.hig-animated-number-new'), timing = { duration: Math.min(duration, 600), easing: 'ease-out', fill: 'forwards' };
|
|
47
|
+
const oldFrames = movement === 0 ? [{ opacity: 1 }, { opacity: 0 }] : [{ opacity: 1, transform: 'translateY(0%)' }, { opacity: 0, transform: `translateY(${-movement * 100}%)` }];
|
|
48
|
+
const newFrames = movement === 0 ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 0, transform: `translateY(${movement * 100}%)` }, { opacity: 1, transform: 'translateY(0%)' }];
|
|
49
|
+
const oldAnimation = old?.animate?.(oldFrames, timing), newAnimation = next?.animate?.(newFrames, timing);
|
|
50
|
+
if (oldAnimation)
|
|
51
|
+
created.push(oldAnimation);
|
|
52
|
+
if (newAnimation)
|
|
53
|
+
created.push(newAnimation);
|
|
54
|
+
}
|
|
55
|
+
active.current = created;
|
|
56
|
+
if (!created.length) {
|
|
57
|
+
setSettled(frame);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let remaining = created.length;
|
|
61
|
+
for (const animation of created)
|
|
62
|
+
animation.onfinish = () => { if (generation.current === id && --remaining === 0) {
|
|
63
|
+
active.current = [];
|
|
64
|
+
setSettled(frame);
|
|
65
|
+
} };
|
|
66
|
+
return () => { if (generation.current === id)
|
|
67
|
+
cancel(); };
|
|
68
|
+
}, [frame, reducedMotion, duration]);
|
|
69
|
+
const tokens = settled === frame || reducedMotion ? createAnimatedNumberTransitions(null, frame.model) : frame.tokens;
|
|
70
|
+
return _jsxs("span", { className: 'hig-number', children: [_jsx("span", { className: 'hig-sr-only', "aria-label": props.label ? accessible : undefined, children: accessible }), _jsxs("span", { ref: element, className: 'hig-animated-number-visual', "aria-hidden": 'true', dir: direction, children: [known && props.prefix, tokens.map(token => token.changed ? _jsxs("span", { className: 'hig-animated-number-place', "data-hig-animated-number-change": true, children: [token.oldText !== undefined && _jsx("span", { className: 'hig-animated-number-old', children: token.oldText }), token.text && _jsx("span", { className: 'hig-animated-number-new', children: token.text })] }, token.key) : _jsx("span", { children: token.text }, token.key)), known && props.suffix, props.stale && _jsxs("span", { children: [" ", staleText] })] })] });
|
|
71
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* Opt-in global base for hosts that want HIG defaults on every element, not only HIG components (#95):
|
|
2
|
+
import '@bloxwap/hig/react/css/base' next to '@bloxwap/hig/react/css'. These are the page-wide rules
|
|
3
|
+
that @bloxwap/hig/react/css shipped before it was scoped to HIG classes. Partial adopters that load
|
|
4
|
+
HIG on some routes only should not import this file. */
|
|
5
|
+
* { box-sizing: border-box; }
|
|
6
|
+
:focus-visible { outline:2px solid var(--hig-focus);outline-offset:3px; }
|
|
7
|
+
table { border-collapse:collapse;width:100%; }
|
|
8
|
+
th,td { padding:12px;text-align:start;border-bottom:1px solid var(--hig-border); }
|
|
9
|
+
input[type='range'] { accent-color:var(--hig-action); min-height:48px; width:100%; }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Exact approved geometry from pinned Font docs mark; metadata lives in SVG asset. */
|
|
3
|
+
export declare function BrandMark({ size, label }: {
|
|
4
|
+
size?: number;
|
|
5
|
+
label?: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export declare function CheckIcon(): React.JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** Exact approved geometry from pinned Font docs mark; metadata lives in SVG asset. */
|
|
3
|
+
export function BrandMark({ size = 32, label }) { return _jsxs("svg", { width: size, height: size, viewBox: '0 0 100 100', role: label ? 'img' : undefined, "aria-label": label, "aria-hidden": label ? undefined : true, children: [_jsx("rect", { width: '100', height: '100', rx: '22.37', fill: '#00ff3f' }), _jsxs("g", { fill: 'none', stroke: '#0a0a0a', strokeWidth: '16', strokeLinecap: 'round', children: [_jsx("path", { d: 'M25 75L75 25' }), _jsx("path", { d: 'M24 24L35 35' }), _jsx("path", { d: 'M65 65L76 76' })] })] }); }
|
|
4
|
+
export function CheckIcon() { return _jsx("svg", { width: '20', height: '20', viewBox: '0 0 24 24', "aria-hidden": 'true', children: _jsx("path", { d: 'm5 12 4 4 10-10', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }); }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Intent } from '@bloxwap/hig/contracts';
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
intent?: Intent;
|
|
5
|
+
busy?: boolean; /** Busy suffix for this button; defaults to HIGProvider `messages.busy`. `''` hides it (busy state stays exposed). */
|
|
6
|
+
busyLabel?: string;
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
suppressFeedback?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export declare const IconButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "aria-label"> & {
|
|
12
|
+
label: string;
|
|
13
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export declare const Link: React.ForwardRefExoticComponent<React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId, useRef } from 'react';
|
|
4
|
+
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
|
+
import { useHIG } from './provider.js';
|
|
6
|
+
export const Button = forwardRef(function Button({ intent = 'primary', busy = false, busyLabel, disabled, fullWidth, suppressFeedback, onClick, children, type = 'button', ...props }, ref) {
|
|
7
|
+
const context = useHIG();
|
|
8
|
+
const id = useId();
|
|
9
|
+
const sequence = useRef(0);
|
|
10
|
+
const busyText = busyLabel ?? context.messages.busy ?? en.busy;
|
|
11
|
+
return _jsxs("button", { ...props, ref: ref, type: type, className: `hig-button ${props.className ?? ''}`, "data-intent": intent, "data-full": fullWidth || undefined, "data-density": context.density, disabled: disabled || busy, "aria-busy": busy || undefined, onClick: e => { e.stopPropagation(); onClick?.(e); if (!e.defaultPrevented && !disabled && !busy && !suppressFeedback) {
|
|
12
|
+
try {
|
|
13
|
+
context.onAccepted?.(id);
|
|
14
|
+
context.feedback?.emit({ id: `${id}/${++sequence.current}`, source: id, intent: 'activate', origin: e.detail === 0 ? 'keyboard' : 'pointer' });
|
|
15
|
+
}
|
|
16
|
+
catch { /* Optional feedback cannot alter the action. */ }
|
|
17
|
+
} }, children: [children, busy && busyText ? _jsxs("span", { role: 'status', className: 'hig-busy', children: [" \u00B7 ", busyText] }) : null] });
|
|
18
|
+
});
|
|
19
|
+
export const IconButton = forwardRef(function IconButton({ label, children, className, ...props }, ref) { return _jsx(Button, { ...props, ref: ref, className: `hig-icon-button ${className ?? ''}`, "aria-label": label, children: _jsx("span", { "aria-hidden": 'true', children: children }) }); });
|
|
20
|
+
export const Link = forwardRef(function Link(props, ref) { return _jsx("a", { ...props, ref: ref, className: `hig-link ${props.className ?? ''}` }); });
|