@dvrd/dvr-controls 1.0.5 → 1.0.8

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 (177) hide show
  1. package/package.json +1 -1
  2. package/src/js/button/button.tsx +0 -102
  3. package/src/js/button/buttonController.tsx +0 -179
  4. package/src/js/button/closeButton.tsx +0 -29
  5. package/src/js/button/dvrdButton.tsx +0 -128
  6. package/src/js/button/outlinedButton.tsx +0 -105
  7. package/src/js/button/simpleButton.tsx +0 -163
  8. package/src/js/button/style/button.scss +0 -95
  9. package/src/js/button/style/closeButton.scss +0 -15
  10. package/src/js/button/style/dvrdButton.scss +0 -30
  11. package/src/js/button/style/outlinedButton.scss +0 -84
  12. package/src/js/button/style/simpleButton.scss +0 -80
  13. package/src/js/carousel/DVRCarousel.tsx +0 -163
  14. package/src/js/carousel/DVRCarouselController.tsx +0 -95
  15. package/src/js/carousel/style/DVRCarousel.scss +0 -38
  16. package/src/js/checkbox/checkbox.tsx +0 -147
  17. package/src/js/checkbox/checkboxController.tsx +0 -131
  18. package/src/js/checkbox/style/checkbox.scss +0 -109
  19. package/src/js/colorPicker/colorPicker.tsx +0 -118
  20. package/src/js/colorPicker/style/colorPicker.scss +0 -20
  21. package/src/js/date/dvrdDatePicker.tsx +0 -357
  22. package/src/js/date/style/dvrdDatePicker.scss +0 -307
  23. package/src/js/dialog/dialog.tsx +0 -207
  24. package/src/js/dialog/dialogController.tsx +0 -70
  25. package/src/js/dialog/inlineDialog.tsx +0 -127
  26. package/src/js/dialog/style/dialog.scss +0 -61
  27. package/src/js/events/withEvents.tsx +0 -40
  28. package/src/js/head/DVRHead.tsx +0 -49
  29. package/src/js/header/DVRHeader.tsx +0 -413
  30. package/src/js/header/style/header.scss +0 -206
  31. package/src/js/icon/awesomeIcon.tsx +0 -46
  32. package/src/js/image/imageUpload.tsx +0 -69
  33. package/src/js/image/style/imageUpload.scss +0 -11
  34. package/src/js/info/info.tsx +0 -136
  35. package/src/js/info/style/info.scss +0 -39
  36. package/src/js/input/animated/animatedTextField.tsx +0 -159
  37. package/src/js/input/date/dateField.tsx +0 -360
  38. package/src/js/input/date/dateFieldController.tsx +0 -245
  39. package/src/js/input/date/datePicker/datePicker.tsx +0 -186
  40. package/src/js/input/date/datePicker/style/datePicker.scss +0 -102
  41. package/src/js/input/date/input/dateInput.tsx +0 -213
  42. package/src/js/input/date/style/dateField.scss +0 -40
  43. package/src/js/input/date/timePicker/style/timePicker.scss +0 -95
  44. package/src/js/input/date/timePicker/timePicker.tsx +0 -143
  45. package/src/js/input/editor/DVREditor.tsx +0 -21
  46. package/src/js/input/number/numberInput.tsx +0 -157
  47. package/src/js/input/password/passwordInput.tsx +0 -140
  48. package/src/js/input/password/passwordRules.tsx +0 -48
  49. package/src/js/input/password/style/passwordInput.scss +0 -39
  50. package/src/js/input/password/style/passwordRules.scss +0 -41
  51. package/src/js/input/simple/style/simpleInput.scss +0 -98
  52. package/src/js/input/simple/v2/simpleInputV2.tsx +0 -178
  53. package/src/js/input/style/input.scss +0 -138
  54. package/src/js/input/v2/inputController_v2.tsx +0 -250
  55. package/src/js/input/v2/input_v2.tsx +0 -7
  56. package/src/js/label/label.tsx +0 -196
  57. package/src/js/label/style/label.scss +0 -4
  58. package/src/js/link/link.tsx +0 -38
  59. package/src/js/link/style/link.scss +0 -30
  60. package/src/js/loader/loader.tsx +0 -79
  61. package/src/js/loader/loaderController.tsx +0 -61
  62. package/src/js/loader/style/loader.scss +0 -53
  63. package/src/js/media/media.tsx +0 -72
  64. package/src/js/navigator/navigator.tsx +0 -51
  65. package/src/js/optionsList/dvrdOptionsList.tsx +0 -112
  66. package/src/js/optionsList/style/dvrdOptionsList.scss +0 -84
  67. package/src/js/optionsMenu/optionsMenu.tsx +0 -187
  68. package/src/js/optionsMenu/style/optionsMenu.scss +0 -70
  69. package/src/js/pdf/element/pdfElement.tsx +0 -315
  70. package/src/js/pdf/element/style/pdfElement.scss +0 -111
  71. package/src/js/pdf/history/pdfHistory.ts +0 -57
  72. package/src/js/pdf/image/pdfImage.tsx +0 -175
  73. package/src/js/pdf/image/style/pdfImage.scss +0 -34
  74. package/src/js/pdf/invoiceTable/pdfInvoiceTable.tsx +0 -176
  75. package/src/js/pdf/invoiceTable/style/pdfInvoiceTable.scss +0 -32
  76. package/src/js/pdf/pdfTemplateCreator.tsx +0 -278
  77. package/src/js/pdf/settings/buttons/iconButton.tsx +0 -49
  78. package/src/js/pdf/settings/buttons/style/iconButton.scss +0 -50
  79. package/src/js/pdf/settings/image/pdfImageSettings.tsx +0 -82
  80. package/src/js/pdf/settings/image/style/pdfImageSettings.scss +0 -9
  81. package/src/js/pdf/settings/invoiceTable/pdfInvoiceTableSettings.tsx +0 -141
  82. package/src/js/pdf/settings/invoiceTable/style/pdfInvoiceTableSettings.scss +0 -38
  83. package/src/js/pdf/settings/pdfElementSettings.tsx +0 -86
  84. package/src/js/pdf/settings/style/pdfElementSettings.scss +0 -56
  85. package/src/js/pdf/settings/text/pdfTextSettings.tsx +0 -202
  86. package/src/js/pdf/settings/text/style/pdfTextSettings.scss +0 -94
  87. package/src/js/pdf/style/pdfTemplateCreator.scss +0 -118
  88. package/src/js/pdf/text/pdfText.tsx +0 -267
  89. package/src/js/pdf/text/style/pdfText.scss +0 -22
  90. package/src/js/popup/style/withBackground.scss +0 -29
  91. package/src/js/popup/withBackground.tsx +0 -102
  92. package/src/js/select/async/asyncSelect.tsx +0 -46
  93. package/src/js/select/async/style/asyncSelect.scss +0 -23
  94. package/src/js/select/dvrdSelect.tsx +0 -185
  95. package/src/js/select/dvrdSelectController.tsx +0 -81
  96. package/src/js/select/select.tsx +0 -310
  97. package/src/js/select/selectController.tsx +0 -341
  98. package/src/js/select/style/dvrdSelect.scss +0 -140
  99. package/src/js/select/style/select.scss +0 -199
  100. package/src/js/sidebarMenu/sidebarMenu.tsx +0 -165
  101. package/src/js/sidebarMenu/style/sidebarMenu.scss +0 -161
  102. package/src/js/slider/DVRSlider.tsx +0 -107
  103. package/src/js/slider/style/DVRSlider.scss +0 -88
  104. package/src/js/snackbar/snackbar.tsx +0 -72
  105. package/src/js/snackbar/snackbarController.tsx +0 -104
  106. package/src/js/snackbar/style/snackbar.scss +0 -46
  107. package/src/js/switch/dvrdSwitch.tsx +0 -53
  108. package/src/js/switch/style/dvrdSwitch.scss +0 -47
  109. package/src/js/switch/style/switch.scss +0 -84
  110. package/src/js/switch/switch.tsx +0 -115
  111. package/src/js/switch/switchController.tsx +0 -97
  112. package/src/js/textField/dvrdInput.tsx +0 -217
  113. package/src/js/textField/dvrdInputController.tsx +0 -97
  114. package/src/js/textField/dvrdNumberInput.tsx +0 -141
  115. package/src/js/textField/dvrdPasswordInput.tsx +0 -40
  116. package/src/js/textField/style/dvrdInput.scss +0 -114
  117. package/src/js/textField/style/dvrdPassword.scss +0 -15
  118. package/src/js/topButton/style/topButton.scss +0 -54
  119. package/src/js/topButton/topButton.tsx +0 -135
  120. package/src/js/util/analyticsUtil.ts +0 -41
  121. package/src/js/util/colorUtil.ts +0 -230
  122. package/src/js/util/componentUtil.tsx +0 -59
  123. package/src/js/util/constants.ts +0 -12
  124. package/src/js/util/controlContext.tsx +0 -46
  125. package/src/js/util/controlUtil.ts +0 -107
  126. package/src/js/util/cookieUtil.ts +0 -17
  127. package/src/js/util/eventUtil.ts +0 -65
  128. package/src/js/util/googleUtil.ts +0 -88
  129. package/src/js/util/interfaces.ts +0 -179
  130. package/src/js/util/jwtUtil.ts +0 -72
  131. package/src/js/util/miscUtil.ts +0 -170
  132. package/src/js/util/momentUtil.ts +0 -45
  133. package/src/js/util/pdfUtil.ts +0 -124
  134. package/src/js/util/requestUtil.ts +0 -146
  135. package/src/js/util/responsiveUtil.ts +0 -37
  136. package/src/js/util/validationUtil.ts +0 -13
  137. package/src/res/img/lock-handle.png +0 -0
  138. package/src/res/img/lock-handle.webp +0 -0
  139. package/src/res/img/lock.png +0 -0
  140. package/src/res/img/lock.webp +0 -0
  141. package/src/style/common-icons-variables.scss +0 -140
  142. package/src/style/common-icons.scss +0 -714
  143. package/src/style/common-variables.scss +0 -243
  144. package/src/style/display-breakpoints.scss +0 -141
  145. package/src/style/fonts/common-icons.eot +0 -0
  146. package/src/style/fonts/common-icons.svg +0 -150
  147. package/src/style/fonts/common-icons.ttf +0 -0
  148. package/src/style/fonts/common-icons.woff +0 -0
  149. package/src/style/fonts/common-icons.woff2 +0 -0
  150. package/src/style/fonts/fontAwesome/css/all.css +0 -7003
  151. package/src/style/fonts/fontAwesome/css/all.min.css +0 -6
  152. package/src/style/fonts/fontAwesome/css/brands.css +0 -1423
  153. package/src/style/fonts/fontAwesome/css/brands.min.css +0 -6
  154. package/src/style/fonts/fontAwesome/css/fontawesome.css +0 -5519
  155. package/src/style/fonts/fontAwesome/css/fontawesome.min.css +0 -6
  156. package/src/style/fonts/fontAwesome/css/regular.css +0 -19
  157. package/src/style/fonts/fontAwesome/css/regular.min.css +0 -6
  158. package/src/style/fonts/fontAwesome/css/solid.css +0 -19
  159. package/src/style/fonts/fontAwesome/css/solid.min.css +0 -6
  160. package/src/style/fonts/fontAwesome/css/svg-with-js.css +0 -634
  161. package/src/style/fonts/fontAwesome/css/svg-with-js.min.css +0 -6
  162. package/src/style/fonts/fontAwesome/css/v4-font-face.css +0 -26
  163. package/src/style/fonts/fontAwesome/css/v4-font-face.min.css +0 -6
  164. package/src/style/fonts/fontAwesome/css/v4-shims.css +0 -2146
  165. package/src/style/fonts/fontAwesome/css/v4-shims.min.css +0 -6
  166. package/src/style/fonts/fontAwesome/css/v5-font-face.css +0 -22
  167. package/src/style/fonts/fontAwesome/css/v5-font-face.min.css +0 -6
  168. package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.ttf +0 -0
  169. package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.woff2 +0 -0
  170. package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.ttf +0 -0
  171. package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.woff2 +0 -0
  172. package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.ttf +0 -0
  173. package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.woff2 +0 -0
  174. package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.ttf +0 -0
  175. package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.woff2 +0 -0
  176. package/src/style/variables.scss +0 -11
  177. package/tsconfig.json +0 -15
