@charmland/gem 0.0.0-stage → 0.1.1

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 (121) hide show
  1. package/LICENSE +177 -0
  2. package/NOTICE +13 -0
  3. package/README.md +24 -2
  4. package/assets/fonts/Hypography-Italic.woff2 +0 -0
  5. package/assets/fonts/Hypography-Regular.woff2 +0 -0
  6. package/assets/fonts/PPFraktionMono-Variable.ttf +0 -0
  7. package/assets/fonts/PPFraktionMonoItalic-Variable.ttf +0 -0
  8. package/assets/fonts/PPFraktionSans-Variable.ttf +0 -0
  9. package/assets/fonts/PPFraktionSansItalic-Variable.ttf +0 -0
  10. package/bin/gem-elm.js +3 -0
  11. package/dist/browser/boot.d.ts +10 -0
  12. package/dist/browser/boot.js +14 -0
  13. package/dist/browser/color-scheme.d.ts +9 -0
  14. package/dist/browser/color-scheme.js +76 -0
  15. package/dist/browser/ports.d.ts +37 -0
  16. package/dist/browser/ports.js +90 -0
  17. package/dist/browser/router.d.ts +5 -0
  18. package/dist/browser/router.js +35 -0
  19. package/dist/browser/runtime.d.ts +12 -0
  20. package/dist/browser/runtime.js +22 -0
  21. package/dist/browser/tabs.d.ts +9 -0
  22. package/dist/browser/tabs.js +69 -0
  23. package/dist/default/theme.css +4664 -0
  24. package/dist/default/theme.js +13815 -0
  25. package/dist/node/build.d.ts +16 -0
  26. package/dist/node/build.js +48 -0
  27. package/dist/node/cli.d.ts +2 -0
  28. package/dist/node/cli.js +21 -0
  29. package/elm.json +28 -0
  30. package/package.json +86 -4
  31. package/src/app/Gem/App.elm +1268 -0
  32. package/src/app/Gem/CharmSticker.elm +35 -0
  33. package/src/app/Gem/Components.elm +292 -0
  34. package/src/app/Gem/Main.elm +17 -0
  35. package/src/app/Gem/Ports.elm +32 -0
  36. package/src/app/Gem/Shell.elm +957 -0
  37. package/src/browser/theme.d.ts +1 -0
  38. package/src/core/Gem/Node.elm +219 -0
  39. package/src/core/Gem/Page.elm +560 -0
  40. package/src/core/Gem/Render.elm +510 -0
  41. package/src/core/Gem/Slots.elm +11 -0
  42. package/src/styles/docs.scss +1083 -0
  43. package/src/styles/fonts.scss +51 -0
  44. package/src/styles/gem.scss +362 -0
  45. package/src/styles/theme.scss +8 -0
  46. package/src/styles/ui/burger.scss +272 -0
  47. package/src/styles/ui/button.scss +350 -0
  48. package/src/styles/ui/charmtone.scss +70 -0
  49. package/src/styles/ui/controls-extra.scss +316 -0
  50. package/src/styles/ui/controls.scss +110 -0
  51. package/src/styles/ui/display.scss +359 -0
  52. package/src/styles/ui/dropdown.scss +341 -0
  53. package/src/styles/ui/form.scss +314 -0
  54. package/src/styles/ui/menu.scss +200 -0
  55. package/src/styles/ui/meter.scss +124 -0
  56. package/src/styles/ui/modal.scss +545 -0
  57. package/src/styles/ui/oauth.scss +50 -0
  58. package/src/styles/ui/page-nav.scss +63 -0
  59. package/src/styles/ui/reset.scss +111 -0
  60. package/src/styles/ui/scrollbar.scss +39 -0
  61. package/src/styles/ui/search.scss +164 -0
  62. package/src/styles/ui/sidebar.scss +229 -0
  63. package/src/styles/ui/squircle.scss +60 -0
  64. package/src/styles/ui/table.scss +97 -0
  65. package/src/styles/ui/theme.scss +132 -0
  66. package/src/styles/ui/toast.scss +587 -0
  67. package/src/styles/ui/toc.scss +128 -0
  68. package/src/styles/ui/typography.scss +21 -0
  69. package/src/styles/ui/ui.scss +33 -0
  70. package/src/ui/Ui/Badge.elm +51 -0
  71. package/src/ui/Ui/Banner.elm +97 -0
  72. package/src/ui/Ui/Burger.elm +259 -0
  73. package/src/ui/Ui/Button.elm +261 -0
  74. package/src/ui/Ui/Card.elm +32 -0
  75. package/src/ui/Ui/Cards.elm +15 -0
  76. package/src/ui/Ui/ChoiceGroup.elm +62 -0
  77. package/src/ui/Ui/CopyButton.elm +139 -0
  78. package/src/ui/Ui/Divider.elm +16 -0
  79. package/src/ui/Ui/Dropdown.elm +600 -0
  80. package/src/ui/Ui/Empty.elm +41 -0
  81. package/src/ui/Ui/ErrorBubble.elm +34 -0
  82. package/src/ui/Ui/Field.elm +45 -0
  83. package/src/ui/Ui/FormStatus.elm +32 -0
  84. package/src/ui/Ui/Icon.elm +381 -0
  85. package/src/ui/Ui/InlineForm.elm +51 -0
  86. package/src/ui/Ui/Input.elm +113 -0
  87. package/src/ui/Ui/KeyValue.elm +25 -0
  88. package/src/ui/Ui/ListRow.elm +67 -0
  89. package/src/ui/Ui/Loader.elm +32 -0
  90. package/src/ui/Ui/Logo/Charm.elm +21 -0
  91. package/src/ui/Ui/Logo/CharmMark.elm +32 -0
  92. package/src/ui/Ui/Logo/CharmSticker.elm +35 -0
  93. package/src/ui/Ui/Logo/Discord.elm +26 -0
  94. package/src/ui/Ui/Logo/GitHub.elm +21 -0
  95. package/src/ui/Ui/Logo/Google.elm +21 -0
  96. package/src/ui/Ui/Logo/Hexy.elm +29 -0
  97. package/src/ui/Ui/Logo/Hyper.elm +42 -0
  98. package/src/ui/Ui/Logo/Integration.elm +117 -0
  99. package/src/ui/Ui/Logo/Prism.elm +35 -0
  100. package/src/ui/Ui/Logos.elm +115 -0
  101. package/src/ui/Ui/Menu.elm +348 -0
  102. package/src/ui/Ui/Meter.elm +132 -0
  103. package/src/ui/Ui/Modal.elm +247 -0
  104. package/src/ui/Ui/Motion.elm +32 -0
  105. package/src/ui/Ui/NumberBox.elm +86 -0
  106. package/src/ui/Ui/OAuthButton.elm +39 -0
  107. package/src/ui/Ui/PageNav.elm +65 -0
  108. package/src/ui/Ui/Pager.elm +49 -0
  109. package/src/ui/Ui/Search.elm +396 -0
  110. package/src/ui/Ui/SearchBox.elm +78 -0
  111. package/src/ui/Ui/Section.elm +21 -0
  112. package/src/ui/Ui/Sidebar.elm +239 -0
  113. package/src/ui/Ui/Stat.elm +29 -0
  114. package/src/ui/Ui/Switch.elm +34 -0
  115. package/src/ui/Ui/Table.elm +89 -0
  116. package/src/ui/Ui/Tabs.elm +280 -0
  117. package/src/ui/Ui/ToC.elm +120 -0
  118. package/src/ui/Ui/Toast.elm +1145 -0
  119. package/src/ui/Ui/Toolbar.elm +31 -0
  120. package/src/ui/Ui/TwoStepConfirm.elm +159 -0
  121. package/src/ui/Ui/Typography.elm +33 -0
