@rio-cloud/rio-uikit 0.16.4-beta.13 → 0.16.4-beta.15

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 (179) hide show
  1. package/CustomState.d.ts +2 -5
  2. package/CustomState.js +2 -2
  3. package/EmptyState.d.ts +2 -5
  4. package/EmptyState.js +2 -2
  5. package/ErrorState.d.ts +2 -5
  6. package/ErrorState.js +2 -2
  7. package/ForbiddenState.d.ts +2 -5
  8. package/ForbiddenState.js +2 -2
  9. package/MaintenanceState.d.ts +2 -5
  10. package/MaintenanceState.js +2 -2
  11. package/NotBookedState.d.ts +2 -5
  12. package/NotFoundState.d.ts +2 -5
  13. package/NotFoundState.js +2 -2
  14. package/Notification.d.ts +2 -9
  15. package/Notification.js +2 -2
  16. package/NotificationsContainer.d.ts +2 -5
  17. package/NotificationsContainer.js +2 -2
  18. package/Tag.d.ts +2 -5
  19. package/Tag.js +2 -2
  20. package/TagList.d.ts +1 -5
  21. package/TagList.js +1 -2
  22. package/TagManager.d.ts +2 -5
  23. package/TagManager.js +2 -2
  24. package/Teaser.d.ts +2 -5
  25. package/Teaser.js +2 -2
  26. package/TeaserContainer.d.ts +2 -5
  27. package/TeaserContainer.js +2 -2
  28. package/TimePicker.d.ts +2 -5
  29. package/TimePicker.js +2 -2
  30. package/components/expander/ExpanderPanel.d.ts +1 -0
  31. package/components/expander/ExpanderPanel.js +4 -3
  32. package/components/notification/Notification.d.ts +32 -1
  33. package/components/notification/Notification.js +3 -2
  34. package/components/notification/NotificationsContainer.d.ts +7 -13
  35. package/components/notification/NotificationsContainer.js +2 -8
  36. package/components/saveableInput/SaveableInput.d.ts +34 -1
  37. package/components/saveableInput/SaveableInput.js +28 -6
  38. package/components/states/BaseStateProps.d.ts +66 -0
  39. package/components/states/BaseStateProps.js +2 -0
  40. package/components/states/CustomState.d.ts +4 -14
  41. package/components/states/CustomState.js +13 -40
  42. package/components/states/EmptyState.d.ts +4 -8
  43. package/components/states/EmptyState.js +6 -6
  44. package/components/states/ErrorState.d.ts +4 -8
  45. package/components/states/ErrorState.js +6 -6
  46. package/components/states/ForbiddenState.d.ts +4 -8
  47. package/components/states/ForbiddenState.js +6 -6
  48. package/components/states/MaintenanceState.d.ts +4 -8
  49. package/components/states/MaintenanceState.js +6 -6
  50. package/components/states/NotBookedState.d.ts +9 -19
  51. package/components/states/NotBookedState.js +8 -23
  52. package/components/states/NotFoundState.d.ts +4 -8
  53. package/components/states/NotFoundState.js +6 -6
  54. package/components/states/StateButton.d.ts +27 -0
  55. package/components/states/StateButton.js +13 -0
  56. package/components/states/StateIcon.d.ts +7 -0
  57. package/components/states/StateIcon.js +4 -0
  58. package/components/tag/Tag.d.ts +69 -36
  59. package/components/tag/Tag.js +7 -30
  60. package/components/tag/TagList.d.ts +24 -16
  61. package/components/tag/TagList.js +6 -15
  62. package/components/tagManager/CustomSuggestionItem.d.ts +6 -12
  63. package/components/tagManager/CustomSuggestionItem.js +4 -9
  64. package/components/tagManager/TagManager.d.ts +61 -26
  65. package/components/tagManager/TagManager.js +22 -39
  66. package/components/tagManager/TagManagerItemList.d.ts +6 -13
  67. package/components/tagManager/TagManagerItemList.js +3 -13
  68. package/components/tagManager/TagManagerTag.d.ts +5 -0
  69. package/components/tagManager/TagManagerTag.js +1 -0
  70. package/components/teaser/Teaser.d.ts +93 -50
  71. package/components/teaser/Teaser.js +69 -118
  72. package/components/teaser/TeaserContainer.d.ts +25 -12
  73. package/components/teaser/TeaserContainer.js +10 -23
  74. package/components/timepicker/TimePicker.d.ts +34 -26
  75. package/components/timepicker/TimePicker.js +13 -30
  76. package/components/tooltip/Tooltip.d.ts +4 -0
  77. package/components/tooltip/Tooltip.js +2 -2
  78. package/hooks/useDocumentTitle.d.ts +2 -0
  79. package/hooks/useDocumentTitle.js +9 -0
  80. package/hooks/useIsFirstRender.d.ts +2 -0
  81. package/hooks/useIsFirstRender.js +10 -0
  82. package/index.d.ts +28 -25
  83. package/index.js +28 -25
  84. package/lib/es/CustomState.d.ts +2 -5
  85. package/lib/es/CustomState.js +3 -2
  86. package/lib/es/EmptyState.d.ts +2 -5
  87. package/lib/es/EmptyState.js +3 -2
  88. package/lib/es/ErrorState.d.ts +2 -5
  89. package/lib/es/ErrorState.js +3 -2
  90. package/lib/es/ForbiddenState.d.ts +2 -5
  91. package/lib/es/ForbiddenState.js +3 -2
  92. package/lib/es/MaintenanceState.d.ts +2 -5
  93. package/lib/es/MaintenanceState.js +3 -2
  94. package/lib/es/NotBookedState.d.ts +2 -5
  95. package/lib/es/NotFoundState.d.ts +2 -5
  96. package/lib/es/NotFoundState.js +3 -2
  97. package/lib/es/Notification.d.ts +2 -9
  98. package/lib/es/Notification.js +3 -2
  99. package/lib/es/NotificationsContainer.d.ts +2 -5
  100. package/lib/es/NotificationsContainer.js +3 -2
  101. package/lib/es/Tag.d.ts +2 -5
  102. package/lib/es/Tag.js +3 -2
  103. package/lib/es/TagList.d.ts +1 -5
  104. package/lib/es/TagList.js +5 -3
  105. package/lib/es/TagManager.d.ts +2 -5
  106. package/lib/es/TagManager.js +3 -2
  107. package/lib/es/Teaser.d.ts +2 -5
  108. package/lib/es/Teaser.js +3 -2
  109. package/lib/es/TeaserContainer.d.ts +2 -5
  110. package/lib/es/TeaserContainer.js +3 -2
  111. package/lib/es/TimePicker.d.ts +2 -5
  112. package/lib/es/TimePicker.js +3 -2
  113. package/lib/es/components/expander/ExpanderPanel.d.ts +1 -0
  114. package/lib/es/components/expander/ExpanderPanel.js +4 -3
  115. package/lib/es/components/notification/Notification.d.ts +32 -1
  116. package/lib/es/components/notification/Notification.js +3 -2
  117. package/lib/es/components/notification/NotificationsContainer.d.ts +7 -13
  118. package/lib/es/components/notification/NotificationsContainer.js +2 -8
  119. package/lib/es/components/saveableInput/SaveableInput.d.ts +34 -1
  120. package/lib/es/components/saveableInput/SaveableInput.js +28 -6
  121. package/lib/es/components/states/BaseStateProps.d.ts +66 -0
  122. package/lib/es/components/states/BaseStateProps.js +4 -0
  123. package/lib/es/components/states/CustomState.d.ts +4 -14
  124. package/lib/es/components/states/CustomState.js +14 -41
  125. package/lib/es/components/states/EmptyState.d.ts +4 -8
  126. package/lib/es/components/states/EmptyState.js +5 -6
  127. package/lib/es/components/states/ErrorState.d.ts +4 -8
  128. package/lib/es/components/states/ErrorState.js +5 -6
  129. package/lib/es/components/states/ForbiddenState.d.ts +4 -8
  130. package/lib/es/components/states/ForbiddenState.js +5 -6
  131. package/lib/es/components/states/MaintenanceState.d.ts +4 -8
  132. package/lib/es/components/states/MaintenanceState.js +5 -6
  133. package/lib/es/components/states/NotBookedState.d.ts +9 -19
  134. package/lib/es/components/states/NotBookedState.js +7 -22
  135. package/lib/es/components/states/NotFoundState.d.ts +4 -8
  136. package/lib/es/components/states/NotFoundState.js +5 -6
  137. package/lib/es/components/states/StateButton.d.ts +27 -0
  138. package/lib/es/components/states/StateButton.js +16 -0
  139. package/lib/es/components/states/StateIcon.d.ts +7 -0
  140. package/lib/es/components/states/StateIcon.js +6 -0
  141. package/lib/es/components/tag/Tag.d.ts +69 -36
  142. package/lib/es/components/tag/Tag.js +7 -30
  143. package/lib/es/components/tag/TagList.d.ts +24 -16
  144. package/lib/es/components/tag/TagList.js +6 -15
  145. package/lib/es/components/tagManager/CustomSuggestionItem.d.ts +6 -12
  146. package/lib/es/components/tagManager/CustomSuggestionItem.js +4 -9
  147. package/lib/es/components/tagManager/TagManager.d.ts +61 -26
  148. package/lib/es/components/tagManager/TagManager.js +22 -39
  149. package/lib/es/components/tagManager/TagManagerItemList.d.ts +6 -13
  150. package/lib/es/components/tagManager/TagManagerItemList.js +3 -13
  151. package/lib/es/components/tagManager/TagManagerTag.d.ts +5 -0
  152. package/lib/es/components/tagManager/TagManagerTag.js +2 -0
  153. package/lib/es/components/teaser/Teaser.d.ts +93 -50
  154. package/lib/es/components/teaser/Teaser.js +69 -120
  155. package/lib/es/components/teaser/TeaserContainer.d.ts +25 -12
  156. package/lib/es/components/teaser/TeaserContainer.js +10 -23
  157. package/lib/es/components/timepicker/TimePicker.d.ts +34 -26
  158. package/lib/es/components/timepicker/TimePicker.js +13 -30
  159. package/lib/es/components/tooltip/Tooltip.d.ts +4 -0
  160. package/lib/es/components/tooltip/Tooltip.js +2 -2
  161. package/lib/es/hooks/useDocumentTitle.d.ts +2 -0
  162. package/lib/es/hooks/useDocumentTitle.js +11 -0
  163. package/lib/es/hooks/useIsFirstRender.d.ts +2 -0
  164. package/lib/es/hooks/useIsFirstRender.js +12 -0
  165. package/lib/es/index.d.ts +28 -25
  166. package/lib/es/index.js +46 -30
  167. package/lib/es/types.d.ts +1 -112
  168. package/lib/es/useDocumentTitle.d.ts +2 -0
  169. package/lib/es/useDocumentTitle.js +7 -0
  170. package/lib/es/useIsFirstRender.d.ts +2 -0
  171. package/lib/es/useIsFirstRender.js +7 -0
  172. package/lib/es/version.json +1 -1
  173. package/package.json +29 -23
  174. package/types.d.ts +1 -112
  175. package/useDocumentTitle.d.ts +2 -0
  176. package/useDocumentTitle.js +2 -0
  177. package/useIsFirstRender.d.ts +2 -0
  178. package/useIsFirstRender.js +2 -0
  179. package/version.json +1 -1