@@ -1,112 +0,0 @@
1
- /*
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
- import './style/dvrdOptionsList.scss';
5
-
6
- import {AwesomeIcon, convertColor, directTimeout, editColor, hasHover} from '@dvrd/dvr-controls';
7
- import classNames from 'classnames';
8
- import React, {CSSProperties, MouseEventHandler, useContext, useEffect, useRef, useState} from 'react';
9
- import {ControlContext} from "../util/controlContext";
10
-
11
- type Option = {
12
- label: React.ReactNode;
13
- onClick: MouseEventHandler;
14
- hoverColor?: 'default' | 'red';
15
- }
16
-
17
- interface Props {
18
- options: Option[];
19
- label: React.ReactNode;
20
- className?: string;
21
- disabled?: boolean;
22
- hoverOpen?: boolean;
23
- }
24
-
25
- export default function DvrdOptionsList(props: Props) {
26
- const context = useContext(ControlContext),
27
- {className, label, options, disabled, hoverOpen} = props,
28
- [open, setOpen] = useState(false),
29
- button = useRef<HTMLDivElement>(null),
30
- [hover, setHover] = useState(false);
31
-
32
- function onClickButton() {
33
- if (!hoverOpen) setOpen(true);
34
- }
35
-
36
- function onMouseEnter() {
37
- setHover(true);
38
- }
39
-
40
- function onMouseLeave() {
41
- setHover(false);
42
- }
43
-
44
- function getButtonStyle(): CSSProperties {
45
- return {
46
- backgroundColor: getBackgroundColor(),
47
- color: getColor(),
48
- }
49
- }
50
-
51
- function getBackgroundColor(): string {
52
- let color: string;
53
- if (disabled) color = 'color-gray-4';
54
- else color = context.baseColor;
55
- color = convertColor(color);
56
- if (hover) color = editColor(-.2, color);
57
- return color;
58
- }
59
-
60
- function getColor(): string {
61
- let color: string;
62
- if (disabled) color = 'color-gray-3';
63
- else color = context.contrastColor;
64
- return convertColor(color);
65
- }
66
-
67
- function clickListener() {
68
- directTimeout(() => {
69
- if (!hasHover(button.current)) setOpen(false);
70
- });
71
- }
72
-
73
- useEffect(() => {
74
- if (open)
75
- document.addEventListener('click', clickListener);
76
- else
77
- document.removeEventListener('click', clickListener);
78
- return function () {
79
- document.removeEventListener('click', clickListener);
80
- }
81
- }, [open]);
82
-
83
- function renderLabel(label: React.ReactNode, className: string) {
84
- if (typeof label === 'string') return <label className={className}>{label}</label>;
85
- return label;
86
- }
87
-
88
- function renderOptions() {
89
- return (
90
- <div className='options-container'>
91
- {options.map((option: Option, index: number) => (
92
- <div key={index} className={classNames('option', option.hoverColor ?? 'default')}
93
- onClick={disabled ? undefined : option.onClick}>
94
- {renderLabel(option.label, 'option-label')}
95
- </div>
96
- ))}
97
- </div>
98
- )
99
- }
100
-
101
- return (
102
- <div
103
- className={classNames('dvrd-options-list', open && 'open', disabled && 'disabled', className, hoverOpen && 'hover')}>
104
- <div className={classNames('btn-container')} ref={button} onClick={onClickButton} style={getButtonStyle()}
105
- onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
106
- <AwesomeIcon name='bars' className='caret'/>
107
- {renderLabel(label, 'button-label')}
108
- </div>
109
- {renderOptions()}
110
- </div>
111
- )
112
- }
@@ -1,84 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../style/variables';
6
-
7
- .dvrd-options-list {
8
- position: relative;
9
-
10
- .btn-container {
11
- @include backgroundShadow2;
12
- border-radius: .5rem;
13
- padding: .7rem 1rem;
14
- display: grid;
15
- grid-template-columns: repeat(2, fit-content(100%));
16
- grid-column-gap: .5rem;
17
- align-items: center;
18
- cursor: pointer;
19
- transition: background-color .2s ease-in-out;
20
-
21
- .button-label {
22
- cursor: inherit;
23
- }
24
-
25
- .caret {
26
- cursor: inherit;
27
- font-size: .8rem;
28
- }
29
- }
30
-
31
- .options-container {
32
- position: absolute;
33
- left: 0;
34
- top: 100%;
35
- min-width: 100%;
36
- visibility: hidden;
37
- opacity: 0;
38
- transition: visibility .2s ease-in-out, opacity .2s ease-in-out, box-shadow .2s ease-in-out;
39
- background-color: white;
40
- border-radius: .5rem;
41
- overflow: hidden;
42
-
43
- .option {
44
- padding: .5rem;
45
- cursor: pointer;
46
- border-bottom: 1px solid $color-gray-4;
47
- transition: background-color .2s ease-in-out;
48
-
49
- .option-label {
50
- white-space: nowrap;
51
- user-select: none;
52
- }
53
-
54
- &:last-child {
55
- border-bottom: none;
56
- }
57
-
58
- &:hover {
59
- &.default {
60
- background-color: rgba($color-blue-1, .2);
61
- }
62
-
63
- &.red {
64
- background-color: rgba(red, .2);
65
- }
66
- }
67
- }
68
- }
69
-
70
- &.open, &.hover:hover {
71
- .options-container {
72
- @include backgroundShadow();
73
- visibility: visible;
74
- opacity: 1;
75
- }
76
- }
77
-
78
- &.disabled {
79
- .btn-container {
80
- cursor: default;
81
- box-shadow: none;
82
- }
83
- }
84
- }
@@ -1,187 +0,0 @@
1
- /*
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- import './style/optionsMenu.scss';
6
-
7
- import React, {ReactElement, ReactNode} from 'react';
8
- import classNames from "classnames";
9
- import {hasHover} from "../util/controlUtil";
10
- import {ElementPosition, MenuPlacement, OptionsMenuItem} from '../util/interfaces';
11
- import AwesomeIcon from '../icon/awesomeIcon';
12
- import {directTimeout} from "../util/componentUtil";
13
- import {getScreenHeight, getScreenWidth} from '../util/responsiveUtil';
14
-
15
- interface Props {
16
- onClickOption?: (option: React.ReactNode | OptionsMenuItem, evt: React.MouseEvent) => void;
17
- onClickOptionIcon?: Function;
18
- optionsComponent?: React.ReactElement;
19
- options: OptionsMenuItem[];
20
- placement: MenuPlacement;
21
- containerClass?: string;
22
- labelClassName?: string;
23
- label?: string;
24
- labelPosition: ElementPosition;
25
- }
26
-
27
- interface State {
28
- open: boolean;
29
- }
30
-
31
- export default class OptionsMenu extends React.Component<Props, State> {
32
- static defaultProps = {
33
- placement: MenuPlacement.BOTTOM_RIGHT,
34
- labelPosition: ElementPosition.RIGHT,
35
- };
36
-
37
- menuList: HTMLDivElement;
38
- container: HTMLDivElement;
39
-
40
- state: State = {
41
- open: false,
42
- };
43
-
44
- onClickOption = (option: OptionsMenuItem) => (evt: React.MouseEvent) => {
45
- if (option.disabled !== true) {
46
- evt.stopPropagation();
47
- const {onClickOption} = this.props;
48
- this.onHideMenu();
49
- if (option.onClick) option.onClick(evt);
50
- else if (onClickOption) onClickOption(option, evt);
51
- }
52
- };
53
-
54
- // noinspection JSUnusedGlobalSymbols
55
- onOpenExternal = () => {
56
- if (this.menuList && this.container) {
57
- const {right, bottom} = this.container.getBoundingClientRect(),
58
- coords = this.calculateMenuCoords(right, bottom);
59
- this.menuList.style.left = coords.x + 'px';
60
- this.menuList.style.top = coords.y + 'px';
61
- this.onOpenMenu();
62
- }
63
- };
64
-
65
- onClickOptionsIcon = (evt: React.MouseEvent) => {
66
- if (this.menuList) {
67
- const {onClickOptionIcon} = this.props,
68
- {clientX, clientY} = evt, {x, y} = this.calculateMenuCoords(clientX, clientY);
69
- this.menuList.style.left = x + 'px';
70
- this.menuList.style.top = y + 'px';
71
- this.onOpenMenu(true);
72
- if (onClickOptionIcon) onClickOptionIcon(evt);
73
- }
74
- };
75
-
76
- onHideMenu = () => {
77
- this.setState({open: false});
78
- };
79
-
80
- onOpenMenu = (toggle: boolean = false) => {
81
- if (toggle) this.setState({open: !this.state.open});
82
- else this.setState({open: true});
83
- };
84
-
85
- calculateMenuCoords = (clickX: number, clickY: number) => {
86
- let x = -999, y = -999;
87
- if (this.menuList) {
88
- const {placement} = this.props, screenWidth = getScreenWidth(), screenHeight = getScreenHeight(),
89
- menuRect = this.menuList.getBoundingClientRect();
90
- if (menuRect) {
91
- const {width, height} = menuRect;
92
- switch (placement) {
93
- case MenuPlacement.BOTTOM_LEFT:
94
- x = Math.max(clickX - width, 0);
95
- y = clickY + height > screenHeight ? screenHeight - height : clickY;
96
- break;
97
- case MenuPlacement.BOTTOM_RIGHT:
98
- x = clickX + width > screenWidth ? screenWidth - width : clickX;
99
- y = clickY + height > screenHeight ? screenHeight - height : clickY;
100
- break;
101
- case MenuPlacement.TOP_LEFT:
102
- x = Math.max(clickX - width, 0);
103
- y = Math.max(clickY - height, 0);
104
- break;
105
- case MenuPlacement.TOP_RIGHT:
106
- x = clickX + width > screenWidth ? screenWidth - width : clickX;
107
- y = Math.max(clickY - height, 0);
108
- break;
109
- }
110
- }
111
- }
112
- return {x, y};
113
- };
114
-
115
- attachListRef = (ref: HTMLDivElement) => {
116
- this.menuList = ref;
117
- };
118
-
119
- attachContainerRef = (ref: HTMLDivElement) => {
120
- this.container = ref;
121
- };
122
-
123
- clickListener = () => {
124
- if (!hasHover(this.container))
125
- this.onHideMenu();
126
- };
127
-
128
- addClickListener = () => {
129
- document.addEventListener('click', this.clickListener);
130
- };
131
-
132
- removeClickListener = () => {
133
- document.removeEventListener('click', this.clickListener);
134
- };
135
-
136
- renderOptionsElement = (): ReactElement => {
137
- const {optionsComponent} = this.props;
138
- if (optionsComponent) return React.cloneElement(optionsComponent, {onClick: this.onClickOptionsIcon});
139
- return <AwesomeIcon name='ellipsis-v' className='options-icon' onClick={this.onClickOptionsIcon}/>
140
- };
141
-
142
- renderLabel = (position: ElementPosition): ReactNode => {
143
- const {label, labelPosition, labelClassName} = this.props;
144
- if (position !== labelPosition || !label?.length) return null;
145
- return <label className={classNames('options-menu-label', labelPosition, labelClassName)}
146
- onClick={this.onClickOptionsIcon}>{label}</label>
147
- }
148
-
149
- renderOptionsList = (): React.ReactElement => {
150
- const {options} = this.props, {open} = this.state;
151
- return (
152
- <div ref={this.attachListRef} className={classNames('menu-options-list', open && 'visible')}>
153
- {options.map((option, key) => (
154
- <div className={classNames('menu-option', option.disabled === true && 'disabled')} key={key}
155
- onClick={this.onClickOption(option)}>
156
- {(option.icon && (!option.iconPlacement || option.iconPlacement === ElementPosition.LEFT)) &&
157
- option.icon}
158
- <label className='menu-option-label'>{option.label}</label>
159
- {(option.icon && option.iconPlacement === ElementPosition.RIGHT) && option.icon}
160
- </div>
161
- ))}
162
- </div>
163
- )
164
- };
165
-
166
- componentDidUpdate = (props: Props, prevState: State) => {
167
- const {open} = this.state;
168
- if (open && !prevState.open) directTimeout(this.addClickListener);
169
- else if (!open && prevState.open) directTimeout(this.removeClickListener);
170
- };
171
-
172
- componentWillUnmount = () => {
173
- this.removeClickListener();
174
- };
175
-
176
- render = () => {
177
- const {containerClass} = this.props;
178
- return (
179
- <div className={classNames('option-menu-container', containerClass)} ref={this.attachContainerRef}>
180
- {this.renderLabel(ElementPosition.LEFT)}
181
- {this.renderOptionsElement()}
182
- {this.renderLabel(ElementPosition.RIGHT)}
183
- {this.renderOptionsList()}
184
- </div>
185
- )
186
- };
187
- };
@@ -1,70 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../style/variables';
6
-
7
- .option-menu-container {
8
- display: flex;
9
- align-items: center;
10
-
11
- .options-icon {
12
- cursor: pointer;
13
- font-size: 1.5rem;
14
- }
15
-
16
- .options-menu-label {
17
- &.left {
18
- margin-right: .5rem;
19
- }
20
-
21
- &.right {
22
- margin-left: .5rem;
23
- }
24
- }
25
-
26
- .menu-options-list {
27
- @include backgroundShadow;
28
- position: fixed;
29
- display: flex;
30
- flex-direction: column;
31
- visibility: hidden;
32
- opacity: 0;
33
- transition: visibility .2s ease-in-out, opacity .2s ease-in-out;
34
- z-index: $z-index-dialog;
35
-
36
- .menu-option {
37
- display: flex;
38
- align-items: center;
39
- justify-content: space-between;
40
- padding: .5rem 1rem;
41
- background-color: white;
42
- cursor: pointer;
43
- transition: background-color .2s ease-in-out;
44
-
45
- .menu-option-label {
46
- margin: 0 .3rem;
47
- flex: 1;
48
- text-align: center;
49
- white-space: nowrap;
50
- }
51
-
52
- &:hover {
53
- background-color: $color-gray-7;
54
- }
55
-
56
- &.disabled {
57
- cursor: not-allowed;
58
-
59
- .menu-option-label {
60
- color: $color-gray-3;
61
- }
62
- }
63
- }
64
-
65
- &.visible {
66
- visibility: visible;
67
- opacity: 1;
68
- }
69
- }
70
- }