@@ -0,0 +1,32 @@
1
+ module Ui.FormStatus exposing (error, notice, success)
2
+
3
+ {-| Form status lines: the single-line verdicts under a form or a
4
+ page-level action. `error` for validation and request failures,
5
+ `success` for confirmation ("Sent."), `notice` for warnings that
6
+ aren't failures ("3 of 5 invites failed").
7
+ -}
8
+
9
+ import Html exposing (Html, p, text)
10
+ import Html.Attributes
11
+
12
+
13
+ {-| An inline error: "Key name is required."
14
+ -}
15
+ error : String -> Html msg
16
+ error message =
17
+ p [ Html.Attributes.class "error" ] [ text message ]
18
+
19
+
20
+ {-| A success line: "Sent."
21
+ -}
22
+ success : String -> Html msg
23
+ success message =
24
+ p [ Html.Attributes.class "sent" ] [ text message ]
25
+
26
+
27
+ {-| A warning that isn't a failure, rendered like the action-level
28
+ error banner copy but in the warning tone.
29
+ -}
30
+ notice : String -> Html msg
31
+ notice message =
32
+ p [ Html.Attributes.class "action-error" ] [ text message ]
@@ -0,0 +1,381 @@
1
+ module Ui.Icon exposing
2
+ ( Icon(..)
3
+ , view
4
+ , viewSize
5
+ )
6
+
7
+ {-| The house icon set. Every glyph is an inline SVG stroked or filled
8
+ with `currentColor`, so it picks up the surrounding text color and
9
+ tracks component states (hover, selected, severity) without props.
10
+
11
+ `view` renders an icon at its natural size; `viewSize` renders it at
12
+ an explicit pixel size. Brand marks are assets, not icons: they live in
13
+ `Ui.Logo.*`.
14
+
15
+ -}
16
+
17
+ import Html exposing (Html)
18
+ import Svg exposing (circle, path, rect, svg)
19
+ import Svg.Attributes exposing (class, cx, cy, d, fill, height, r, rx, stroke, strokeLinecap, strokeLinejoin, strokeWidth, viewBox, width, x, y)
20
+
21
+
22
+ {-| Every glyph the library ships. Constructors are stable names; the
23
+ `view` function owns the geometry, so an icon can be redesigned without
24
+ touching call sites.
25
+ -}
26
+ type Icon
27
+ = Clear
28
+ | Chevron
29
+ | Close
30
+ | Check
31
+ | Copy
32
+ | ExternalLink
33
+ | List
34
+ | Table
35
+ | Reasoning
36
+ | Vision
37
+ | CreditCard
38
+ | ErrorTail
39
+ | ToastSuccess
40
+ | ToastInfo
41
+ | ToastWarn
42
+ | ToastError
43
+ | ArrowLeft
44
+ | Search
45
+ | Burst
46
+
47
+
48
+ {-| Render an icon at its natural size, sized by the surrounding CSS
49
+ where a component wants a different one.
50
+ -}
51
+ view : Icon -> Html msg
52
+ view icon =
53
+ case icon of
54
+ Clear ->
55
+ clear (width "24") (height "24")
56
+
57
+ Chevron ->
58
+ chevron (width "24") (height "24")
59
+
60
+ Close ->
61
+ close (width "24") (height "24")
62
+
63
+ Check ->
64
+ check (width "24") (height "24")
65
+
66
+ Copy ->
67
+ copy (width "24") (height "24")
68
+
69
+ ExternalLink ->
70
+ externalLink (width "24") (height "24")
71
+
72
+ List ->
73
+ list (width "24") (height "24")
74
+
75
+ Table ->
76
+ table (width "24") (height "24")
77
+
78
+ Reasoning ->
79
+ reasoning (width "24") (height "24")
80
+
81
+ Vision ->
82
+ vision (width "24") (height "24")
83
+
84
+ CreditCard ->
85
+ creditCard (width "24") (height "24")
86
+
87
+ ErrorTail ->
88
+ errorTail (width "77") (height "77")
89
+
90
+ ToastSuccess ->
91
+ toastSuccess (width "24") (height "24")
92
+
93
+ ToastInfo ->
94
+ toastInfo (width "24") (height "24")
95
+
96
+ ToastWarn ->
97
+ toastWarn (width "24") (height "24")
98
+
99
+ ToastError ->
100
+ toastError (width "24") (height "24")
101
+
102
+ ArrowLeft ->
103
+ arrowLeft (width "24") (height "24")
104
+
105
+ Search ->
106
+ search (width "24") (height "24")
107
+
108
+ Burst ->
109
+ burst (width "24")
110
+
111
+
112
+ {-| Render an icon at an explicit pixel size on both axes.
113
+ -}
114
+ viewSize : Int -> Icon -> Html msg
115
+ viewSize px icon =
116
+ let
117
+ size =
118
+ width (String.fromInt px)
119
+
120
+ sizeHeight =
121
+ height (String.fromInt px)
122
+ in
123
+ case icon of
124
+ Clear ->
125
+ clear size sizeHeight
126
+
127
+ Chevron ->
128
+ chevron size sizeHeight
129
+
130
+ Close ->
131
+ close size sizeHeight
132
+
133
+ Check ->
134
+ check size sizeHeight
135
+
136
+ Copy ->
137
+ copy size sizeHeight
138
+
139
+ ExternalLink ->
140
+ externalLink size sizeHeight
141
+
142
+ List ->
143
+ list size sizeHeight
144
+
145
+ Table ->
146
+ table size sizeHeight
147
+
148
+ Reasoning ->
149
+ reasoning size sizeHeight
150
+
151
+ Vision ->
152
+ vision size sizeHeight
153
+
154
+ CreditCard ->
155
+ creditCard size sizeHeight
156
+
157
+ ErrorTail ->
158
+ errorTail size sizeHeight
159
+
160
+ ToastSuccess ->
161
+ toastSuccess size sizeHeight
162
+
163
+ ToastInfo ->
164
+ toastInfo size sizeHeight
165
+
166
+ ToastWarn ->
167
+ toastWarn size sizeHeight
168
+
169
+ ToastError ->
170
+ toastError size sizeHeight
171
+
172
+ ArrowLeft ->
173
+ arrowLeft size sizeHeight
174
+
175
+ Search ->
176
+ search size sizeHeight
177
+
178
+ Burst ->
179
+ burst size
180
+
181
+
182
+ stroked : List (Html.Attribute msg) -> String -> List (Svg.Svg msg) -> Html msg
183
+ stroked attributes box children =
184
+ svg
185
+ ([ fill "none"
186
+ , stroke "currentColor"
187
+ , strokeLinecap "round"
188
+ , strokeLinejoin "round"
189
+ , strokeWidth "2"
190
+ , viewBox box
191
+ ]
192
+ ++ attributes
193
+ )
194
+ children
195
+
196
+
197
+ clear : Html.Attribute msg -> Html.Attribute msg -> Html msg
198
+ clear w h =
199
+ stroked
200
+ [ class "clear-icon", w, h ]
201
+ "0 0 24 24"
202
+ [ circle [ cx "12", cy "12", r "10" ] []
203
+ , path [ d "M16 8 8 16" ] []
204
+ , path [ d "M8 8l8 8" ] []
205
+ ]
206
+
207
+
208
+ chevron : Html.Attribute msg -> Html.Attribute msg -> Html msg
209
+ chevron w h =
210
+ stroked
211
+ [ class "chevron", w, h ]
212
+ "0 0 24 24"
213
+ [ path [ d "M6.3 8.9 12 14.6 17.7 8.9" ] [] ]
214
+
215
+
216
+ close : Html.Attribute msg -> Html.Attribute msg -> Html msg
217
+ close w h =
218
+ stroked
219
+ [ class "close-icon", w, h ]
220
+ "0 0 24 24"
221
+ [ path [ d "M17.7 6.3 6.3 17.7" ] []
222
+ , path [ d "M6.3 6.3 17.7 17.7" ] []
223
+ ]
224
+
225
+
226
+ check : Html.Attribute msg -> Html.Attribute msg -> Html msg
227
+ check w h =
228
+ stroked
229
+ [ class "check-icon", w, h ]
230
+ "0 0 24 24"
231
+ [ path [ d "M4.3 10.9 10 16.6 19.9 6.7" ] [] ]
232
+
233
+
234
+ search : Html.Attribute msg -> Html.Attribute msg -> Html msg
235
+ search w h =
236
+ stroked
237
+ [ class "search-icon", w, h ]
238
+ "0 0 24 24"
239
+ [ circle [ cx "10.5", cy "10.5", r "6.5" ] []
240
+ , path [ d "M15.5 15.5 21 21" ] []
241
+ ]
242
+
243
+
244
+ copy : Html.Attribute msg -> Html.Attribute msg -> Html msg
245
+ copy w h =
246
+ svg
247
+ [ class "copy-icon", w, h, fill "currentColor", viewBox "0 0 24 24" ]
248
+ [ path
249
+ [ d "M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM5.00242 8L5.00019 20H14.9998V8H5.00242ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z" ]
250
+ []
251
+ ]
252
+
253
+
254
+ externalLink : Html.Attribute msg -> Html.Attribute msg -> Html msg
255
+ externalLink w h =
256
+ stroked
257
+ [ class "external-link-icon", w, h ]
258
+ "0 0 24 24"
259
+ [ path [ d "M10 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-4" ] []
260
+ , path [ d "M14 4h6v6" ] []
261
+ , path [ d "M10.5 13.5 20 4" ] []
262
+ ]
263
+
264
+
265
+ list : Html.Attribute msg -> Html.Attribute msg -> Html msg
266
+ list w h =
267
+ stroked
268
+ [ class "list-icon", w, h ]
269
+ "0 0 24 24"
270
+ [ path [ d "M4.5 5h.01M4.5 12h.01M4.5 19h.01M8 5h13M8 12h13M8 19h13" ] [] ]
271
+
272
+
273
+ table : Html.Attribute msg -> Html.Attribute msg -> Html msg
274
+ table w h =
275
+ stroked
276
+ [ class "table-icon", w, h ]
277
+ "0 0 24 24"
278
+ [ rect [ x "3", y "4", width "18", height "16", rx "2" ] []
279
+ , path [ d "M4 8h16" ] []
280
+ , path [ d "M9 8v11" ] []
281
+ , path [ d "M15 8v11" ] []
282
+ ]
283
+
284
+
285
+ reasoning : Html.Attribute msg -> Html.Attribute msg -> Html msg
286
+ reasoning w h =
287
+ stroked
288
+ [ class "reasoning-icon", w, h ]
289
+ "0 0 24 24"
290
+ [ path
291
+ [ d "M12 4c.8 4.4 3.2 6.8 7.6 7.6-4.4.8-6.8 3.2-7.6 7.6-.8-4.4-3.2-6.8-7.6-7.6C8.8 10.8 11.2 8.4 12 4Z" ]
292
+ []
293
+ ]
294
+
295
+
296
+ vision : Html.Attribute msg -> Html.Attribute msg -> Html msg
297
+ vision w h =
298
+ stroked
299
+ [ class "vision-icon", w, h ]
300
+ "0 0 24 24"
301
+ [ path [ d "M12 4c5 0 9 3.6 9.8 8-.8 4.4-4.8 8-9.8 8s-9-3.6-9.8-8C3 7.6 7 4 12 4Z" ] []
302
+ , circle [ cx "12", cy "12", r "3.5" ] []
303
+ ]
304
+
305
+
306
+ creditCard : Html.Attribute msg -> Html.Attribute msg -> Html msg
307
+ creditCard w h =
308
+ stroked
309
+ [ class "card-icon", w, h ]
310
+ "0 0 24 24"
311
+ [ rect [ x "3", y "4", width "18", height "16", rx "2" ] []
312
+ , path [ d "M3 10h18" ] []
313
+ , path [ d "M15 16h2" ] []
314
+ ]
315
+
316
+
317
+ errorTail : Html.Attribute msg -> Html.Attribute msg -> Html msg
318
+ errorTail w h =
319
+ svg
320
+ [ class "tail", w, h, viewBox "0 0 77 77" ]
321
+ [ path [ d "M0 77V0H77L0 77Z" ] [] ]
322
+
323
+
324
+ toastSuccess : Html.Attribute msg -> Html.Attribute msg -> Html msg
325
+ toastSuccess w h =
326
+ stroked
327
+ [ class "toast-icon", w, h ]
328
+ "0 0 24 24"
329
+ [ path [ d "M4 12.5l5 5L20 6.5" ] [] ]
330
+
331
+
332
+ toastInfo : Html.Attribute msg -> Html.Attribute msg -> Html msg
333
+ toastInfo w h =
334
+ stroked
335
+ [ class "toast-icon", w, h ]
336
+ "0 0 24 24"
337
+ [ circle [ cx "12", cy "12", r "9" ] []
338
+ , path [ d "M12 8h.01" ] []
339
+ , path [ d "M12 11v6" ] []
340
+ ]
341
+
342
+
343
+ toastWarn : Html.Attribute msg -> Html.Attribute msg -> Html msg
344
+ toastWarn w h =
345
+ stroked
346
+ [ class "toast-icon", w, h ]
347
+ "0 0 24 24"
348
+ [ path [ d "M12 4 3.1 19.4a1 1 0 0 0 .9 1.6h16a1 1 0 0 0 .9-1.6L12 4Z" ] []
349
+ , path [ d "M12 10v4" ] []
350
+ , path [ d "M12 17h.01" ] []
351
+ ]
352
+
353
+
354
+ toastError : Html.Attribute msg -> Html.Attribute msg -> Html msg
355
+ toastError w h =
356
+ stroked
357
+ [ class "toast-icon", w, h ]
358
+ "0 0 24 24"
359
+ [ path [ d "M6 6l12 12" ] []
360
+ , path [ d "M18 6L6 18" ] []
361
+ ]
362
+
363
+
364
+ arrowLeft : Html.Attribute msg -> Html.Attribute msg -> Html msg
365
+ arrowLeft w h =
366
+ stroked
367
+ [ class "arrow-left", w, h ]
368
+ "0 0 24 24"
369
+ [ path [ d "M20 12H4" ] []
370
+ , path [ d "M12.5 4.9 4 12l8.5 7.1" ] []
371
+ ]
372
+
373
+
374
+ burst : Html.Attribute msg -> Html msg
375
+ burst size =
376
+ svg
377
+ [ class "burst-icon", size, fill "currentColor", viewBox "0 0 141 141" ]
378
+ [ path
379
+ [ d "M67.049 1.726c1.317-2.301 4.635-2.301 5.953 0l2.652 4.635a3.43 3.43 0 0 0 5.411.712l3.762-3.79c1.868-1.882 5.074-1.023 5.75 1.54l1.363 5.164a3.43 3.43 0 0 0 5.042 2.089l4.615-2.688c2.291-1.334 5.165.325 5.155 2.977l-.02 5.34a3.43 3.43 0 0 0 4.33 3.322l5.153-1.401c2.559-.696 4.906 1.65 4.21 4.21l-1.402 5.152a3.43 3.43 0 0 0 3.322 4.33l5.34-.02c2.652-.01 4.312 2.864 2.977 5.155l-2.688 4.615a3.43 3.43 0 0 0 2.089 5.042l5.163 1.363c2.564.676 3.423 3.882 1.541 5.75l-3.79 3.762a3.43 3.43 0 0 0 .712 5.41l4.635 2.654c2.302 1.317 2.302 4.635 0 5.953l-4.635 2.652a3.43 3.43 0 0 0-.712 5.411l3.79 3.762c1.882 1.868 1.023 5.074-1.541 5.75l-5.163 1.363a3.43 3.43 0 0 0-2.089 5.042l2.688 4.615c1.335 2.291-.325 5.165-2.977 5.155l-5.34-.02a3.43 3.43 0 0 0-3.322 4.33l1.402 5.153c.696 2.559-1.651 4.906-4.21 4.21l-5.153-1.402a3.43 3.43 0 0 0-4.33 3.322l.02 5.34c.01 2.652-2.864 4.312-5.155 2.977l-4.615-2.688a3.43 3.43 0 0 0-5.042 2.089l-1.363 5.163c-.676 2.564-3.882 3.423-5.75 1.541l-3.762-3.79a3.43 3.43 0 0 0-5.41.712l-2.653 4.635c-1.317 2.302-4.636 2.302-5.953 0l-2.653-4.635a3.43 3.43 0 0 0-5.411-.712l-3.762 3.79c-1.868 1.882-5.074 1.023-5.75-1.541l-1.363-5.163a3.43 3.43 0 0 0-5.042-2.089l-4.615 2.688c-2.291 1.335-5.165-.325-5.155-2.977l.02-5.34a3.43 3.43 0 0 0-4.33-3.322l-5.153 1.402c-2.559.696-4.905-1.651-4.21-4.21l1.402-5.153a3.43 3.43 0 0 0-3.322-4.33l-5.34.02c-2.652.01-4.311-2.864-2.977-5.155l2.688-4.615a3.43 3.43 0 0 0-2.089-5.042l-5.163-1.363c-2.564-.676-3.423-3.882-1.541-5.75l3.79-3.762a3.43 3.43 0 0 0-.712-5.41l-4.635-2.653c-2.301-1.317-2.301-4.636 0-5.953l4.635-2.653a3.43 3.43 0 0 0 .712-5.411l-3.79-3.762c-1.882-1.868-1.023-5.074 1.54-5.75l5.164-1.363a3.43 3.43 0 0 0 2.089-5.042l-2.688-4.615c-1.334-2.291.325-5.165 2.977-5.155l5.34.02a3.43 3.43 0 0 0 3.322-4.33l-1.401-5.153c-.696-2.559 1.65-4.905 4.21-4.21l5.152 1.402a3.43 3.43 0 0 0 4.33-3.322l-.02-5.34c-.01-2.652 2.864-4.311 5.155-2.977l4.615 2.688a3.43 3.43 0 0 0 5.042-2.089l1.363-5.163c.676-2.564 3.882-3.423 5.75-1.541l3.762 3.79a3.43 3.43 0 0 0 5.41-.712z" ]
380
+ []
381
+ ]
@@ -0,0 +1,51 @@
1
+ module Ui.InlineForm exposing (view)
2
+
3
+ {-| The toolbar-style create form: a row of labeled controls ending in
4
+ a submit button, all bottom-aligned. The API-keys page's create row.
5
+ -}
6
+
7
+ import Html exposing (Attribute, Html, button, div, form, label, text)
8
+ import Html.Attributes
9
+ import Html.Events
10
+
11
+
12
+ {-| One inline field: the small label above, the control below.
13
+ -}
14
+ type alias InlineField msg =
15
+ { labelText : String
16
+ , control : Html msg
17
+ }
18
+
19
+
20
+ {-| Render the inline form. `onSubmit` fires on the form's submit —
21
+ including pressing Enter in any field.
22
+ -}
23
+ view :
24
+ { fields : List (InlineField msg)
25
+ , submitLabel : String
26
+ , onSubmit : msg
27
+ , attributes : List (Attribute msg)
28
+ }
29
+ -> Html msg
30
+ view config =
31
+ form
32
+ ([ Html.Attributes.class "inline-form"
33
+ , Html.Events.onSubmit config.onSubmit
34
+ ]
35
+ ++ config.attributes
36
+ )
37
+ (List.map
38
+ (\field ->
39
+ label []
40
+ [ text field.labelText
41
+ , field.control
42
+ ]
43
+ )
44
+ config.fields
45
+ ++ [ button
46
+ [ Html.Attributes.class "primary"
47
+ , Html.Attributes.type_ "submit"
48
+ ]
49
+ [ text config.submitLabel ]
50
+ ]
51
+ )
@@ -0,0 +1,113 @@
1
+ module Ui.Input exposing (Kind(..), Size(..), view)
2
+
3
+ {-| The one-line text input and the textarea. The recessed surface the
4
+ focus ring paints on; the border stays transparent so the ring never
5
+ shifts the layout. The `Code` kind renders the device-code style: a
6
+ mono field for `XXXX-XXXX` masked input.
7
+ -}
8
+
9
+ import Html exposing (Attribute, Html, input, textarea)
10
+ import Html.Attributes as Attr
11
+ import Html.Events
12
+
13
+
14
+ {-| The input's flavor. Each maps onto the native type; `Code` styles
15
+ the mono device-code field.
16
+ -}
17
+ type Kind
18
+ = Text
19
+ | Search
20
+ | Email
21
+ | Password
22
+ | Code
23
+ | Multiline
24
+
25
+
26
+ {-| The control height. `Regular` matches toolbar controls; `Compact`
27
+ is the dense size.
28
+ -}
29
+ type Size
30
+ = Regular
31
+ | Compact
32
+
33
+
34
+ nativeType : Kind -> String
35
+ nativeType kind =
36
+ case kind of
37
+ Text ->
38
+ "text"
39
+
40
+ Search ->
41
+ "search"
42
+
43
+ Email ->
44
+ "email"
45
+
46
+ Password ->
47
+ "password"
48
+
49
+ Code ->
50
+ "text"
51
+
52
+ Multiline ->
53
+ "text"
54
+
55
+
56
+ {-| Render an input. `rows` applies only to `Multiline`.
57
+ -}
58
+ view :
59
+ { kind : Kind
60
+ , value : String
61
+ , placeholder : String
62
+ , onInput : String -> msg
63
+ , size : Size
64
+ , rows : Int
65
+ , attributes : List (Attribute msg)
66
+ }
67
+ -> Html msg
68
+ view config =
69
+ let
70
+ sizeClass =
71
+ case config.size of
72
+ Regular ->
73
+ []
74
+
75
+ Compact ->
76
+ [ Attr.class "compact" ]
77
+
78
+ baseAttrs =
79
+ [ Attr.value config.value
80
+ , Attr.placeholder config.placeholder
81
+ , Html.Events.onInput config.onInput
82
+ ]
83
+ ++ sizeClass
84
+ ++ config.attributes
85
+
86
+ codeAttrs =
87
+ case config.kind of
88
+ Code ->
89
+ [ Attr.class "code" ]
90
+
91
+ _ ->
92
+ []
93
+ in
94
+ case config.kind of
95
+ Multiline ->
96
+ textarea
97
+ (baseAttrs
98
+ ++ [ Attr.rows config.rows
99
+ , Attr.attribute "aria-label" config.placeholder
100
+ ]
101
+ )
102
+ []
103
+
104
+ _ ->
105
+ input
106
+ (baseAttrs
107
+ ++ [ Attr.type_ (nativeType config.kind)
108
+ , Attr.attribute "autocomplete" "off"
109
+ , Attr.spellcheck (config.kind == Multiline)
110
+ ]
111
+ ++ codeAttrs
112
+ )
113
+ []
@@ -0,0 +1,25 @@
1
+ module Ui.KeyValue exposing (view)
2
+
3
+ {-| The label/value readout row: device details, read-only profile
4
+ fields, model specs. The label stays quiet; the value carries the
5
+ data.
6
+ -}
7
+
8
+ import Html exposing (Attribute, Html, span, text)
9
+ import Html.Attributes
10
+
11
+
12
+ {-| Render one label/value row. Pass extra attributes to stack rows
13
+ into a grid or column (the docs show both layouts).
14
+ -}
15
+ view :
16
+ { label : String
17
+ , value : List (Html msg)
18
+ , attributes : List (Attribute msg)
19
+ }
20
+ -> Html msg
21
+ view config =
22
+ span ([ Html.Attributes.class "detail" ] ++ config.attributes)
23
+ [ span [ Html.Attributes.class "label" ] [ text config.label ]
24
+ , span [ Html.Attributes.class "value" ] config.value
25
+ ]
@@ -0,0 +1,67 @@
1
+ module Ui.ListRow exposing (State(..), view)
2
+
3
+ {-| The list row: the shared shape under the invoices, members, keys,
4
+ and devices lists. One line of leading content, a muted meta line,
5
+ and row actions on the right; a `State` can strike the row through
6
+ (revoked keys) or flag it (failed invoices).
7
+ -}
8
+
9
+ import Html exposing (Attribute, Html, div, li, text)
10
+ import Html.Attributes
11
+
12
+
13
+ {-| The row's life state. `Normal` is the default; `Muted` strikes and
14
+ dims the row (revoked keys, past invitations); `Flagged` marks it as
15
+ failed.
16
+ -}
17
+ type State
18
+ = Normal
19
+ | Muted
20
+ | Flagged
21
+
22
+
23
+ stateClass : State -> Maybe String
24
+ stateClass state =
25
+ case state of
26
+ Normal ->
27
+ Nothing
28
+
29
+ Muted ->
30
+ Just "muted-row"
31
+
32
+ Flagged ->
33
+ Just "failed"
34
+
35
+
36
+ {-| Render one row inside an `Html.ul` the caller owns. `lead` is the
37
+ primary content (name + suffix, email, invoice description); `meta`
38
+ is the quiet second line; `actions` ride the right edge.
39
+ -}
40
+ view :
41
+ { lead : List (Html msg)
42
+ , meta : List (Html msg)
43
+ , actions : List (Html msg)
44
+ , state : State
45
+ , attributes : List (Attribute msg)
46
+ }
47
+ -> Html msg
48
+ view config =
49
+ let
50
+ stateAttrs =
51
+ stateClass config.state
52
+ |> Maybe.map (\cls -> [ Html.Attributes.class cls ])
53
+ |> Maybe.withDefault []
54
+ in
55
+ li
56
+ ([ Html.Attributes.class "list-row" ] ++ stateAttrs ++ config.attributes)
57
+ [ div [ Html.Attributes.class "list-row-body" ]
58
+ ([ div [ Html.Attributes.class "lead" ] config.lead ]
59
+ ++ (if List.isEmpty config.meta then
60
+ []
61
+
62
+ else
63
+ [ div [ Html.Attributes.class "meta" ] config.meta ]
64
+ )
65
+ )
66
+ , div [ Html.Attributes.class "row-actions" ] config.actions
67
+ ]
@@ -0,0 +1,32 @@
1
+ module Ui.Loader exposing (view, visible)
2
+
3
+ {-| The global loading dial: a charple disc with a spinning crossbar,
4
+ pinned to the top-right corner, fading in and out as content loads.
5
+ The house pattern is text busy-labels for actions and this dial for
6
+ page loads.
7
+ -}
8
+
9
+ import Html exposing (Html)
10
+ import Html.Attributes
11
+
12
+
13
+ {-| Render the loader. `visible` controls the fade; keep it mounted
14
+ either way so the transition can play.
15
+ -}
16
+ view : Bool -> Html msg
17
+ view isVisible =
18
+ Html.div
19
+ [ Html.Attributes.classList
20
+ [ ( "loader", True )
21
+ , ( "visible", isVisible )
22
+ ]
23
+ ]
24
+ []
25
+
26
+
27
+ {-| Convenience alias for `view True`, for call sites that mount and
28
+ unmount rather than fade.
29
+ -}
30
+ visible : Html msg
31
+ visible =
32
+ view True