@@ -1,4 +1,4 @@
1
- import { type Attributes } from 'react';
1
+ import React, { type Attributes } from 'react';
2
2
  export type SaveableInputProps = {
3
3
  /**
4
4
  * The input placeholder.
@@ -25,6 +25,26 @@ export type SaveableInputProps = {
25
25
  * @returns
26
26
  */
27
27
  onValueChanged?: (value: string, previousValue: string) => void;
28
+ /**
29
+ * Callback function that gets triggered on every input change. Use this to control the component
30
+ * or when implementing key validation.
31
+ * @param keyValue the key value that has been entered
32
+ * @param inputValue the current complete value of the input
33
+ * @returns
34
+ */
35
+ onInputChange?: (keyValue: string, inputValue: string) => void;
36
+ /**
37
+ * Callback function that gets triggered when the user aborts the edit mode. Use this
38
+ * to control the component and handle the resetting of previous value on the outside.
39
+ * @returns
40
+ */
41
+ onEsc?: () => void;
42
+ /**
43
+ * Callback function that gets triggered when the input is in edit mode. Use this
44
+ * to control the component dna to handle the previous value on the outside.
45
+ * @returns
46
+ */
47
+ onEnterEdit?: () => void;
28
48
  /**
29
49
  * Defines the button style: `default` or `primary`.
30
50
  */
@@ -33,6 +53,19 @@ export type SaveableInputProps = {
33
53
  * Additional HTML attributes to be set on the input element.
34
54
  */
35
55
  inputProps?: Attributes;
56
+ /**
57
+ * Adds a given unit to the input.
58
+ */
59
+ unit?: string | React.ReactNode;
60
+ /**
61
+ * Icon class name that shall be used. If defined, the input element is wrapped in an input-group
62
+ * and the icon will be set in an input-addon. Example: `rioglyph-search`.
63
+ */
64
+ icon?: string;
65
+ /**
66
+ * Disables the component so the user cannot enter the edit mode.
67
+ */
68
+ disabled?: boolean;
36
69
  /**
37
70
  * Additional classes to be set on the input itself.
38
71
  */
@@ -11,15 +11,19 @@ const Button_1 = tslib_1.__importDefault(require("../../Button"));
11
11
  const useKey_1 = tslib_1.__importDefault(require("../../hooks/useKey"));
12
12
  const useEsc_1 = tslib_1.__importDefault(require("../../hooks/useEsc"));
13
13
  const DEFAULT_BUTTON_STYLE = 'primary';
14
- // TODO:
14
+ // Features:
15
15
  // [ ] what shall happen when user leaves component while in edit mode (click outside or tab) - close on blur?
16
16
  // [x] avoid save without change
17
17
  // [x] use fixed previous value
18
18
  // [x] enter = save
19
19
  // [x] esc key to abort and leave edit mode
20
20
  // [x] tab focus + enter = go into edit mode
21
+ // [x] validate after each key, i.e for number inputs - use onInputChange callback
22
+ // [x] support form feedback error - wrap it with form-group and feedback classes
23
+ // [x] allow for unit and icon
24
+ // [x] disabled input
21
25
  const SaveableInput = (props) => {
22
- const { placeholder, fixedPreviousValue = '', previousValue = '', value: externalValue = '', onValueChanged = noop_1.default, buttonStyle = DEFAULT_BUTTON_STYLE, inputClassName, className, inputProps } = props, remainingProps = tslib_1.__rest(props, ["placeholder", "fixedPreviousValue", "previousValue", "value", "onValueChanged", "buttonStyle", "inputClassName", "className", "inputProps"]);
26
+ const { placeholder, fixedPreviousValue = '', previousValue = '', value: externalValue = '', onValueChanged = noop_1.default, onInputChange, onEsc = noop_1.default, onEnterEdit = noop_1.default, buttonStyle = DEFAULT_BUTTON_STYLE, inputClassName, inputProps, icon, unit, disabled = false, className } = props, remainingProps = tslib_1.__rest(props, ["placeholder", "fixedPreviousValue", "previousValue", "value", "onValueChanged", "onInputChange", "onEsc", "onEnterEdit", "buttonStyle", "inputClassName", "inputProps", "icon", "unit", "disabled", "className"]);
23
27
  const externalOldValue = previousValue || fixedPreviousValue;
24
28
  const [inputValue, setInputValue] = (0, react_1.useState)(externalValue);
25
29
  const [oldInputValue, setOldInputValue] = (0, react_1.useState)(externalOldValue);
@@ -59,6 +63,7 @@ const SaveableInput = (props) => {
59
63
  setInputValue(initialInputValueRef.current);
60
64
  setOldInputValue(initialOldInputValueRef.current);
61
65
  setEditInput(false);
66
+ onEsc();
62
67
  }
63
68
  });
64
69
  const handleToggleInput = () => {
@@ -70,23 +75,40 @@ const SaveableInput = (props) => {
70
75
  initialInputValueRef.current = inputValue;
71
76
  initialOldInputValueRef.current = oldInputValue;
72
77
  }
78
+ onEnterEdit();
73
79
  }
74
80
  else {
75
81
  setEditInput(false);
82
+ // In case the new input value has not changed to the initial value
83
+ // reset the internal old value to the initial
76
84
  if (initialInputValueRef.current !== inputValue) {
77
85
  setOldInputValue(initialInputValueRef.current);
78
86
  onValueChanged(inputValue, oldInputValue);
79
87
  }
80
88
  }
81
89
  };
