oolib 2.141.2 → 2.141.4

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.
@@ -34,7 +34,7 @@ var styled_components_1 = require("styled-components");
34
34
  var filters_1 = require("../utils/filters");
35
35
  var Embed = function (_a) {
36
36
  var isBlock = _a.isBlock, readOnly = _a.readOnly, value = _a.value, isValidURL = _a.isValidURL, onChange = _a.onChange;
37
- var _b = (0, react_1.useState)(value ? (0, filters_1.extractHeight)(value) : "450px"), height = _b[0], setHeight = _b[1];
37
+ var _b = (0, react_1.useState)(value && (0, filters_1.extractHeight)(value)), height = _b[0], setHeight = _b[1];
38
38
  var theme = (0, styled_components_1.useTheme)();
39
39
  // const { user } = theme?.useGetQueryData('userData') || {};
40
40
  // const screenWidth = useScreenWidth()
@@ -26,6 +26,6 @@ function extractHeight(address) {
26
26
  var tempElement = document.createElement('div');
27
27
  tempElement.innerHTML = address;
28
28
  var heightValue = (_a = tempElement.querySelector('iframe')) === null || _a === void 0 ? void 0 : _a.getAttribute('height');
29
- return heightValue;
29
+ return heightValue || "450px";
30
30
  }
31
31
  exports.extractHeight = extractHeight;
@@ -1,8 +1,9 @@
1
- export function RowActionsMenu({ value, rowIdx, onChange, id, setActionsActiveOnRow, rowActionsButtonWidth, conditionsToRender }: {
1
+ export function RowActionsMenu({ value, rowIdx, onChange, id, disableAddRow, setActionsActiveOnRow, rowActionsButtonWidth, conditionsToRender }: {
2
2
  value: any;
3
3
  rowIdx: any;
4
4
  onChange: any;
5
5
  id: any;
6
+ disableAddRow: any;
6
7
  setActionsActiveOnRow: any;
7
8
  rowActionsButtonWidth: any;
8
9
  conditionsToRender?: boolean;
@@ -26,6 +26,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  __setModuleDefault(result, mod);
27
27
  return result;
28
28
  };
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ };
29
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
30
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
31
40
  };
@@ -41,7 +50,7 @@ var styled_1 = require("../styled");
41
50
  var StyledCustomSelectCompWrapper = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n /* width: 1.5rem; */\n height: 2.5rem;\n"], ["\n ", "\n /* width: 1.5rem; */\n height: 2.5rem;\n"])), styled_1.commonRowColActionMenuStyles);
42
51
  // const CustomSelectComp =
43
52
  var RowActionsMenu = function (_a) {
44
- var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id, setActionsActiveOnRow = _a.setActionsActiveOnRow, rowActionsButtonWidth = _a.rowActionsButtonWidth, _b = _a.conditionsToRender, conditionsToRender = _b === void 0 ? true : _b;
53
+ var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id, disableAddRow = _a.disableAddRow, setActionsActiveOnRow = _a.setActionsActiveOnRow, rowActionsButtonWidth = _a.rowActionsButtonWidth, _b = _a.conditionsToRender, conditionsToRender = _b === void 0 ? true : _b;
45
54
  var _c = (0, react_1.useState)(false), actionMenuIsOpen = _c[0], setActionMenuIsOpen = _c[1];
46
55
  var isFirstMount = (0, react_1.useRef)(true);
47
56
  (0, react_1.useEffect)(function () {
@@ -67,7 +76,7 @@ var RowActionsMenu = function (_a) {
67
76
  var active = _a.active, onClick = _a.onClick;
68
77
  return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { width: rowActionsButtonWidth + "px" }, onClick: onClick, active: active },
69
78
  react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThreeVertical", size: 16 })));
70
- }, actions: [
79
+ }, actions: __spreadArray(__spreadArray([], (!disableAddRow ? [
71
80
  {
72
81
  display: UIContent_1.UIContent.SimpleTable.delete,
73
82
  onClick: function () { return (0, handleRowActions_1.handleDeleteRow)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id }); },
@@ -88,13 +97,14 @@ var RowActionsMenu = function (_a) {
88
97
  return (0, handleRowActions_1.handleInsertRowAfter)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id });
89
98
  },
90
99
  },
100
+ ] : []), true), [
91
101
  {
92
102
  display: UIContent_1.UIContent.SimpleTable.clearContent,
93
103
  onClick: function () {
94
104
  return (0, handleRowActions_1.handleClearRowContent)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id });
95
105
  },
96
106
  },
97
- ] })));
107
+ ], false) })));
98
108
  };
99
109
  exports.RowActionsMenu = RowActionsMenu;
100
110
  var templateObject_1;
@@ -219,7 +219,8 @@ function SimpleTable(_a) {
219
219
  enableColActions &&
220
220
  rowIdx === 0 &&
221
221
  hoveredRowAndCol.colIdx === cellIdx }),
