@inglorious/ui 0.1.0 → 1.0.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.
Files changed (283) hide show
  1. package/README.md +45 -0
  2. package/package.json +191 -16
  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
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @typedef {import('../../../types/navigation/pagination').PaginationProps} PaginationProps
3
+ * @typedef {import('../../../types/navigation/pagination').PaginationItemRenderProps} PaginationItemRenderProps
4
+ * @typedef {import('../../../types/navigation/pagination').PaginationControlRenderProps} PaginationControlRenderProps
5
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
6
+ */
7
+
8
+ import { classMap, html } from "@inglorious/web"
9
+
10
+ import { button } from "../../controls/button/index.js"
11
+
12
+ const PRETTY_PAGE = 1
13
+
14
+ export const pagination = {
15
+ /**
16
+ * @param {PaginationProps} props
17
+ * @returns {TemplateResult}
18
+ */
19
+ render(props) {
20
+ const {
21
+ page = 1,
22
+ count = 1,
23
+ siblingCount = 1,
24
+ isFirstButtonVisible = false,
25
+ isLastButtonVisible = false,
26
+ isDisabled = false,
27
+ className = "",
28
+ } = props
29
+
30
+ const items = getPageItems(page, count, siblingCount)
31
+ const extraClasses = Object.fromEntries(
32
+ className
33
+ .split(/\s+/)
34
+ .filter(Boolean)
35
+ .map((name) => [name, true]),
36
+ )
37
+
38
+ return html`<nav
39
+ class=${classMap({ "iw-pagination": true, ...extraClasses })}
40
+ aria-label="Pagination"
41
+ >
42
+ ${isFirstButtonVisible
43
+ ? this.renderControl(props, {
44
+ label: "«",
45
+ target: 1,
46
+ isDisabled: page <= PRETTY_PAGE || isDisabled,
47
+ })
48
+ : null}
49
+ ${this.renderControl(props, {
50
+ label: "‹",
51
+ target: Math.max(PRETTY_PAGE, page - PRETTY_PAGE),
52
+ isDisabled: page <= PRETTY_PAGE || isDisabled,
53
+ })}
54
+ ${items.map((item) => this.renderItem(props, { item }))}
55
+ ${this.renderControl(props, {
56
+ label: "›",
57
+ target: Math.min(count, page + PRETTY_PAGE),
58
+ isDisabled: page >= count || isDisabled,
59
+ })}
60
+ ${isLastButtonVisible
61
+ ? this.renderControl(props, {
62
+ label: "»",
63
+ target: count,
64
+ isDisabled: page >= count || isDisabled,
65
+ })
66
+ : null}
67
+ </nav>`
68
+ },
69
+
70
+ /**
71
+ * @param {PaginationProps} props
72
+ * @param {PaginationItemRenderProps} payload
73
+ * @returns {TemplateResult}
74
+ */
75
+ renderItem(props, { item }) {
76
+ if (item === "…") {
77
+ return html`<span class="iw-pagination-ellipsis">…</span>`
78
+ }
79
+
80
+ const isCurrent = item === props.page
81
+ return button.render({
82
+ variant: isCurrent ? "default" : props.buttonVariant,
83
+ color: isCurrent ? "primary" : props.buttonColor,
84
+ size: props.buttonSize,
85
+ className: [
86
+ "iw-pagination-item",
87
+ isCurrent ? "iw-pagination-item-current" : "",
88
+ props.itemClassName ?? "",
89
+ ]
90
+ .filter(Boolean)
91
+ .join(" "),
92
+ "aria-current": isCurrent ? "page" : null,
93
+ isDisabled: props.isDisabled,
94
+ onClick: () => props.onChange?.(item),
95
+ children: item,
96
+ })
97
+ },
98
+
99
+ /**
100
+ * @param {PaginationProps} props
101
+ * @param {PaginationControlRenderProps} payload
102
+ * @returns {TemplateResult}
103
+ */
104
+ renderControl(
105
+ props,
106
+ { label, target, isDisabled = false, onChange = props.onChange },
107
+ ) {
108
+ return button.render({
109
+ variant: props.buttonVariant,
110
+ color: props.buttonColor,
111
+ size: props.buttonSize,
112
+ className: ["iw-pagination-item", props.itemClassName ?? ""]
113
+ .filter(Boolean)
114
+ .join(" "),
115
+ ariaLabel: `Go to page ${target}`,
116
+ isDisabled,
117
+ onClick: () => onChange?.(target),
118
+ children: label,
119
+ })
120
+ },
121
+ }
122
+
123
+ function getPageItems(page, count, siblingCount) {
124
+ if (count <= 7) {
125
+ return Array.from({ length: count }, (_, index) => index + PRETTY_PAGE)
126
+ }
127
+
128
+ const start = Math.max(PRETTY_PAGE + PRETTY_PAGE, page - siblingCount)
129
+ const end = Math.min(count - PRETTY_PAGE, page + siblingCount)
130
+ const items = [1]
131
+
132
+ if (start > 2) items.push("…")
133
+ for (let current = start; current <= end; current += PRETTY_PAGE) {
134
+ items.push(current)
135
+ }
136
+ if (end < count - PRETTY_PAGE) items.push("…")
137
+ items.push(count)
138
+
139
+ return items
140
+ }
@@ -0,0 +1 @@
1
+ export { speedDial } from "./template.js"
@@ -0,0 +1,40 @@
1
+ import { createRender } from "../../stories/notifyStory.js"
2
+ import { speedDial } from "."
3
+
4
+ export default {
5
+ title: "Navigation/Speed Dial",
6
+ tags: ["autodocs"],
7
+ render: createRender(speedDial),
8
+ argTypes: {
9
+ isOpen: {
10
+ control: "boolean",
11
+ description: "Whether actions are expanded.",
12
+ },
13
+ direction: {
14
+ control: "select",
15
+ options: ["up", "down", "left", "right"],
16
+ description: "Direction in which actions expand.",
17
+ },
18
+ onToggle: { action: "onToggle" },
19
+ onAction: { action: "onAction" },
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ description: {
24
+ component:
25
+ "Floating action entry point with overridable action rendering.",
26
+ },
27
+ },
28
+ },
29
+ }
30
+
31
+ export const Default = {
32
+ args: {
33
+ isOpen: true,
34
+ actions: [
35
+ { value: "edit", icon: "✎", label: "Edit" },
36
+ { value: "share", icon: "↗", label: "Share" },
37
+ { value: "print", icon: "⎙", label: "Print" },
38
+ ],
39
+ },
40
+ }
@@ -0,0 +1,38 @@
1
+ .iw-speed-dial {
2
+ display: inline-flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ gap: var(--iw-space-2);
6
+ }
7
+
8
+ .iw-speed-dial-actions {
9
+ display: inline-flex;
10
+ flex-direction: column;
11
+ gap: var(--iw-space-2);
12
+ }
13
+
14
+ .iw-speed-dial-down .iw-speed-dial-actions {
15
+ order: 1;
16
+ }
17
+
18
+ .iw-speed-dial-left .iw-speed-dial-actions,
19
+ .iw-speed-dial-right .iw-speed-dial-actions {
20
+ flex-direction: row;
21
+ }
22
+
23
+ .iw-speed-dial-trigger,
24
+ .iw-speed-dial-action {
25
+ border: 0 none;
26
+ border-radius: 999px;
27
+ background: var(--iw-color-primary);
28
+ color: var(--iw-color-primary-text, var(--iw-color-white));
29
+ width: 3rem;
30
+ height: 3rem;
31
+ box-shadow: var(--iw-shadow-md);
32
+ cursor: pointer;
33
+ }
34
+
35
+ .iw-speed-dial-action {
36
+ width: 2.5rem;
37
+ height: 2.5rem;
38
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @typedef {import('../../../types/navigation/speed-dial').SpeedDialProps} SpeedDialProps
3
+ * @typedef {import('../../../types/navigation/speed-dial').SpeedDialAction} SpeedDialAction
4
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
+ */
6
+
7
+ import { classMap, html } from "@inglorious/web"
8
+
9
+ export const speedDial = {
10
+ /**
11
+ * @param {SpeedDialProps} props
12
+ * @returns {TemplateResult}
13
+ */
14
+ render(props) {
15
+ const {
16
+ isOpen = false,
17
+ direction = "up",
18
+ icon = "+",
19
+ ariaLabel = "Speed dial",
20
+ actions = [],
21
+ } = props
22
+
23
+ return html`<div
24
+ class=${classMap({
25
+ "iw-speed-dial": true,
26
+ [`iw-speed-dial-${direction}`]: true,
27
+ "iw-speed-dial-open": isOpen,
28
+ })}
29
+ >
30
+ ${isOpen
31
+ ? html`<div class="iw-speed-dial-actions">
32
+ ${actions.map((action, index) =>
33
+ this.renderAction(action, index, props),
34
+ )}
35
+ </div>`
36
+ : null}
37
+ <button
38
+ type="button"
39
+ class="iw-speed-dial-trigger"
40
+ aria-label=${ariaLabel}
41
+ @click=${() => props.onToggle?.(!isOpen)}
42
+ >
43
+ ${icon}
44
+ </button>
45
+ </div>`
46
+ },
47
+
48
+ /**
49
+ * @param {SpeedDialAction} action
50
+ * @param {number} index
51
+ * @param {SpeedDialProps} props
52
+ * @returns {TemplateResult}
53
+ */
54
+ renderAction(action, index, props) {
55
+ return html`<button
56
+ type="button"
57
+ class="iw-speed-dial-action"
58
+ aria-label=${action.label ?? `Speed dial action ${index + 1}`}
59
+ ?disabled=${action.isDisabled}
60
+ @click=${() => {
61
+ action.onClick?.(action.value ?? index)
62
+ props.onAction?.(action.value ?? index, action)
63
+ }}
64
+ >
65
+ ${action.icon ?? action.label}
66
+ </button>`
67
+ },
68
+ }
@@ -0,0 +1 @@
1
+ export { stepper } from "./template.js"
@@ -0,0 +1,35 @@
1
+ import { createRender } from "../../stories/notifyStory.js"
2
+ import { stepper } from "."
3
+
4
+ export default {
5
+ title: "Navigation/Stepper",
6
+ tags: ["autodocs"],
7
+ render: createRender(stepper),
8
+ argTypes: {
9
+ steps: { control: "object", description: "Ordered step definitions." },
10
+ activeStep: {
11
+ control: "number",
12
+ description: "Zero-based active step index.",
13
+ },
14
+ orientation: {
15
+ control: "select",
16
+ options: ["horizontal", "vertical"],
17
+ description: "Stepper axis.",
18
+ },
19
+ },
20
+ parameters: {
21
+ docs: {
22
+ description: {
23
+ component:
24
+ "Progress navigation for multi-step workflows with overridable `renderStep`.",
25
+ },
26
+ },
27
+ },
28
+ }
29
+
30
+ export const Default = {
31
+ args: {
32
+ activeStep: 1,
33
+ steps: [{ label: "Campaign" }, { label: "Ad group" }, { label: "Ad" }],
34
+ },
35
+ }
@@ -0,0 +1,49 @@
1
+ .iw-stepper {
2
+ display: flex;
3
+ gap: var(--iw-space-4);
4
+ margin: 0;
5
+ padding: 0;
6
+ list-style: none;
7
+ }
8
+
9
+ .iw-stepper-vertical {
10
+ flex-direction: column;
11
+ }
12
+
13
+ .iw-stepper-step {
14
+ display: inline-flex;
15
+ align-items: center;
16
+ gap: var(--iw-space-2);
17
+ color: var(--iw-color-text-muted, var(--iw-color-text));
18
+ }
19
+
20
+ .iw-stepper-indicator {
21
+ width: 2rem;
22
+ height: 2rem;
23
+ display: inline-flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ border-radius: 999px;
27
+ border: 1px solid var(--iw-color-border);
28
+ }
29
+
30
+ .iw-stepper-step-active,
31
+ .iw-stepper-step-completed {
32
+ color: var(--iw-color-text);
33
+ }
34
+
35
+ .iw-stepper-step-active .iw-stepper-indicator,
36
+ .iw-stepper-step-completed .iw-stepper-indicator {
37
+ background: var(--iw-color-primary);
38
+ border-color: var(--iw-color-primary);
39
+ color: var(--iw-color-primary-text, var(--iw-color-white));
40
+ }
41
+
42
+ .iw-stepper-content {
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+
47
+ .iw-stepper-optional {
48
+ font-size: var(--iw-font-size-sm);
49
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @typedef {import('../../../types/navigation/stepper').StepperProps} StepperProps
3
+ * @typedef {import('../../../types/navigation/stepper').Step} Step
4
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
+ */
6
+
7
+ import { classMap, html } from "@inglorious/web"
8
+
9
+ export const stepper = {
10
+ /**
11
+ * @param {StepperProps} props
12
+ * @returns {TemplateResult}
13
+ */
14
+ render(props) {
15
+ const {
16
+ steps = [],
17
+ activeStep = 0,
18
+ orientation = "horizontal",
19
+ isAlternativeLabel = false,
20
+ } = props
21
+
22
+ return html`<ol
23
+ class=${classMap({
24
+ "iw-stepper": true,
25
+ [`iw-stepper-${orientation}`]: true,
26
+ "iw-stepper-alternative-label": isAlternativeLabel,
27
+ })}
28
+ >
29
+ ${steps.map((step, index) =>
30
+ this.renderStep(step, index, { ...props, activeStep }),
31
+ )}
32
+ </ol>`
33
+ },
34
+
35
+ /**
36
+ * @param {Step} step
37
+ * @param {number} index
38
+ * @param {StepperProps} props
39
+ * @returns {TemplateResult}
40
+ */
41
+ renderStep(step, index, props) {
42
+ const completed = step.isCompleted ?? index < props.activeStep
43
+ const active = index === props.activeStep
44
+
45
+ return html`<li
46
+ class=${classMap({
47
+ "iw-stepper-step": true,
48
+ "iw-stepper-step-active": active,
49
+ "iw-stepper-step-completed": completed,
50
+ })}
51
+ >
52
+ <span class="iw-stepper-indicator">${completed ? "✓" : index + 1}</span>
53
+ <span class="iw-stepper-content">
54
+ <span class="iw-stepper-label">${step.label}</span>
55
+ ${step.optional
56
+ ? html`<span class="iw-stepper-optional">${step.optional}</span>`
57
+ : null}
58
+ </span>
59
+ </li>`
60
+ },
61
+ }
@@ -0,0 +1 @@
1
+ export { tabs } from "./template.js"
@@ -0,0 +1,35 @@
1
+ .iw-tabs-list {
2
+ display: flex;
3
+ align-items: stretch;
4
+ gap: var(--iw-space-2);
5
+ border-bottom: 1px solid var(--iw-color-border);
6
+ }
7
+
8
+ .iw-tabs-centered {
9
+ justify-content: center;
10
+ }
11
+
12
+ .iw-tabs-full-width .iw-tab {
13
+ flex: 1 1 0;
14
+ }
15
+
16
+ .iw-tab {
17
+ border: 0 none;
18
+ border-bottom: 2px solid transparent;
19
+ background: transparent;
20
+ color: var(--iw-color-text-muted, var(--iw-color-text));
21
+ display: inline-flex;
22
+ align-items: center;
23
+ gap: var(--iw-space-2);
24
+ padding: var(--iw-space-3) var(--iw-space-4);
25
+ cursor: pointer;
26
+ }
27
+
28
+ .iw-tab-selected {
29
+ color: var(--iw-color-primary);
30
+ border-bottom-color: var(--iw-color-primary);
31
+ }
32
+
33
+ .iw-tab-panel {
34
+ padding-top: var(--iw-space-4);
35
+ }
@@ -0,0 +1,40 @@
1
+ import { createRender } from "../../stories/notifyStory.js"
2
+ import { tabs } from "."
3
+
4
+ export default {
5
+ title: "Navigation/Tabs",
6
+ tags: ["autodocs"],
7
+ render: createRender(tabs),
8
+ argTypes: {
9
+ items: {
10
+ control: "object",
11
+ description: "Tab labels, values, and optional panels.",
12
+ },
13
+ value: { control: "text", description: "Currently selected tab value." },
14
+ isCentered: { control: "boolean", description: "Center the tab list." },
15
+ isFullWidth: {
16
+ control: "boolean",
17
+ description: "Stretch tabs to fill available width.",
18
+ },
19
+ onChange: { action: "onChange" },
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ description: {
24
+ component:
25
+ "Section navigation with overridable `renderTab` and `renderPanel` methods.",
26
+ },
27
+ },
28
+ },
29
+ }
30
+
31
+ export const Default = {
32
+ args: {
33
+ value: "overview",
34
+ items: [
35
+ { value: "overview", label: "Overview", panel: "Overview content" },
36
+ { value: "activity", label: "Activity", panel: "Activity content" },
37
+ { value: "settings", label: "Settings", panel: "Settings content" },
38
+ ],
39
+ },
40
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @typedef {import('../../../types/navigation/tabs').TabsProps} TabsProps
3
+ * @typedef {import('../../../types/navigation/tabs').TabItem} TabItem
4
+ * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
+ */
6
+
7
+ import { classMap, html } from "@inglorious/web"
8
+
9
+ export const tabs = {
10
+ /**
11
+ * @param {TabsProps} props
12
+ * @returns {TemplateResult}
13
+ */
14
+ render(props) {
15
+ const {
16
+ items = [],
17
+ value = items[0]?.value ?? 0,
18
+ isCentered = false,
19
+ isFullWidth = false,
20
+ } = props
21
+
22
+ return html`<div class="iw-tabs">
23
+ <div
24
+ class=${classMap({
25
+ "iw-tabs-list": true,
26
+ "iw-tabs-centered": isCentered,
27
+ "iw-tabs-full-width": isFullWidth,
28
+ })}
29
+ role="tablist"
30
+ >
31
+ ${items.map((item, index) =>
32
+ this.renderTab(item, index, { ...props, value }),
33
+ )}
34
+ </div>
35
+ ${this.renderPanel(
36
+ items.find((item, index) => (item.value ?? index) === value) ?? null,
37
+ props,
38
+ )}
39
+ </div>`
40
+ },
41
+
42
+ /**
43
+ * @param {TabItem} item
44
+ * @param {number} index
45
+ * @param {TabsProps} props
46
+ * @returns {TemplateResult}
47
+ */
48
+ renderTab(item, index, props) {
49
+ const tabValue = item.value ?? index
50
+ const selected = tabValue === props.value
51
+
52
+ return html`<button
53
+ type="button"
54
+ role="tab"
55
+ class=${classMap({
56
+ "iw-tab": true,
57
+ "iw-tab-selected": selected,
58
+ })}
59
+ aria-selected=${selected ? "true" : "false"}
60
+ ?disabled=${item.isDisabled}
61
+ @click=${() => {
62
+ item.onClick?.(tabValue)
63
+ props.onChange?.(tabValue)
64
+ }}
65
+ >
66
+ ${item.icon ? html`<span class="iw-tab-icon">${item.icon}</span>` : null}
67
+ <span>${item.label}</span>
68
+ </button>`
69
+ },
70
+
71
+ /**
72
+ * @param {TabItem | null} item
73
+ * @returns {TemplateResult | null}
74
+ */
75
+ renderPanel(item) {
76
+ if (!item?.panel) return null
77
+ return html`<div class="iw-tab-panel" role="tabpanel">${item.panel}</div>`
78
+ },
79
+ }
@@ -0,0 +1,39 @@
1
+ import { Meta } from "@storybook/addon-docs/blocks"
2
+
3
+ <Meta title="Overview" />
4
+
5
+ # Inglorious UI
6
+
7
+ Inglorious UI is a design system built on the same entity/type model as Inglorious Web. It provides ready-made primitives for building complete UIs while keeping rendering and behavior fully overrideable.
8
+
9
+ ## What You Get
10
+
11
+ - **Controls**: Buttons, inputs, selects, toggles, sliders, and field helpers.
12
+ - **Data Display**: Typography, badges, avatars, icons, tooltips, and data-driven widgets.
13
+ - **Navigation**: Tabs, breadcrumbs, drawers, menus, pagination, and links.
14
+ - **Feedback**: Alerts, dialogs, progress indicators, snackbars, and skeletons.
15
+ - **Layout & Surfaces**: Grid, flex, containers, cards, paper, and app scaffolding.
16
+
17
+ ## Design System Principles
18
+
19
+ - **Composable**: Most components are built from smaller primitives.
20
+ - **Overridable**: You can replace `render()` and sub-renders to customize structure.
21
+ - **Themeable**: Themes are layered on top of shared tokens and reset styles.
22
+ - **Entity-first**: Every primitive is a type that integrates with the same rendering and store model.
23
+
24
+ ## Using the Library
25
+
26
+ To get a themed UI, include the base styles plus a theme stylesheet, then add the theme classes at your app root.
27
+
28
+ ```css
29
+ @import "@inglorious/ui/base.css";
30
+ @import "@inglorious/ui/themes/bootstrap.css";
31
+ ```
32
+
33
+ ```html
34
+ <div class="iw-theme-bootstrap iw-theme-light">...</div>
35
+ ```
36
+
37
+ Explore the sidebar to see primitives grouped by category, with examples and configuration options for each type.
38
+
39
+ You can also switch the active **Theme** and **Mode** from the Storybook header toolbar to preview components with different styles.