82
- const handleInputChange = (event) => setInputValue(event.target.value);
90
+ const handleInputChange = (event) => {
91
+ var _a;
92
+ // Only update internal value if the external "InputChange" callback function is not defined
93
+ // as it will be used in a controlled way
94
+ if (onInputChange) {
95
+ // Use type assertion to access nativeEvent.data
96
+ const nativeEventData = (_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.data;
97
+ if (nativeEventData) {
98
+ onInputChange(nativeEventData, event.currentTarget.value);
99
+ }
100
+ return;
101
+ }
102
+ setInputValue(event.target.value);
103
+ };
83
104
  const handleFocus = () => setIsFocused(true);
84
105
  const handleBlur = () => setIsFocused(false);
85
106
  const showOldValue = !(0, isEmpty_1.default)(oldInputValue) && oldInputValue !== inputValue && !editInput;
86
107
  const wrapperClasses = (0, classnames_1.default)('form-group', className);
87
- const inputClasses = (0, classnames_1.default)('form-control', showOldValue && 'padding-bottom-0 padding-top-10 text-size-12', inputClassName);
108
+ const inputClasses = (0, classnames_1.default)('form-control', showOldValue && 'padding-bottom-0 padding-top-10 text-size-12', unit && 'padding-right-50', // This value is not perfect as with longer units it might conflict with the value
109
+ inputClassName);
110
+ const oldValueClasses = (0, classnames_1.default)('position-absolute', 'top-2', 'left-10', 'margin-left-3', 'text-size-10', 'text-decoration-line-through', icon && 'padding-left-20');
88
111
  const buttonIconClasses = (0, classnames_1.default)('rioglyph', editInput ? 'rioglyph-ok' : 'rioglyph-pencil');
89
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'input-group' }, { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({ type: 'text', ref: inputRef, placeholder: placeholder, className: inputClasses, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, onBlur: handleBlur, disabled: !editInput }, inputProps)), showOldValue && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'position-absolute top-2 left-10 ' +
90
- 'margin-left-3 text-size-10 text-decoration-line-through' }, { children: oldInputValue }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'input-group-btn' }, { children: (0, jsx_runtime_1.jsx)(Button_1.default, Object.assign({ bsStyle: buttonStyle, iconOnly: true, onClick: handleToggleInput }, { children: (0, jsx_runtime_1.jsx)("span", { className: buttonIconClasses }) })) }))] })) })));
112
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'input-group' }, { children: [icon && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'input-group-addon' }, { children: (0, jsx_runtime_1.jsx)("span", { className: `rioglyph ${icon}`, "aria-hidden": 'true' }) }))), (0, jsx_runtime_1.jsx)("input", Object.assign({ type: 'text', ref: inputRef, placeholder: placeholder, className: inputClasses, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, onBlur: handleBlur, disabled: !editInput }, inputProps)), unit && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'position-absolute right-0 margin-right-50' }, { children: unit })), showOldValue && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: oldValueClasses }, { children: oldInputValue })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'input-group-btn' }, { children: (0, jsx_runtime_1.jsx)(Button_1.default, Object.assign({ bsStyle: buttonStyle, iconOnly: true, onClick: handleToggleInput, disabled: disabled }, { children: (0, jsx_runtime_1.jsx)("span", { className: buttonIconClasses }) })) }))] })) })));
91
113
  };