222
- !config.disableRowActionsMenu && react_1.default.createElement(RowActionsMenu_1.RowActionsMenu, { value: value, rowIdx: rowIdx, onChange: onChange, id: id, setActionsActiveOnRow: setActionsActiveOnRow, rowActionsButtonWidth: rowActionsButtonWidth, conditionsToRender: !readOnly &&
222
+ !config.disableRowActionsMenu && react_1.default.createElement(RowActionsMenu_1.RowActionsMenu, { value: value, rowIdx: rowIdx, onChange: onChange, id: id, setActionsActiveOnRow: setActionsActiveOnRow, rowActionsButtonWidth: rowActionsButtonWidth, disableAddRow: config === null || config === void 0 ? void 0 : config.disableAddRow,
223
+ conditionsToRender: !readOnly &&
223
224
  enableRowActions &&
224
225
  cellIdx === 0 &&
225
226
  rowIdx !== undefined && //cuz for fixed col headers, rowIdx is undefined
@@ -114,6 +114,7 @@ export namespace icons {
114
114
  export { ThumbsDown };
115
115
  export { CopySimple };
116
116
  export { PaperPlaneRight };
117
+ export { Warning };
117
118
  export { OkeGoogleIcon };
118
119
  export { LetterH };
119
120
  export { IndexIcon };
@@ -291,6 +292,7 @@ import { Funnel } from 'phosphor-react';
291
292
  import { ThumbsDown } from 'phosphor-react';
292
293
  import { CopySimple } from 'phosphor-react';
293
294
  import { PaperPlaneRight } from 'phosphor-react';
295
+ import { Warning } from 'phosphor-react';
294
296
  import { OkeGoogleIcon } from "./custom";
295
297
  import { LetterH } from "./custom";
296
298
  import { IndexIcon } from "./custom";
@@ -119,6 +119,7 @@ exports.icons = {
119
119
  ThumbsDown: phosphor_react_1.ThumbsDown,
120
120
  CopySimple: phosphor_react_1.CopySimple,
121
121
  PaperPlaneRight: phosphor_react_1.PaperPlaneRight,
122
+ Warning: phosphor_react_1.Warning,
122
123
  //custom
123
124
  OkeGoogleIcon: custom_1.OkeGoogleIcon,
124
125
  LetterH: custom_1.LetterH,
@@ -0,0 +1,112 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ namespace argTypes {
4
+ namespace blockError {
5
+ let name: string;
6
+ }
7
+ namespace icon {
8
+ let name_1: string;
9
+ export { name_1 as name };
10
+ export { availableIcons as options };
11
+ export namespace control {
12
+ let type: string;
13
+ }
14
+ export let defaultValue: any;
15
+ }
16
+ namespace iconAfter {
17
+ let name_2: string;
18
+ export { name_2 as name };
19
+ }
20
+ namespace clearButton {
21
+ let name_3: string;
22
+ export { name_3 as name };
23
+ }
24
+ namespace validateOnlyOnBlur {
25
+ let name_4: string;
26
+ export { name_4 as name };
27
+ }
28
+ namespace actionButton {
29
+ let name_5: string;
30
+ export { name_5 as name };
31
+ }
32
+ namespace actionButtonText {
33
+ let name_6: string;
34
+ export { name_6 as name };
35
+ }
36
+ namespace clearButtonText {
37
+ let name_7: string;
38
+ export { name_7 as name };
39
+ }
40
+ namespace readOnly {
41
+ let name_8: string;
42
+ export { name_8 as name };
43
+ }
44
+ namespace isRequired {
45
+ let name_9: string;
46
+ export { name_9 as name };
47
+ }
48
+ namespace disabled {
49
+ let name_10: string;
50
+ export { name_10 as name };
51
+ }
52
+ namespace invert {
53
+ let name_11: string;
54
+ export { name_11 as name };
55
+ }
56
+ }
57
+ namespace args {
58
+ let icon_1: any;
59
+ export { icon_1 as icon };
60
+ let iconAfter_1: boolean;
61
+ export { iconAfter_1 as iconAfter };
62
+ let blockError_1: string;
63
+ export { blockError_1 as blockError };
64
+ let validateOnlyOnBlur_1: boolean;
65
+ export { validateOnlyOnBlur_1 as validateOnlyOnBlur };
66
+ let actionButton_1: boolean;
67
+ export { actionButton_1 as actionButton };
68
+ let actionButtonText_1: string;
69
+ export { actionButtonText_1 as actionButtonText };
70
+ let clearButton_1: boolean;
71
+ export { clearButton_1 as clearButton };
72
+ let clearButtonText_1: string;
73
+ export { clearButtonText_1 as clearButtonText };
74
+ let readOnly_1: boolean;
75
+ export { readOnly_1 as readOnly };
76
+ let isRequired_1: boolean;
77
+ export { isRequired_1 as isRequired };
78
+ let disabled_1: boolean;
79
+ export { disabled_1 as disabled };
80
+ let invert_1: boolean;
81
+ export { invert_1 as invert };
82
+ }
83
+ }
84
+ export default _default;
85
+ export function Text(args: any): React.JSX.Element;
86
+ export function Email_(args: any): React.JSX.Element;
87
+ export function Password_(args: any): React.JSX.Element;
88
+ export function Phone_(args: any): React.JSX.Element;
89
+ export function URL_(args: any): React.JSX.Element;
90
+ export function Number_(args: any): React.JSX.Element;
91
+ export namespace Number_ {
92
+ export namespace args_1 {
93
+ let min: number;
94
+ let max: number;
95
+ }
96
+ export { args_1 as args };
97
+ export namespace argTypes_1 {
98
+ export namespace min_1 {
99
+ let name_12: string;
100
+ export { name_12 as name };
101
+ }
102
+ export { min_1 as min };
103
+ export namespace max_1 {
104
+ let name_13: string;
105
+ export { name_13 as name };
106
+ }
107
+ export { max_1 as max };
108
+ }
109
+ export { argTypes_1 as argTypes };
110
+ }
111
+ declare const availableIcons: string[];
112
+ import React from 'react';
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Number_ = exports.URL_ = exports.Phone_ = exports.Password_ = exports.Email_ = exports.Text = void 0;
38
+ var react_1 = __importStar(require("react"));
39
+ var TextInputs_1 = require("../../../v2/components/TextInputs");
40
+ var icons_1 = require("../../../icons");
41
+ var themes_1 = require("../../../themes");
42
+ var availableIcons = Object.keys(icons_1.icons).sort();
43
+ exports.default = {
44
+ title: 'Oolib V 2.0/components/TextInputs',
45
+ argTypes: {
46
+ blockError: {
47
+ name: "Block Error"
48
+ },
49
+ icon: {
50
+ name: "Icon",
51
+ options: availableIcons,
52
+ control: { type: 'select' },
53
+ defaultValue: undefined
54
+ },
55
+ iconAfter: {
56
+ name: "Icon After",
57
+ },
58
+ clearButton: {
59
+ name: "Clear Button"
60
+ },
61
+ validateOnlyOnBlur: {
62
+ name: "Validate Only On Blur"
63
+ },
64
+ actionButton: {
65
+ name: "Primary Action"
66
+ },
67
+ actionButtonText: {
68
+ name: "Primary Action Text"
69
+ },
70
+ clearButtonText: {
71
+ name: "Clear Button Text"
72
+ },
73
+ readOnly: {
74
+ name: "Read Only",
75
+ },
76
+ isRequired: {
77
+ name: "Is Required"
78
+ },
79
+ disabled: {
80
+ name: "Disabled"
81
+ },
82
+ invert: {
83
+ name: "Invert"
84
+ }
85
+ },
86
+ args: {
87
+ icon: undefined,
88
+ iconAfter: false,
89
+ blockError: '',
90
+ validateOnlyOnBlur: false,
91
+ actionButton: false,
92
+ actionButtonText: 'Action',
93
+ clearButton: false,
94
+ clearButtonText: '',
95
+ readOnly: false,
96
+ isRequired: false,
97
+ disabled: false,
98
+ invert: false,
99
+ },
100
+ };
101
+ var GenInputStories = function (_a) {
102
+ var args = _a.args, Comp = _a.Comp, searchUrl = _a.searchUrl;
103
+ var _b = (0, react_1.useState)(''), value = _b[0], setValue = _b[1];
104
+ var handleOnChange = function (key, value) {
105
+ setValue(value);
106
+ };
107
+ args[args['size']] = true;
108
+ var newProps = __assign({}, args);
109
+ // if (Comp === Password) {
110
+ // newProps = { ...args }
111
+ // delete newProps['icon']
112
+ // } else {
113
+ // newProps = { ...args, icon: args.icon ? 'PencilSimple' : null }
114
+ // }
115
+ newProps['theme'] = {
116
+ colors: {
117
+ primaryColor40: '#addbff',
118
+ primaryColor100: '#33a4ff',
119
+ primaryColor10: '#EBF6FF',
120
+ primaryColorText: '#0071CC',
121
+ },
122
+ };
123
+ var actionBtn;
124
+ if (args.actionButton) {
125
+ actionBtn = { text: args.actionButtonText, invert: args.invert, onClick: function () { return console.log('clicked'); }, icon: args.actionButtonIcon };
126
+ }
127
+ var clearBtn;
128
+ if (args.clearButton) {
129
+ clearBtn = { text: args.clearButtonText, invert: args.invert, onClick: function () { return console.log('clicked'); }, icon: args.clearButtonIcon };
130
+ }
131
+ return (react_1.default.createElement("div", { style: {
132
+ backgroundColor: args.invert ? themes_1.colors.greyColor100 : '',
133
+ padding: '20px',
134
+ } },
135
+ react_1.default.createElement(Comp, __assign({}, newProps, { onChange: handleOnChange, value: value, actionBtn: actionBtn, clearBtn: clearBtn }))));
136
+ };
137
+ var Text = function (args) { return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'text input', sublabel: 'some sub label' }), Comp: TextInputs_1.TextInput })); };
138
+ exports.Text = Text;
139
+ var Email_ = function (args) {
140
+ return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'email input', sublabel: 'some sub label' }), Comp: TextInputs_1.EmailInput }));
141
+ };
142
+ exports.Email_ = Email_;
143
+ var Password_ = function (args) {
144
+ return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'password input', sublabel: 'some sub label' }), Comp: TextInputs_1.PasswordInput }));
145
+ };
146
+ exports.Password_ = Password_;
147
+ var Phone_ = function (args) {
148
+ return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'phone input', sublabel: 'some sub label' }), Comp: TextInputs_1.PhoneInput }));
149
+ };
150
+ exports.Phone_ = Phone_;
151
+ var URL_ = function (args) {
152
+ return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'url input', sublabel: 'some sub label' }), Comp: TextInputs_1.URLInput }));
153
+ };
154
+ exports.URL_ = URL_;
155
+ var Number_ = function (args) {
156
+ return (react_1.default.createElement(GenInputStories, { args: __assign(__assign({}, args), { label: 'number input', sublabel: 'some sub label' }), Comp: TextInputs_1.NumberInput }));
157
+ };
158
+ exports.Number_ = Number_;
159
+ exports.Number_.args = {
160
+ min: 0,
161
+ max: 100,
162
+ };
163
+ exports.Number_.argTypes = {
164
+ min: {
165
+ name: "Min"
166
+ },
167
+ max: {
168
+ name: "Max"
169
+ }
170
+ };
@@ -1,19 +1,21 @@
1
- import { FunctionComponent } from 'react';
2
- import { icons } from '../../../icons';
1
+ import { FunctionComponent, MouseEvent } from "react";
2
+ import { icons } from "../../../icons";
3
3
  export interface DisplayIconProps {
4
4
  icon: keyof typeof icons;
5
5
  size: number;
6
6
  color: string;
7
- weight?: 'bold' | 'regular';
7
+ weight?: "bold" | "regular";
8
+ onClick?: (event: MouseEvent<HTMLDivElement>) => void;
8
9
  }
