@inglorious/ui 0.1.0 → 1.0.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 (283) hide show
  1. package/README.md +45 -0
  2. package/package.json +190 -15
  3. package/src/all.css +7 -0
  4. package/src/controls/button/button.stories.js +35 -15
  5. package/src/controls/button/index.js +1 -3
  6. package/src/controls/button/style.css +80 -37
  7. package/src/controls/button/template.js +23 -26
  8. package/src/controls/button-group/button-group.stories.js +19 -15
  9. package/src/controls/button-group/index.js +1 -2
  10. package/src/controls/button-group/style.css +0 -7
  11. package/src/controls/button-group/template.js +46 -56
  12. package/src/controls/checkbox/checkbox.stories.js +16 -13
  13. package/src/controls/checkbox/index.js +1 -2
  14. package/src/controls/checkbox/style.css +23 -2
  15. package/src/controls/checkbox/template.js +20 -18
  16. package/src/controls/combobox/combobox.stories.js +92 -0
  17. package/src/controls/{select → combobox}/handlers.js +8 -5
  18. package/src/controls/combobox/helpers.js +91 -0
  19. package/src/controls/combobox/index.js +43 -0
  20. package/src/controls/combobox/style.css +203 -0
  21. package/src/controls/combobox/template.js +340 -0
  22. package/src/controls/controls.css +12 -0
  23. package/src/controls/fab/fab.stories.js +11 -11
  24. package/src/controls/fab/index.js +1 -2
  25. package/src/controls/fab/template.js +21 -19
  26. package/src/controls/icon-button/icon-button.stories.js +8 -10
  27. package/src/controls/icon-button/index.js +1 -2
  28. package/src/controls/icon-button/template.js +13 -19
  29. package/src/controls/input/index.js +1 -2
  30. package/src/controls/input/input.stories.js +24 -23
  31. package/src/controls/input/style.css +9 -7
  32. package/src/controls/input/template.js +28 -31
  33. package/src/controls/radio-group/index.js +1 -2
  34. package/src/controls/radio-group/radio-group.stories.js +11 -8
  35. package/src/controls/radio-group/style.css +22 -1
  36. package/src/controls/radio-group/template.js +20 -15
  37. package/src/controls/rating/index.js +1 -2
  38. package/src/controls/rating/rating.stories.js +7 -10
  39. package/src/controls/rating/style.css +1 -2
  40. package/src/controls/rating/template.js +20 -17
  41. package/src/controls/select/helpers.js +2 -21
  42. package/src/controls/select/index.js +1 -13
  43. package/src/controls/select/select.stories.js +68 -64
  44. package/src/controls/select/style.css +66 -189
  45. package/src/controls/select/template.js +77 -406
  46. package/src/controls/slider/index.js +1 -2
  47. package/src/controls/slider/slider.stories.js +15 -12
  48. package/src/controls/slider/style.css +24 -3
  49. package/src/controls/slider/template.js +30 -23
  50. package/src/controls/switch/index.js +1 -2
  51. package/src/controls/switch/style.css +23 -2
  52. package/src/controls/switch/switch.stories.js +14 -11
  53. package/src/controls/switch/template.js +18 -16
  54. package/src/data-display/avatar/avatar.stories.js +106 -0
  55. package/src/data-display/avatar/index.js +3 -0
  56. package/src/data-display/avatar/style.css +64 -0
  57. package/src/data-display/avatar/template.js +81 -0
  58. package/src/data-display/badge/badge.stories.js +64 -0
  59. package/src/data-display/badge/index.js +3 -0
  60. package/src/data-display/badge/style.css +84 -0
  61. package/src/data-display/badge/template.js +46 -0
  62. package/src/data-display/chip/chip.stories.js +57 -0
  63. package/src/data-display/chip/index.js +3 -0
  64. package/src/data-display/chip/style.css +84 -0
  65. package/src/data-display/chip/template.js +32 -0
  66. package/src/data-display/data-display.css +11 -0
  67. package/src/data-display/data-grid/base.css +58 -0
  68. package/src/data-display/data-grid/data-grid.stories.js +158 -0
  69. package/src/data-display/data-grid/filters/helpers.js +8 -0
  70. package/src/data-display/data-grid/filters/index.js +21 -0
  71. package/src/data-display/data-grid/filters/input.js +24 -0
  72. package/src/data-display/data-grid/filters/range.js +48 -0
  73. package/src/data-display/data-grid/filters/select.js +17 -0
  74. package/src/data-display/data-grid/handlers.js +523 -0
  75. package/src/data-display/data-grid/helpers.js +248 -0
  76. package/src/data-display/data-grid/index.js +64 -0
  77. package/src/data-display/data-grid/style.css +14 -0
  78. package/src/data-display/data-grid/template.js +458 -0
  79. package/src/data-display/data-grid/theme.css +148 -0
  80. package/src/data-display/divider/divider.stories.js +48 -0
  81. package/src/data-display/divider/index.js +3 -0
  82. package/src/data-display/divider/style.css +18 -0
  83. package/src/data-display/divider/template.js +17 -0
  84. package/src/data-display/icon/icon-implementations.mdx +160 -0
  85. package/src/data-display/icon/icon-utf8.stories.js +156 -0
  86. package/src/data-display/icon/icon.stories.js +38 -0
  87. package/src/data-display/icon/index.js +3 -0
  88. package/src/data-display/icon/style.css +17 -0
  89. package/src/data-display/icon/template.js +19 -0
  90. package/src/data-display/list/handlers.js +25 -0
  91. package/src/data-display/list/index.js +4 -0
  92. package/src/data-display/list/list.stories.js +187 -0
  93. package/src/data-display/list/style.css +119 -0
  94. package/src/data-display/list/template.js +302 -0
  95. package/src/data-display/material-icon/index.js +3 -0
  96. package/src/data-display/material-icon/material-icon.stories.js +99 -0
  97. package/src/data-display/material-icon/style.css +27 -0
  98. package/src/data-display/material-icon/template.js +21 -0
  99. package/src/data-display/table/index.js +1 -0
  100. package/src/data-display/table/style.css +42 -0
  101. package/src/data-display/table/table.stories.js +40 -0
  102. package/src/data-display/table/template.js +114 -0
  103. package/src/data-display/tooltip/index.js +3 -0
  104. package/src/data-display/tooltip/style.css +57 -0
  105. package/src/data-display/tooltip/template.js +58 -0
  106. package/src/data-display/tooltip/tooltip.stories.js +44 -0
  107. package/src/data-display/typography/index.js +3 -0
  108. package/src/data-display/typography/style.css +49 -0
  109. package/src/data-display/typography/template.js +110 -0
  110. package/src/data-display/typography/typography.stories.js +48 -0
  111. package/src/data-display/virtual-list/handlers.js +68 -0
  112. package/src/data-display/virtual-list/index.js +4 -0
  113. package/src/data-display/virtual-list/template.js +101 -0
  114. package/src/examples/dashboard/app-drawer.js +255 -0
  115. package/src/examples/dashboard/app-header.js +149 -0
  116. package/src/examples/dashboard/dashboard.js +85 -0
  117. package/src/examples/dashboard/dashboard.stories.js +47 -0
  118. package/src/examples/dashboard/data.js +205 -0
  119. package/src/examples/dashboard/mode.js +27 -0
  120. package/src/examples/dashboard/primitive-content.js +1325 -0
  121. package/src/examples/dashboard/primitive-section.js +158 -0
  122. package/src/examples/dashboard/router.js +13 -0
  123. package/src/examples/dashboard/social-card.js +73 -0
  124. package/src/examples/dashboard/stat-card.js +84 -0
  125. package/src/examples/dashboard/style.css +339 -0
  126. package/src/examples/dashboard/theme-utils.js +95 -0
  127. package/src/examples/dashboard/theme.js +27 -0
  128. package/src/examples/dashboard/traffic-card.js +108 -0
  129. package/src/examples/dashboard/traffic-sales-card.js +267 -0
  130. package/src/feedback/alert/alert.stories.js +70 -0
  131. package/src/feedback/alert/index.js +3 -0
  132. package/src/feedback/alert/style.css +98 -0
  133. package/src/feedback/alert/template.js +74 -0
  134. package/src/feedback/backdrop/backdrop.stories.js +21 -0
  135. package/src/feedback/backdrop/index.js +3 -0
  136. package/src/feedback/backdrop/style.css +25 -0
  137. package/src/feedback/backdrop/template.js +31 -0
  138. package/src/feedback/dialog/dialog.stories.js +27 -0
  139. package/src/feedback/dialog/index.js +3 -0
  140. package/src/feedback/dialog/style.css +68 -0
  141. package/src/feedback/dialog/template.js +64 -0
  142. package/src/feedback/feedback.css +6 -0
  143. package/src/feedback/progress/index.js +3 -0
  144. package/src/feedback/progress/progress.stories.js +54 -0
  145. package/src/feedback/progress/style.css +95 -0
  146. package/src/feedback/progress/template.js +88 -0
  147. package/src/feedback/skeleton/index.js +3 -0
  148. package/src/feedback/skeleton/skeleton.stories.js +44 -0
  149. package/src/feedback/skeleton/style.css +41 -0
  150. package/src/feedback/skeleton/template.js +48 -0
  151. package/src/feedback/snackbar/index.js +3 -0
  152. package/src/feedback/snackbar/snackbar.stories.js +25 -0
  153. package/src/feedback/snackbar/style.css +64 -0
  154. package/src/feedback/snackbar/template.js +55 -0
  155. package/src/index.js +32 -1
  156. package/src/layout/container/container.stories.js +105 -0
  157. package/src/layout/container/index.js +3 -0
  158. package/src/layout/container/style.css +34 -0
  159. package/src/layout/container/template.js +119 -0
  160. package/src/layout/flex/flex.stories.js +28 -10
  161. package/src/layout/flex/index.js +1 -2
  162. package/src/layout/flex/style.css +20 -0
  163. package/src/layout/flex/template.js +40 -13
  164. package/src/layout/grid/grid.stories.js +46 -30
  165. package/src/layout/grid/index.js +1 -2
  166. package/src/layout/grid/style.css +20 -0
  167. package/src/layout/grid/template.js +100 -20
  168. package/src/layout/layout.css +3 -0
  169. package/src/navigation/bottom-navigation/bottom-navigation.stories.js +33 -0
  170. package/src/navigation/bottom-navigation/index.js +1 -0
  171. package/src/navigation/bottom-navigation/style.css +32 -0
  172. package/src/navigation/bottom-navigation/template.js +74 -0
  173. package/src/navigation/breadcrumbs/breadcrumbs.stories.js +33 -0
  174. package/src/navigation/breadcrumbs/index.js +1 -0
  175. package/src/navigation/breadcrumbs/style.css +27 -0
  176. package/src/navigation/breadcrumbs/template.js +79 -0
  177. package/src/navigation/drawer/drawer.stories.js +60 -0
  178. package/src/navigation/drawer/index.js +3 -0
  179. package/src/navigation/drawer/style.css +125 -0
  180. package/src/navigation/drawer/template.js +131 -0
  181. package/src/navigation/link/index.js +3 -0
  182. package/src/navigation/link/link.stories.js +53 -0
  183. package/src/navigation/link/style.css +40 -0
  184. package/src/navigation/link/template.js +53 -0
  185. package/src/navigation/menu/index.js +1 -0
  186. package/src/navigation/menu/menu.stories.js +36 -0
  187. package/src/navigation/menu/style.css +44 -0
  188. package/src/navigation/menu/template.js +81 -0
  189. package/src/navigation/navigation.css +9 -0
  190. package/src/navigation/pagination/index.js +1 -0
  191. package/src/navigation/pagination/pagination.stories.js +61 -0
  192. package/src/navigation/pagination/style.css +29 -0
  193. package/src/navigation/pagination/template.js +140 -0
  194. package/src/navigation/speed-dial/index.js +1 -0
  195. package/src/navigation/speed-dial/speed-dial.stories.js +40 -0
  196. package/src/navigation/speed-dial/style.css +38 -0
  197. package/src/navigation/speed-dial/template.js +68 -0
  198. package/src/navigation/stepper/index.js +1 -0
  199. package/src/navigation/stepper/stepper.stories.js +35 -0
  200. package/src/navigation/stepper/style.css +49 -0
  201. package/src/navigation/stepper/template.js +61 -0
  202. package/src/navigation/tabs/index.js +1 -0
  203. package/src/navigation/tabs/style.css +35 -0
  204. package/src/navigation/tabs/tabs.stories.js +40 -0
  205. package/src/navigation/tabs/template.js +79 -0
  206. package/src/overview.mdx +39 -0
  207. package/src/stories/notifyStory.js +22 -25
  208. package/src/styles/base.css +2 -0
  209. package/src/styles/reset.css +15 -0
  210. package/src/{themes → styles/themes}/bootstrap.css +2 -0
  211. package/src/{themes → styles/themes}/inglorious.css +9 -1
  212. package/src/{themes → styles/themes}/material.css +2 -0
  213. package/src/{tokens/index.css → styles/tokens.css} +9 -0
  214. package/src/surfaces/accordion/accordion.stories.js +60 -0
  215. package/src/surfaces/accordion/index.js +1 -0
  216. package/src/surfaces/accordion/style.css +64 -0
  217. package/src/surfaces/accordion/template.js +85 -0
  218. package/src/surfaces/app-bar/app-bar.stories.js +109 -0
  219. package/src/surfaces/app-bar/index.js +3 -0
  220. package/src/surfaces/app-bar/style.css +109 -0
  221. package/src/surfaces/app-bar/template.js +78 -0
  222. package/src/surfaces/card/card.stories.js +108 -0
  223. package/src/surfaces/card/index.js +1 -0
  224. package/src/surfaces/card/style.css +107 -0
  225. package/src/surfaces/card/template.js +163 -0
  226. package/src/surfaces/paper/index.js +3 -0
  227. package/src/surfaces/paper/paper.stories.js +97 -0
  228. package/src/surfaces/paper/style.css +73 -0
  229. package/src/surfaces/paper/template.js +76 -0
  230. package/src/surfaces/surfaces.css +4 -0
  231. package/types/controls/button-group.d.ts +8 -7
  232. package/types/controls/button.d.ts +10 -7
  233. package/types/controls/checkbox.d.ts +8 -6
  234. package/types/controls/combobox.d.ts +66 -0
  235. package/types/controls/fab.d.ts +6 -5
  236. package/types/controls/icon-button.d.ts +8 -7
  237. package/types/controls/input.d.ts +18 -11
  238. package/types/controls/radio-group.d.ts +7 -5
  239. package/types/controls/rating.d.ts +6 -5
  240. package/types/controls/select.d.ts +11 -34
  241. package/types/controls/slider.d.ts +8 -6
  242. package/types/controls/switch.d.ts +7 -5
  243. package/types/data-display/avatar.d.ts +30 -0
  244. package/types/data-display/badge.d.ts +20 -0
  245. package/types/data-display/chip.d.ts +25 -0
  246. package/types/data-display/data-grid.d.ts +151 -0
  247. package/types/data-display/divider.d.ts +14 -0
  248. package/types/data-display/icon.d.ts +16 -0
  249. package/types/data-display/list.d.ts +66 -0
  250. package/types/data-display/material-icon.d.ts +15 -0
  251. package/types/data-display/table.d.ts +45 -0
  252. package/types/data-display/tooltip.d.ts +20 -0
  253. package/types/data-display/typography.d.ts +28 -0
  254. package/types/data-display/virtual-list.d.ts +94 -0
  255. package/types/feedback/alert.d.ts +22 -0
  256. package/types/feedback/backdrop.d.ts +17 -0
  257. package/types/feedback/dialog.d.ts +21 -0
  258. package/types/feedback/progress.d.ts +18 -0
  259. package/types/feedback/skeleton.d.ts +18 -0
  260. package/types/feedback/snackbar.d.ts +19 -0
  261. package/types/index.d.ts +92 -14
  262. package/types/layout/container.d.ts +28 -0
  263. package/types/layout/flex.d.ts +16 -5
  264. package/types/layout/grid.d.ts +15 -4
  265. package/types/navigation/bottom-navigation.d.ts +33 -0
  266. package/types/navigation/breadcrumbs.d.ts +29 -0
  267. package/types/navigation/drawer.d.ts +23 -0
  268. package/types/navigation/link.d.ts +22 -0
  269. package/types/navigation/menu.d.ts +32 -0
  270. package/types/navigation/pagination.d.ts +50 -0
  271. package/types/navigation/speed-dial.d.ts +35 -0
  272. package/types/navigation/stepper.d.ts +26 -0
  273. package/types/navigation/tabs.d.ts +31 -0
  274. package/types/surfaces/accordion.d.ts +32 -0
  275. package/types/surfaces/app-bar.d.ts +25 -0
  276. package/types/surfaces/card.d.ts +39 -0
  277. package/types/surfaces/paper.d.ts +28 -0
  278. package/src/shared/withRenderValidation.js +0 -19
  279. package/src/widgets/card/card.stories.js +0 -135
  280. package/src/widgets/card/index.js +0 -4
  281. package/src/widgets/card/style.css +0 -53
  282. package/src/widgets/card/template.js +0 -97
  283. package/types/widgets/card.d.ts +0 -21