92
114
  exports.default = SaveableInput;
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import type { TextAlignment } from '../../values/TextAlignment';
3
+ import type { StateButtonProps } from './StateButton';
4
+ import type { StateIconProps } from './StateIcon';
5
+ export type BaseStateProps = {
6
+ /**
7
+ * The icon to be shown.
8
+ *
9
+ * Default icons are defined for all states.
10
+ */
11
+ icon?: string;
12
+ /**
13
+ * List of icons to show instead a single icon.
14
+ *
15
+ * @default []
16
+ */
17
+ icons?: StateIconProps[];
18
+ /**
19
+ * Custom Image if needed.
20
+ */
21
+ image?: React.ReactNode;
22
+ /**
23
+ * The headline to be shown.
24
+ */
25
+ headline?: string | React.ReactNode;
26
+ /**
27
+ * The text to display.
28
+ */
29
+ message?: string | React.ReactNode;
30
+ /**
31
+ * Definitions for the buttons to show.
32
+ *
33
+ * @default []
34
+ */
35
+ buttons?: StateButtonProps[];
36
+ /**
37
+ * Defines whether to use 100% width or default width.
38
+ *
39
+ * Note: Only to be used for special cases on the CustomState component.
40
+ *
41
+ * @default false
42
+ */
43
+ fullWidth?: boolean;
44
+ /**
45
+ * Smaller icon and headline size.
46
+ *
47
+ * @default false
48
+ */
49
+ condensed?: boolean;
50
+ /**
51
+ * Defines where the panel is aligned.
52
+ *
53
+ * Possible values are: 'left', 'center' and 'right'.
54
+ *
55
+ * @default 'center'
56
+ */
57
+ alignment?: TextAlignment;
58
+ /**
59
+ * Optional class names for the wrapper.
60
+ */
61
+ outerClassName?: string;
62
+ /**
63
+ * Optional class names for the content.
64
+ */
65
+ innerClassName?: string;
66
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // @ts-ignore-next-line importsNotUsedAsValues
4
+ require("react");
@@ -1,15 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type CustomStateProps = BaseStateProps;
4
+ declare const CustomState: (props: PropsWithChildren<CustomStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default CustomState;
2
- declare function CustomState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace CustomState {
4
- export namespace defaultProps {
5
- export const icon: string;
6
- export const icons: never[];
7
- export const buttons: never[];
8
- export { ALIGN_CENTER as alignment };
9
- export const fullWidth: boolean;
10
- export const condensed: boolean;
11
- }
12
- export { baseStatePropTypes as propTypes };
13
- }
14
- import { ALIGN_CENTER } from "./baseStatePropTypes";
15
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,59 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- /* eslint-disable complexity */
6
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
7
7
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
8
8
  const isEmpty_1 = tslib_1.__importDefault(require("lodash/fp/isEmpty"));
9
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
10
- const StateButton = ({ text, className, onClick = () => { }, href }) => {
11
- const buttonClassNames = (0, classnames_1.default)('btn btn-primary', 'margin-top-10', className && className);
12
- // In case a href is given, render a link button instead
13
- if (href) {
14
- return ((0, jsx_runtime_1.jsx)("a", Object.assign({ className: buttonClassNames, href: href, onClick: onClick }, { children: text })));
15
- }
16
- return ((0, jsx_runtime_1.jsx)("button", Object.assign({ className: buttonClassNames, type: 'button', onClick: onClick }, { children: text })));
9
+ const StateButton_1 = tslib_1.__importDefault(require("./StateButton"));
10
+ const StateIcon_1 = tslib_1.__importDefault(require("./StateIcon"));
11
+ const justify = {
12
+ left: 'justify-content-start',
13
+ center: 'justify-content-center',
14
+ right: 'justify-content-end',
17
15
  };
18
- const Icon = ({ name, color, className }) => {
19
- const iconClassNames = (0, classnames_1.default)('rioglyph', color || 'text-color-light', name && name, !className && 'text-size-300pct', className && className);
20
- return (0, jsx_runtime_1.jsx)("span", { className: iconClassNames });
21
- };
22
- const getAlignmentClassName = alignment => {
23
- switch (alignment) {
24
- case baseStatePropTypes_1.ALIGN_LEFT:
25
- return 'justify-content-start';
26
- case baseStatePropTypes_1.ALIGN_CENTER:
27
- return 'justify-content-center';
28
- case baseStatePropTypes_1.ALIGN_RIGHT:
29
- return 'justify-content-end';
30
- default:
31
- return 'justify-content-center';
32
- }
33
- };
34
- const CustomState = props => {
35
- const { icon, icons, image, headline, message, buttons, alignment, fullWidth, condensed, outerClassName, innerClassName, children } = props, remainingProps = tslib_1.__rest(props, ["icon", "icons", "image", "headline", "message", "buttons", "alignment", "fullWidth", "condensed", "outerClassName", "innerClassName", "children"]);
16
+ const CustomState = (props) => {
17
+ const { icon = 'rioglyph-rio', icons = [], image, headline, message, buttons = [], alignment = 'center', fullWidth = false, condensed = false, outerClassName, innerClassName, children } = props, remainingProps = tslib_1.__rest(props, ["icon", "icons", "image", "headline", "message", "buttons", "alignment", "fullWidth", "condensed", "outerClassName", "innerClassName", "children"]);
36
18
  const wrapperClasses = (0, classnames_1.default)('margin-0', 'width-100pct', !fullWidth && 'max-width-600', 'panel-default', 'panel', condensed ? 'padding-10' : 'padding-15', outerClassName && outerClassName);
37
19
  const innerClassNames = (0, classnames_1.default)('display-flex', 'flex-column', 'align-items-center', 'text-center', condensed ? 'padding-15' : 'padding-25', innerClassName && innerClassName);
38
20
  const iconClasses = (0, classnames_1.default)(condensed ? 'text-size-16 margin-bottom-10' : 'text-size-h2 margin-bottom-20');
39
21
  const iconsClasses = (0, classnames_1.default)(condensed ? 'text-size-16 margin-bottom-10' : 'text-size-h2 margin-bottom-20', 'display-flex', 'align-items-center', 'max-width-100pct');
40
22
  const headlineClassNames = (0, classnames_1.default)(condensed ? 'text-size-h4' : 'text-size-h3 text-size-h2-sm', 'line-height-125rel', 'text-color-dark', 'text-medium', 'width-500', 'max-width-100pct');
41
- const renderButtons = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'btn-toolbar margin-top-20' }, { children: buttons.map((buttonProps, index) => ((0, jsx_runtime_1.jsx)(StateButton, Object.assign({}, buttonProps), index))) })));
42
- const renderIcon = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: iconClasses }, { children: (0, jsx_runtime_1.jsx)(Icon, { name: icon }) })));
43
- const renderIcons = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: iconsClasses }, { children: icons.map((iconProps, index) => ((0, jsx_runtime_1.jsx)(Icon, Object.assign({}, iconProps), index))) })));
23
+ const renderButtons = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'btn-toolbar margin-top-20' }, { children: buttons.map((buttonProps, index) => ((0, jsx_runtime_1.jsx)(StateButton_1.default, Object.assign({}, buttonProps), index))) })));
24
+ const renderIcon = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: iconClasses }, { children: (0, jsx_runtime_1.jsx)(StateIcon_1.default, { name: icon }) })));
25
+ const renderIcons = ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: iconsClasses }, { children: icons.map((iconProps, index) => ((0, jsx_runtime_1.jsx)(StateIcon_1.default, Object.assign({}, iconProps), index))) })));
44
26
  const renderChildren = (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'width-500 max-width-100pct margin-top-25' }, { children: children }));