9
10
  /**
10
- * @component Renders an icon component with customizable size, color, and weight.
11
+ * @component Renders an icon component with customizable size, color, weight, and click handler.
11
12
  *
12
13
  * - The props object containing the following properties:
13
14
  * @prop {keyof typeof icons} icon: The name of the icon to be rendered.
14
15
  * @prop {number} size: The size of the icon in pixels.
15
16
  * @prop {string} color: The color of the icon.
16
17
  * @prop {'bold' | 'regular'} weight: The weight of the icon font. Defaults to "bold".
18
+ * @prop {function} onClick: Optional click handler for the icon.
17
19
  * @return {ReactElement} The rendered icon component.
18
20
  */
19
21
  declare const DisplayIcon: FunctionComponent<DisplayIconProps>;
@@ -6,19 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DisplayIcon = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var icons_1 = require("../../../icons");
9
+ var themes_1 = require("../../../v2/themes");
9
10
  /**
10
- * @component Renders an icon component with customizable size, color, and weight.
11
+ * @component Renders an icon component with customizable size, color, weight, and click handler.
11
12
  *
12
13
  * - The props object containing the following properties:
13
14
  * @prop {keyof typeof icons} icon: The name of the icon to be rendered.
14
15
  * @prop {number} size: The size of the icon in pixels.
15
16
  * @prop {string} color: The color of the icon.
16
17
  * @prop {'bold' | 'regular'} weight: The weight of the icon font. Defaults to "bold".
18
+ * @prop {function} onClick: Optional click handler for the icon.
17
19
  * @return {ReactElement} The rendered icon component.
18
20
  */
