@helpdice/ui 1.7.4 → 1.7.7

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 (306) hide show
  1. package/dist/CurrencyInput/index.js +2981 -0
  2. package/dist/LinearProgress/index.d.ts +2 -0
  3. package/dist/{css-baseline → LinearProgress}/index.js +25 -317
  4. package/dist/LinearProgress/linear-progress.d.ts +9 -0
  5. package/dist/Loadable/index.js +570 -0
  6. package/dist/PhoneInput/index.js +2175 -22
  7. package/dist/PhoneInput/phone.d.ts +1 -1
  8. package/dist/Placeholder/index.js +2116 -254
  9. package/dist/auto-complete/index.js +2145 -652
  10. package/dist/avatar/index.js +2119 -333
  11. package/dist/badge/index.js +2117 -331
  12. package/dist/breadcrumbs/index.js +2126 -340
  13. package/dist/button/button.compact.d.ts +2 -0
  14. package/dist/button/index.js +2214 -342
  15. package/dist/button-dropdown/index.js +2120 -291
  16. package/dist/button-group/index.js +2117 -331
  17. package/dist/capacity/index.js +2117 -331
  18. package/dist/card/index.js +2127 -298
  19. package/dist/checkbox/index.js +2119 -290
  20. package/dist/code/index.js +2116 -297
  21. package/dist/collapse/index.js +2117 -475
  22. package/dist/description/index.js +2117 -331
  23. package/dist/display/index.js +2117 -331
  24. package/dist/divider/index.js +2118 -332
  25. package/dist/dot/index.js +2117 -331
  26. package/dist/drawer/index.js +2129 -439
  27. package/dist/fieldset/index.js +2121 -354
  28. package/dist/grid/index.js +2119 -333
  29. package/dist/image/index.js +2122 -336
  30. package/dist/index.d.ts +2 -14
  31. package/dist/index.js +3175 -1881
  32. package/dist/input/index.js +2125 -296
  33. package/dist/keyboard/index.js +2116 -297
  34. package/dist/link/index.js +2117 -331
  35. package/dist/list/index.js +2119 -333
  36. package/dist/loading/index.js +2117 -331
  37. package/dist/menu/index.js +77 -45
  38. package/dist/modal/index.js +2145 -452
  39. package/dist/note/index.js +2117 -331
  40. package/dist/page/index.js +2117 -331
  41. package/dist/pagination/index.js +2118 -351
  42. package/dist/popover/index.js +2123 -354
  43. package/dist/progress/index.js +2117 -331
  44. package/dist/radio/index.js +2120 -334
  45. package/dist/rating/index.js +2118 -332
  46. package/dist/row/index.js +2115 -296
  47. package/dist/select/index.js +2151 -688
  48. package/dist/slider/index.js +2123 -356
  49. package/dist/snippet/index.js +2118 -421
  50. package/dist/spacer/index.js +2115 -296
  51. package/dist/spinner/index.js +2117 -331
  52. package/dist/table/index.js +2341 -754
  53. package/dist/tabs/index.js +2123 -344
  54. package/dist/tag/index.js +2116 -254
  55. package/dist/text/index.js +2116 -297
  56. package/dist/textarea/index.js +2117 -288
  57. package/dist/toggle/index.js +2117 -331
  58. package/dist/tooltip/index.js +2120 -351
  59. package/dist/tree/index.js +2123 -459
  60. package/dist/use-input/index.js +2122 -24
  61. package/dist/use-modal/index.js +2122 -24
  62. package/dist/use-network-status/index.d.ts +2 -0
  63. package/dist/{use-current-state → use-network-status}/index.js +22 -15
  64. package/dist/use-network-status/use-netowork-status.d.ts +4 -0
  65. package/dist/use-scale/index.js +2115 -296
  66. package/dist/use-tabs/index.js +2122 -24
  67. package/dist/user/index.js +2123 -337
  68. package/esm/CurrencyInput/components/CurrencyInput.js +342 -0
  69. package/esm/CurrencyInput/components/CurrencyInputProps.js +1 -0
  70. package/esm/CurrencyInput/components/utils/addSeparators.js +7 -0
  71. package/esm/CurrencyInput/components/utils/cleanValue.js +69 -0
  72. package/esm/CurrencyInput/components/utils/escapeRegExp.js +8 -0
  73. package/esm/CurrencyInput/components/utils/fixedDecimalValue.js +29 -0
  74. package/esm/CurrencyInput/components/utils/formatValue.js +124 -0
  75. package/esm/CurrencyInput/components/utils/getLocaleConfig.js +47 -0
  76. package/esm/CurrencyInput/components/utils/getSuffix.js +10 -0
  77. package/esm/CurrencyInput/components/utils/index.js +8 -0
  78. package/esm/CurrencyInput/components/utils/isNumber.js +3 -0
  79. package/esm/CurrencyInput/components/utils/padTrimValue.js +27 -0
  80. package/esm/CurrencyInput/components/utils/parseAbbrValue.js +43 -0
  81. package/esm/CurrencyInput/components/utils/removeInvalidChars.js +10 -0
  82. package/esm/CurrencyInput/components/utils/removeSeparators.js +10 -0
  83. package/esm/CurrencyInput/components/utils/repositionCursor.js +35 -0
  84. package/esm/CurrencyInput/index.js +4 -0
  85. package/esm/LinearProgress/index.d.ts +2 -0
  86. package/esm/LinearProgress/index.js +2 -0
  87. package/esm/LinearProgress/linear-progress.d.ts +9 -0
  88. package/esm/LinearProgress/linear-progress.js +28 -0
  89. package/esm/Loadable/index.js +2 -0
  90. package/esm/PhoneInput/phone.d.ts +1 -1
  91. package/esm/PhoneInput/phone.js +23 -20
  92. package/esm/auto-complete/auto-complete-dropdown.js +1 -3
  93. package/esm/auto-complete/auto-complete-item.js +1 -3
  94. package/esm/auto-complete/auto-complete-searching.js +1 -1
  95. package/esm/auto-complete/auto-complete.js +1 -1
  96. package/esm/avatar/avatar-group.js +1 -2
  97. package/esm/avatar/avatar.js +1 -2
  98. package/esm/badge/badge.js +1 -2
  99. package/esm/breadcrumbs/breadcrumbs-item.js +1 -1
  100. package/esm/breadcrumbs/breadcrumbs-separator.js +1 -1
  101. package/esm/breadcrumbs/breadcrumbs.js +1 -1
  102. package/esm/button/button-icon.js +1 -1
  103. package/esm/button/button.compact.d.ts +2 -0
  104. package/esm/button/button.compact.js +94 -50
  105. package/esm/button/button.js +1 -2
  106. package/esm/button/utils.js +1 -1
  107. package/esm/button-dropdown/button-dropdown-item.js +1 -1
  108. package/esm/button-dropdown/button-dropdown.js +1 -2
  109. package/esm/button-group/button-group.js +1 -2
  110. package/esm/capacity/capacity.js +1 -2
  111. package/esm/card/card-content.js +1 -1
  112. package/esm/card/card-footer.js +1 -2
  113. package/esm/card/card.js +1 -2
  114. package/esm/carousal/Arrow.js +18 -0
  115. package/esm/carousal/Indicator.js +20 -0
  116. package/esm/carousal/Thumbs.js +302 -0
  117. package/esm/carousal/animations.js +162 -0
  118. package/esm/carousal/index.js +683 -0
  119. package/esm/carousal/types.js +1 -0
  120. package/esm/carousal/utils.js +49 -0
  121. package/esm/checkbox/checkbox-group.js +1 -1
  122. package/esm/checkbox/checkbox.icon.js +1 -1
  123. package/esm/checkbox/checkbox.js +1 -2
  124. package/esm/code/code.js +1 -1
  125. package/esm/collapse/collapse-group.js +1 -2
  126. package/esm/collapse/collapse.js +1 -4
  127. package/esm/description/description.js +1 -2
  128. package/esm/display/display.js +1 -2
  129. package/esm/divider/divider.js +1 -2
  130. package/esm/dot/dot.js +1 -2
  131. package/esm/drawer/drawer-wrapper.js +1 -3
  132. package/esm/drawer/drawer.js +1 -1
  133. package/esm/fieldset/fieldset-content.js +1 -1
  134. package/esm/fieldset/fieldset-footer.js +1 -1
  135. package/esm/fieldset/fieldset-group.js +1 -3
  136. package/esm/fieldset/fieldset-title.js +1 -1
  137. package/esm/fieldset/fieldset.js +1 -2
  138. package/esm/grid/basic-item.js +1 -2
  139. package/esm/grid/grid-container.js +1 -1
  140. package/esm/grid/grid.js +1 -1
  141. package/esm/image/image-browser.js +1 -2
  142. package/esm/image/image.js +1 -2
  143. package/esm/image/image.skeleton.js +1 -1
  144. package/esm/index.d.ts +2 -14
  145. package/esm/index.js +5 -9
  146. package/esm/input/input-block-label.js +1 -1
  147. package/esm/input/input-icon-clear.js +1 -2
  148. package/esm/input/input-label.js +1 -1
  149. package/esm/input/input.js +1 -2
  150. package/esm/keyboard/keyboard.js +1 -1
  151. package/esm/link/link.js +1 -2
  152. package/esm/list/list-item.js +1 -2
  153. package/esm/loading/loading.js +1 -2
  154. package/esm/modal/modal-action.js +1 -2
  155. package/esm/modal/modal-actions.js +1 -1
  156. package/esm/modal/modal-content.js +1 -1
  157. package/esm/modal/modal-subtitle.js +1 -1
  158. package/esm/modal/modal-title.js +1 -1
  159. package/esm/modal/modal-wrapper.js +1 -3
  160. package/esm/modal/modal.js +1 -1
  161. package/esm/note/note.js +1 -2
  162. package/esm/page/page-header.js +1 -1
  163. package/esm/page/page.js +1 -1
  164. package/esm/pagination/pagination-item.js +1 -2
  165. package/esm/pagination/pagination.js +1 -1
  166. package/esm/popover/popover-item.js +1 -2
  167. package/esm/popover/popover.js +1 -1
  168. package/esm/progress/progress.js +1 -2
  169. package/esm/radio/radio-description.js +1 -1
  170. package/esm/radio/radio-group.js +1 -1
  171. package/esm/radio/radio.js +1 -2
  172. package/esm/rating/rating.js +1 -2
  173. package/esm/row/row.js +1 -1
  174. package/esm/select/select-dropdown.js +1 -3
  175. package/esm/select/select-icon-clear.js +1 -1
  176. package/esm/select/select-multiple-value.js +1 -1
  177. package/esm/select/select-option.js +1 -3
  178. package/esm/select/select.js +9 -12
  179. package/esm/slider/slider-dot.js +1 -2
  180. package/esm/slider/slider-mark.js +1 -1
  181. package/esm/slider/slider.js +1 -3
  182. package/esm/snippet/snippet.js +1 -3
  183. package/esm/spinner/spinner.js +1 -2
  184. package/esm/table/table-body.js +1 -2
  185. package/esm/table/table-head.js +3 -2
  186. package/esm/tabs/tabs-item.js +1 -2
  187. package/esm/tabs/tabs.js +1 -3
  188. package/esm/tag/tag.js +1 -1
  189. package/esm/text/child.js +1 -1
  190. package/esm/textarea/textarea.js +1 -2
  191. package/esm/toggle/toggle.js +1 -2
  192. package/esm/tooltip/tooltip-content.js +1 -3
  193. package/esm/tooltip/tooltip-icon.js +1 -1
  194. package/esm/tooltip/tooltip.js +1 -1
  195. package/esm/tree/tree-file-icon.js +1 -1
  196. package/esm/tree/tree-file.js +1 -2
  197. package/esm/tree/tree-folder-icon.js +1 -1
  198. package/esm/tree/tree-folder.js +1 -3
  199. package/esm/tree/tree-status-icon.js +1 -1
  200. package/esm/tree/tree.js +1 -1
  201. package/esm/use-input/use-input.js +1 -1
  202. package/esm/use-modal/use-modal.js +1 -1
  203. package/esm/use-network-status/index.d.ts +2 -0
  204. package/esm/use-network-status/index.js +2 -0
  205. package/esm/use-network-status/use-netowork-status.d.ts +4 -0
  206. package/esm/use-network-status/use-netowork-status.js +29 -0
  207. package/esm/use-scale/with-scale.js +1 -1
  208. package/esm/use-tabs/use-tabs.js +1 -1
  209. package/esm/user/user.js +1 -2
  210. package/esm/utils/use-context-state/use-context-state.js +1 -1
  211. package/esm/utils/use-drag.js +1 -1
  212. package/package.json +12 -4
  213. package/dist/css-baseline/css-baseline.d.ts +0 -9
  214. package/dist/css-baseline/index.d.ts +0 -1
  215. package/dist/shared/backdrop.d.ts +0 -14
  216. package/dist/shared/css-transition.d.ts +0 -13
  217. package/dist/shared/dropdown.d.ts +0 -9
  218. package/dist/shared/ellipsis.d.ts +0 -6
  219. package/dist/shared/expand.d.ts +0 -7
  220. package/dist/shared/highlight.d.ts +0 -13
  221. package/dist/ui-provider/index.d.ts +0 -3
  222. package/dist/ui-provider/index.js +0 -2186
  223. package/dist/ui-provider/theme-provider.d.ts +0 -8
  224. package/dist/ui-provider/ui-provider.d.ts +0 -8
  225. package/dist/use-all-themes/all-themes-context.d.ts +0 -7
  226. package/dist/use-all-themes/index.d.ts +0 -3
  227. package/dist/use-all-themes/index.js +0 -311
  228. package/dist/use-classes/index.d.ts +0 -2
  229. package/dist/use-classes/index.js +0 -48
  230. package/dist/use-classes/use-classes.d.ts +0 -4
  231. package/dist/use-current-state/index.d.ts +0 -2
  232. package/dist/use-current-state/use-current-state.d.ts +0 -4
  233. package/dist/use-media-query/index.d.ts +0 -3
  234. package/dist/use-media-query/index.js +0 -444
  235. package/dist/use-media-query/use-media-query.d.ts +0 -12
  236. package/dist/use-theme/index.d.ts +0 -2
  237. package/dist/use-theme/index.js +0 -309
  238. package/dist/use-theme/theme-context.d.ts +0 -4
  239. package/dist/use-toasts/helpers.d.ts +0 -18
  240. package/dist/use-toasts/index.d.ts +0 -3
  241. package/dist/use-toasts/index.js +0 -204
  242. package/dist/use-toasts/toast-container.d.ts +0 -3
  243. package/dist/use-toasts/toast-item.d.ts +0 -8
  244. package/dist/use-toasts/use-toast.d.ts +0 -40
  245. package/dist/utils/use-current-state.d.ts +0 -2
  246. package/dist/utils/use-dom-observer.d.ts +0 -3
  247. package/dist/utils/use-hd-ui-context.d.ts +0 -16
  248. package/dist/utils/use-previous.d.ts +0 -2
  249. package/esm/captcha/index.js +0 -128
  250. package/esm/css-baseline/css-baseline.d.ts +0 -9
  251. package/esm/css-baseline/css-baseline.js +0 -23
  252. package/esm/css-baseline/index.d.ts +0 -1
  253. package/esm/css-baseline/index.js +0 -2
  254. package/esm/shared/backdrop.d.ts +0 -14
  255. package/esm/shared/backdrop.js +0 -66
  256. package/esm/shared/css-transition.d.ts +0 -13
  257. package/esm/shared/css-transition.js +0 -65
  258. package/esm/shared/dropdown.d.ts +0 -9
  259. package/esm/shared/dropdown.js +0 -99
  260. package/esm/shared/ellipsis.d.ts +0 -6
  261. package/esm/shared/ellipsis.js +0 -13
  262. package/esm/shared/expand.d.ts +0 -7
  263. package/esm/shared/expand.js +0 -86
  264. package/esm/shared/highlight.d.ts +0 -13
  265. package/esm/shared/highlight.js +0 -46
  266. package/esm/ui-provider/index.d.ts +0 -3
  267. package/esm/ui-provider/index.js +0 -4
  268. package/esm/ui-provider/theme-provider.d.ts +0 -8
  269. package/esm/ui-provider/theme-provider.js +0 -45
  270. package/esm/ui-provider/ui-provider.d.ts +0 -8
  271. package/esm/ui-provider/ui-provider.js +0 -55
  272. package/esm/use-all-themes/all-themes-context.d.ts +0 -7
  273. package/esm/use-all-themes/all-themes-context.js +0 -11
  274. package/esm/use-all-themes/index.d.ts +0 -3
  275. package/esm/use-all-themes/index.js +0 -2
  276. package/esm/use-classes/index.d.ts +0 -2
  277. package/esm/use-classes/index.js +0 -2
  278. package/esm/use-classes/use-classes.d.ts +0 -4
  279. package/esm/use-classes/use-classes.js +0 -34
  280. package/esm/use-current-state/index.d.ts +0 -2
  281. package/esm/use-current-state/index.js +0 -2
  282. package/esm/use-current-state/use-current-state.d.ts +0 -4
  283. package/esm/use-current-state/use-current-state.js +0 -23
  284. package/esm/use-media-query/index.d.ts +0 -3
  285. package/esm/use-media-query/index.js +0 -2
  286. package/esm/use-media-query/use-media-query.d.ts +0 -12
  287. package/esm/use-media-query/use-media-query.js +0 -81
  288. package/esm/use-theme/index.d.ts +0 -2
  289. package/esm/use-theme/index.js +0 -2
  290. package/esm/use-theme/theme-context.d.ts +0 -4
  291. package/esm/use-theme/theme-context.js +0 -9
  292. package/esm/use-toasts/helpers.d.ts +0 -18
  293. package/esm/use-toasts/helpers.js +0 -68
  294. package/esm/use-toasts/index.d.ts +0 -3
  295. package/esm/use-toasts/index.js +0 -2
  296. package/esm/use-toasts/toast-container.d.ts +0 -3
  297. package/esm/use-toasts/toast-container.js +0 -120
  298. package/esm/use-toasts/toast-item.d.ts +0 -8
  299. package/esm/use-toasts/toast-item.js +0 -45
  300. package/esm/use-toasts/use-toast.d.ts +0 -40
  301. package/esm/use-toasts/use-toast.js +0 -103
  302. package/esm/utils/use-current-state.d.ts +0 -2
  303. package/esm/utils/use-current-state.js +0 -2
  304. package/esm/utils/use-dom-observer.d.ts +0 -3
  305. package/esm/utils/use-hd-ui-context.d.ts +0 -16
  306. package/esm/utils/use-previous.d.ts +0 -2