45
27
  const renderHeadline = (0, jsx_runtime_1.jsx)("div", Object.assign({ className: headlineClassNames }, { children: headline }));
46
28
  const renderMessage = (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'text-color-dark margin-top-15 width-500 max-width-100pct' }, { children: message }));
47
29
  const singleOrMultiIcon = (0, isEmpty_1.default)(icons) ? renderIcon : renderIcons;
48
30
  const imageOrIcon = image ? image : singleOrMultiIcon;
49
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `display-flex ${getAlignmentClassName(alignment)} max-width-100pct` }, remainingProps, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: innerClassNames }, { children: [imageOrIcon, headline && renderHeadline, message && renderMessage, !(0, isEmpty_1.default)(buttons) && renderButtons, children && renderChildren] })) })) })));
50
- };
51
- CustomState.defaultProps = {
52
- icon: 'rioglyph-rio',
53
- icons: [],
54
- buttons: [],
55
- alignment: baseStatePropTypes_1.ALIGN_CENTER,
56
- fullWidth: false,
57
- condensed: false,
31
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `display-flex ${justify[alignment]} max-width-100pct` }, remainingProps, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: innerClassNames }, { children: [imageOrIcon, headline && renderHeadline, message && renderMessage, !(0, isEmpty_1.default)(buttons) && renderButtons, children && renderChildren] })) })) })));
58
32
  };