19
21
  var DisplayIcon = function (_a) {
20
- var icon = _a.icon, size = _a.size, color = _a.color, _b = _a.weight, weight = _b === void 0 ? 'bold' : _b;
22
+ var icon = _a.icon, size = _a.size, _b = _a.color, color = _b === void 0 ? themes_1.colors.grey80 : _b, _c = _a.weight, weight = _c === void 0 ? "bold" : _c, onClick = _a.onClick;
21
23
  var IconComp = icons_1.icons[icon];
22
- return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: weight }));
24
+ return (react_1.default.createElement("div", { style: { cursor: onClick ? "pointer" : "default", display: "flex" }, onMouseDown: onClick || undefined }, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: weight })));
23
25
  };
24
26
  exports.DisplayIcon = DisplayIcon;
@@ -0,0 +1,52 @@
1
+ export function TextInput({ id, invert, disabled, icon, type, placeholder, value, onChange, onFocus, onBlur, readOnly, iconOnClick, iconAfter, handleValidation, validateOnMount, actionBtn, clearBtn, className, maxLength, maxNumLimiter: DEPRECATED_maxNumLimiter, forceFocus, validateOnlyOnBlur, validationStatus: _validationStatus, displayValidationMsg, content, passValidationErrorToFormValidation, plugin, }: {
2
+ id: any;
3
+ invert: any;
4
+ disabled: any;
5
+ icon: any;
6
+ type: any;
7
+ placeholder?: string;
8
+ value?: string;
9
+ onChange: any;
10
+ onFocus: any;
11
+ onBlur: any;
12
+ readOnly: any;
13
+ iconOnClick: any;
14
+ iconAfter: any;
15
+ handleValidation: any;
16
+ validateOnMount?: boolean;
17
+ actionBtn: any;
18
+ clearBtn: any;
19
+ className: any;
20
+ maxLength: any;
21
+ maxNumLimiter: any;
22
+ forceFocus: any;
23
+ validateOnlyOnBlur?: boolean;
24
+ validationStatus: any;
25
+ displayValidationMsg?: boolean;
26
+ content: any;
27
+ passValidationErrorToFormValidation: any;
28
+ plugin: any;
29
+ }, ...args: any[]): React.JSX.Element;
30
+ export function PasswordInput({ ...props }: {
31
+ [x: string]: any;
32
+ }): React.JSX.Element;
33
+ export function EmailInput({ passValidationErrorToFormValidation, ...props }: {
34
+ [x: string]: any;
35
+ passValidationErrorToFormValidation: any;
36
+ }): React.JSX.Element;
37
+ export function PhoneInput({ passValidationErrorToFormValidation, ...props }: {
38
+ [x: string]: any;
39
+ passValidationErrorToFormValidation: any;
40
+ }): React.JSX.Element;
41
+ export function URLInput({ routesAreValidInputs, validationPlugin, passValidationErrorToFormValidation, content, ...props }: {
42
+ [x: string]: any;
43
+ routesAreValidInputs?: boolean;
44
+ validationPlugin: any;
45
+ passValidationErrorToFormValidation: any;
46
+ content: any;
47
+ }): React.JSX.Element;
48
+ export function NumberInput({ passValidationErrorToFormValidation, ...props }: {
49
+ [x: string]: any;
50
+ passValidationErrorToFormValidation: any;
51
+ }): React.JSX.Element;
52
+ import React from "react";
@@ -0,0 +1,353 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __rest = (this && this.__rest) || function (s, e) {
73
+ var t = {};
74
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
+ t[p] = s[p];
76
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
+ t[p[i]] = s[p[i]];
80
+ }
81
+ return t;
82
+ };
83
+ Object.defineProperty(exports, "__esModule", { value: true });
84
+ exports.NumberInput = exports.URLInput = exports.PhoneInput = exports.EmailInput = exports.PasswordInput = exports.TextInput = void 0;
85
+ var react_1 = __importStar(require("react"));
86
+ var styled_components_1 = require("styled-components");
87
+ var BlockLabel_1 = require("../../../components/BlockLabel");
88
+ var LoadersAndProgress_1 = require("../../../components/LoadersAndProgress");
89
+ var OKELink_1 = require("../../../components/OKELink");
90
+ var icons_1 = require("../../../icons");
91
+ var _EXPORTS_1 = require("../../../utils/_EXPORTS");
92
+ var utilsOolib_1 = require("../../../utilsOolib");
93
+ var themes_1 = require("../../themes");
94
+ var Buttons_1 = require("../Buttons");
95
+ var Typo2_1 = require("../Typo2");
96
+ var index_styled_1 = require("./index.styled");
97
+ var DisplayIcon_1 = require("../../../utils/comps/DisplayIcon");
98
+ function TextInput(_a) {
99
+ var _this = this;
100
+ var id = _a.id, invert = _a.invert, disabled = _a.disabled, icon = _a.icon, type = _a.type, _b = _a.placeholder, placeholder = _b === void 0 ? "Enter Text..." : _b, _c = _a.value, value = _c === void 0 ? "" : _c, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, readOnly = _a.readOnly, iconOnClick = _a.iconOnClick, iconAfter = _a.iconAfter, handleValidation = _a.handleValidation, _d = _a.validateOnMount, validateOnMount = _d === void 0 ? true : _d, // i think it makes sense to always run validation the minute the comp mounts, but we will see if this has sideeffects
101
+ actionBtn = _a.actionBtn, clearBtn = _a.clearBtn, className = _a.className, maxLength = _a.maxLength, DEPRECATED_maxNumLimiter = _a.maxNumLimiter, forceFocus = _a.forceFocus, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
102
+ _e = _a.validateOnlyOnBlur, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
103
+ validateOnlyOnBlur = _e === void 0 ? false : _e, //for example, in the login form we want validation to only run, once the text input is blurred. else it can be irritating
104
+ _validationStatus = _a.validationStatus, _f = _a.displayValidationMsg, displayValidationMsg = _f === void 0 ? true : _f, content = _a.content, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, plugin = _a.plugin;
105
+ var props = arguments[0];
106
+ var theme = (0, styled_components_1.useTheme)();
107
+ var _g = (0, react_1.useState)(_validationStatus), validationStatus = _g[0], setValidationStatus = _g[1];
108
+ (0, react_1.useEffect)(function () {
109
+ setValidationStatus(_validationStatus);
110
+ }, [_validationStatus]);
111
+ var actionBtnEnabaled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
112
+ var clearBtnEnabled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
113
+ var handleValidate = function (e, onBlur) { return __awaiter(_this, void 0, void 0, function () {
114
+ var value, res, validationPlugin, pluginResponse;
115
+ return __generator(this, function (_a) {
116
+ switch (_a.label) {
117
+ case 0:
118
+ onBlur && onBlur(e);
119
+ value = e.target.value;
120
+ if (!value)
121
+ return [2 /*return*/];
122
+ if (type === "url")
123
+ setValidationStatus("loading");
124
+ if (!handleValidation) return [3 /*break*/, 2];
125
+ return [4 /*yield*/, handleValidation(value)];
126
+ case 1:
127
+ res = _a.sent();
128
+ setValidationStatus(res);
129
+ _a.label = 2;
130
+ case 2:
131
+ validationPlugin = (plugin === null || plugin === void 0 ? void 0 : plugin.validation) &&
132
+ theme.pluginConfigs &&
133
+ theme.pluginConfigs.tplBlockPlugins[plugin.validation];
134
+ if (!validationPlugin) return [3 /*break*/, 4];
135
+ setValidationStatus("loading");
136
+ return [4 /*yield*/, validationPlugin({
137
+ value: value,
138
+ content: content,
139
+ passValidationErrorToFormValidation: passValidationErrorToFormValidation,
140
+ })];
141
+ case 3:
142
+ pluginResponse = _a.sent();
143
+ //if plugin responds with undefined, it means it found no error. hence lets pass the 'success info' to passValidationErrorToFormValidation
144
+ if (!pluginResponse)
145
+ passValidationErrorToFormValidation("success");
146
+ setValidationStatus(pluginResponse);
147
+ _a.label = 4;
148
+ case 4: return [2 /*return*/];
149
+ }
150
+ });
151
+ }); };
152
+ (0, react_1.useEffect)(function () {
153
+ if (validateOnMount) {
154
+ handleValidate({ target: { value: value } });
155
+ }
156
+ }, [validateOnMount]);
157
+ var handleOnChange = function (e) {
158
+ onChange(id, e.target.value);
159
+ if (!e.target.value)
160
+ setValidationStatus("");
161
+ if (!validateOnlyOnBlur) {
162
+ handleValidate(e);
163
+ }
164
+ else {
165
+ /**
166
+ * basically if an error has already been set then, run validation in realtime on change
167
+ */
168
+ if (validationStatus) {
169
+ if (type === "url")
170
+ return setValidationStatus("");
171
+ handleValidate(e);
172
+ }
173
+ }
174
+ };
175
+ var inputRef = (0, react_1.useRef)(null);
176
+ (0, react_1.useEffect)(function () {
177
+ forceFocus && inputRef.current && inputRef.current.focus();
178
+ }, [forceFocus]);
179
+ var localize = (0, utilsOolib_1.useLocale)();
180
+ return (react_1.default.createElement(react_1.default.Fragment, null,
181
+ react_1.default.createElement("div", { className: className },
182
+ react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
183
+ readOnly ? (react_1.default.createElement(Typo2_1.UI_BODY_SM, null, type === "password" ? "********" : value)) : (react_1.default.createElement(react_1.default.Fragment, null,
184
+ react_1.default.createElement(index_styled_1.InputContainerStyled, { type: type, disabled: disabled, iconAfter: iconAfter, onClick: function () { return inputRef.current.focus(); } },
185
+ icon && (react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: icon, color: disabled ? themes_1.colors.grey40 : themes_1.colors.grey80, size: 16, onClick: !disabled ? iconOnClick || null : undefined })),
186
+ react_1.default.createElement(index_styled_1.InputStyled, { ref: inputRef, className: "UI_BODY_SM", id: id, type: type, name: type, disabled: disabled, placeholder: localize(placeholder), value: value, onChange: handleOnChange, maxLength: maxLength || DEPRECATED_maxNumLimiter, onBlur: validateOnlyOnBlur ? function (e) { return handleValidate(e, onBlur); } : onBlur, onFocus: onFocus, autoComplete: "off" }),
187
+ validationStatus === "loading" && (react_1.default.createElement("div", null,
188
+ react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true, invert: invert }))),
189
+ clearBtn && clearBtnEnabled && (react_1.default.createElement(index_styled_1.ClearButtonStyled, { onClick: function () { return onChange(id, ""); } },
190
+ react_1.default.createElement(Typo2_1.UI_CAPTION, null, localize((clearBtn === null || clearBtn === void 0 ? void 0 : clearBtn.text) || "clear")))),
191
+ actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimary, { M: true, value: actionBtn.text, invert: actionBtn.invert, onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: "-2rem" } }))),
192
+ displayValidationMsg && (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.msg) && (react_1.default.createElement(index_styled_1.MsgContainerStyled, { status: validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type },
193
+ (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "error" && (react_1.default.createElement(DisplayIcon_1.DisplayIcon, { size: 12, icon: "Warning", weight: "fill", color: themes_1.colors.red })),
194
+ react_1.default.createElement(Typo2_1.UI_HELPTEXT, null,
195
+ validationStatus.msg,
196
+ validationStatus.link && (react_1.default.createElement(OKELink_1.OKELink, { style: { marginLeft: "1rem" }, to: validationStatus.link.to }, validationStatus.link.text))))))))));
197
+ }
198
+ exports.TextInput = TextInput;
199
+ //passValidationErrorToFormValidation is not being handled by PasswordInput, cuz i dont think we will need it here..
200
+ var PasswordInput = function (_a) {
201
+ var props = __rest(_a, []);
202
+ var _b = (0, react_1.useState)(false), showPassword = _b[0], setShowPassword = _b[1];
203
+ var icon = showPassword ? "Eye" : "EyeClosed";
204
+ var toggleShowPassword = function (e) {
205
+ if (props.disabled)
206
+ return;
207
+ e.preventDefault();
208
+ setShowPassword(function (prev) { return !prev; });
209
+ };
210
+ return (react_1.default.createElement(TextInput, __assign({ placeholder: "Enter password...", type: showPassword ? "text" : "password", iconOnClick: toggleShowPassword, iconAfter: true, icon: icon }, props)));
211
+ };
212
+ exports.PasswordInput = PasswordInput;
213
+ var EmailInput = function (_a) {
214
+ var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
215
+ var handleValidation = function (value) {
216
+ var regEx = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
217
+ var errorObj = regEx.test(value)
218
+ ? ""
219
+ : { type: "error", msg: "Enter a valid email address" };
220
+ if (passValidationErrorToFormValidation) {
221
+ passValidationErrorToFormValidation((errorObj === null || errorObj === void 0 ? void 0 : errorObj.type) || "success");
222
+ }
223
+ return errorObj;
224
+ };
225
+ return (react_1.default.createElement(TextInput, __assign({ type: "email", placeholder: "Enter email...", handleValidation: handleValidation }, props)));
226
+ };
227
+ exports.EmailInput = EmailInput;
228
+ var PhoneInput = function (_a) {
229
+ var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
230
+ var handleValidation = function (value) {
231
+ var errorObj;
232
+ if (isNaN(value)) {
233
+ errorObj = { type: "error", msg: "Enter a valid phone number" };
234
+ if (passValidationErrorToFormValidation)
235
+ passValidationErrorToFormValidation(errorObj.type);
236
+ return errorObj;
237
+ }
238
+ if (value.length < 9) {
239
+ errorObj = { type: "error", msg: "Enter a valid phone number" };
240
+ if (passValidationErrorToFormValidation)
241
+ passValidationErrorToFormValidation(errorObj.type);
242
+ return errorObj;
243
+ }
244
+ //else
245
+ if (passValidationErrorToFormValidation)
246
+ passValidationErrorToFormValidation("success");
247
+ };
248
+ return (react_1.default.createElement(TextInput, __assign({ type: "tel", placeholder: "Enter Phone...", handleValidation: handleValidation, maxLength: 11 }, props)));
249
+ };
250
+ exports.PhoneInput = PhoneInput;
251
+ var URLInput = function (_a) {
252
+ var _b = _a.routesAreValidInputs, routesAreValidInputs = _b === void 0 ? false : _b, //if we want react route declarations to be considered as 'valid' then set this to true
253
+ validationPlugin = _a.validationPlugin, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, content = _a.content, props = __rest(_a, ["routesAreValidInputs", "validationPlugin", "passValidationErrorToFormValidation", "content"]);
254
+ var handleValidation = function (value) { return __awaiter(void 0, void 0, void 0, function () {
255
+ var pluginResponse, successObj, response, successObj, err_1, successObj, errorObj;
256
+ return __generator(this, function (_a) {
257
+ switch (_a.label) {
258
+ case 0:
259
+ if (!validationPlugin) return [3 /*break*/, 2];
260
+ return [4 /*yield*/, validationPlugin({
261
+ value: value,
262
+ content: content,
263
+ passValidationErrorToFormValidation: passValidationErrorToFormValidation,
264
+ })];
265
+ case 1:
266
+ pluginResponse = _a.sent();
267
+ if (pluginResponse)
268
+ return [2 /*return*/, pluginResponse];
269
+ _a.label = 2;
270
+ case 2:
271
+ //else
272
+ //if routesAreValidInputs, then first validate for a route
273
+ if (routesAreValidInputs && value.substring(0, 1) === "/") {
274
+ successObj = { type: "success", msg: "valid route" };
275
+ if (passValidationErrorToFormValidation)
276
+ passValidationErrorToFormValidation(successObj.type);
277
+ return [2 /*return*/, successObj];
278
+ }
279
+ //else validate for a url
280
+ if (!/^https?:\/\//i.test(value)) {
281
+ value = "https://" + value;
282
+ }
283
+ _a.label = 3;
284
+ case 3:
285
+ _a.trys.push([3, 5, , 6]);
286
+ return [4 /*yield*/, fetch(value)];
287
+ case 4:
288
+ response = _a.sent();
289
+ if (response.status !== 200)
290
+ throw new Error("");
291
+ successObj = { type: "success", msg: "valid url" };
292
+ if (passValidationErrorToFormValidation)
293
+ passValidationErrorToFormValidation(successObj.type);
294
+ return [2 /*return*/, successObj];
295
+ case 5:
296
+ err_1 = _a.sent();
297
+ if (/[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(value)) {
298
+ successObj = { type: "success", msg: "valid url" };
299
+ if (passValidationErrorToFormValidation)
300
+ passValidationErrorToFormValidation(successObj.type);
301
+ return [2 /*return*/, successObj];
302
+ }
303
+ errorObj = { type: "error", msg: "Enter a valid url..." };
304
+ if (passValidationErrorToFormValidation)
305
+ passValidationErrorToFormValidation(errorObj.type);
306
+ return [2 /*return*/, errorObj];
307
+ case 6: return [2 /*return*/];
308
+ }
309
+ });
310
+ }); };
311
+ return (react_1.default.createElement(TextInput, __assign({ type: "url", handleValidation: handleValidation, placeholder: "Enter a valid url..." }, props)));
312
+ };
313
+ exports.URLInput = URLInput;
314
+ var NumberInput = function (_a) {
315
+ var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
316
+ var min = props.min, max = props.max;
317
+ var handleValidation = function (value) {
318
+ var errorObj;
319
+ if (isNaN(value)) {
320
+ errorObj = { type: "error", msg: "Enter a number" };
321
+ if (passValidationErrorToFormValidation)
322
+ passValidationErrorToFormValidation(errorObj.type);
323
+ return errorObj;
324
+ }
325
+ if (min && value < min) {
326
+ errorObj = {
327
+ type: "error",
328
+ msg: "Enter value greater than or equal to ".concat(min),
329
+ };
330
+ if (passValidationErrorToFormValidation)
331
+ passValidationErrorToFormValidation(errorObj.type);
332
+ return errorObj;
333
+ }
334
+ if (max && value > max) {
335
+ errorObj = {
336
+ type: "error",
337
+ msg: "Enter value less than or equal to ".concat(max),
338
+ };
339
+ if (passValidationErrorToFormValidation)
340
+ passValidationErrorToFormValidation(errorObj.type);
341
+ return errorObj;
342
+ }
343
+ //else
344
+ if (passValidationErrorToFormValidation)
345
+ passValidationErrorToFormValidation("success");
346
+ };
347
+ return (react_1.default.createElement(TextInput
348
+ // type="number"
349
+ , __assign({
350
+ // type="number"
351
+ handleValidation: handleValidation, placeholder: "Enter Number..." }, props)));
352
+ };
353
+ exports.NumberInput = NumberInput;
@@ -0,0 +1,4 @@
1
+ export const MsgContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export const InputContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export const InputStyled: import("styled-components").StyledComponent<"input", any, {}, never>;
4
+ export const ClearButtonStyled: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.ClearButtonStyled = exports.InputStyled = exports.InputContainerStyled = exports.MsgContainerStyled = void 0;
31
+ var styled_components_1 = __importStar(require("styled-components"));
32
+ var mixins_1 = require("../../../themes/mixins");
33
+ var themes_1 = require("../../themes");
34
+ var globalStyles_1 = require("../../themes/globalStyles");
35
+ var getColorValue = function (status) {
36
+ return status === "error" ? themes_1.colors.red : status === "success" && themes_1.colors.green;
37
+ };
38
+ exports.MsgContainerStyled = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 2px;\n display: flex;\n align-items: center;\n gap: 2px;\n ", "\n"], ["\n margin-top: 2px;\n display: flex;\n align-items: center;\n gap: 2px;\n ", "\n"])), function (_a) {
39
+ var status = _a.status;
40
+ return status && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), getColorValue(status));
41
+ });
42
+ exports.InputContainerStyled = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n ", ";\n\n position: relative;\n &::before {\n content: \"\";\n background-color: ", ";\n position: absolute;\n z-index: -1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 6px;\n }\n\n color: ", ";\n display: flex;\n align-items: center;\n gap: 6px;\n\n ", "\n ", "\n\n ", ";\n ", ";\n"], ["\n ", "\n ", ";\n\n position: relative;\n &::before {\n content: \"\";\n background-color: ", ";\n position: absolute;\n z-index: -1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 6px;\n }\n\n color: ", ";\n display: flex;\n align-items: center;\n gap: 6px;\n\n ", "\n ", "\n\n ", ";\n ", ";\n"])), globalStyles_1.globalInputElemPadding_v2, function (_a) {
43
+ var iconAfter = _a.iconAfter;
44
+ return iconAfter && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row-reverse;\n justify-content: space-between;\n "], ["\n flex-direction: row-reverse;\n justify-content: space-between;\n "])));
45
+ }, themes_1.colors.white, themes_1.colors.grey10, themes_1.colors.grey80, function (_a) {
46
+ var disabled = _a.disabled;
47
+ return !disabled && globalStyles_1.globalInputElemHover_v2;
48
+ }, function (_a) {
49
+ var disabled = _a.disabled;
50
+ return !disabled && globalStyles_1.globalInputElemFocused_v2;
51
+ }, function (_a) {
52
+ var disabled = _a.disabled;
53
+ return disabled && (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-color: ", ";\n color: ", ";\n "], ["\n border-color: ", ";\n color: ", ";\n "])), themes_1.colors.grey10, themes_1.colors.grey40);
54
+ }, function (_a) {
55
+ var readOnly = _a.readOnly;
56
+ return readOnly && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
57
+ });
58
+ exports.InputStyled = styled_components_1.default.input(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"], ["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"])), globalStyles_1.globalInputHeight, function (_a) {
59
+ var disabled = _a.disabled;
60
+ return (disabled ? themes_1.colors.grey40 : themes_1.colors.grey80);
61
+ });
62
+ exports.ClearButtonStyled = styled_components_1.default.button(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n border-radius: 14px;\n background-color: ", ";\n cursor: pointer;\n border: 0;\n padding: 4px 10px;\n"], ["\n border-radius: 14px;\n background-color: ", ";\n cursor: pointer;\n border: 0;\n padding: 4px 10px;\n"])), themes_1.colors.grey10);
63
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -13,6 +13,9 @@ export declare const colors: {
13
13
  grey80: string;
14
14
  grey40: string;
15
15
  grey10: string;
16
+ white: string;
17
+ green: string;
18
+ red: string;
16
19
  };
17
20
  export interface Colors2Type {
18
21
  primary: string;
@@ -29,4 +32,7 @@ export interface Colors2Type {
29
32
  grey80: string;
30
33
  grey40: string;
31
34
  grey10: string;
35
+ white: string;
36
+ green: string;
37
+ red: string;
32
38
  }
@@ -15,6 +15,9 @@ var surfaceContainerLow = "#F1F4F7";
15
15
  var grey80 = '#333333';
16
16
  var grey40 = "#999999";
17
17
  var grey10 = "#E7E7E7";
18
+ var white = "#ffffff";
19
+ var green = "#159300";
20
+ var red = "#C41717";
18
21
  exports.colors = {
19
22
  primary: primary,
20
23
  secondary: secondary,
@@ -29,5 +32,8 @@ exports.colors = {
29
32
  surfaceContainerLow: surfaceContainerLow,
30
33
  grey80: grey80,
31
34
  grey40: grey40,
32
- grey10: grey10
35
+ grey10: grey10,
36
+ white: white,
37
+ green: green,
38
+ red: red
33
39
  };
@@ -0,0 +1,4 @@
1
+ export declare const globalInputHeight = "36px";
2
+ export declare const globalInputElemPadding_v2: import("styled-components").FlattenSimpleInterpolation;
3
+ export declare const globalInputElemHover_v2: import("styled-components").FlattenSimpleInterpolation;
4
+ export declare const globalInputElemFocused_v2: import("styled-components").FlattenSimpleInterpolation;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.globalInputElemFocused_v2 = exports.globalInputElemHover_v2 = exports.globalInputElemPadding_v2 = exports.globalInputHeight = void 0;
8
+ var styled_components_1 = require("styled-components");
9
+ var colors_1 = require("./colors");
10
+ exports.globalInputHeight = '36px';
11
+ exports.globalInputElemPadding_v2 = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 10px;\n"], ["\n padding: 0 10px;\n"])));
12
+ exports.globalInputElemHover_v2 = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n &::before{\n border: 1.5px solid ", ";\n box-shadow: 0 4px 10px #00000012;\n }\n }\n"], ["\n &:hover {\n &::before{\n border: 1.5px solid ", ";\n box-shadow: 0 4px 10px #00000012;\n }\n }\n"])), colors_1.colors.grey80);
13
+ exports.globalInputElemFocused_v2 = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n&:focus-within {\n &::before{\n border: 1.5px solid ", ";\n box-shadow: 0 4px 10px #00000012;\n }\n }\n"], ["\n&:focus-within {\n &::before{\n border: 1.5px solid ", ";\n box-shadow: 0 4px 10px #00000012;\n }\n }\n"])), colors_1.colors.grey80);
14
+ var templateObject_1, templateObject_2, templateObject_3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.141.2",
3
+ "version": "2.141.4",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",