@@ -1,5 +1,6 @@
1
- import { augmentType } from "@inglorious/store/types"
2
- import { createMockApi, render } from "@inglorious/web/test"
1
+ import { createStore } from "@inglorious/store"
2
+ import { mount } from "@inglorious/web"
3
+ import { render } from "@inglorious/web/test"
3
4
 
4
5
  export const notifyActionArgType = {
5
6
  onNotify: {
@@ -9,35 +10,31 @@ export const notifyActionArgType = {
9
10
  },
10
11
  }
11
12
 
12
- export function makeStoryRender(typeDefinition, id, options = {}) {
13
- const { resolveByEntityType = false } = options
14
- const type = augmentType(typeDefinition)
15
-
13
+ export function createRender(type) {
16
14
  return (args) => {
17
15
  const container = document.createElement("div")
18
- const { onNotify, ...entityArgs } = args
19
- const entity = { id, ...entityArgs }
20
- const api = createInstrumentedApi(entity, onNotify)
21
-
22
- if (resolveByEntityType && entity.type) {
23
- const getType = api.getType?.bind(api)
24
- api.getType = (typeName) =>
25
- typeName === entity.type ? type : getType?.(typeName)
26
- }
27
-
28
- render(type.render(entity, api), container)
16
+ render(type.render(args), container)
29
17
  return container
30
18
  }
31
19
  }
32
20
 
33
- function createInstrumentedApi(entityOrState, onNotify) {
34
- const api = createMockApi(entityOrState)
35
- const originalNotify = api.notify.bind(api)
21
+ export function createEntityRender(types) {
22
+ return (args) => {
23
+ const { onNotify, ...entity } = args
24
+
25
+ const store = createStore({
26
+ types,
27
+ entities: { [entity.id]: entity },
28
+ autoCreateEntities: true,
29
+ })
30
+ const originalNotify = store._api.notify
31
+ store._api.notify = (type, payload) => {
32
+ onNotify?.({ type, payload })
33
+ return originalNotify(type, payload)
34
+ }
36
35
 
37
- api.notify = (type, payload) => {
38
- onNotify?.({ type, payload })
39
- return originalNotify(type, payload)
36
+ const container = document.createElement("div")
37
+ mount(store, (api) => api.render(entity.id), container)
38
+ return container
40
39
  }
41
-
42
- return api
43
40
  }
@@ -0,0 +1,2 @@
1
+ @import "./reset.css";
2
+ @import "./tokens.css";
@@ -0,0 +1,15 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html,
8
+ body {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+
13
+ body {
14
+ min-height: 100%;
15
+ }
@@ -1,4 +1,6 @@
1
1
  .iw-theme-bootstrap {
2
+ font-family: var(--iw-font-family-sans);
3
+
2
4
  /* ========================================
3
5
  BOOTSTRAP THEME - Bootstrap Inspired
4
6
  ======================================== */
@@ -1,4 +1,6 @@
1
1
  .iw-theme-inglorious {
2
+ font-family: var(--iw-font-family-sans);
3
+
2
4
  /* ========================================
3
5
  INGLORIOUS THEME - Neon Videogame Aesthetic
4
6
  ======================================== */
@@ -27,6 +29,12 @@
27
29
  --iw-color-accent-hover: #ff33ff;
28
30
  --iw-color-accent-active: #ff66ff;
29
31
 
32
+ /* Geometry: keep Inglorious mostly squared */
33
+ --iw-radius-sm: 0;
34
+ --iw-radius-md: 0;
35
+ --iw-radius-lg: 0;
36
+ --iw-radius-xl: 0;
37
+
30
38
  /* ========================================
31
39
  COMPONENT TOKENS
32
40
  ======================================== */
@@ -79,7 +87,7 @@
79
87
 
80
88
  /* Alert */
81
89
  --iw-alert-radius: var(--iw-radius-none);
82
- --iw-alert-shadow: 0 0 10px currentColor;
90
+ --iw-alert-shadow: none;
83
91
  color-scheme: dark;
84
92
  }
85
93
 
@@ -1,4 +1,6 @@
1
1
  .iw-theme-material {
2
+ font-family: var(--iw-font-family-sans);
3
+
2
4
  /* ========================================
3
5
  MATERIAL THEME - Material Design Inspired
4
6
  ======================================== */
@@ -63,6 +63,15 @@
63
63
  --iw-space-20: 5rem;
64
64
  --iw-space-24: 6rem;
65
65
 
66
+ /* ========================================
67
+ BREAKPOINTS
68
+ ======================================== */
69
+ --iw-breakpoint-xs: 20rem;
70
+ --iw-breakpoint-sm: 40rem;
71
+ --iw-breakpoint-md: 48rem;
72
+ --iw-breakpoint-lg: 64rem;
73
+ --iw-breakpoint-xl: 80rem;
74
+
66
75
  /* ========================================
67
76
  BORDER RADIUS
68
77
  ======================================== */
@@ -0,0 +1,60 @@
1
+ import { html } from "@inglorious/web"
2
+
3
+ import { createRender } from "../../stories/notifyStory.js"
4
+ import { accordion } from "."
5
+
6
+ export default {
7
+ title: "Surfaces/Accordion",
8
+ tags: ["autodocs"],
9
+ render: createRender(accordion),
10
+ argTypes: {
11
+ items: {
12
+ control: "object",
13
+ description: "Accordion sections with title, content, and state flags.",
14
+ },
15
+ onItemToggle: { action: "onItemToggle" },
16
+ },
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component:
21
+ "Collapsible surface sections. Override `renderItem(item, index, props)` for custom row rendering.",
22
+ },
23
+ },
24
+ },
25
+ }
26
+
27
+ export const Default = {
28
+ args: {
29
+ items: [
30
+ {
31
+ title: "Account",
32
+ content: "Manage your account settings.",
33
+ isExpanded: true,
34
+ },
35
+ {
36
+ title: "Security",
37
+ content: "Set up 2FA and app passwords.",
38
+ },
39
+ {
40
+ title: "Billing",
41
+ content: html`<strong>Invoices and subscriptions</strong>`,
42
+ },
43
+ ],
44
+ },
45
+ }
46
+
47
+ export const WithIcons = {
48
+ args: {
49
+ items: [
50
+ {
51
+ icon: "👤",
52
+ title: "Profile",
53
+ content: "Public profile details",
54
+ isExpanded: true,
55
+ },
56
+ { icon: "🔒", title: "Privacy", content: "Visibility and permissions" },
57
+ { icon: "💳", title: "Payments", content: "Payment methods" },
58
+ ],
59
+ },
60
+ }
@@ -0,0 +1 @@
1
+ export { accordion } from "./template.js"
@@ -0,0 +1,64 @@
1
+ .iw-accordion {
2
+ display: flex;
3
+ flex-direction: column;
4
+ border: 1px solid var(--iw-color-border);
5
+ border-radius: var(--iw-radius-md);
6
+ overflow: hidden;
7
+ background: var(--iw-color-surface);
8
+ }
9
+
10
+ .iw-accordion-item + .iw-accordion-item {
11
+ border-top: 1px solid var(--iw-color-border);
12
+ }
13
+
14
+ .iw-accordion-trigger {
15
+ width: 100%;
16
+ border: 0 none;
17
+ background: transparent;
18
+ color: inherit;
19
+ padding: var(--iw-space-3) var(--iw-space-4);
20
+ display: flex;
21
+ align-items: center;
22
+ gap: var(--iw-space-2);
23
+ text-align: left;
24
+ cursor: pointer;
25
+ }
26
+
27
+ .iw-accordion-trigger:hover:enabled {
28
+ background: color-mix(
29
+ in srgb,
30
+ var(--iw-color-surface-hover) 75%,
31
+ transparent
32
+ );
33
+ }
34
+
35
+ .iw-accordion-icon {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ color: var(--iw-color-text-muted, var(--iw-color-text));
40
+ }
41
+
42
+ .iw-accordion-title {
43
+ flex: 1 1 auto;
44
+ font-weight: var(--iw-font-weight-normal);
45
+ }
46
+
47
+ .iw-accordion-caret {
48
+ display: inline-flex;
49
+ transition: transform var(--iw-transition-fast);
50
+ color: var(--iw-color-text-muted, var(--iw-color-text));
51
+ }
52
+
53
+ .iw-accordion-item-expanded .iw-accordion-caret {
54
+ transform: rotate(180deg);
55
+ }
56
+
57
+ .iw-accordion-panel {
58
+ padding: 0 var(--iw-space-4) var(--iw-space-4);
59
+ color: var(--iw-color-text-secondary, var(--iw-color-text));
60
+ }
61
+
62
+ .iw-accordion-item-disabled {
63
+ opacity: 0.6;
64
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @typedef {import('../../../types/surfaces/accordion').AccordionProps} AccordionProps
3
+ * @typedef {import('../../../types/surfaces/accordion').AccordionItem} AccordionItem
4
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
+ */
6
+
7
+ import { classMap, html, ref } from "@inglorious/web"
8
+
9
+ import { applyElementProps } from "../../shared/applyElementProps.js"
10
+
11
+ export const accordion = {
12
+ /**
13
+ * @param {AccordionProps} props
14
+ * @returns {TemplateResult}
15
+ */
16
+ render(props) {
17
+ const {
18
+ type, // eslint-disable-line no-unused-vars
19
+ items = [],
20
+ className = "",
21
+ ...rest
22
+ } = props
23
+
24
+ const extraClasses = Object.fromEntries(
25
+ className
26
+ .split(/\s+/)
27
+ .filter(Boolean)
28
+ .map((name) => [name, true]),
29
+ )
30
+
31
+ return html`<div
32
+ class=${classMap({
33
+ "iw-accordion": true,
34
+ ...extraClasses,
35
+ })}
36
+ ${ref((el) => applyElementProps(el, rest))}
37
+ >
38
+ ${items.map((item, index) => this.renderItem(item, index, props))}
39
+ </div>`
40
+ },
41
+
42
+ /**
43
+ * @param {AccordionItem} item
44
+ * @param {number} index
45
+ * @param {AccordionProps} props
46
+ * @returns {TemplateResult}
47
+ */
48
+ renderItem(item, index, props) {
49
+ const {
50
+ title,
51
+ content,
52
+ isDisabled = false,
53
+ isExpanded = false,
54
+ onToggle,
55
+ icon,
56
+ } = item
57
+
58
+ return html`<section
59
+ class=${classMap({
60
+ "iw-accordion-item": true,
61
+ "iw-accordion-item-expanded": isExpanded,
62
+ "iw-accordion-item-disabled": isDisabled,
63
+ })}
64
+ >
65
+ <button
66
+ class="iw-accordion-trigger"
67
+ type="button"
68
+ aria-expanded=${isExpanded}
69
+ ?disabled=${isDisabled}
70
+ @click=${() => {
71
+ if (isDisabled) return
72
+ onToggle?.(item, index, !isExpanded)
73
+ props.onItemToggle?.(item, index, !isExpanded)
74
+ }}
75
+ >
76
+ ${icon ? html`<span class="iw-accordion-icon">${icon}</span>` : null}
77
+ <span class="iw-accordion-title">${title}</span>
78
+ <span class="iw-accordion-caret">▾</span>
79
+ </button>
80
+ ${isExpanded
81
+ ? html`<div class="iw-accordion-panel">${content}</div>`
82
+ : null}
83
+ </section>`
84
+ },
85
+ }
@@ -0,0 +1,109 @@
1
+ import { html } from "@inglorious/web"
2
+
3
+ import { createRender } from "../../stories/notifyStory.js"
4
+ import { appBar } from "."
5
+
6
+ export default {
7
+ title: "Surfaces/App Bar",
8
+ tags: ["autodocs"],
9
+ render: createRender(appBar),
10
+ argTypes: {
11
+ title: {
12
+ control: "text",
13
+ description: "Primary heading content in the bar.",
14
+ },
15
+ subtitle: {
16
+ control: "text",
17
+ description: "Secondary supporting text under the title.",
18
+ },
19
+ leading: {
20
+ control: "text",
21
+ description: "Optional start-aligned control area.",
22
+ },
23
+ trailing: {
24
+ control: "text",
25
+ description: "Optional end-aligned actions.",
26
+ },
27
+ position: {
28
+ control: "select",
29
+ options: ["static", "sticky", "fixed", "absolute", "relative"],
30
+ description: "Positioning strategy for the bar.",
31
+ },
32
+ placement: {
33
+ control: "select",
34
+ options: ["top", "bottom"],
35
+ description: "Anchor the bar to the top or bottom edge.",
36
+ },
37
+ variant: {
38
+ control: "select",
39
+ options: ["regular", "dense", "prominent"],
40
+ description: "Height and vertical rhythm preset.",
41
+ },
42
+ color: {
43
+ control: "select",
44
+ options: ["default", "primary", "secondary", "transparent", "inherit"],
45
+ description: "Color scheme for the app bar.",
46
+ },
47
+ isDense: {
48
+ control: "boolean",
49
+ description: 'Legacy compact mode alias (forces `variant="dense"`).',
50
+ },
51
+ isElevated: {
52
+ control: "boolean",
53
+ description: "Enable drop shadow separation from content.",
54
+ },
55
+ },
56
+ parameters: {
57
+ docs: {
58
+ description: {
59
+ component:
60
+ "Top application chrome with optional leading controls, title area, content slot, and trailing actions.",
61
+ },
62
+ },
63
+ },
64
+ }
65
+
66
+ export const Default = {
67
+ args: {
68
+ title: "Dashboard",
69
+ subtitle: "Workspace",
70
+ variant: "regular",
71
+ color: "default",
72
+ placement: "top",
73
+ leading: html`<button class="iw-icon-button">☰</button>`,
74
+ trailing: html`<button class="iw-button iw-button-outline iw-button-sm">
75
+ New
76
+ </button>`,
77
+ },
78
+ }
79
+
80
+ export const WithContent = {
81
+ args: {
82
+ title: "Projects",
83
+ color: "default",
84
+ children: html`<input class="iw-input-input" placeholder="Search" />`,
85
+ trailing: html`<button class="iw-icon-button">⚙</button>`,
86
+ },
87
+ }
88
+
89
+ export const Prominent = {
90
+ args: {
91
+ title: "Design System",
92
+ subtitle: "Surfaces and layout tokens",
93
+ variant: "prominent",
94
+ color: "primary",
95
+ leading: html`<button class="iw-icon-button">←</button>`,
96
+ trailing: html`<button class="iw-icon-button">⋯</button>`,
97
+ },
98
+ }
99
+
100
+ export const BottomAppBar = {
101
+ args: {
102
+ title: "Playback",
103
+ subtitle: "Now playing",
104
+ color: "secondary",
105
+ position: "fixed",
106
+ placement: "bottom",
107
+ trailing: html`<button class="iw-icon-button">⏯</button>`,
108
+ },
109
+ }
@@ -0,0 +1,3 @@
1
+ import * as renderers from "./template.js"
2
+
3
+ export const appBar = { ...renderers }
@@ -0,0 +1,109 @@
1
+ .iw-app-bar {
2
+ display: flex;
3
+ align-items: center;
4
+ min-height: var(--iw-space-16);
5
+ /* gap: var(--iw-space-3); */
6
+ background: var(--iw-color-surface);
7
+ color: var(--iw-color-text);
8
+ border-bottom: 1px solid var(--iw-color-border);
9
+ }
10
+
11
+ .iw-app-bar-elevated {
12
+ box-shadow: var(--iw-shadow-md);
13
+ }
14
+
15
+ .iw-app-bar-prominent {
16
+ align-items: flex-start;
17
+ padding-top: var(--iw-space-3);
18
+ padding-bottom: var(--iw-space-3);
19
+ }
20
+
21
+ .iw-app-bar-fixed {
22
+ position: fixed;
23
+ left: 0;
24
+ right: 0;
25
+ z-index: var(--iw-z-fixed, 1030);
26
+ }
27
+
28
+ .iw-app-bar-sticky {
29
+ position: sticky;
30
+ z-index: var(--iw-z-sticky, 1020);
31
+ }
32
+
33
+ .iw-app-bar-absolute {
34
+ position: absolute;
35
+ left: 0;
36
+ right: 0;
37
+ }
38
+
39
+ .iw-app-bar-relative {
40
+ position: relative;
41
+ }
42
+
43
+ .iw-app-bar-placement-top {
44
+ top: 0;
45
+ }
46
+
47
+ .iw-app-bar-placement-bottom {
48
+ bottom: 0;
49
+ border-bottom: 0 none;
50
+ border-top: 1px solid var(--iw-color-border);
51
+ }
52
+
53
+ .iw-app-bar-color-default {
54
+ background: var(--iw-color-surface);
55
+ color: var(--iw-color-text);
56
+ }
57
+
58
+ .iw-app-bar-color-primary {
59
+ background: var(--iw-color-primary);
60
+ color: var(--iw-color-primary-text, var(--iw-color-white));
61
+ border-color: color-mix(in srgb, currentColor 18%, transparent);
62
+ }
63
+
64
+ .iw-app-bar-color-secondary {
65
+ background: var(--iw-color-accent, var(--iw-color-gray-700));
66
+ color: var(--iw-color-white);
67
+ border-color: color-mix(in srgb, currentColor 18%, transparent);
68
+ }
69
+
70
+ .iw-app-bar-color-transparent {
71
+ background: transparent;
72
+ border-color: transparent;
73
+ box-shadow: none;
74
+ }
75
+
76
+ .iw-app-bar-color-inherit {
77
+ background: inherit;
78
+ color: inherit;
79
+ border-color: transparent;
80
+ box-shadow: none;
81
+ }
82
+
83
+ .iw-app-bar-leading,
84
+ .iw-app-bar-trailing {
85
+ display: inline-flex;
86
+ align-items: center;
87
+ gap: var(--iw-space-2);
88
+ }
89
+
90
+ .iw-app-bar-meta {
91
+ display: flex;
92
+ flex-direction: column;
93
+ min-width: 0;
94
+ }
95
+
96
+ .iw-app-bar-title {
97
+ font-weight: var(--iw-font-weight-semibold);
98
+ line-height: var(--iw-line-height-tight);
99
+ }
100
+
101
+ .iw-app-bar-subtitle {
102
+ font-size: var(--iw-font-size-sm);
103
+ color: color-mix(in srgb, currentColor 72%, transparent);
104
+ line-height: var(--iw-line-height-tight);
105
+ }
106
+
107
+ .iw-app-bar-trailing {
108
+ margin-left: auto;
109
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @typedef {import('../../../types/surfaces/app-bar').AppBarProps} AppBarProps
3
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
4
+ */
5
+
6
+ import { classMap, html, ref, when } from "@inglorious/web"
7
+
8
+ import { applyElementProps } from "../../shared/applyElementProps.js"
9
+
10
+ /**
11
+ * @param {AppBarProps} props
12
+ * @returns {TemplateResult}
13
+ */
14
+ export function render(props) {
15
+ const {
16
+ type, // eslint-disable-line no-unused-vars
17
+ title,
18
+ subtitle,
19
+ leading,
20
+ trailing,
21
+ children,
22
+ isDense = false,
23
+ variant = "regular",
24
+ color = "default",
25
+ isElevated = true,
26
+ position = "static",
27
+ placement = "top",
28
+ className = "",
29
+ ...rest
30
+ } = props
31
+
32
+ const extraClasses = Object.fromEntries(
33
+ className
34
+ .split(/\s+/)
35
+ .filter(Boolean)
36
+ .map((name) => [name, true]),
37
+ )
38
+
39
+ const hasMeta = title || subtitle
40
+ const effectiveVariant = isDense ? "dense" : variant
41
+
42
+ return html`<header
43
+ class=${classMap({
44
+ "iw-app-bar": true,
45
+ "iw-app-bar-elevated": isElevated,
46
+ [`iw-app-bar-${effectiveVariant}`]: true,
47
+ [`iw-app-bar-color-${color}`]: true,
48
+ [`iw-app-bar-${position}`]: true,
49
+ [`iw-app-bar-placement-${placement}`]: true,
50
+ ...extraClasses,
51
+ })}
52
+ ${ref((el) => applyElementProps(el, rest))}
53
+ >
54
+ ${when(
55
+ leading,
56
+ () => html`<div class="iw-app-bar-leading">${leading}</div>`,
57
+ )}
58
+ ${when(
59
+ hasMeta,
60
+ () =>
61
+ html`<div class="iw-app-bar-meta">
62
+ ${when(
63
+ title,
64
+ () => html`<div class="iw-app-bar-title">${title}</div>`,
65
+ )}
66
+ ${when(
67
+ subtitle,
68
+ () => html`<div class="iw-app-bar-subtitle">${subtitle}</div>`,
69
+ )}
70
+ </div>`,
71
+ )}
72
+ ${children}
73
+ ${when(
74
+ trailing,
75
+ () => html`<div class="iw-app-bar-trailing">${trailing}</div>`,
76
+ )}
77
+ </header>`
78
+ }