59
- CustomState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
60
33
  exports.default = CustomState;
@@ -1,9 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type EmptyStateProps = BaseStateProps;
4
+ declare const EmptyState: (props: PropsWithChildren<EmptyStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default EmptyState;
2
- declare function EmptyState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace EmptyState {
4
- export namespace defaultProps {
5
- const icon: string;
6
- }
7
- export { baseStatePropTypes as propTypes };
8
- }
9
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
6
7
  const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
8
- const EmptyState = props => (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({}, props));
9
- EmptyState.defaultProps = {
10
- icon: 'rioglyph-empty',
8
+ const EmptyState = (props) => {
9
+ const { icon = 'rioglyph-empty' } = props, remainingProps = tslib_1.__rest(props, ["icon"]);
10
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ icon: icon }, remainingProps));
11
11
  };
12
- EmptyState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
13
12
  exports.default = EmptyState;
@@ -1,9 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type ErrorStateProps = BaseStateProps;
4
+ declare const ErrorState: (props: PropsWithChildren<ErrorStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default ErrorState;
2
- declare function ErrorState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace ErrorState {
4
- export namespace defaultProps {
5
- const icon: string;
6
- }
7
- export { baseStatePropTypes as propTypes };
8
- }
9
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
6
7
  const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
8
- const ErrorState = props => (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({}, props));
9
- ErrorState.defaultProps = {
10
- icon: 'rioglyph-truck-breakdown',
8
+ const ErrorState = (props) => {
9
+ const { icon = 'rioglyph-truck-breakdown' } = props, remainingProps = tslib_1.__rest(props, ["icon"]);
10
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ icon: icon }, remainingProps));
11
11
  };
