@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
@@ -1,17 +1,13 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import {
4
- makeStoryRender,
5
- notifyActionArgType,
6
- } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notifyStory.js"
7
4
  import { fab } from "."
8
5
 
9
6
  export default {
10
7
  title: "Controls/Fab",
11
8
  tags: ["autodocs"],
12
- render: makeStoryRender(fab, "story-fab"),
9
+ render: createRender(fab),
13
10
  argTypes: {
14
- ...notifyActionArgType,
15
11
  children: { control: "text", description: "Content of the FAB." },
16
12
  color: {
17
13
  control: "select",
@@ -23,8 +19,12 @@ export default {
23
19
  options: ["sm", "md", "lg"],
24
20
  description: "Button size.",
25
21
  },
26
- extended: { control: "boolean", description: "Use extended pill shape." },
27
- disabled: { control: "boolean", description: "Disables interaction." },
22
+ isExtended: {
23
+ control: "boolean",
24
+ description: "Use extended pill shape.",
25
+ },
26
+ isDisabled: { control: "boolean", description: "Disables interaction." },
27
+ onClick: { action: "onClick" },
28
28
  },
29
29
  parameters: {
30
30
  docs: {
@@ -40,13 +40,13 @@ Default.args = {
40
40
  children: "+",
41
41
  color: "primary",
42
42
  size: "md",
43
- extended: false,
44
- disabled: false,
43
+ isExtended: false,
44
+ isDisabled: false,
45
45
  }
46
46
 
47
47
  export const Extended = {}
48
48
  Extended.args = {
49
49
  ...Default.args,
50
- extended: true,
50
+ isExtended: true,
51
51
  children: html`<span>+</span><span>Create</span>`,
52
52
  }
@@ -1,4 +1,3 @@
1
- import { withRenderValidation } from "../../shared/withRenderValidation.js"
2
1
  import * as renderers from "./template.js"
3
2
 
4
- export const fab = [{ ...renderers }, withRenderValidation]
3
+ export const fab = { ...renderers }
@@ -1,33 +1,35 @@
1
1
  /**
2
- * @typedef {import('../../../types/controls/fab').FabEntity} FabEntity
3
- * @typedef {import('@inglorious/web').Api} Api
2
+ * @typedef {import('../../../types/controls/fab').FabProps} FabProps
4
3
  * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
4
  */
6
5
 
7
6
  import { html } from "@inglorious/web"
8
7
 
9
- import { buttonPrimitive as button } from "../button/index.js"
8
+ import { button } from "../button/index.js"
10
9
 
11
10
  /**
12
11
  * Floating action button for primary contextual actions.
13
12
  *
14
- * @param {FabEntity} entity
15
- * @param {Api} api
13
+ * @param {FabProps} props
16
14
  * @returns {TemplateResult}
17
15
  */
18
- export function render(entity, api) {
19
- const { children, extended = false, className = "", ...rest } = entity
16
+ export function render(props) {
17
+ const {
18
+ children,
19
+ isExtended = false,
20
+ className = "",
21
+ onClick,
22
+ ...rest
23
+ } = props
20
24
 
21
- return button.render(
22
- {
23
- ...rest,
24
- shape: extended ? "pill" : "round",
25
- className:
26
- `iw-fab ${extended ? "iw-fab-extended" : ""} ${className}`.trim(),
27
- children: extended
28
- ? children
29
- : html`<span class="iw-fab-content">${children}</span>`,
30
- },
31
- api,
32
- )
25
+ return button.render({
26
+ ...rest,
27
+ shape: isExtended ? "pill" : "round",
28
+ className:
29
+ `iw-fab ${isExtended ? "iw-fab-extended" : ""} ${className}`.trim(),
30
+ children: isExtended
31
+ ? children
32
+ : html`<span class="iw-fab-content">${children}</span>`,
33
+ onClick,
34
+ })
33
35
  }
@@ -1,15 +1,11 @@
1
- import {
2
- makeStoryRender,
3
- notifyActionArgType,
4
- } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notifyStory.js"
5
2
  import { iconButton } from "."
6
3
 
7
4
  export default {
8
5
  title: "Controls/IconButton",
9
6
  tags: ["autodocs"],
10
- render: makeStoryRender(iconButton, "story-icon-button"),
7
+ render: createRender(iconButton),
11
8
  argTypes: {
12
- ...notifyActionArgType,
13
9
  icon: { control: "text", description: "Leading icon content." },
14
10
  label: { control: "text", description: "Optional button label." },
15
11
  iconAfter: { control: "text", description: "Trailing icon content." },
@@ -18,10 +14,6 @@ export default {
18
14
  options: ["row", "column"],
19
15
  description: "Layout direction for icon and label.",
20
16
  },
21
- iconOnly: {
22
- control: "boolean",
23
- description: "Renders icon-only content.",
24
- },
25
17
  ariaLabel: {
26
18
  control: "text",
27
19
  description: "Accessible name when used as icon-only button.",
@@ -36,6 +28,12 @@ export default {
36
28
  options: ["primary", "secondary", "success", "warning", "error", "info"],
37
29
  description: "Semantic color inherited from button.",
38
30
  },
31
+ size: {
32
+ control: "select",
33
+ options: ["sm", "md", "lg"],
34
+ description: "Size scale for paddings and font-size.",
35
+ },
36
+ onClick: { action: "onClick" },
39
37
  },
40
38
  parameters: {
41
39
  docs: {
@@ -1,4 +1,3 @@
1
- import { withRenderValidation } from "../../shared/withRenderValidation.js"
2
1
  import * as renderers from "./template.js"
3
2
 
4
- export const iconButton = [{ ...renderers }, withRenderValidation]
3
+ export const iconButton = { ...renderers }
@@ -1,47 +1,41 @@
1
1
  /**
2
- * @typedef {import('../../../types/controls/icon-button').IconButtonEntity} IconButtonEntity
3
- * @typedef {import('@inglorious/web').Api} Api
2
+ * @typedef {import('../../../types/controls/icon-button').IconButtonProps} IconButtonProps
4
3
  * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
4
  */
6
5
 
7
6
  import { html } from "@inglorious/web"
8
7
 
9
- import { render as renderButton } from "../button/template.js"
8
+ import { button } from "../button/index.js"
10
9
 
11
10
  /**
12
11
  * Icon button wrapper built on top of the base button renderer.
13
12
  *
14
- * @param {IconButtonEntity} entity
15
- * @param {Api} api
13
+ * @param {IconButtonProps} props
16
14
  * @returns {TemplateResult}
17
15
  */
18
- export function render(entity, api) {
16
+ export function render(props) {
19
17
  const {
18
+ type, // eslint-disable-line no-unused-vars
20
19
  icon,
21
20
  label,
22
21
  iconAfter,
23
22
  direction = "row",
24
- iconOnly = false,
25
- ariaLabel,
26
- } = entity
23
+ onClick,
24
+ } = props
27
25
 
28
26
  const children = html`
29
27
  <span class="iw-icon-button-content iw-icon-button-content-${direction}">
30
28
  ${icon ? html`<span class="iw-button-icon">${icon}</span>` : null}
31
- ${iconOnly ? null : label}
29
+ ${label}
32
30
  ${iconAfter
33
31
  ? html`<span class="iw-button-icon">${iconAfter}</span>`
34
32
  : null}
35
33
  </span>
36
34
  `
37
35
 
38
- return renderButton(
39
- {
40
- ...entity,
41
- label: iconOnly ? "" : label,
42
- children,
43
- ariaLabel,
44
- },
45
- api,
46
- )
36
+ return button.render({
37
+ ...props,
38
+ children,
39
+ onClick,
40
+ })
47
41
  }
@@ -1,4 +1,3 @@
1
- import { withRenderValidation } from "../../shared/withRenderValidation.js"
2
1
  import * as renderers from "./template.js"
3
2
 
4
- export const input = [{ ...renderers }, withRenderValidation]
3
+ export const input = { ...renderers }
@@ -1,15 +1,12 @@
1
- import {
2
- makeStoryRender,
3
- notifyActionArgType,
4
- } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notifyStory.js"
5
2
  import { input } from "."
6
3
 
7
4
  export default {
8
5
  title: "Controls/Input",
9
6
  tags: ["autodocs"],
10
- render: makeStoryRender(input, "story-input"),
7
+ render: createRender(input),
11
8
  argTypes: {
12
- ...notifyActionArgType,
9
+ // ...notifyActionArgType,
13
10
  label: {
14
11
  control: "text",
15
12
  description: "Field label rendered above the input.",
@@ -58,22 +55,25 @@ export default {
58
55
  options: ["sm", "md", "lg"],
59
56
  description: "Size scale for paddings and font-size.",
60
57
  },
61
- disabled: {
58
+ isDisabled: {
62
59
  control: "boolean",
63
60
  description: "Disables user input and interaction.",
64
61
  },
65
- readonly: {
62
+ isReadOnly: {
66
63
  control: "boolean",
67
64
  description: "Prevents editing while keeping the field focusable.",
68
65
  },
69
- required: {
66
+ isRequired: {
70
67
  control: "boolean",
71
68
  description: "Marks the field as required.",
72
69
  },
73
- fullWidth: {
70
+ isFullWidth: {
74
71
  control: "boolean",
75
72
  description: "Expands input width to 100% of its container.",
76
73
  },
74
+ onChange: { action: "onChange" },
75
+ onBlur: { action: "onBlur" },
76
+ onFocus: { action: "onFocus" },
77
77
  },
78
78
  parameters: {
79
79
  docs: {
@@ -84,27 +84,28 @@ export default {
84
84
  },
85
85
  },
86
86
  }
87
+
87
88
  export const Default = {}
88
89
  Default.args = {
89
90
  label: "Username",
90
91
  placeholder: "Enter your username",
91
92
  name: "username",
92
- type: "text",
93
+ inputType: "text",
93
94
  value: "",
94
95
  hint: "",
95
96
  error: "",
96
97
  size: "md",
97
- disabled: false,
98
- readonly: false,
99
- required: false,
100
- fullWidth: false,
98
+ isDisabled: false,
99
+ isReadOnly: false,
100
+ isRequired: false,
101
+ isFullWidth: false,
101
102
  }
102
103
 
103
104
  export const WithHint = {}
104
105
  WithHint.args = {
105
106
  ...Default.args,
106
107
  label: "Email",
107
- type: "email",
108
+ inputType: "email",
108
109
  placeholder: "you@example.com",
109
110
  hint: "We'll never share your email",
110
111
  }
@@ -113,7 +114,7 @@ export const WithError = {}
113
114
  WithError.args = {
114
115
  ...Default.args,
115
116
  label: "Email",
116
- type: "email",
117
+ inputType: "email",
117
118
  value: "invalid-email",
118
119
  error: "Please enter a valid email address",
119
120
  }
@@ -122,16 +123,16 @@ export const Required = {}
122
123
  Required.args = {
123
124
  ...Default.args,
124
125
  label: "Password",
125
- type: "password",
126
+ inputType: "password",
126
127
  placeholder: "Enter your password",
127
- required: true,
128
+ isRequired: true,
128
129
  }
129
130
 
130
131
  export const Disabled = {}
131
132
  Disabled.args = {
132
133
  ...Default.args,
133
134
  label: "Disabled Input",
134
- disabled: true,
135
+ isDisabled: true,
135
136
  value: "Cannot edit",
136
137
  }
137
138
 
@@ -139,7 +140,7 @@ export const Readonly = {}
139
140
  Readonly.args = {
140
141
  ...Default.args,
141
142
  label: "Readonly Input",
142
- readonly: true,
143
+ isReadOnly: true,
143
144
  value: "Read-only value",
144
145
  }
145
146
 
@@ -162,14 +163,14 @@ FullWidth.args = {
162
163
  ...Default.args,
163
164
  label: "Full Width Input",
164
165
  placeholder: "This input takes full width",
165
- fullWidth: true,
166
+ isFullWidth: true,
166
167
  }
167
168
 
168
169
  export const Number = {}
169
170
  Number.args = {
170
171
  ...Default.args,
171
172
  label: "Amount",
172
- type: "number",
173
+ inputType: "number",
173
174
  value: "1234.56",
174
175
  placeholder: "0.00",
175
176
  min: "0",
@@ -4,13 +4,13 @@
4
4
  gap: var(--iw-space-1);
5
5
  font-family: var(--iw-font-family-sans);
6
6
 
7
- &.iw-input-full-width {
7
+ &.iw-input-full-width .iw-input {
8
8
  width: 100%;
9
9
  }
10
10
 
11
11
  .iw-input-label {
12
12
  font-size: var(--iw-font-size-sm);
13
- font-weight: var(--iw-font-weight-medium);
13
+ font-weight: var(--iw-font-weight-normal);
14
14
  color: var(--iw-color-text);
15
15
  }
16
16
 
@@ -26,11 +26,11 @@
26
26
  }
27
27
 
28
28
  .iw-input {
29
- width: 100%;
30
- padding: var(--iw-space-2) var(--iw-space-3);
29
+ height: 2.25rem;
30
+ padding: 0 var(--iw-space-3);
31
31
  font-family: inherit;
32
32
  font-size: var(--iw-font-size-base);
33
- line-height: var(--iw-line-height-normal);
33
+ line-height: 1.2;
34
34
  color: var(--iw-input-text);
35
35
  background-color: var(--iw-input-bg);
36
36
  border: 1px solid var(--iw-input-border);
@@ -72,12 +72,14 @@
72
72
  }
73
73
 
74
74
  &.iw-input-sm {
75
- padding: var(--iw-space-1) var(--iw-space-2);
75
+ height: 2rem;
76
+ padding: 0 var(--iw-space-2);
76
77
  font-size: var(--iw-font-size-sm);
77
78
  }
78
79
 
79
80
  &.iw-input-lg {
80
- padding: var(--iw-space-3) var(--iw-space-4);
81
+ height: 2.75rem;
82
+ padding: 0 var(--iw-space-4);
81
83
  font-size: var(--iw-font-size-lg);
82
84
  }
83
85
  }
@@ -1,54 +1,52 @@
1
1
  /**
2
- * @typedef {import('../../../types/controls/input').InputEntity} InputEntity
3
- * @typedef {import('@inglorious/web').Api} Api
2
+ * @typedef {import('../../../types/controls/input').InputProps} InputProps
4
3
  * @typedef {import('@inglorious/web').TemplateResult} TemplateResult
5
4
  */
6
5
 
7
6
  import { classMap, html, ref } from "@inglorious/web"
8
7
 
9
- import { applyElementProps } from "@/shared/applyElementProps.js"
8
+ import { applyElementProps } from "../../shared/applyElementProps.js"
10
9
 
11
10
  /**
12
11
  * Input component for Inglorious Web.
13
12
  *
14
13
  * @example
15
14
  * // Stateless usage
16
- * input.render({ label: 'Email', type: 'email', placeholder: 'you@example.com' }, api)
15
+ * input.render({ label: 'Email', type: 'email', placeholder: 'you@example.com' })
17
16
  *
18
- * @example
19
- * // Stateful usage with event handling
20
- * // Entity: { type: 'input', id: 'emailInput', label: 'Email' }
21
- * // In store: api.render('emailInput')
22
- *
23
- * @param {InputEntity} entity
24
- * @param {Api} api
17
+ * @param {InputProps} props
25
18
  * @returns {TemplateResult}
26
19
  */
27
- export function render(entity, api) {
20
+ export function render(props) {
28
21
  const {
22
+ id,
23
+ type, // eslint-disable-line no-unused-vars
29
24
  name = "",
30
- type = "text",
25
+ inputType = "text",
31
26
  value = "",
32
27
  placeholder = "",
33
28
  label,
34
29
  hint,
35
30
  error,
36
31
  size = "md",
37
- disabled = false,
38
- readonly = false,
39
- required = false,
40
- fullWidth = false,
32
+ isDisabled = false,
33
+ isReadOnly = false,
34
+ isRequired = false,
35
+ isFullWidth = false,
41
36
  icon,
42
37
  iconAfter,
38
+ onChange,
39
+ onBlur,
40
+ onFocus,
43
41
  ...rest
44
- } = entity
42
+ } = props
45
43
 
46
- const inputId = entity.id || name
44
+ const inputId = id || name
47
45
 
48
46
  const wrapperClasses = {
49
47
  "iw-input-field": true,
50
- "iw-input-full-width": fullWidth,
51
- "iw-input-disabled": disabled,
48
+ "iw-input-full-width": isFullWidth,
49
+ "iw-input-disabled": isDisabled,
52
50
  "iw-input-has-error": !!error,
53
51
  "iw-input-has-icon": !!icon,
54
52
  "iw-input-has-icon-after": !!iconAfter,
@@ -58,7 +56,7 @@ export function render(entity, api) {
58
56
  "iw-input": true,
59
57
  [`iw-input-${size}`]: size !== "md",
60
58
  "iw-input-error": !!error,
61
- "iw-input-number": type === "number",
59
+ "iw-input-number": inputType === "number",
62
60
  }
63
61
 
64
62
  return html`
@@ -67,7 +65,7 @@ export function render(entity, api) {
67
65
  ? html`
68
66
  <label for=${inputId} class="iw-input-label">
69
67
  ${label}
70
- ${required
68
+ ${isRequired
71
69
  ? html`<span class="iw-input-required">*</span>`
72
70
  : null}
73
71
  </label>
@@ -80,17 +78,16 @@ export function render(entity, api) {
80
78
  <input
81
79
  id=${inputId}
82
80
  name=${name}
83
- type=${type}
81
+ type=${inputType}
84
82
  .value=${value}
85
83
  placeholder=${placeholder}
86
- ?disabled=${disabled}
87
- ?readonly=${readonly}
88
- ?required=${required}
84
+ ?disabled=${isDisabled}
85
+ ?readonly=${isReadOnly}
86
+ ?required=${isRequired}
89
87
  class=${classMap(inputClasses)}
90
- @input=${(event) =>
91
- api.notify(`#${entity.id}:change`, event.target.value)}
92
- @blur=${() => api.notify(`#${entity.id}:blur`)}
93
- @focus=${() => api.notify(`#${entity.id}:focus`)}
88
+ @input=${(event) => onChange?.(event.target.value)}
89
+ @blur=${onBlur}
90
+ @focus=${onFocus}
94
91
  ${ref((element) => applyElementProps(element, rest))}
95
92
  />
96
93
 
@@ -1,4 +1,3 @@
1
- import { withRenderValidation } from "../../shared/withRenderValidation.js"
2
1
  import * as renderers from "./template.js"
3
2
 
4
- export const radioGroup = [{ ...renderers }, withRenderValidation]
3
+ export const radioGroup = { ...renderers }
@@ -1,15 +1,11 @@
1
- import {
2
- makeStoryRender,
3
- notifyActionArgType,
4
- } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notifyStory.js"
5
2
  import { radioGroup } from "."
6
3
 
7
4
  export default {
8
5
  title: "Controls/RadioGroup",
9
6
  tags: ["autodocs"],
10
- render: makeStoryRender(radioGroup, "story-radio-group"),
7
+ render: createRender(radioGroup),
11
8
  argTypes: {
12
- ...notifyActionArgType,
13
9
  label: { control: "text", description: "Fieldset label." },
14
10
  name: { control: "text", description: "Native radio input name." },
15
11
  value: { control: "text", description: "Selected option value." },
@@ -18,8 +14,14 @@ export default {
18
14
  options: ["column", "row"],
19
15
  description: "Layout direction for options.",
20
16
  },
21
- disabled: { control: "boolean", description: "Disables all options." },
17
+ color: {
18
+ control: "select",
19
+ options: ["primary", "secondary", "success", "warning", "error", "info"],
20
+ description: "Semantic accent color.",
21
+ },
22
+ isDisabled: { control: "boolean", description: "Disables all options." },
22
23
  options: { control: "object", description: "List of radio options." },
24
+ onChange: { action: "onChange" },
23
25
  },
24
26
  parameters: {
25
27
  docs: {
@@ -36,7 +38,8 @@ Default.args = {
36
38
  name: "priority",
37
39
  value: "medium",
38
40
  direction: "column",
39
- disabled: false,
41
+ color: "primary",
42
+ isDisabled: false,
40
43
  options: [
41
44
  { label: "Low", value: "low" },
42
45
  { label: "Medium", value: "medium" },
@@ -1,4 +1,5 @@
1
1
  .iw-radio-group {
2
+ --iw-radio-accent: var(--iw-color-primary);
2
3
  border: 0;
3
4
  margin: 0;
4
5
  padding: 0;
@@ -20,7 +21,7 @@
20
21
 
21
22
  .iw-radio {
22
23
  margin: 0;
23
- accent-color: var(--iw-color-primary);
24
+ accent-color: var(--iw-radio-accent);
24
25
  }
25
26
 
26
27
  &.iw-radio-group-column {
@@ -38,4 +39,24 @@
38
39
  &.iw-radio-group-disabled {
39
40
  opacity: 0.6;
40
41
  }
42
+
43
+ &.iw-radio-group-secondary {
44
+ --iw-radio-accent: var(--iw-color-gray-600);
45
+ }
46
+
47
+ &.iw-radio-group-success {
48
+ --iw-radio-accent: var(--iw-color-success);
49
+ }
50
+
51
+ &.iw-radio-group-warning {
52
+ --iw-radio-accent: var(--iw-color-warning);
53
+ }
54
+
55
+ &.iw-radio-group-error {
56
+ --iw-radio-accent: var(--iw-color-error);
57
+ }
58
+
59
+ &.iw-radio-group-info {
60
+ --iw-radio-accent: var(--iw-color-info);
61
+ }
41
62
  }