@tiller-ds/patterns
Version:
Patterns module of Tiller Design System
1,075 lines (940 loc) • 47.1 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('formik'), require('yup'), require('@tiller-ds/core'), require('@tiller-ds/form-elements'), require('@tiller-ds/formik-elements'), require('@tiller-ds/icons'), require('@tiller-ds/intl'), require('@tiller-ds/theme')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'formik', 'yup', '@tiller-ds/core', '@tiller-ds/form-elements', '@tiller-ds/formik-elements', '@tiller-ds/icons', '@tiller-ds/intl', '@tiller-ds/theme'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Patterns = {}, global.React, global.formik, global.Yup, global.core, global.formElements, global.formikElements, global.icons, global.intl, global.theme));
})(this, (function (exports, React, formik, Yup, core, formElements, formikElements, icons, intl, theme) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
/*
* Copyright 2025 CROZ d.o.o, the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var EmailValidationSchema$1 = Yup__namespace.object({
email: Yup__namespace.string().email("intl:login.validation.emailValidation.email.validity").max(255).required("intl:login.validation.emailValidation.email.required")
});
function EmailForm(_a) {
var title = _a.title,
subtitle = _a.subtitle,
buttonText = _a.buttonText,
backToLogin = _a.backToLogin,
children = _a.children,
props = __rest(_a, ["title", "subtitle", "buttonText", "backToLogin", "children"]);
var tokens = theme.useTokens("Login", props.tokens);
return /*#__PURE__*/React__default["default"].createElement(formik.Form, null, /*#__PURE__*/React__default["default"].createElement(formElements.FormLayout.Section, null, /*#__PURE__*/React__default["default"].createElement("div", {
className: tokens.emailForm.master
}, /*#__PURE__*/React__default["default"].createElement("h1", {
className: tokens.emailForm.headerContainer
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: title || "login.labels.forgottenPassword"
})), /*#__PURE__*/React__default["default"].createElement("p", {
className: "mb-5 text-center"
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: subtitle || "login.labels.forgottenPasswordDescription"
})), children, /*#__PURE__*/React__default["default"].createElement(formikElements.InputField, {
"data-testid": "email",
className: tokens.emailForm.inputSpacing,
name: "email",
label: /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: "login.labels.email"
}),
autoFocus: true,
required: true
}), /*#__PURE__*/React__default["default"].createElement(core.Button, {
"data-testid": "submit",
className: tokens.emailForm.submitButton.master + " " + tokens.emailForm.submitButton.margin,
variant: "filled",
type: "submit"
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: buttonText || "login.labels.sendEmail"
})), /*#__PURE__*/React__default["default"].createElement("div", {
className: tokens.emailForm.link.container
}, /*#__PURE__*/React__default["default"].createElement(icons.Icon, {
type: "arrow-left",
className: tokens.emailForm.link.icon
}), /*#__PURE__*/React__default["default"].createElement(core.Link, {
className: tokens.emailForm.link.master,
to: "/login"
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: backToLogin || "login.labels.backToLogin"
}))))));
}
/*
* Copyright 2025 CROZ d.o.o, the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var defaultPasswordValidationRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/;
var PasswordValidationSchema$1 = function PasswordValidationSchema(passwordValidationRegex) {
return Yup__namespace.object({
newPassword: Yup__namespace.string().required("intl:login.validation.passwordValidation.newPassword.required").matches(passwordValidationRegex || defaultPasswordValidationRegex, "intl:login.validation.passwordValidation.newPassword.regex"),
repeatPassword: Yup__namespace.string().required("intl:login.validation.passwordValidation.repeatPassword.required").oneOf([Yup__namespace.ref("newPassword"), null], "intl:login.validation.passwordValidation.repeatPassword.oneOf")
});
};
function ForgottenPassword(_a) {
var validationSchema = _a.validationSchema,
initialValues = _a.initialValues,
handleSubmit = _a.handleSubmit,
children = _a.children,
_b = _a.passwordValidationRegex,
passwordValidationRegex = _b === void 0 ? defaultPasswordValidationRegex : _b,
props = __rest(_a, ["validationSchema", "initialValues", "handleSubmit", "children", "passwordValidationRegex"]);
var tokens = theme.useTokens("Login", props.tokens);
return /*#__PURE__*/React__namespace.createElement("div", {
className: tokens.container
}, /*#__PURE__*/React__namespace.createElement(core.Card, null, /*#__PURE__*/React__namespace.createElement(core.Card.Body, null, /*#__PURE__*/React__namespace.createElement(formikElements.FormContainer, {
initialValues: initialValues,
validationSchema: validationSchema || PasswordValidationSchema$1(passwordValidationRegex),
onSubmit: handleSubmit
}, function () {
return children;
}))));
}
/*
* Copyright 2025 CROZ d.o.o, the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var LoginValidationSchema = Yup__namespace.object({
username: Yup__namespace.string().required("intl:login.validation.loginValidation.username.required"),
password: Yup__namespace.string().required("intl:login.validation.loginValidation.password.required")
});
var LoginEmailValidationSchema = Yup__namespace.object({
email: Yup__namespace.string().required("intl:login.validation.loginEmailValidation.email.required"),
password: Yup__namespace.string().required("intl:login.validation.loginEmailValidation.password.required")
});
function Login(_a) {
var title = _a.title,
logo = _a.logo,
rememberMe = _a.rememberMe,
buttonText = _a.buttonText,
forgotPassword = _a.forgotPassword,
forgotPasswordLink = _a.forgotPasswordLink,
initialValues = _a.initialValues,
handleSubmit = _a.handleSubmit,
children = _a.children,
useEmail = _a.useEmail,
className = _a.className,
props = __rest(_a, ["title", "logo", "rememberMe", "buttonText", "forgotPassword", "forgotPasswordLink", "initialValues", "handleSubmit", "children", "useEmail", "className"]);
var tokens = theme.useTokens("Login", props.tokens);
return /*#__PURE__*/React__namespace.createElement("div", {
className: className || tokens.container
}, /*#__PURE__*/React__namespace.createElement(core.Card, null, /*#__PURE__*/React__namespace.createElement(core.Card.Body, null, /*#__PURE__*/React__namespace.createElement(formikElements.FormContainer, {
initialValues: initialValues,
validationSchema: useEmail ? LoginEmailValidationSchema : LoginValidationSchema,
onSubmit: handleSubmit,
validateAfterSubmit: true
}, function () {
return /*#__PURE__*/React__namespace.createElement(formik.Form, null, /*#__PURE__*/React__namespace.createElement(formElements.FormLayout.Section, null, /*#__PURE__*/React__namespace.createElement("div", {
className: tokens.master
}, logo && /*#__PURE__*/React__namespace.createElement("div", {
className: tokens.logoContainer
}, /*#__PURE__*/React__namespace.createElement("img", {
src: logo,
alt: "logo",
className: tokens.logoSize
})), children, /*#__PURE__*/React__namespace.createElement("h1", {
className: tokens.headerContainer
}, /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: title || "login.labels.header"
})), /*#__PURE__*/React__namespace.createElement(formikElements.InputField, {
className: tokens.inputSpacing,
name: useEmail ? "email" : "username",
label: useEmail ? /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: "login.labels.email"
}) : /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: "login.labels.username"
}),
autoFocus: true,
required: true
}), /*#__PURE__*/React__namespace.createElement(formikElements.PasswordInputField, {
name: "password",
className: tokens.inputSpacing,
label: /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: "login.labels.password"
}),
required: true
}), rememberMe === true && /*#__PURE__*/React__namespace.createElement(formikElements.CheckboxGroupField, {
name: "type",
label: ""
}, /*#__PURE__*/React__namespace.createElement(formikElements.CheckboxGroupField.Item, {
label: /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: "login.labels.rememberMe"
}),
value: "remember-me"
})), /*#__PURE__*/React__namespace.createElement(core.Button, {
className: tokens.loginButton.master + " " + tokens.loginButton.margin,
variant: "filled",
type: "submit"
}, /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: buttonText || "login.labels.login"
})), forgotPassword === true && /*#__PURE__*/React__namespace.createElement("div", {
className: tokens.link.container
}, /*#__PURE__*/React__namespace.createElement(core.Link, {
className: tokens.link.master,
to: forgotPasswordLink !== null && forgotPasswordLink !== void 0 ? forgotPasswordLink : "/forgotten-password"
}, /*#__PURE__*/React__namespace.createElement(intl.Intl, {
name: "login.labels.forgotPassword"
}))))));
}))));
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global$b =
// eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
// eslint-disable-next-line no-restricted-globals -- safe
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func -- fallback
(function () { return this; })() || Function('return this')();
var objectGetOwnPropertyDescriptor = {};
var fails$4 = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var fails$3 = fails$4;
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails$3(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
var objectPropertyIsEnumerable = {};
var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor$1(this, V);
return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;
var createPropertyDescriptor$2 = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var toString = {}.toString;
var classofRaw = function (it) {
return toString.call(it).slice(8, -1);
};
var fails$2 = fails$4;
var classof = classofRaw;
var split = ''.split;
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var indexedObject = fails$2(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins -- safe
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
var requireObjectCoercible$1 = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = indexedObject;
var requireObjectCoercible = requireObjectCoercible$1;
var toIndexedObject$3 = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
var isObject$5 = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var isObject$4 = isObject$5;
// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var toPrimitive$2 = function (input, PREFERRED_STRING) {
if (!isObject$4(input)) return input;
var fn, val;
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$4(val = fn.call(input))) return val;
if (typeof (fn = input.valueOf) == 'function' && !isObject$4(val = fn.call(input))) return val;
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$4(val = fn.call(input))) return val;
throw TypeError("Can't convert object to primitive value");
};
var hasOwnProperty = {}.hasOwnProperty;
var has$6 = function (it, key) {
return hasOwnProperty.call(it, key);
};
var global$a = global$b;
var isObject$3 = isObject$5;
var document = global$a.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject$3(document) && isObject$3(document.createElement);
var documentCreateElement = function (it) {
return EXISTS ? document.createElement(it) : {};
};
var DESCRIPTORS$4 = descriptors;
var fails$1 = fails$4;
var createElement = documentCreateElement;
// Thank's IE8 for his funny defineProperty
var ie8DomDefine = !DESCRIPTORS$4 && !fails$1(function () {
// eslint-disable-next-line es/no-object-defineproperty -- requied for testing
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
var DESCRIPTORS$3 = descriptors;
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
var toIndexedObject$2 = toIndexedObject$3;
var toPrimitive$1 = toPrimitive$2;
var has$5 = has$6;
var IE8_DOM_DEFINE$1 = ie8DomDefine;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject$2(O);
P = toPrimitive$1(P, true);
if (IE8_DOM_DEFINE$1) try {
return $getOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has$5(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
var objectDefineProperty = {};
var isObject$2 = isObject$5;
var anObject$2 = function (it) {
if (!isObject$2(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
var DESCRIPTORS$2 = descriptors;
var IE8_DOM_DEFINE = ie8DomDefine;
var anObject$1 = anObject$2;
var toPrimitive = toPrimitive$2;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
objectDefineProperty.f = DESCRIPTORS$2 ? $defineProperty : function defineProperty(O, P, Attributes) {
anObject$1(O);
P = toPrimitive(P, true);
anObject$1(Attributes);
if (IE8_DOM_DEFINE) try {
return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var DESCRIPTORS$1 = descriptors;
var definePropertyModule$1 = objectDefineProperty;
var createPropertyDescriptor = createPropertyDescriptor$2;
var createNonEnumerableProperty$4 = DESCRIPTORS$1 ? function (object, key, value) {
return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var redefine$1 = {exports: {}};
var global$9 = global$b;
var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
var setGlobal$3 = function (key, value) {
try {
createNonEnumerableProperty$3(global$9, key, value);
} catch (error) {
global$9[key] = value;
} return value;
};
var global$8 = global$b;
var setGlobal$2 = setGlobal$3;
var SHARED = '__core-js_shared__';
var store$3 = global$8[SHARED] || setGlobal$2(SHARED, {});
var sharedStore = store$3;
var store$2 = sharedStore;
var functionToString = Function.toString;
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
if (typeof store$2.inspectSource != 'function') {
store$2.inspectSource = function (it) {
return functionToString.call(it);
};
}
var inspectSource$2 = store$2.inspectSource;
var global$7 = global$b;
var inspectSource$1 = inspectSource$2;
var WeakMap$1 = global$7.WeakMap;
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource$1(WeakMap$1));
var shared$2 = {exports: {}};
var store$1 = sharedStore;
(shared$2.exports = function (key, value) {
return store$1[key] || (store$1[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.10.1',
mode: 'global',
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});
var id = 0;
var postfix = Math.random();
var uid$1 = function (key) {
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};
var shared$1 = shared$2.exports;
var uid = uid$1;
var keys = shared$1('keys');
var sharedKey$1 = function (key) {
return keys[key] || (keys[key] = uid(key));
};
var hiddenKeys$3 = {};
var NATIVE_WEAK_MAP = nativeWeakMap;
var global$6 = global$b;
var isObject$1 = isObject$5;
var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
var objectHas = has$6;
var shared = sharedStore;
var sharedKey = sharedKey$1;
var hiddenKeys$2 = hiddenKeys$3;
var WeakMap = global$6.WeakMap;
var set, get, has$4;
var enforce = function (it) {
return has$4(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP) {
var store = shared.state || (shared.state = new WeakMap());
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function (it, metadata) {
metadata.facade = it;
wmset.call(store, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store, it) || {};
};
has$4 = function (it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys$2[STATE] = true;
set = function (it, metadata) {
metadata.facade = it;
createNonEnumerableProperty$2(it, STATE, metadata);
return metadata;
};
get = function (it) {
return objectHas(it, STATE) ? it[STATE] : {};
};
has$4 = function (it) {
return objectHas(it, STATE);
};
}
var internalState = {
set: set,
get: get,
has: has$4,
enforce: enforce,
getterFor: getterFor
};
var global$5 = global$b;
var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
var has$3 = has$6;
var setGlobal$1 = setGlobal$3;
var inspectSource = inspectSource$2;
var InternalStateModule = internalState;
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(String).split('String');
(redefine$1.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
var state;
if (typeof value == 'function') {
if (typeof key == 'string' && !has$3(value, 'name')) {
createNonEnumerableProperty$1(value, 'name', key);
}
state = enforceInternalState(value);
if (!state.source) {
state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
}
if (O === global$5) {
if (simple) O[key] = value;
else setGlobal$1(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else createNonEnumerableProperty$1(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
});
var global$4 = global$b;
var path$1 = global$4;
var path = path$1;
var global$3 = global$b;
var aFunction = function (variable) {
return typeof variable == 'function' ? variable : undefined;
};
var getBuiltIn$1 = function (namespace, method) {
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global$3[namespace])
: path[namespace] && path[namespace][method] || global$3[namespace] && global$3[namespace][method];
};
var objectGetOwnPropertyNames = {};
var ceil = Math.ceil;
var floor = Math.floor;
// `ToInteger` abstract operation
// https://tc39.es/ecma262/#sec-tointeger
var toInteger$2 = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
};
var toInteger$1 = toInteger$2;
var min$1 = Math.min;
// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
var toLength$1 = function (argument) {
return argument > 0 ? min$1(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
var toInteger = toInteger$2;
var max = Math.max;
var min = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
var toAbsoluteIndex$1 = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min(integer, length);
};
var toIndexedObject$1 = toIndexedObject$3;
var toLength = toLength$1;
var toAbsoluteIndex = toAbsoluteIndex$1;
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject$1($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare -- NaN check
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare -- NaN check
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) {
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var arrayIncludes = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: createMethod(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: createMethod(false)
};
var has$2 = has$6;
var toIndexedObject = toIndexedObject$3;
var indexOf = arrayIncludes.indexOf;
var hiddenKeys$1 = hiddenKeys$3;
var objectKeysInternal = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has$2(hiddenKeys$1, key) && has$2(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has$2(O, key = names[i++])) {
~indexOf(result, key) || result.push(key);
}
return result;
};
// IE8- don't enum bug keys
var enumBugKeys$1 = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
var internalObjectKeys = objectKeysInternal;
var enumBugKeys = enumBugKeys$1;
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
var objectGetOwnPropertySymbols = {};
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
var getBuiltIn = getBuiltIn$1;
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
var anObject = anObject$2;
// all object keys, includes non-enumerable and symbols
var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
var has$1 = has$6;
var ownKeys = ownKeys$1;
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
var definePropertyModule = objectDefineProperty;
var copyConstructorProperties$2 = function (target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
var fails = fails$4;
var replacement = /#|\.prototype\./;
var isForced$1 = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails(detection)
: !!detection;
};
var normalize = isForced$1.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced$1.data = {};
var NATIVE = isForced$1.NATIVE = 'N';
var POLYFILL = isForced$1.POLYFILL = 'P';
var isForced_1 = isForced$1;
var global$2 = global$b;
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
var createNonEnumerableProperty = createNonEnumerableProperty$4;
var redefine = redefine$1.exports;
var setGlobal = setGlobal$3;
var copyConstructorProperties$1 = copyConstructorProperties$2;
var isForced = isForced_1;
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
var _export = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global$2;
} else if (STATIC) {
target = global$2[TARGET] || setGlobal(TARGET, {});
} else {
target = (global$2[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties$1(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
var $ = _export;
var DESCRIPTORS = descriptors;
var global$1 = global$b;
var has = has$6;
var isObject = isObject$5;
var defineProperty = objectDefineProperty.f;
var copyConstructorProperties = copyConstructorProperties$2;
var NativeSymbol = global$1.Symbol;
if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
// Safari 12 bug
NativeSymbol().description !== undefined
)) {
var EmptyStringDescriptionStore = {};
// wrap Symbol constructor for correct work with undefined description
var SymbolWrapper = function Symbol() {
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
var result = this instanceof SymbolWrapper
? new NativeSymbol(description)
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
: description === undefined ? NativeSymbol() : NativeSymbol(description);
if (description === '') EmptyStringDescriptionStore[result] = true;
return result;
};
copyConstructorProperties(SymbolWrapper, NativeSymbol);
var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
symbolPrototype.constructor = SymbolWrapper;
var symbolToString = symbolPrototype.toString;
var native = String(NativeSymbol('test')) == 'Symbol(test)';
var regexp = /^Symbol\((.*)\)[^)]+$/;
defineProperty(symbolPrototype, 'description', {
configurable: true,
get: function description() {
var symbol = isObject(this) ? this.valueOf() : this;
var string = symbolToString.call(symbol);
if (has(EmptyStringDescriptionStore, symbol)) return '';
var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
return desc === '' ? undefined : desc;
}
});
$({ global: true, forced: true }, {
Symbol: SymbolWrapper
});
}
function PasswordResetForm(_a) {
var title = _a.title,
subtitle = _a.subtitle,
buttonText = _a.buttonText,
props = __rest(_a, ["title", "subtitle", "buttonText"]);
var tokens = theme.useTokens("Login", props.tokens);
return /*#__PURE__*/React__default["default"].createElement(formik.Form, null, /*#__PURE__*/React__default["default"].createElement(formElements.FormLayout.Section, null, /*#__PURE__*/React__default["default"].createElement("div", {
className: tokens.passwordResetForm.master
}, /*#__PURE__*/React__default["default"].createElement("h1", {
className: tokens.passwordResetForm.headerContainer
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: title || "login.labels.resetPasswordTitle"
})), /*#__PURE__*/React__default["default"].createElement("p", {
className: tokens.passwordResetForm.description
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: subtitle || "login.labels.forgottenPasswordDescription"
})), /*#__PURE__*/React__default["default"].createElement(formikElements.PasswordInputField, {
name: "newPassword",
label: /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: "login.labels.newPassword"
}),
className: tokens.passwordResetForm.inputSpacing,
autoFocus: true,
required: true
}), /*#__PURE__*/React__default["default"].createElement(formikElements.PasswordInputField, {
name: "repeatPassword",
label: /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: "login.labels.newPasswordRepeat"
}),
className: tokens.passwordResetForm.inputSpacing,
required: true
}), /*#__PURE__*/React__default["default"].createElement(core.Button, {
"data-testid": "submit",
className: tokens.passwordResetForm.resetButton.master + " " + tokens.passwordResetForm.resetButton.margin,
variant: "filled",
type: "submit"
}, /*#__PURE__*/React__default["default"].createElement(intl.Intl, {
name: buttonText || "login.labels.resetPassword"
})))));
}
var patternsDictionaryInternal = {
messages: {},
translations: {
hr: {
"login.labels.header": "Prijavi se",
"login.labels.email": "E-pošta",
"login.labels.username": "Korisničko ime",
"login.labels.password": "Lozinka",
"login.labels.rememberMe": "Zapamti me",
"login.labels.login": "Prijava",
"login.labels.forgotPassword": "Zaboravili ste lozinku?",
"login.labels.forgottenPassword": "Zaboravljena lozinka?",
"login.labels.forgottenPasswordDescription": "Unesite adresu e-pošte povezanu s vašim računom i poslat ćemo vam poveznicu za resetiranje lozinke.",
"login.labels.sendEmail": "Pošalji e-poštu",
"login.labels.backToLogin": "Povratak na prijavu",
"login.labels.checkEmailNotification": "Molimo provjerite svoju e-poštu i kliknite na ponuđenu poveznicu za resetiranje lozinke.",
"login.labels.resetPasswordTitle": "Resetiraj lozinku",
"login.labels.resetPassword": "Resetiraj lozinku",
"login.labels.resetPasswordDescription": "Vaša nova lozinka mora se razlikovati od prethodno korištenih lozinki. Lozinka mora sadržavati najmanje 8 znakova, jedno veliko slovo, jedan broj i jedan poseban znak.",
"login.labels.newPassword": "Nova lozinka",
"login.labels.newPasswordRepeat": "Ponovite lozinku",
"login.labels.passwordChangeNotification": "Vaša lozinka je uspješno promijenjena.",
"login.validation.passwordValidation.newPassword.required": "Polje unosa nove lozinke je obavezno.",
"login.validation.passwordValidation.newPassword.regex": "Lozinka mora sadržavati najmanje 8 znakova, jedno veliko slovo, jedan broj i jedan poseban znak.",
"login.validation.passwordValidation.repeatPassword.required": "Polje ponavljanja zaporke je obavezno.",
"login.validation.passwordValidation.repeatPassword.oneOf": "Lozinke moraju biti jednake.",
"login.validation.emailValidation.email.validity": "E-pošta mora biti valjana.",
"login.validation.emailValidation.email.required": "E-pošta je obavezno polje.",
"login.validation.loginValidation.username.required": "Korisničko ime je obavezno polje.",
"login.validation.loginValidation.password.required": "Lozinka je obavezno polje.",
"login.validation.loginEmailValidation.email.required": "E-pošta je obavezno polje.",
"login.validation.loginEmailValidation.password.required": "Lozinka je obavezno polje."
},
en: {
"login.labels.header": "Login Here",
"login.labels.email": "Email",
"login.labels.username": "Username",
"login.labels.password": "Password",
"login.labels.rememberMe": "Remember Me",
"login.labels.login": "Log In",
"login.labels.forgotPassword": "Forgot Password?",
"login.labels.forgottenPassword": "Forgotten Password?",
"login.labels.forgottenPasswordDescription": "Enter the email address associated with your account and we will send you a link to reset your password.",
"login.labels.sendEmail": "Send Email",
"login.labels.backToLogin": "Back to Login",
"login.labels.checkEmailNotification": "Please check your email and click on the provided link to reset your password.",
"login.labels.resetPasswordTitle": "Reset Password",
"login.labels.resetPassword": "Reset Password",
"login.labels.resetPasswordDescription": "Your new password must be different from previous used passwords. Password must contain at least 8 characters, one uppercase, one number and one special character.",
"login.labels.newPassword": "New Password",
"login.labels.newPasswordRepeat": "Repeat Password",
"login.labels.passwordChangeNotification": "Your password has been successfully changed.",
"login.validation.passwordValidation.newPassword.required": "New Password field is required.",
"login.validation.passwordValidation.newPassword.regex": "Password must contain at least 8 characters, one upppercase, one number and one special character.",
"login.validation.passwordValidation.repeatPassword.required": "Repeat Password field is required.",
"login.validation.passwordValidation.repeatPassword.oneOf": "Passwords must match.",
"login.validation.emailValidation.email.validity": "Email must be valid.",
"login.validation.emailValidation.email.required": "Email field is required.",
"login.validation.loginValidation.username.required": "Username field is required.",
"login.validation.loginValidation.password.required": "Password field is required.",
"login.validation.loginEmailValidation.email.required": "Email field is required.",
"login.validation.loginEmailValidation.password.required": "Password field is required."
}
}
};
/*
* Copyright 2025 CROZ d.o.o, the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var EmailValidationSchema = EmailValidationSchema$1;
var PasswordValidationSchema = PasswordValidationSchema$1;
var patternsDictionary = patternsDictionaryInternal;
exports.EmailForm = EmailForm;
exports.EmailValidationSchema = EmailValidationSchema;
exports.ForgottenPassword = ForgottenPassword;
exports.Login = Login;
exports.PasswordResetForm = PasswordResetForm;
exports.PasswordValidationSchema = PasswordValidationSchema;
exports.patternsDictionary = patternsDictionary;
Object.defineProperty(exports, '__esModule', { value: true });
}));