12
- ErrorState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
13
12
  exports.default = ErrorState;
@@ -1,9 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type ForbiddenStateProps = BaseStateProps;
4
+ declare const ForbiddenState: (props: PropsWithChildren<ForbiddenStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default ForbiddenState;
2
- declare function ForbiddenState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace ForbiddenState {
4
- export namespace defaultProps {
5
- const icon: string;
6
- }
7
- export { baseStatePropTypes as propTypes };
8
- }
9
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
6
7
  const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
8
- const ForbiddenState = props => (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({}, props));
9
- ForbiddenState.defaultProps = {
10
- icon: 'rioglyph-ban-circle',
8
+ const ForbiddenState = (props) => {
9
+ const { icon = 'rioglyph-ban-circle' } = props, remainingProps = tslib_1.__rest(props, ["icon"]);
10
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ icon: icon }, remainingProps));
11
11
  };
12
- ForbiddenState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
13
12
  exports.default = ForbiddenState;
@@ -1,9 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type MaintenanceStateProps = BaseStateProps;
4
+ declare const MaintenanceState: (props: PropsWithChildren<MaintenanceStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default MaintenanceState;
2
- declare function MaintenanceState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace MaintenanceState {
4
- export namespace defaultProps {
5
- const icon: string;
6
- }
7
- export { baseStatePropTypes as propTypes };
8
- }
9
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
6
7
  const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
8
- const MaintenanceState = props => (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({}, props));
9
- MaintenanceState.defaultProps = {
10
- icon: 'rioglyph-wrench',
8
+ const MaintenanceState = (props) => {
9
+ const { icon = 'rioglyph-wrench' } = props, remainingProps = tslib_1.__rest(props, ["icon"]);
10
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ icon: icon }, remainingProps));
11
11
  };
12
- MaintenanceState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
13
12
  exports.default = MaintenanceState;
@@ -1,20 +1,10 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type NotBookedStateProps = BaseStateProps & {
4
+ /**
5
+ * List of features.
6
+ */
7
+ features?: string | React.ReactNode[];
8
+ };
9
+ declare const NotBookedState: (props: PropsWithChildren<NotBookedStateProps>) => import("react/jsx-runtime").JSX.Element;
1
10
  export default NotBookedState;
2
- declare function NotBookedState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace NotBookedState {
4
- namespace defaultProps {
5
- const icon: string;
6
- }
7
- namespace propTypes {
8
- const headline: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
9
- const message: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
10
- const features: PropTypes.Requireable<(NonNullable<PropTypes.ReactNodeLike> | null | undefined)[]>;
11
- const buttons: PropTypes.Requireable<(PropTypes.InferProps<{
12
- text: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
13
- className: PropTypes.Requireable<string>;
14
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
15
- href: PropTypes.Requireable<string>;
16
- }> | null | undefined)[]>;
17
- const condensed: PropTypes.Requireable<boolean>;
18
- }
19
- }
20
- import PropTypes from "prop-types";
@@ -2,29 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const prop_types_1 = tslib_1.__importDefault(require("prop-types"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
8
7
  const isArray_1 = tslib_1.__importDefault(require("lodash/fp/isArray"));
9
8
  const isEmpty_1 = tslib_1.__importDefault(require("lodash/fp/isEmpty"));
10
- const NotBookedState = props => {
11
- const { message, features } = props, remainingProps = tslib_1.__rest(props, ["message", "features"]);
12
- const combinedMessages = ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [message && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'text-medium margin-bottom-20' }, { children: message })), features && (0, isArray_1.default)(features) && !(0, isEmpty_1.default)(features) && ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: 'feature-list' }, { children: features.map((feature, index) => ((0, jsx_runtime_1.jsx)("li", { children: feature }, index))) })))] }));
13
- return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ message: combinedMessages }, remainingProps));
14
- };
15
- NotBookedState.defaultProps = {
16
- icon: 'rioglyph-stars',
17
- };
18
- NotBookedState.propTypes = {
19
- headline: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.node]),
20
- message: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.node]),
21
- features: prop_types_1.default.arrayOf(prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.node])),
22
- buttons: prop_types_1.default.arrayOf(prop_types_1.default.shape({
23
- text: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.node]).isRequired,
24
- className: prop_types_1.default.string,
25
- onClick: prop_types_1.default.func,
26
- href: prop_types_1.default.string,
27
- })),
28
- condensed: prop_types_1.default.bool,
9
+ const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
10
+ const NotBookedState = (props) => {
11
+ const { message, features, icon = 'rioglyph-stars' } = props, remainingProps = tslib_1.__rest(props, ["message", "features", "icon"]);
12
+ const combinedMessages = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [message && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'text-medium margin-bottom-20' }, { children: message })), features && (0, isArray_1.default)(features) && !(0, isEmpty_1.default)(features) && ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: 'feature-list' }, { children: features.map((feature, index) => ((0, jsx_runtime_1.jsx)("li", { children: feature }, index))) })))] }));
13
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ message: combinedMessages, icon: icon }, remainingProps));
29
14
  };