@@ -1,7 +1,14 @@
1
1
  import React, { memo } from 'react';
2
2
  import Button from './button';
3
+ // import { useTheme } from '@helpdice/theme';
4
+ // import { getButtonColors } from './styles';
5
+
6
+ // import useScale from 'components/use-scale';
7
+
3
8
  var CompactButton = function CompactButton(_ref) {
4
- var _ref$to = _ref.to,
9
+ var _ref$color = _ref.color,
10
+ _color = _ref$color === void 0 ? 'default' : _ref$color,
11
+ _ref$to = _ref.to,
5
12
  to = _ref$to === void 0 ? '/' : _ref$to,
6
13
  children = _ref.children,
7
14
  iconRight = _ref.iconRight,
@@ -13,57 +20,94 @@ var CompactButton = function CompactButton(_ref) {
13
20
  a = _ref.a,
14
21
  target = _ref.target,
15
22
  onClick = _ref.onClick;
23
+ // const theme = useTheme();
24
+ // const { SCALES } = useScale();
25
+ // const [paddingLeft, paddingRight] = [
26
+ // auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
27
+ // auto ? SCALES.pr(1.15) : SCALES.pr(1.375),
28
+ // ]
29
+ // const { bg, border, color } = useMemo(
30
+ // () => getButtonColors(theme.palette, {
31
+ // color: _color
32
+ // }),
33
+ // [theme.palette],
34
+ // )
16
35
  if (a) {
17
- return /*#__PURE__*/React.createElement("a", {
18
- style: {
19
- all: 'unset',
20
- boxSizing: 'border-box',
21
- display: 'inline-block',
22
- lineHeight: 'calc(2.5* 16px)',
23
- fontWeight: '400',
24
- fontSize: 'calc(0.875* 16px)',
25
- textAlign: 'center',
26
- whiteSpace: 'nowrap',
27
- position: 'relative',
28
- overflow: 'hidden',
29
- color: '#666',
30
- backgroundColor: '#fff',
31
- cursor: 'pointer',
32
- minWidth: 'min-content',
33
- width: 'auto',
34
- height: 'calc(2.5* 16px)',
35
- padding: '0 calc(0.69* 16px) 0 calc(0.69* 16px)',
36
- margin: 0,
37
- '--helpdice-ui-button-height': 'calc(2.5* 16px)',
38
- '--helpdice-ui-button-icon-padding': 'calc(0.4362* 16px)'
36
+ return /*#__PURE__*/React.createElement(Button, {
37
+ icon: icon,
38
+ style: style,
39
+ type: type,
40
+ onClick: function onClick() {
41
+ return window.open(to, target);
39
42
  },
40
- href: to,
41
- target: target
42
- }, /*#__PURE__*/React.createElement("span", {
43
- style: {
44
- position: 'absolute',
45
- right: 'auto',
46
- left: 'var(--helpdice-ui-button-icon-padding)',
47
- top: '50%',
48
- transform: 'translateY(-50%)',
49
- display: 'flex',
50
- justifyContent: 'center',
51
- alignItems: 'center',
52
- color: 'var(--helpdice-ui-button-color)',
53
- zIndex: 1
54
- }
55
- }, icon), /*#__PURE__*/React.createElement("div", {
56
- style: {
57
- display: 'inline-flex',
58
- position: 'relative',
59
- zIndex: 1,
60
- justifyContent: 'center',
61
- alignItems: 'center',
62
- textAlign: 'center',
63
- lineHeight: 'inherit',
64
- paddingLeft: icon ? 'calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding)* .5)' : 0
65
- }
66
- }, children));
43
+ auto: true,
44
+ scale: scale,
45
+ px: 0.6,
46
+ iconRight: iconRight
47
+ }, children)
48
+ // <a
49
+ // style={
50
+ // {
51
+ // all: 'unset',
52
+ // boxSizing: 'border-box',
53
+ // display: 'inline-block',
54
+ // lineHeight: 'calc(2.5* 16px)',
55
+ // fontWeight: '400',
56
+ // fontSize: 'calc(0.875* 16px)',
57
+ // textAlign: 'center',
58
+ // whiteSpace: 'nowrap',
59
+ // position: 'relative',
60
+ // overflow: 'hidden',
61
+ // color: color,
62
+ // backgroundColor: bg,
63
+ // border: `1px solid ${border}`,
64
+ // cursor: 'pointer',
65
+ // '--helpdice-ui-button-icon-padding': `${SCALES.pl(0.727)}`,
66
+ // '--helpdice-ui-button-height': `${SCALES.height(2.5)}`,
67
+ // '--helpdice-ui-button-color':`${color}`,
68
+ // '--helpdice-ui-button-bg': `${bg}`,
69
+ // minWidth: `${auto ? 'min-content' : SCALES.width(10.5)}`,
70
+ // width: `${auto ? 'auto' : 'initial'}`,
71
+ // height: `${SCALES.height(2.5)}`,
72
+ // padding:` ${SCALES.pt(0)} ${paddingRight} ${SCALES.pb(0)} ${paddingLeft}`,
73
+ // margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`
74
+ // } as React.CSSProperties
75
+ // }
76
+ // href={to}
77
+ // target={target}
78
+ // >
79
+ // <span
80
+ // style={{
81
+ // position: 'absolute',
82
+ // right: 'auto',
83
+ // left: 'var(--helpdice-ui-button-icon-padding)',
84
+ // top: '50%',
85
+ // transform: 'translateY(-50%)',
86
+ // display: 'flex',
87
+ // justifyContent: 'center',
88
+ // alignItems: 'center',
89
+ // color: 'var(--helpdice-ui-button-color)',
90
+ // zIndex: 1
91
+ // }}
92
+ // >
93
+ // {icon}
94
+ // </span>
95
+ // <div
96
+ // style={{
97
+ // display: 'inline-flex',
98
+ // position: 'relative',
99
+ // zIndex: 1,
100
+ // justifyContent: 'center',
101
+ // alignItems: 'center',
102
+ // textAlign: 'center',
103
+ // lineHeight: 'inherit',
104
+ // paddingLeft: icon ? 'calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding)* .5)' : 0
105
+ // }}
106
+ // >
107
+ // {children}
108
+ // </div>
109
+ // </a>
110
+ ;
67
111
  }
68
112
  return /*#__PURE__*/React.createElement(Button, {
69
113
  icon: icon,
@@ -7,13 +7,12 @@ import _JSXStyle from "../styled-jsx.es.js";
7
7
 
8
8
  import React, { useRef, useState, useMemo, useImperativeHandle } from 'react';
9
9
  import useScale, { withScale } from '../use-scale';
10
- import useTheme from '../use-theme';
10
+ import { useTheme, useClasses } from '@helpdice/theme';
11
11
  import ButtonDrip from './button.drip';
12
12
  import ButtonLoading from './button-loading';
13
13
  import { filterPropsWithGroup, getButtonChildrenWithIcon } from './utils';
14
14
  import { useButtonGroupContext } from '../button-group/button-group-context';
15
15
  import { getButtonColors, getButtonCursor, getButtonDripColor, getButtonHoverColors } from './styles';
16
- import useClasses from '../use-classes';
17
16
  var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
18
17
  var theme = useTheme();
19
18
  var _useScale = useScale(),
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _JSXStyle from "../styled-jsx.es.js";
3
3
  import React from 'react';
4
4
  import ButtonIcon from './button-icon';
5
- import useClasses from '../use-classes';
5
+ import { useClasses } from '@helpdice/theme';
6
6
  export var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
7
7
  var icon = icons.icon,
8
8
  iconRight = icons.iconRight;
@@ -5,7 +5,7 @@ import _JSXStyle from "../styled-jsx.es.js";
5
5
  /* "use client" */
6
6
 
7
7
  import React, { useMemo } from 'react';
8
- import useTheme from '../use-theme';
8
+ import { useTheme } from '@helpdice/theme';
9
9
  import { getColor } from './styles';
10
10
  import { useButtonDropdown } from './button-dropdown-context';
11
11
  import Loading from '../loading';
@@ -6,7 +6,7 @@ import _JSXStyle from "../styled-jsx.es.js";
6
6
  /* "use client" */
7
7
 
8
8
  import React, { useCallback, useMemo, useRef, useState } from 'react';
9
- import useTheme from '../use-theme';
9
+ import { useTheme, useClasses } from '@helpdice/theme';
10
10
  import useClickAway from '../utils/use-click-away';
11
11
  import { getColor } from './styles';
12
12
  import ButtonDropdownIcon from './icon';
@@ -14,7 +14,6 @@ import ButtonDropdownItem from './button-dropdown-item';
14
14
  import { ButtonDropdownContext } from './button-dropdown-context';
15
15
  import { pickChild, pickChildByProps } from '../utils/collections';
16
16
  import useScale, { withScale } from '../use-scale';
17
- import useClasses from '../use-classes';
18
17
  var stopPropagation = function stopPropagation(event) {
19
18
  event.stopPropagation();
20
19
  event.nativeEvent.stopImmediatePropagation();
@@ -3,10 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["disabled", "type", "ghost", "vertical", "children", "className"];
4
4
  import _JSXStyle from "../styled-jsx.es.js";
5
5
  import React, { useMemo } from 'react';
6
- import useTheme from '../use-theme';
6
+ import { useTheme, useClasses } from '@helpdice/theme';
7
7
  import { ButtonGroupContext } from './button-group-context';
8
8
  import useScale, { withScale } from '../use-scale';
9
- import useClasses from '../use-classes';
10
9
  var getGroupBorderColors = function getGroupBorderColors(palette, props) {
11
10
  var _props$ghost = props.ghost,
12
11
  ghost = _props$ghost === void 0 ? false : _props$ghost,
@@ -3,10 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["value", "limit", "color", "className"];
4
4
  import _JSXStyle from "../styled-jsx.es.js";
5
5
  import React, { useMemo } from 'react';
6
- import useTheme from '../use-theme';
6
+ import { useTheme, useClasses } from '@helpdice/theme';
7
7
  import { useProportions } from '../utils/calculations';
8
8
  import useScale, { withScale } from '../use-scale';
9
- import useClasses from '../use-classes';
10
9
  var getColor = function getColor(val, palette) {
11
10
  if (val < 33) return palette.cyan;
12
11
  if (val < 66) return palette.warning;
@@ -4,7 +4,7 @@ var _excluded = ["className", "children"];
4
4
  import _JSXStyle from "../styled-jsx.es.js";
5
5
  import React from 'react';
6
6
  import useScale, { withScale } from '../use-scale';
7
- import useClasses from '../use-classes';
7
+ import { useClasses } from '@helpdice/theme';
8
8
  var CardContentComponent = function CardContentComponent(_ref) {
9
9
  var _ref$className = _ref.className,
10
10
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -3,9 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["children", "className", "disableAutoMargin"];
4
4
  import _JSXStyle from "../styled-jsx.es.js";
5
5
  import React from 'react';
6
- import useTheme from '../use-theme';
6
+ import { useTheme, useClasses } from '@helpdice/theme';
7
7
  import useScale, { withScale } from '../use-scale';
8
- import useClasses from '../use-classes';
9
8
  var CardFooterComponent = function CardFooterComponent(_ref) {
10
9
  var children = _ref.children,
11
10
  _ref$className = _ref.className,
package/esm/card/card.js CHANGED
@@ -4,14 +4,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
4
4
  var _excluded = ["children", "hoverable", "className", "shadow", "type"];
5
5
  import _JSXStyle from "../styled-jsx.es.js";
6
6
  import React, { useMemo } from 'react';
7
- import useTheme from '../use-theme';
7
+ import { useTheme, useClasses } from '@helpdice/theme';
8
8
  import { getStyles } from './styles';
9
9
  import CardFooter from './card-footer';
10
10
  import CardContent from './card-content';
11
11
  import Image from '../image';
12
12
  import { hasChild, pickChild } from '../utils/collections';
13
13
  import useScale, { withScale } from '../use-scale';
14
- import useClasses from '../use-classes';
15
14
  var CardComponent = function CardComponent(_ref) {
16
15
  var children = _ref.children,
17
16
  _ref$hoverable = _ref.hoverable,
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import klass from '../../cssClasses'; // Assuming cssClasses.ts is in src/
3
+
4
+ var Arrow = function Arrow(_ref) {
5
+ var direction = _ref.direction,
6
+ onClickHandler = _ref.onClickHandler,
7
+ enabled = _ref.enabled,
8
+ label = _ref.label;
9
+ var isPrev = direction === 'prev';
10
+ var arrowClassName = isPrev ? klass.ARROW_PREV(!enabled) : klass.ARROW_NEXT(!enabled);
11
+ return /*#__PURE__*/React.createElement("button", {
12
+ type: "button",
13
+ "aria-label": label,
14
+ className: arrowClassName,
15
+ onClick: onClickHandler
16
+ });
17
+ };
18
+ export default Arrow;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import klass from '../../cssClasses'; // Assuming cssClasses.ts is in src/
3
+
4
+ var Indicator = function Indicator(_ref) {
5
+ var onClickHandler = _ref.onClickHandler,
6
+ isSelected = _ref.isSelected,
7
+ index = _ref.index,
8
+ label = _ref.label;
9
+ return /*#__PURE__*/React.createElement("li", {
10
+ className: klass.DOT(isSelected),
11
+ onClick: onClickHandler,
12
+ onKeyDown: onClickHandler,
13
+ value: index,
14
+ key: index,
15
+ role: "button",
16
+ tabIndex: 0,
17
+ "aria-label": "".concat(label, " ").concat(index + 1)
18
+ });
19
+ };
20
+ export default Indicator;
@@ -0,0 +1,302 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
+ import React, { Component, Children } from 'react';
11
+ import klass from '../cssClasses';
12
+ import { outerWidth } from '../dimensions';
13
+ import CSSTranslate from '../CSSTranslate';
14
+ // @ts-ignore
15
+ import Swipe from 'react-easy-swipe';
16
+ import getWindow from '../shims/window';
17
+ var isKeyboardEvent = function isKeyboardEvent(e) {
18
+ return e.hasOwnProperty('key');
19
+ };
20
+ var Thumbs = /*#__PURE__*/function (_Component) {
21
+ function Thumbs(_props) {
22
+ var _this;
23
+ _classCallCheck(this, Thumbs);
24
+ _this = _callSuper(this, Thumbs, [_props]);
25
+ _defineProperty(_this, "setItemsWrapperRef", function (node) {
26
+ _this.itemsWrapperRef = node;
27
+ });
28
+ _defineProperty(_this, "setItemsListRef", function (node) {
29
+ _this.itemsListRef = node;
30
+ });
31
+ _defineProperty(_this, "setThumbsRef", function (node, index) {
32
+ if (!_this.thumbsRef) {
33
+ _this.thumbsRef = [];
34
+ }
35
+ _this.thumbsRef[index] = node;
36
+ });
37
+ _defineProperty(_this, "updateSizes", function () {
38
+ if (!_this.props.children || !_this.itemsWrapperRef || !_this.thumbsRef) {
39
+ return;
40
+ }
41
+ var total = Children.count(_this.props.children);
42
+ var wrapperSize = _this.itemsWrapperRef.clientWidth;
43
+ var itemSize = _this.props.thumbWidth ? _this.props.thumbWidth : outerWidth(_this.thumbsRef[0]);
44
+ var visibleItems = Math.floor(wrapperSize / itemSize);
45
+ var showArrows = visibleItems < total;
46
+ var lastPosition = showArrows ? total - visibleItems : 0;
47
+ _this.setState(function (_state, props) {
48
+ return {
49
+ itemSize: itemSize,
50
+ visibleItems: visibleItems,
51
+ firstItem: showArrows ? _this.getFirstItem(props.selectedItem) : 0,
52
+ lastPosition: lastPosition,
53
+ showArrows: showArrows
54
+ };
55
+ });
56
+ });
57
+ _defineProperty(_this, "handleClickItem", function (index, item, e) {
58
+ if (!isKeyboardEvent(e) || e.key === 'Enter') {
59
+ var handler = _this.props.onSelectItem;
60
+ if (typeof handler === 'function') {
61
+ handler(index, item);
62
+ }
63
+ }
64
+ });
65
+ _defineProperty(_this, "onSwipeStart", function () {
66
+ _this.setState({
67
+ swiping: true
68
+ });
69
+ });
70
+ _defineProperty(_this, "onSwipeEnd", function () {
71
+ _this.setState({
72
+ swiping: false
73
+ });
74
+ });
75
+ _defineProperty(_this, "onSwipeMove", function (delta) {
76
+ var deltaX = delta.x;
77
+ if (!_this.state.itemSize || !_this.itemsWrapperRef || !_this.state.visibleItems) {
78
+ return false;
79
+ }
80
+ var leftBoundary = 0;
81
+ var childrenLength = Children.count(_this.props.children);
82
+ var currentPosition = -(_this.state.firstItem * 100) / _this.state.visibleItems;
83
+ var lastLeftItem = Math.max(childrenLength - _this.state.visibleItems, 0);
84
+ var lastLeftBoundary = -lastLeftItem * 100 / _this.state.visibleItems;
85
+
86
+ // prevent user from swiping left out of boundaries
87
+ if (currentPosition === leftBoundary && deltaX > 0) {
88
+ deltaX = 0;
89
+ }
90
+
91
+ // prevent user from swiping right out of boundaries
92
+ if (currentPosition === lastLeftBoundary && deltaX < 0) {
93
+ deltaX = 0;
94
+ }
95
+ var wrapperSize = _this.itemsWrapperRef.clientWidth;
96
+ var position = currentPosition + 100 / (wrapperSize / deltaX);
97
+ // if 3d isn't available we will use left to move
98
+ if (_this.itemsListRef) {
99
+ ['WebkitTransform', 'MozTransform', 'MsTransform', 'OTransform', 'transform', 'msTransform'].forEach(function (prop) {
100
+ _this.itemsListRef.style[prop] = CSSTranslate(position, '%', _this.props.axis);
101
+ });
102
+ }
103
+ return true;
104
+ });
105
+ _defineProperty(_this, "slideRight", function (positions) {
106
+ _this.moveTo(_this.state.firstItem - (typeof positions === 'number' ? positions : 1));
107
+ });
108
+ _defineProperty(_this, "slideLeft", function (positions) {
109
+ _this.moveTo(_this.state.firstItem + (typeof positions === 'number' ? positions : 1));
110
+ });
111
+ _defineProperty(_this, "moveTo", function (position) {
112
+ // position can't be lower than 0
113
+ position = position < 0 ? 0 : position;
114
+ // position can't be higher than last postion
115
+ position = position >= _this.state.lastPosition ? _this.state.lastPosition : position;
116
+ _this.setState({
117
+ firstItem: position
118
+ });
119
+ });
120
+ _this.state = {
121
+ selectedItem: _props.selectedItem,
122
+ swiping: false,
123
+ showArrows: false,
124
+ firstItem: 0,
125
+ visibleItems: 0,
126
+ lastPosition: 0
127
+ };
128
+ return _this;
129
+ }
130
+ _inherits(Thumbs, _Component);
131
+ return _createClass(Thumbs, [{
132
+ key: "componentDidMount",
133
+ value: function componentDidMount() {
134
+ this.setupThumbs();
135
+ }
136
+ }, {
137
+ key: "componentDidUpdate",
138
+ value: function componentDidUpdate(prevProps) {
139
+ if (this.props.selectedItem !== this.state.selectedItem) {
140
+ this.setState({
141
+ selectedItem: this.props.selectedItem,
142
+ firstItem: this.getFirstItem(this.props.selectedItem)
143
+ });
144
+ }
145
+ if (this.props.children === prevProps.children) {
146
+ return;
147
+ }
148
+
149
+ // This will capture any size changes for arrow adjustments etc.
150
+ // usually in the same render cycle so we don't see any flickers
151
+ this.updateSizes();
152
+ }
153
+ }, {
154
+ key: "componentWillUnmount",
155
+ value: function componentWillUnmount() {
156
+ this.destroyThumbs();
157
+ }
158
+ }, {
159
+ key: "setupThumbs",
160
+ value: function setupThumbs() {
161
+ // as the widths are calculated, we need to resize
162
+ // the carousel when the window is resized
163
+ getWindow().addEventListener('resize', this.updateSizes);
164
+ // issue #2 - image loading smaller
165
+ getWindow().addEventListener('DOMContentLoaded', this.updateSizes);
166
+
167
+ // when the component is rendered we need to calculate
168
+ // the container size to adjust the responsive behaviour
169
+ this.updateSizes();
170
+ }
171
+ }, {
172
+ key: "destroyThumbs",
173
+ value: function destroyThumbs() {
174
+ // removing listeners
175
+ getWindow().removeEventListener('resize', this.updateSizes);
176
+ getWindow().removeEventListener('DOMContentLoaded', this.updateSizes);
177
+ }
178
+ }, {
179
+ key: "getFirstItem",
180
+ value: function getFirstItem(selectedItem) {
181
+ var firstItem = selectedItem;
182
+ if (selectedItem >= this.state.lastPosition) {
183
+ firstItem = this.state.lastPosition;
184
+ }
185
+ if (selectedItem < this.state.firstItem + this.state.visibleItems) {
186
+ firstItem = this.state.firstItem;
187
+ }
188
+ if (selectedItem < this.state.firstItem) {
189
+ firstItem = selectedItem;
190
+ }
191
+ return firstItem;
192
+ }
193
+ }, {
194
+ key: "renderItems",
195
+ value: function renderItems() {
196
+ var _this2 = this;
197
+ return this.props.children.map(function (img, index) {
198
+ var itemClass = klass.ITEM(false, index === _this2.state.selectedItem);
199
+ var thumbProps = {
200
+ key: index,
201
+ ref: function ref(e) {
202
+ return _this2.setThumbsRef(e, index);
203
+ },
204
+ className: itemClass,
205
+ onClick: _this2.handleClickItem.bind(_this2, index, _this2.props.children[index]),
206
+ onKeyDown: _this2.handleClickItem.bind(_this2, index, _this2.props.children[index]),
207
+ 'aria-label': "".concat(_this2.props.labels.item, " ").concat(index + 1),
208
+ style: {
209
+ width: _this2.props.thumbWidth
210
+ }
211
+ };
212
+ return /*#__PURE__*/React.createElement("li", _extends({}, thumbProps, {
213
+ role: "button",
214
+ tabIndex: 0
215
+ }), img);
216
+ });
217
+ }
218
+ }, {
219
+ key: "render",
220
+ value: function render() {
221
+ var _this3 = this;
222
+ if (!this.props.children) {
223
+ return null;
224
+ }
225
+ var isSwipeable = Children.count(this.props.children) > 1;
226
+
227
+ // show left arrow?
228
+ var hasPrev = this.state.showArrows && this.state.firstItem > 0;
229
+ // show right arrow
230
+ var hasNext = this.state.showArrows && this.state.firstItem < this.state.lastPosition;
231
+ // obj to hold the transformations and styles
232
+ var itemListStyles = {};
233
+ var currentPosition = -this.state.firstItem * (this.state.itemSize || 0);
234
+ var transformProp = CSSTranslate(currentPosition, 'px', this.props.axis);
235
+ var transitionTime = this.props.transitionTime + 'ms';
236
+ itemListStyles = {
237
+ WebkitTransform: transformProp,
238
+ MozTransform: transformProp,
239
+ MsTransform: transformProp,
240
+ OTransform: transformProp,
241
+ transform: transformProp,
242
+ msTransform: transformProp,
243
+ WebkitTransitionDuration: transitionTime,
244
+ MozTransitionDuration: transitionTime,
245
+ MsTransitionDuration: transitionTime,
246
+ OTransitionDuration: transitionTime,
247
+ transitionDuration: transitionTime,
248
+ msTransitionDuration: transitionTime
249
+ };
250
+ return /*#__PURE__*/React.createElement("div", {
251
+ className: klass.CAROUSEL(false)
252
+ }, /*#__PURE__*/React.createElement("div", {
253
+ className: klass.WRAPPER(false),
254
+ ref: this.setItemsWrapperRef
255
+ }, /*#__PURE__*/React.createElement("button", {
256
+ type: "button",
257
+ className: klass.ARROW_PREV(!hasPrev),
258
+ onClick: function onClick() {
259
+ return _this3.slideRight();
260
+ },
261
+ "aria-label": this.props.labels.leftArrow
262
+ }), isSwipeable ? /*#__PURE__*/React.createElement(Swipe, {
263
+ tagName: "ul",
264
+ className: klass.SLIDER(false, this.state.swiping),
265
+ onSwipeLeft: this.slideLeft,
266
+ onSwipeRight: this.slideRight,
267
+ onSwipeMove: this.onSwipeMove,
268
+ onSwipeStart: this.onSwipeStart,
269
+ onSwipeEnd: this.onSwipeEnd,
270
+ style: itemListStyles,
271
+ innerRef: this.setItemsListRef,
272
+ allowMouseEvents: this.props.emulateTouch
273
+ }, this.renderItems()) : /*#__PURE__*/React.createElement("ul", {
274
+ className: klass.SLIDER(false, this.state.swiping),
275
+ ref: function ref(node) {
276
+ return _this3.setItemsListRef(node);
277
+ },
278
+ style: itemListStyles
279
+ }, this.renderItems()), /*#__PURE__*/React.createElement("button", {
280
+ type: "button",
281
+ className: klass.ARROW_NEXT(!hasNext),
282
+ onClick: function onClick() {
283
+ return _this3.slideLeft();
284
+ },
285
+ "aria-label": this.props.labels.rightArrow
286
+ })));
287
+ }
288
+ }]);
289
+ }(Component);
290
+ _defineProperty(Thumbs, "displayName", 'Thumbs');
291
+ _defineProperty(Thumbs, "defaultProps", {
292
+ axis: 'horizontal',
293
+ labels: {
294
+ leftArrow: 'previous slide / item',
295
+ rightArrow: 'next slide / item',
296
+ item: 'slide item'
297
+ },
298
+ selectedItem: 0,
299
+ thumbWidth: 80,
300
+ transitionTime: 350
301
+ });
302
+ export { Thumbs as default };