30
15
  exports.default = NotBookedState;
@@ -1,9 +1,5 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { BaseStateProps } from './BaseStateProps';
3
+ export type NotFoundStateProps = BaseStateProps;
4
+ declare const NotFoundState: (props: PropsWithChildren<NotFoundStateProps>) => import("react/jsx-runtime").JSX.Element;
1
5
  export default NotFoundState;
2
- declare function NotFoundState(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace NotFoundState {
4
- export namespace defaultProps {
5
- const icon: string;
6
- }
7
- export { baseStatePropTypes as propTypes };
8
- }
9
- import { baseStatePropTypes } from "./baseStatePropTypes";
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
6
7
  const CustomState_1 = tslib_1.__importDefault(require("./CustomState"));
7
- const baseStatePropTypes_1 = require("./baseStatePropTypes");
8
- const NotFoundState = props => (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({}, props));
9
- NotFoundState.defaultProps = {
10
- icon: 'rioglyph-looking-glass-man',
8
+ const NotFoundState = (props) => {
9
+ const { icon = 'rioglyph-looking-glass-man' } = props, remainingProps = tslib_1.__rest(props, ["icon"]);
10
+ return (0, jsx_runtime_1.jsx)(CustomState_1.default, Object.assign({ icon: icon }, remainingProps));
11
11
  };
12
- NotFoundState.propTypes = baseStatePropTypes_1.baseStatePropTypes;
13
12
  exports.default = NotFoundState;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ export type StateButtonProps = {
3
+ /**
4
+ * The button text.
5
+ *
6
+ * This can also be a node with an icon to be shown on the button.
7
+ */
8
+ text: string | React.ReactNode;
9
+ /**
10
+ * Callback fired after the component starts to collapse.
11
+ *
12
+ * @default () => {}
13
+ */
14
+ onClick?: VoidFunction;
15
+ /**
16
+ * Instead of a callback for the button you can specify a "href".
17
+ *
18
+ * This way it will render a link button instead.
19
+ */
20
+ href?: string;
21
+ /**
22
+ * Additional classes assigned to the button.
23
+ */
24
+ className?: string;
25
+ };
26
+ declare const StateButton: ({ text, className, onClick, href }: StateButtonProps) => import("react/jsx-runtime").JSX.Element;
27
+ export default StateButton;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ // @ts-ignore-next-line importsNotUsedAsValues
6
+ require("react");
7
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
8
+ const StateButton = ({ text, className, onClick = () => { }, href }) => {
9
+ const buttonClassNames = (0, classnames_1.default)('btn btn-primary', 'margin-top-10', className && className);
10
+ // In case a href is given, render a link button instead
11
+ if (href) {
12
+ return ((0, jsx_runtime_1.jsx)("a", Object.assign({ className: buttonClassNames, href: href, onClick: onClick }, { children: text })));
13
+ }
14
+ return ((0, jsx_runtime_1.jsx)("button", Object.assign({ className: buttonClassNames, type: 'button', onClick: onClick }, { children: text })));
15
+ };
16
+ exports.default = StateButton;
@@ -0,0 +1,7 @@
1
+ export type StateIconProps = {
2
+ name?: string;
3
+ className?: string;
4
+ color?: string;
5
+ };
6
+ declare const StateIcon: ({ name, color, className }: StateIconProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default StateIcon;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ require("react");
5
+ const StateIcon = ({ name, color = 'text-color-light', className = 'text-size-300pct' }) => ((0, jsx_runtime_1.jsx)("span", { className: `rioglyph ${name} ${color} ${className}` }));
6
+ exports.default = StateIcon;