react-input-material 0.0.354 → 0.0.355
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.
- package/components/Dummy.d.ts +9 -5
- package/components/Dummy.tsx +9 -4
- package/components/FileInput.d.ts +3 -2
- package/components/FileInput.js +1 -1
- package/components/FileInput.module.css +1 -1
- package/components/FileInput.styles.css +2 -2
- package/components/FileInput.tsx +221 -187
- package/components/GenericAnimate.d.ts +3 -0
- package/components/GenericAnimate.module.css +3 -3
- package/components/GenericAnimate.styles.css +1 -1
- package/components/GenericAnimate.tsx +17 -10
- package/components/GenericInput.d.ts +26 -2
- package/components/GenericInput.js +1 -1
- package/components/GenericInput.styles.css +1 -1
- package/components/GenericInput.tsx +470 -347
- package/components/Inputs.d.ts +3 -3
- package/components/Inputs.js +1 -1
- package/components/Inputs.module.css +2 -2
- package/components/Inputs.styles.css +2 -2
- package/components/Inputs.tsx +20 -21
- package/components/Interval.d.ts +4 -6
- package/components/Interval.js +1 -1
- package/components/Interval.module.css +1 -1
- package/components/Interval.styles.css +2 -2
- package/components/Interval.tsx +7 -13
- package/components/RequireableCheckbox.d.ts +10 -3
- package/components/RequireableCheckbox.js +1 -1
- package/components/RequireableCheckbox.tsx +66 -51
- package/components/WrapConfigurations.d.ts +13 -0
- package/components/WrapConfigurations.tsx +17 -5
- package/components/WrapStrict.d.ts +6 -0
- package/components/WrapStrict.tsx +7 -0
- package/components/WrapThemeProvider.d.ts +7 -5
- package/components/WrapThemeProvider.tsx +8 -5
- package/components/WrapTooltip.d.ts +4 -2
- package/components/WrapTooltip.tsx +14 -6
- package/helper.d.ts +39 -9
- package/helper.js +1 -1
- package/index.js +1 -1
- package/index.styles.css +6 -6
- package/package.json +1 -1
- package/type.d.ts +42 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("@rmwc/checkbox"),require("@rmwc/theme"),require("@rmwc/tooltip"),require("@rmwc/typography"),require("clientnode"),require("clientnode/property-types"),require("react"),require("react/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/extends","@babel/runtime/helpers/objectWithoutPropertiesLoose","@rmwc/checkbox","@rmwc/theme","@rmwc/tooltip","@rmwc/typography","clientnode","clientnode/property-types","react","react/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("@rmwc/checkbox"),require("@rmwc/theme"),require("@rmwc/tooltip"),require("@rmwc/typography"),require("clientnode"),require("clientnode/property-types"),require("react"),require("react/jsx-runtime")):t(e["@babel/runtime/helpers/extends"],e["@babel/runtime/helpers/objectWithoutPropertiesLoose"],e["@rmwc/checkbox"],e["@rmwc/theme"],e["@rmwc/tooltip"],e["@rmwc/typography"],e.clientnode,e["clientnode/property-types"],e.react,e["react/jsx-runtime"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,(function(e,t,n,r,o,i,a,c,l,d){return function(){"use strict";var u=[function(e){e.exports=d},function(t){t.exports=e},function(e){e.exports=l},function(e){e.exports=a},function(e){e.exports=r},function(e){e.exports=c},function(e,t,n){n.d(t,{WrapTooltip:function(){return l}});var r=n(1),o=n.n(r),i=n(9),a=n(11),c=n(0),l=function(e){var t=e.children,n=e.options;return"string"==typeof n?(0,c.jsx)(a.Tooltip,{content:(0,c.jsx)(i.Typography,{use:"caption",children:n}),children:(0,c.jsx)("div",{className:"generic-tooltip",children:t})}):null!==n&&"object"==typeof n?("string"==typeof n.content&&(n=o()({},n,{content:(0,c.jsx)(i.Typography,{use:"caption",children:n.content})})),(0,c.jsx)(a.Tooltip,o()({},n,{children:(0,c.jsx)("div",{className:"generic-tooltip",children:t})}))):(0,c.jsx)(c.Fragment,{children:t})}},function(e,t,n){n.d(t,{WrapConfigurations:function(){return c}});n(1),n(13),n(2),n(4);var r=n(12),o=n(10),i=n(6),a=n(0),c=function(e){var t=e.children,n=e.strict,c=e.themeConfiguration,l=e.tooltip,d=e.wrap;return(0,a.jsx)(r.x,{strict:Boolean(n),children:(0,a.jsx)(i.WrapTooltip,{options:l,children:(0,a.jsx)(o.WrapThemeProvider,{configuration:c,wrap:d,children:t})})})}},function(e,t,n){n.d(t,{deriveMissingPropertiesFromState:function(){return u},wrapStateSetter:function(){return m},triggerCallbackIfExists:function(){return s},translateKnownSymbols:function(){return p},determineInitialValue:function(){return f},determineValidationState:function(){return b},mapPropertiesIntoModel:function(){return h},getConsolidatedProperties:function(){return y}});var r=n(1),o=n.n(r),i=n(3),a=n.n(i),c=n(5);n(2);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(e,t){for(var n in void 0!==e.model.value&&void 0===e.value&&(e.value=e.model.value),void 0===e.value&&(e.value=t.value),e.model.state?e.model.state=o()({},e.model.state):e.model.state={},t.modelState)Object.prototype.hasOwnProperty.call(t.modelState,n)&&void 0===e.model.state[n]&&(e.model.state[n]=t.modelState[n]);return e},m=function(e,t){return function(n){var r="function"==typeof n?n(t):n;a().equals(null==r?void 0:r.modelState,null==t?void 0:t.modelState)||e(r)}},s=function(e,t,n){void 0===n&&(n=!0);for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];t="on"+a().stringCapitalize(t),e[t]&&(n?e[t].apply(e,o):a().timeout((function(){return e[t].apply(e,o)})))},p=function(e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0],l=o[1];l===c.UndefinedSymbol?t[i]=void 0:l===c.NullSymbol?t[i]=null:t[i]=a().copy(e[i])}return t},f=function(e,t,n){var r,o;return void 0!==n?n:void 0!==e.value?e.value:void 0!==(null==(r=e.model)?void 0:r.value)?e.model.value:void 0!==e.initialValue?a().copy(e.initialValue):void 0!==e.default?a().copy(e.default):void 0!==(null==(o=e.model)?void 0:o.default)?a().copy(e.model.default):void 0!==t?t:null},b=function(e,t,n){void 0===n&&(n={});var r=!1;n=o()({invalidRequired:function(){return!1===e.model.nullable&&"boolean"!==e.model.type&&!e.model.value&&0!==e.model.value||"boolean"===e.model.type&&!("boolean"==typeof e.model.value||["false","true"].includes(e.model.value))}},n),e.model.state=e.model.state||{};for(var i=0,a=Object.entries(n);i<a.length;i++){var c=a[i],l=c[0],d=c[1],u=t[l];e.model.state[l]=d(),r=r||u!==t[l]}return r&&(e.model.state.invalid=Object.keys(n).some((function(t){return e.model.state[t]})),e.model.state.valid=!e.model.state.invalid),r},h=function(e,t){var n=a().extend(!0,{model:a().copy(t)},e);n.disabled&&(n.model.mutable=!1,delete n.disabled),n.invertedPattern&&(n.model.invertedRegularExpressionPattern=n.invertedPattern,delete n.invertedPattern),n.pattern&&(n.model.regularExpressionPattern=n.pattern,delete n.pattern),n.required&&(n.model.nullable=!1,delete n.required),"text"===n.type&&(n.type="string");for(var r,o=l(Object.keys(n.model).concat("value"));!(r=o()).done;){var i=r.value;Object.prototype.hasOwnProperty.call(n,i)&&void 0!==n[i]&&(n.model[i]=n[i])}for(var c in n.model.state)Object.prototype.hasOwnProperty.call(n,c)&&void 0!==n[c]&&(n.model.state[c]=n[c]);return void 0===n.model.value&&(n.model.value=a().copy(n.model.default)),n},y=function(e){var t=o()({},e,e.model||{},(e.model||{}).state||{});return t.disabled=!(t.mutable&&t.writable),delete t.mutable,delete t.writable,delete t.state,t.required=!t.nullable,delete t.nullable,t.invertedRegularExpressionPattern&&(t.invertedPattern=t.invertedRegularExpressionPattern),delete t.invertedRegularExpressionPattern,t.regularExpressionPattern&&(t.pattern=t.regularExpressionPattern),delete t.regularExpressionPattern,t}},function(e){e.exports=i},function(e,t,n){n.d(t,{WrapThemeProvider:function(){return i}});var r=n(4),o=n(0),i=function(e){var t=e.children,n=e.configuration,i=e.wrap;return n?(0,o.jsx)(r.ThemeProvider,{options:n,wrap:!1!==i,children:t}):t}},function(e){e.exports=o},function(e,t,n){n.d(t,{x:function(){return i}});var r=n(2),o=n(0),i=function(e){var t=e.children;return e.strict?(0,o.jsx)(r.StrictMode,{children:t}):(0,o.jsx)(o.Fragment,{children:t})}},function(e){e.exports=t},,,,,,,,,,,,,,,,function(e,t,n){n.d(t,{cN:function(){return s},by:function(){return b},uG:function(){return y}});var r=n(1),o=n.n(r),i=n(3),a=n.n(i),c=n(5),l={declaration:c.string,default:c.any,description:c.string,name:c.string,selection:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.number,c.string])),(0,c.objectOf)((0,c.oneOfType)([c.number,c.string]))]),type:c.string,value:c.any},d={dirty:(0,c.oneOfType)([c.boolean,c.symbol]),focused:(0,c.oneOfType)([c.boolean,c.symbol]),invalid:(0,c.oneOfType)([c.boolean,c.symbol]),invalidRequired:(0,c.oneOfType)([c.boolean,c.symbol]),pristine:(0,c.oneOfType)([c.boolean,c.symbol]),touched:(0,c.oneOfType)([c.boolean,c.symbol]),untouched:(0,c.oneOfType)([c.boolean,c.symbol]),valid:(0,c.oneOfType)([c.boolean,c.symbol]),visited:(0,c.oneOfType)([c.boolean,c.symbol])},u=o()({},l,{emptyEqualsNull:c.boolean,invertedRegularExpressionPattern:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),maximum:(0,c.oneOfType)([c.number,c.string]),maximumLength:c.number,minimum:(0,c.oneOfType)([c.number,c.string]),minimumLength:c.number,mutable:c.boolean,state:(0,c.shape)(d),writable:c.boolean,regularExpressionPattern:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),trim:c.boolean}),m=o()({},l,d,{className:c.string,disabled:c.boolean,enforceUncontrolled:c.boolean,initialValue:c.any,model:(0,c.shape)(u),onChange:c.func,onChangeValue:c.func,onChangeShowDeclaration:c.func,onChangeState:c.func,onClick:c.func,onFocus:c.func,onTouch:c.func,required:c.boolean,requiredText:c.string,ripple:(0,c.oneOfType)([c.boolean,c.object]),showDeclaration:(0,c.oneOfType)([c.boolean,c.symbol]),showInitialValidationState:c.boolean,styles:c.object,themeConfiguration:c.object,tooltip:c.any}),s={dirty:!1,focused:!1,invalid:!1,invalidRequired:!1,pristine:!0,touched:!1,untouched:!0,valid:!0,visited:!1},p={declaration:"",default:null,description:"",emptyEqualsNull:!0,invertedRegularExpressionPattern:null,maximum:1/0,maximumLength:-1,minimum:-1/0,minimumLength:0,mutable:!0,name:"NO_NAME_DEFINED",nullable:!0,regularExpressionPattern:null,state:o()({},s),trim:!0,type:"string",writable:!0},f={enforceUncontrolled:!1,model:o()({},p),showDeclaration:void 0,showInitialValidationState:!1,requiredText:"Please fill this field."},b=o()({},m,d,{checked:c.boolean,id:c.string}),h=o()({},p,{default:!1,type:"boolean",value:!1}),y=o()({},f,{default:!1,model:o()({},h),requiredText:"Please check this field."}),v=o()({},d,{invalidMaximum:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimum:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMaximumLength:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimumLength:(0,c.oneOfType)([c.boolean,c.symbol]),invalidInvertedPattern:(0,c.oneOfType)([c.boolean,c.symbol]),invalidPattern:(0,c.oneOfType)([c.boolean,c.symbol])}),x=o()({},m,v,{align:c.string,children:c.func,cursor:(0,c.oneOfType)([(0,c.shape)({end:c.number.isRequired,start:c.number.isRequired}),c.symbol]),editor:c.string,editorIsActive:(0,c.oneOfType)([c.boolean,c.symbol]),fullWidth:c.boolean,hidden:(0,c.oneOfType)([c.boolean,c.symbol]),icon:(0,c.oneOfType)([c.string,c.object]),invertedPatternText:c.string,labels:(0,c.oneOfType)([(0,c.arrayOf)(c.string),c.object]),maximum:(0,c.oneOfType)([c.number,c.string]),maximumLengthText:c.string,maximumText:c.string,minimum:(0,c.oneOfType)([c.number,c.string]),minimumLengthText:c.string,minimumText:c.string,onBlur:c.func,onChangeEditorIsActive:c.func,onKeyDown:c.func,onKeyUp:c.func,onSelect:c.func,onSelectionChange:c.func,outlined:c.boolean,patternText:c.string,placeholder:c.string,representation:(0,c.oneOfType)([c.string,c.symbol]),rows:c.number,searchSelection:c.boolean,selectableEditor:c.boolean,step:c.number,suggestionCreator:c.func,suggestSelection:c.boolean,trailingIcon:c.any,transformer:c.object}),g=o()({},s,{invalidMaximum:!1,invalidMinimum:!1,invalidMaximumLength:!1,invalidMinimumLength:!1,invalidInvertedPattern:!1,invalidPattern:!1}),k=o()({},p,{state:g}),T=o()({},f,{cursor:{end:0,start:0},editor:"plain",invertedPatternText:'Your string should not match the regular expression${[].concat(invertedPattern).length > 1 ? "s" : ""}: "${[].concat(invertedPattern).join("\\", \\"")}".',maximumLengthText:"Please type less or equal than ${maximumLength} symbols.",maximumText:"Please type less or equal than ${formatValue(maximum)}.",minimumLengthText:"Please type at least or equal ${minimumLength} symbols.",minimumText:"Please type at least or equal ${formatValue(minimum)}.",model:o()({},k),patternText:'Your string have to match the regular expression${[].concat(pattern).length > 1 ? "s" : ""}: "${[].concat(pattern).join("\\", \\"")}".',rows:4,searchSelection:!1,selectableEditor:!1,step:1,suggestSelection:!1}),P=o()({},d,{invalidMaximumSize:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimumSize:(0,c.oneOfType)([c.boolean,c.symbol]),invalidContentTypePattern:(0,c.oneOfType)([c.boolean,c.symbol]),invalidName:(0,c.oneOfType)([c.boolean,c.symbol])}),O=(o()({},m,P,{children:c.func,contentTypePatternText:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),deleteButton:(0,c.oneOfType)([c.object,c.string]),downloadButton:(0,c.oneOfType)([c.object,c.string]),editButton:(0,c.oneOfType)([c.object,c.string]),encoding:c.string,generateFileNameInputProperties:c.func,invertedContentTypePatternText:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),maximumSizeText:c.string,minimumSizeText:c.string,newButton:(0,c.oneOfType)([c.object,c.string]),onBlur:c.func,outlined:c.boolean}),o()({},s,{invalidMaximumSize:!1,invalidMinimumSize:!1,invalidContentTypePattern:!1,invalidName:!1})),S=o()({},p,{contentTypeRegularExpressionPattern:/^.+\/.+$/,fileName:o()({},k,{maximumLength:1024,name:"Name",regularExpressionPattern:/^[^\/]+$/}),invertedContentTypeRegularExpressionPattern:null,maximumSize:1/0,minimumSize:0,state:O});delete o()({},T,{emptyEqualsNull:!1,invertedPatternText:'Your file\'s name should not match the regular expression${[].concat(invertedPattern).length > 1 ? "s" : ""}: ""${[].concat(invertedPattern).join("\\", \\"")}".',patternText:'Your file\'s name has to match the regular expression${[].concat(pattern).length > 1 ? "s" : ""}: ""${[].concat(pattern).join("\\", \\"")}".',required:!0}).model;o()({},f,{contentTypePatternText:'Your file\'s mime-type has to match the regular expression${[].concat(contentTypePattern).length > 1 ? "s" : ""}: ""${[].concat(contentTypePattern).join("\\", \\"")}".',deleteButton:"delete",downloadButton:"download",editButton:"edit",encoding:"utf-8",generateFileNameInputProperties:a().identity,invertedContentTypePatternText:'Your file\'s mime-type should not match the regular expression${[].concat(invertedContentTypePattern).length > 1 ? "s" : ""}: ""${[].concat(invertedContentTypePattern).join("\\", \\"")}".',maximumSizeText:"Please provide a file with less or equal size than ${maximumSize} byte.",media:{sixteenByNine:!0},minimumSizeText:"Please provide a file with more or equal size than ${maximumSize} byte.",model:o()({},S),newButton:"new",sourceToBlobOptions:{endings:"transparent",type:"text/plain"}}),o()({},m,v,{children:c.func,createPrototype:c.func,maximumNumber:c.number,minimumNumber:c.number});var j=o()({},p,{state:o()({},p.state,{invalidMaximumNumber:!1,invalidMinimumNumber:!1}),maximumNumber:1/0,minimumNumber:0,type:"string[]"});o()({},f,{addIcon:{icon:"add"},createPrototype:function(e){return e.prototype},model:o()({},j),removeIcon:{icon:"clear"}}),o()({},x,{value:(0,c.shape)({end:(0,c.oneOfType)([c.number,(0,c.shape)(x)]),start:(0,c.oneOfType)([c.number,(0,c.shape)(x)])})}),o()({},s),o()({},k,{description:"End",name:"end"}),o()({},k,{description:"Start",name:"start"})},,,,,,,,function(e){e.exports=n}],m={};function s(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return u[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return function(){s.r(p),s.d(p,{RequireableCheckbox:function(){return h},RequireableCheckboxInner:function(){return b},default:function(){return y},determineValidationState:function(){return f}});var e=s(1),t=s.n(e),n=s(3),r=s.n(n),o=s(2),i=s(37),a=s(4),c={"mdc-touch-target-wrapper":"mdc-touch-target-wrapper","mdc-checkbox":"mdc-checkbox","mdc-checkbox__native-control":"mdc-checkbox__native-control","mdc-checkbox__background":"mdc-checkbox__background","mdc-checkbox--selected":"mdc-checkbox--selected","mdc-checkbox__ripple":"mdc-checkbox__ripple","mdc-ripple-upgraded--background-focused":"mdc-ripple-upgraded--background-focused","mdc-ripple-upgraded":"mdc-ripple-upgraded","mdc-checkbox--anim-unchecked-checked":"mdc-checkbox--anim-unchecked-checked","mdc-checkbox--anim-unchecked-indeterminate":"mdc-checkbox--anim-unchecked-indeterminate","mdc-checkbox-fade-in-background-8A000000secondary00000000secondary":"mdc-checkbox-fade-in-background-8A000000secondary00000000secondary","mdc-checkbox--anim-checked-unchecked":"mdc-checkbox--anim-checked-unchecked","mdc-checkbox--anim-indeterminate-unchecked":"mdc-checkbox--anim-indeterminate-unchecked","mdc-checkbox-fade-out-background-8A000000secondary00000000secondary":"mdc-checkbox-fade-out-background-8A000000secondary00000000secondary","mdc-checkbox__checkmark":"mdc-checkbox__checkmark","mdc-checkbox__mixedmark":"mdc-checkbox__mixedmark","mdc-checkbox--disabled":"mdc-checkbox--disabled","mdc-checkbox--upgraded":"mdc-checkbox--upgraded","mdc-checkbox__checkmark-path":"mdc-checkbox__checkmark-path","mdc-checkbox-unchecked-checked-checkmark-path":"mdc-checkbox-unchecked-checked-checkmark-path","mdc-checkbox-unchecked-indeterminate-mixedmark":"mdc-checkbox-unchecked-indeterminate-mixedmark","mdc-checkbox-checked-unchecked-checkmark-path":"mdc-checkbox-checked-unchecked-checkmark-path","mdc-checkbox--anim-checked-indeterminate":"mdc-checkbox--anim-checked-indeterminate","mdc-checkbox-checked-indeterminate-checkmark":"mdc-checkbox-checked-indeterminate-checkmark","mdc-checkbox-checked-indeterminate-mixedmark":"mdc-checkbox-checked-indeterminate-mixedmark","mdc-checkbox--anim-indeterminate-checked":"mdc-checkbox--anim-indeterminate-checked","mdc-checkbox-indeterminate-checked-checkmark":"mdc-checkbox-indeterminate-checked-checkmark","mdc-checkbox-indeterminate-checked-mixedmark":"mdc-checkbox-indeterminate-checked-mixedmark","mdc-checkbox-indeterminate-unchecked-mixedmark":"mdc-checkbox-indeterminate-unchecked-mixedmark","mdc-checkbox--touch":"mdc-checkbox--touch","mdc-ripple-upgraded--unbounded":"mdc-ripple-upgraded--unbounded","mdc-ripple-upgraded--foreground-activation":"mdc-ripple-upgraded--foreground-activation","mdc-ripple-fg-radius-in":"mdc-ripple-fg-radius-in","mdc-ripple-fg-opacity-in":"mdc-ripple-fg-opacity-in","mdc-ripple-upgraded--foreground-deactivation":"mdc-ripple-upgraded--foreground-deactivation","mdc-ripple-fg-opacity-out":"mdc-ripple-fg-opacity-out","mdc-form-field":"mdc-form-field","mdc-form-field--align-end":"mdc-form-field--align-end","mdc-ripple-surface":"mdc-ripple-surface","mdc-ripple-surface--primary":"mdc-ripple-surface--primary","mdc-ripple-surface--accent":"mdc-ripple-surface--accent","requireable-checkbox":"requireable-checkbox"},l=s(7),d=s(8),u=s(29),m=s(0);function f(e,t){return(0,d.determineValidationState)(e,t,{invalidRequired:function(){return!1===e.model.nullable&&!e.model.value}})}var b=function(e,n){var u,s,p=function(e){var t=(0,d.mapPropertiesIntoModel)(e,h.defaultProperties.model);return f(t,t.model.state),(t=(0,d.getConsolidatedProperties)(t)).checked=Boolean(t.value),t},b=function(e){r().extend(!0,w,p(w)),(0,d.triggerCallbackIfExists)(w,"change",j,w,e)},y=function(e){return S((function(n){var r=!1;n.modelState.focused||(w.focused=!0,r=!0),n.modelState.untouched&&(w.touched=!0,w.untouched=!1,r=!0);var o=n;return r&&(b(e),o=t()({},n,{modelState:w.model.state}),(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),(0,d.triggerCallbackIfExists)(w,"touch",j,e,w),o}))},v=(0,o.useRef)(null),x=(0,o.useRef)(null),g=(0,d.translateKnownSymbols)(e),k=(0,d.determineInitialValue)(g,h.defaultProperties.model.default,g.checked),T=r().extend(!0,r().copy(h.defaultProperties),g),P=(0,o.useState)({modelState:t()({},h.defaultModelState),value:k}),O=P[0],S=P[1],j=!T.enforceUncontrolled&&(void 0!==(null==(u=g.model)?void 0:u.value)||void 0!==g.value)&&Boolean(g.onChange||g.onChangeValue);(0,d.deriveMissingPropertiesFromState)(T,O);var w=p(T),q={modelState:w.model.state,value:w.value};return(j||w.value===O.value)&&r().equals(w.model.state,O.modelState)||S(q),j&&(S=(0,d.wrapStateSetter)(S,q)),(0,o.useImperativeHandle)(n,(function(){return{properties:w,references:{foundationRef:x,inputReference:v},state:t()({modelState:w.model.state},j?{}:{value:w.value})}})),(0,m.jsx)(l.WrapConfigurations,{strict:h.strict,themeConfiguration:w.themeConfiguration,tooltip:w.tooltip,children:(0,m.jsx)("div",{className:[c["requireable-checkbox"]].concat(null!==(s=w.className)&&void 0!==s?s:[]).join(" "),style:w.styles,children:(0,m.jsx)(i.Checkbox,{checked:Boolean(w.value),disabled:w.disabled,foundationRef:x,id:w.id||w.name,indeterminate:null===w.value,inputRef:v,label:w.invalid&&(w.showInitialValidationState||w.visited)?(0,m.jsx)(a.Theme,{use:"error",children:w.description||w.name}):w.description||w.name,name:w.name,onBlur:function(e){return S((function(n){var r=!1;return n.modelState.focused&&(w.focused=!1,r=!0),n.modelState.visited||(w.visited=!0,r=!0),r&&(b(e),(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),(0,d.triggerCallbackIfExists)(w,"blur",j,e,w),r?t()({},n,{modelState:w.model.state}):n}))},onChange:function(e){w.model.mutable&&w.model.writable&&(w.value=Boolean(e.target.checked),S((function(n){if(n.value===w.value)return n;var r=!1,o=t()({},n,{value:w.value});return n.modelState.pristine&&(w.dirty=!0,w.pristine=!1,r=!0),b(e),f(w,n.modelState)&&(r=!0),(0,d.triggerCallbackIfExists)(w,"changeValue",j,w.value,e,w),r&&(o.modelState=w.model.state,(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),o})))},onClick:function(e){(0,d.triggerCallbackIfExists)(w,"click",j,e,w),y(e)},onFocus:function(e){(0,d.triggerCallbackIfExists)(w,"focus",j,e,w),y(e)},ripple:w.ripple,value:""+w.value})})})};b.displayName="RequireableCheckbox";var h=(0,o.memo)((0,o.forwardRef)(b));h.wrapped=b,h.webComponentAdapterWrapped="react",h.defaultModelState=u.cN,h.defaultProperties=t()({},u.uG,{model:t()({},u.uG.model,{state:void 0,value:void 0}),value:void 0}),h.propTypes=u.by,h.strict=!1;var y=h}(),p}()}));
|
|
1
|
+
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("@rmwc/checkbox"),require("@rmwc/theme"),require("@rmwc/tooltip"),require("@rmwc/typography"),require("clientnode"),require("clientnode/property-types"),require("react"),require("react/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/extends","@babel/runtime/helpers/objectWithoutPropertiesLoose","@rmwc/checkbox","@rmwc/theme","@rmwc/tooltip","@rmwc/typography","clientnode","clientnode/property-types","react","react/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("@rmwc/checkbox"),require("@rmwc/theme"),require("@rmwc/tooltip"),require("@rmwc/typography"),require("clientnode"),require("clientnode/property-types"),require("react"),require("react/jsx-runtime")):t(e["@babel/runtime/helpers/extends"],e["@babel/runtime/helpers/objectWithoutPropertiesLoose"],e["@rmwc/checkbox"],e["@rmwc/theme"],e["@rmwc/tooltip"],e["@rmwc/typography"],e.clientnode,e["clientnode/property-types"],e.react,e["react/jsx-runtime"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,(function(e,t,n,r,o,i,a,c,l,d){return function(){"use strict";var u=[function(e){e.exports=d},function(t){t.exports=e},function(e){e.exports=l},function(e){e.exports=a},function(e){e.exports=r},function(e){e.exports=c},function(e,t,n){n.d(t,{WrapTooltip:function(){return l}});var r=n(1),o=n.n(r),i=n(9),a=n(11),c=n(0),l=function(e){var t=e.children,n=e.options;return"string"==typeof n?(0,c.jsx)(a.Tooltip,{content:(0,c.jsx)(i.Typography,{use:"caption",children:n}),children:(0,c.jsx)("div",{className:"generic-tooltip",children:t})}):null!==n&&"object"==typeof n?("string"==typeof n.content&&(n=o()({},n,{content:(0,c.jsx)(i.Typography,{use:"caption",children:n.content})})),(0,c.jsx)(a.Tooltip,o()({},n,{children:(0,c.jsx)("div",{className:"generic-tooltip",children:t})}))):(0,c.jsx)(c.Fragment,{children:t})}},function(e,t,n){n.d(t,{WrapConfigurations:function(){return c}});n(1),n(13),n(2),n(4);var r=n(12),o=n(10),i=n(6),a=n(0),c=function(e){var t=e.children,n=e.strict,c=e.themeConfiguration,l=e.tooltip,d=e.wrap;return(0,a.jsx)(r.x,{strict:Boolean(n),children:(0,a.jsx)(i.WrapTooltip,{options:l,children:(0,a.jsx)(o.WrapThemeProvider,{configuration:c,wrap:d,children:t})})})}},function(e,t,n){n.d(t,{deriveMissingPropertiesFromState:function(){return u},wrapStateSetter:function(){return m},triggerCallbackIfExists:function(){return s},translateKnownSymbols:function(){return p},determineInitialValue:function(){return f},determineValidationState:function(){return b},mapPropertiesIntoModel:function(){return h},getConsolidatedProperties:function(){return y}});var r=n(1),o=n.n(r),i=n(3),a=n.n(i),c=n(5);n(2);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(e,t){for(var n in void 0!==e.model.value&&void 0===e.value&&(e.value=e.model.value),void 0===e.value&&(e.value=t.value),e.model.state?e.model.state=o()({},e.model.state):e.model.state={},t.modelState)Object.prototype.hasOwnProperty.call(t.modelState,n)&&void 0===e.model.state[n]&&(e.model.state[n]=t.modelState[n]);return e},m=function(e,t){return function(n){var r="function"==typeof n?n(t):n;a().equals(null==r?void 0:r.modelState,null==t?void 0:t.modelState)||e(r)}},s=function(e,t,n){void 0===n&&(n=!0);for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];t="on"+a().stringCapitalize(t),e[t]&&(n?e[t].apply(e,o):a().timeout((function(){return e[t].apply(e,o)})))},p=function(e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0],l=o[1];l===c.UndefinedSymbol?t[i]=void 0:l===c.NullSymbol?t[i]=null:t[i]=a().copy(e[i])}return t},f=function(e,t,n){var r,o;return void 0!==n?n:void 0!==e.value?e.value:void 0!==(null==(r=e.model)?void 0:r.value)?e.model.value:void 0!==e.initialValue?a().copy(e.initialValue):void 0!==e.default?a().copy(e.default):void 0!==(null==(o=e.model)?void 0:o.default)?a().copy(e.model.default):void 0!==t?t:null},b=function(e,t,n){void 0===n&&(n={});var r=!1;n=o()({invalidRequired:function(){return!1===e.model.nullable&&"boolean"!==e.model.type&&!e.model.value&&0!==e.model.value||"boolean"===e.model.type&&!("boolean"==typeof e.model.value||["false","true"].includes(e.model.value))}},n),e.model.state=e.model.state||{};for(var i=0,a=Object.entries(n);i<a.length;i++){var c=a[i],l=c[0],d=c[1],u=t[l];e.model.state[l]=d(),r=r||u!==t[l]}return r&&(e.model.state.invalid=Object.keys(n).some((function(t){return e.model.state[t]})),e.model.state.valid=!e.model.state.invalid),r},h=function(e,t){var n=a().extend(!0,{model:a().copy(t)},e);n.disabled&&(n.model.mutable=!1,delete n.disabled),n.invertedPattern&&(n.model.invertedRegularExpressionPattern=n.invertedPattern,delete n.invertedPattern),n.pattern&&(n.model.regularExpressionPattern=n.pattern,delete n.pattern),n.required&&(n.model.nullable=!1,delete n.required),"text"===n.type&&(n.type="string");for(var r,o=l(Object.keys(n.model).concat("value"));!(r=o()).done;){var i=r.value;Object.prototype.hasOwnProperty.call(n,i)&&void 0!==n[i]&&(n.model[i]=n[i])}for(var c in n.model.state)Object.prototype.hasOwnProperty.call(n,c)&&void 0!==n[c]&&(n.model.state[c]=n[c]);return void 0===n.model.value&&(n.model.value=a().copy(n.model.default)),n},y=function(e){var t=o()({},e,e.model||{},(e.model||{}).state||{});return t.disabled=!(t.mutable&&t.writable),delete t.mutable,delete t.writable,delete t.state,t.required=!t.nullable,delete t.nullable,t.invertedRegularExpressionPattern&&(t.invertedPattern=t.invertedRegularExpressionPattern),delete t.invertedRegularExpressionPattern,t.regularExpressionPattern&&(t.pattern=t.regularExpressionPattern),delete t.regularExpressionPattern,t}},function(e){e.exports=i},function(e,t,n){n.d(t,{WrapThemeProvider:function(){return i}});var r=n(4),o=n(0),i=function(e){var t=e.children,n=e.configuration,i=e.wrap;return n?(0,o.jsx)(r.ThemeProvider,{options:n,wrap:!1!==i,children:t}):t}},function(e){e.exports=o},function(e,t,n){n.d(t,{x:function(){return i}});var r=n(2),o=n(0),i=function(e){var t=e.children;return e.strict?(0,o.jsx)(r.StrictMode,{children:t}):(0,o.jsx)(o.Fragment,{children:t})}},function(e){e.exports=t},,,,,,,,,,,,,,,,function(e,t,n){n.d(t,{cN:function(){return s},by:function(){return b},uG:function(){return y}});var r=n(1),o=n.n(r),i=n(3),a=n.n(i),c=n(5),l={declaration:c.string,default:c.any,description:c.string,name:c.string,selection:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.number,c.string])),(0,c.objectOf)((0,c.oneOfType)([c.number,c.string]))]),type:c.string,value:c.any},d={dirty:(0,c.oneOfType)([c.boolean,c.symbol]),focused:(0,c.oneOfType)([c.boolean,c.symbol]),invalid:(0,c.oneOfType)([c.boolean,c.symbol]),invalidRequired:(0,c.oneOfType)([c.boolean,c.symbol]),pristine:(0,c.oneOfType)([c.boolean,c.symbol]),touched:(0,c.oneOfType)([c.boolean,c.symbol]),untouched:(0,c.oneOfType)([c.boolean,c.symbol]),valid:(0,c.oneOfType)([c.boolean,c.symbol]),visited:(0,c.oneOfType)([c.boolean,c.symbol])},u=o()({},l,{emptyEqualsNull:c.boolean,invertedRegularExpressionPattern:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),maximum:(0,c.oneOfType)([c.number,c.string]),maximumLength:c.number,minimum:(0,c.oneOfType)([c.number,c.string]),minimumLength:c.number,mutable:c.boolean,state:(0,c.shape)(d),writable:c.boolean,regularExpressionPattern:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),trim:c.boolean}),m=o()({},l,d,{className:c.string,disabled:c.boolean,enforceUncontrolled:c.boolean,initialValue:c.any,model:(0,c.shape)(u),onChange:c.func,onChangeValue:c.func,onChangeShowDeclaration:c.func,onChangeState:c.func,onClick:c.func,onFocus:c.func,onTouch:c.func,required:c.boolean,requiredText:c.string,ripple:(0,c.oneOfType)([c.boolean,c.object]),showDeclaration:(0,c.oneOfType)([c.boolean,c.symbol]),showInitialValidationState:c.boolean,styles:c.object,themeConfiguration:c.object,tooltip:c.any}),s={dirty:!1,focused:!1,invalid:!1,invalidRequired:!1,pristine:!0,touched:!1,untouched:!0,valid:!0,visited:!1},p={declaration:"",default:null,description:"",emptyEqualsNull:!0,invertedRegularExpressionPattern:null,maximum:1/0,maximumLength:-1,minimum:-1/0,minimumLength:0,mutable:!0,name:"NO_NAME_DEFINED",nullable:!0,regularExpressionPattern:null,state:o()({},s),trim:!0,type:"string",writable:!0},f={enforceUncontrolled:!1,model:o()({},p),showDeclaration:void 0,showInitialValidationState:!1,requiredText:"Please fill this field."},b=o()({},m,d,{checked:c.boolean,id:c.string}),h=o()({},p,{default:!1,type:"boolean",value:!1}),y=o()({},f,{default:!1,model:o()({},h),requiredText:"Please check this field."}),v=o()({},d,{invalidMaximum:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimum:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMaximumLength:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimumLength:(0,c.oneOfType)([c.boolean,c.symbol]),invalidInvertedPattern:(0,c.oneOfType)([c.boolean,c.symbol]),invalidPattern:(0,c.oneOfType)([c.boolean,c.symbol])}),x=o()({},m,v,{align:c.string,children:c.func,cursor:(0,c.oneOfType)([(0,c.shape)({end:c.number.isRequired,start:c.number.isRequired}),c.symbol]),editor:c.string,editorIsActive:(0,c.oneOfType)([c.boolean,c.symbol]),fullWidth:c.boolean,hidden:(0,c.oneOfType)([c.boolean,c.symbol]),icon:(0,c.oneOfType)([c.string,c.object]),invertedPatternText:c.string,labels:(0,c.oneOfType)([(0,c.arrayOf)(c.string),c.object]),maximum:(0,c.oneOfType)([c.number,c.string]),maximumLengthText:c.string,maximumText:c.string,minimum:(0,c.oneOfType)([c.number,c.string]),minimumLengthText:c.string,minimumText:c.string,onBlur:c.func,onChangeEditorIsActive:c.func,onKeyDown:c.func,onKeyUp:c.func,onSelect:c.func,onSelectionChange:c.func,outlined:c.boolean,patternText:c.string,placeholder:c.string,representation:(0,c.oneOfType)([c.string,c.symbol]),rows:c.number,searchSelection:c.boolean,selectableEditor:c.boolean,step:c.number,suggestionCreator:c.func,suggestSelection:c.boolean,trailingIcon:c.any,transformer:c.object}),g=o()({},s,{invalidMaximum:!1,invalidMinimum:!1,invalidMaximumLength:!1,invalidMinimumLength:!1,invalidInvertedPattern:!1,invalidPattern:!1}),k=o()({},p,{state:g}),T=o()({},f,{cursor:{end:0,start:0},editor:"plain",invertedPatternText:'Your string should not match the regular expression${[].concat(invertedPattern).length > 1 ? "s" : ""}: "${[].concat(invertedPattern).join("\\", \\"")}".',maximumLengthText:"Please type less or equal than ${maximumLength} symbols.",maximumText:"Please type less or equal than ${formatValue(maximum)}.",minimumLengthText:"Please type at least or equal ${minimumLength} symbols.",minimumText:"Please type at least or equal ${formatValue(minimum)}.",model:o()({},k),patternText:'Your string have to match the regular expression${[].concat(pattern).length > 1 ? "s" : ""}: "${[].concat(pattern).join("\\", \\"")}".',rows:4,searchSelection:!1,selectableEditor:!1,step:1,suggestSelection:!1}),P=o()({},d,{invalidMaximumSize:(0,c.oneOfType)([c.boolean,c.symbol]),invalidMinimumSize:(0,c.oneOfType)([c.boolean,c.symbol]),invalidContentTypePattern:(0,c.oneOfType)([c.boolean,c.symbol]),invalidName:(0,c.oneOfType)([c.boolean,c.symbol])}),O=(o()({},m,P,{children:c.func,contentTypePatternText:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),deleteButton:(0,c.oneOfType)([c.object,c.string]),downloadButton:(0,c.oneOfType)([c.object,c.string]),editButton:(0,c.oneOfType)([c.object,c.string]),encoding:c.string,generateFileNameInputProperties:c.func,invertedContentTypePatternText:(0,c.oneOfType)([(0,c.arrayOf)((0,c.oneOfType)([c.object,c.string])),c.object,c.string]),maximumSizeText:c.string,minimumSizeText:c.string,newButton:(0,c.oneOfType)([c.object,c.string]),onBlur:c.func,outlined:c.boolean}),o()({},s,{invalidMaximumSize:!1,invalidMinimumSize:!1,invalidContentTypePattern:!1,invalidName:!1})),S=o()({},p,{contentTypeRegularExpressionPattern:/^.+\/.+$/,fileName:o()({},k,{maximumLength:1024,name:"Name",regularExpressionPattern:/^[^/]+$/}),invertedContentTypeRegularExpressionPattern:null,maximumSize:1/0,minimumSize:0,state:O});delete o()({},T,{emptyEqualsNull:!1,invertedPatternText:'Your file\'s name should not match the regular expression${[].concat(invertedPattern).length > 1 ? "s" : ""}: ""${[].concat(invertedPattern).join("\\", \\"")}".',patternText:'Your file\'s name has to match the regular expression${[].concat(pattern).length > 1 ? "s" : ""}: ""${[].concat(pattern).join("\\", \\"")}".',required:!0}).model;o()({},f,{contentTypePatternText:'Your file\'s mime-type has to match the regular expression${[].concat(contentTypePattern).length > 1 ? "s" : ""}: ""${[].concat(contentTypePattern).join("\\", \\"")}".',deleteButton:"delete",downloadButton:"download",editButton:"edit",encoding:"utf-8",generateFileNameInputProperties:a().identity,invertedContentTypePatternText:'Your file\'s mime-type should not match the regular expression${[].concat(invertedContentTypePattern).length > 1 ? "s" : ""}: ""${[].concat(invertedContentTypePattern).join("\\", \\"")}".',maximumSizeText:"Please provide a file with less or equal size than ${maximumSize} byte.",media:{sixteenByNine:!0},minimumSizeText:"Please provide a file with more or equal size than ${maximumSize} byte.",model:o()({},S),newButton:"new",sourceToBlobOptions:{endings:"transparent",type:"text/plain"}}),o()({},m,v,{children:c.func,createPrototype:c.func,maximumNumber:c.number,minimumNumber:c.number});var j=o()({},p,{state:o()({},p.state,{invalidMaximumNumber:!1,invalidMinimumNumber:!1}),maximumNumber:1/0,minimumNumber:0,type:"string[]"});o()({},f,{addIcon:{icon:"add"},createPrototype:function(e){return e.prototype},model:o()({},j),removeIcon:{icon:"clear"}}),o()({},x,{value:(0,c.shape)({end:(0,c.oneOfType)([c.number,(0,c.shape)(x)]),start:(0,c.oneOfType)([c.number,(0,c.shape)(x)])})}),o()({},s),o()({},k,{description:"End",name:"end"}),o()({},k,{description:"Start",name:"start"})},,,,,,,,function(e){e.exports=n}],m={};function s(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return u[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return function(){s.r(p),s.d(p,{RequireableCheckbox:function(){return h},RequireableCheckboxInner:function(){return b},default:function(){return y},determineValidationState:function(){return f}});var e=s(1),t=s.n(e),n=s(3),r=s.n(n),o=s(2),i=s(37),a=s(4),c={"mdc-touch-target-wrapper":"mdc-touch-target-wrapper","mdc-checkbox":"mdc-checkbox","mdc-checkbox__native-control":"mdc-checkbox__native-control","mdc-checkbox__background":"mdc-checkbox__background","mdc-checkbox--selected":"mdc-checkbox--selected","mdc-checkbox__ripple":"mdc-checkbox__ripple","mdc-ripple-upgraded--background-focused":"mdc-ripple-upgraded--background-focused","mdc-ripple-upgraded":"mdc-ripple-upgraded","mdc-checkbox--anim-unchecked-checked":"mdc-checkbox--anim-unchecked-checked","mdc-checkbox--anim-unchecked-indeterminate":"mdc-checkbox--anim-unchecked-indeterminate","mdc-checkbox-fade-in-background-8A000000secondary00000000secondary":"mdc-checkbox-fade-in-background-8A000000secondary00000000secondary","mdc-checkbox--anim-checked-unchecked":"mdc-checkbox--anim-checked-unchecked","mdc-checkbox--anim-indeterminate-unchecked":"mdc-checkbox--anim-indeterminate-unchecked","mdc-checkbox-fade-out-background-8A000000secondary00000000secondary":"mdc-checkbox-fade-out-background-8A000000secondary00000000secondary","mdc-checkbox__checkmark":"mdc-checkbox__checkmark","mdc-checkbox__mixedmark":"mdc-checkbox__mixedmark","mdc-checkbox--disabled":"mdc-checkbox--disabled","mdc-checkbox--upgraded":"mdc-checkbox--upgraded","mdc-checkbox__checkmark-path":"mdc-checkbox__checkmark-path","mdc-checkbox-unchecked-checked-checkmark-path":"mdc-checkbox-unchecked-checked-checkmark-path","mdc-checkbox-unchecked-indeterminate-mixedmark":"mdc-checkbox-unchecked-indeterminate-mixedmark","mdc-checkbox-checked-unchecked-checkmark-path":"mdc-checkbox-checked-unchecked-checkmark-path","mdc-checkbox--anim-checked-indeterminate":"mdc-checkbox--anim-checked-indeterminate","mdc-checkbox-checked-indeterminate-checkmark":"mdc-checkbox-checked-indeterminate-checkmark","mdc-checkbox-checked-indeterminate-mixedmark":"mdc-checkbox-checked-indeterminate-mixedmark","mdc-checkbox--anim-indeterminate-checked":"mdc-checkbox--anim-indeterminate-checked","mdc-checkbox-indeterminate-checked-checkmark":"mdc-checkbox-indeterminate-checked-checkmark","mdc-checkbox-indeterminate-checked-mixedmark":"mdc-checkbox-indeterminate-checked-mixedmark","mdc-checkbox-indeterminate-unchecked-mixedmark":"mdc-checkbox-indeterminate-unchecked-mixedmark","mdc-checkbox--touch":"mdc-checkbox--touch","mdc-ripple-upgraded--unbounded":"mdc-ripple-upgraded--unbounded","mdc-ripple-upgraded--foreground-activation":"mdc-ripple-upgraded--foreground-activation","mdc-ripple-fg-radius-in":"mdc-ripple-fg-radius-in","mdc-ripple-fg-opacity-in":"mdc-ripple-fg-opacity-in","mdc-ripple-upgraded--foreground-deactivation":"mdc-ripple-upgraded--foreground-deactivation","mdc-ripple-fg-opacity-out":"mdc-ripple-fg-opacity-out","mdc-form-field":"mdc-form-field","mdc-form-field--align-end":"mdc-form-field--align-end","mdc-ripple-surface":"mdc-ripple-surface","mdc-ripple-surface--primary":"mdc-ripple-surface--primary","mdc-ripple-surface--accent":"mdc-ripple-surface--accent","requireable-checkbox":"requireable-checkbox"},l=s(7),d=s(8),u=s(29),m=s(0);function f(e,t){return(0,d.determineValidationState)(e,t,{invalidRequired:function(){return!1===e.model.nullable&&!e.model.value}})}var b=function(e,n){var u,s,p=function(e){var t=(0,d.mapPropertiesIntoModel)(e,h.defaultProperties.model);return f(t,t.model.state),(t=(0,d.getConsolidatedProperties)(t)).checked=Boolean(t.value),t},b=function(e){r().extend(!0,w,p(w)),(0,d.triggerCallbackIfExists)(w,"change",j,w,e)},y=function(e){return S((function(n){var r=!1;n.modelState.focused||(w.focused=!0,r=!0),n.modelState.untouched&&(w.touched=!0,w.untouched=!1,r=!0);var o=n;return r&&(b(e),o=t()({},n,{modelState:w.model.state}),(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),(0,d.triggerCallbackIfExists)(w,"touch",j,e,w),o}))},v=(0,o.useRef)(null),x=(0,o.useRef)(null),g=(0,d.translateKnownSymbols)(e),k=(0,d.determineInitialValue)(g,h.defaultProperties.model.default,g.checked),T=r().extend(!0,r().copy(h.defaultProperties),g),P=(0,o.useState)({modelState:t()({},h.defaultModelState),value:k}),O=P[0],S=P[1],j=!T.enforceUncontrolled&&(void 0!==(null==(u=g.model)?void 0:u.value)||void 0!==g.value)&&Boolean(g.onChange||g.onChangeValue);(0,d.deriveMissingPropertiesFromState)(T,O);var w=p(T),q={modelState:w.model.state,value:w.value};return(j||w.value===O.value)&&r().equals(w.model.state,O.modelState)||S(q),j&&(S=(0,d.wrapStateSetter)(S,q)),(0,o.useImperativeHandle)(n,(function(){return{properties:w,references:{foundationRef:x,inputReference:v},state:t()({modelState:w.model.state},j?{}:{value:w.value})}})),(0,m.jsx)(l.WrapConfigurations,{strict:h.strict,themeConfiguration:w.themeConfiguration,tooltip:w.tooltip,children:(0,m.jsx)("div",{className:[c["requireable-checkbox"]].concat(null!==(s=w.className)&&void 0!==s?s:[]).join(" "),style:w.styles,children:(0,m.jsx)(i.Checkbox,{checked:Boolean(w.value),disabled:w.disabled,foundationRef:x,id:w.id||w.name,indeterminate:null===w.value,inputRef:v,label:w.invalid&&(w.showInitialValidationState||w.visited)?(0,m.jsx)(a.Theme,{use:"error",children:w.description||w.name}):w.description||w.name,name:w.name,onBlur:function(e){return S((function(n){var r=!1;return n.modelState.focused&&(w.focused=!1,r=!0),n.modelState.visited||(w.visited=!0,r=!0),r&&(b(e),(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),(0,d.triggerCallbackIfExists)(w,"blur",j,e,w),r?t()({},n,{modelState:w.model.state}):n}))},onChange:function(e){w.model.mutable&&w.model.writable&&(w.value=Boolean(e.target.checked),S((function(n){if(n.value===w.value)return n;var r=!1,o=t()({},n,{value:w.value});return n.modelState.pristine&&(w.dirty=!0,w.pristine=!1,r=!0),b(e),f(w,n.modelState)&&(r=!0),(0,d.triggerCallbackIfExists)(w,"changeValue",j,w.value,e,w),r&&(o.modelState=w.model.state,(0,d.triggerCallbackIfExists)(w,"changeState",j,w.model.state,e,w)),o})))},onClick:function(e){(0,d.triggerCallbackIfExists)(w,"click",j,e,w),y(e)},onFocus:function(e){(0,d.triggerCallbackIfExists)(w,"focus",j,e,w),y(e)},ripple:w.ripple,value:""+w.value})})})};b.displayName="RequireableCheckbox";var h=(0,o.memo)((0,o.forwardRef)(b));h.wrapped=b,h.webComponentAdapterWrapped="react",h.defaultModelState=u.cN,h.defaultProperties=t()({},u.uG,{model:t()({},u.uG.model,{state:void 0,value:void 0}),value:void 0}),h.propTypes=u.by,h.strict=!1;var y=h}(),p}()}));
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
*/
|
|
19
19
|
// region imports
|
|
20
20
|
import Tools from 'clientnode'
|
|
21
|
-
import {FirstParameter} from 'clientnode/type'
|
|
22
21
|
import {
|
|
23
22
|
FocusEvent as ReactFocusEvent,
|
|
24
23
|
forwardRef,
|
|
@@ -27,7 +26,6 @@ import {
|
|
|
27
26
|
MouseEvent as ReactMouseEvent,
|
|
28
27
|
MutableRefObject,
|
|
29
28
|
ReactElement,
|
|
30
|
-
RefCallback,
|
|
31
29
|
SyntheticEvent,
|
|
32
30
|
useImperativeHandle,
|
|
33
31
|
useRef,
|
|
@@ -56,10 +54,8 @@ import {
|
|
|
56
54
|
} from '../helper'
|
|
57
55
|
import {
|
|
58
56
|
CheckboxAdapter as Adapter,
|
|
59
|
-
CheckboxModel as Model,
|
|
60
57
|
CheckboxProperties as Properties,
|
|
61
58
|
CheckboxProps as Props,
|
|
62
|
-
CheckboxState as State,
|
|
63
59
|
defaultModelState,
|
|
64
60
|
DefaultCheckboxProperties as DefaultProperties,
|
|
65
61
|
defaultCheckboxProperties as defaultProperties,
|
|
@@ -70,6 +66,13 @@ import {
|
|
|
70
66
|
} from '../type'
|
|
71
67
|
// endregion
|
|
72
68
|
// region helper
|
|
69
|
+
/**
|
|
70
|
+
* Derives validation state from provided properties and state.
|
|
71
|
+
* @param properties - Current component properties.
|
|
72
|
+
* @param currentState - Current component state.
|
|
73
|
+
*
|
|
74
|
+
* @returns Whether component is in an aggregated valid or invalid state.
|
|
75
|
+
*/
|
|
73
76
|
export function determineValidationState(
|
|
74
77
|
properties:DefaultProperties, currentState:Partial<ModelState>
|
|
75
78
|
):boolean {
|
|
@@ -86,7 +89,6 @@ export function determineValidationState(
|
|
|
86
89
|
// endregion
|
|
87
90
|
/**
|
|
88
91
|
* Validateable checkbox wrapper component.
|
|
89
|
-
*
|
|
90
92
|
* @property static:displayName - Descriptive name for component to show in web
|
|
91
93
|
* developer tools.
|
|
92
94
|
*
|
|
@@ -102,12 +104,12 @@ export function determineValidationState(
|
|
|
102
104
|
* 4. All state changes except selection changes trigger an "onChange" event
|
|
103
105
|
* which delivers the consolidated properties object (with latest
|
|
104
106
|
* modifications included).
|
|
105
|
-
*
|
|
106
107
|
* @property static:displayName - Descriptive name for component to show in web
|
|
107
108
|
* developer tools.
|
|
108
109
|
*
|
|
109
110
|
* @param props - Given components properties.
|
|
110
111
|
* @param reference - Reference object to forward internal state.
|
|
112
|
+
*
|
|
111
113
|
* @returns React elements.
|
|
112
114
|
*/
|
|
113
115
|
export const RequireableCheckboxInner = function(
|
|
@@ -117,12 +119,14 @@ export const RequireableCheckboxInner = function(
|
|
|
117
119
|
/**
|
|
118
120
|
* Calculate external properties (a set of all configurable properties).
|
|
119
121
|
* @param properties - Properties to merge.
|
|
122
|
+
*
|
|
120
123
|
* @returns External properties object.
|
|
121
124
|
*/
|
|
122
125
|
const getConsolidatedProperties = (properties:Props):Properties => {
|
|
123
|
-
let result:DefaultProperties =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
let result:DefaultProperties =
|
|
127
|
+
mapPropertiesIntoModel<Props, DefaultProperties>(
|
|
128
|
+
properties, RequireableCheckbox.defaultProperties.model
|
|
129
|
+
)
|
|
126
130
|
|
|
127
131
|
determineValidationState(result, result.model.state)
|
|
128
132
|
|
|
@@ -137,12 +141,13 @@ export const RequireableCheckboxInner = function(
|
|
|
137
141
|
/**
|
|
138
142
|
* Triggered on blur events.
|
|
139
143
|
* @param event - Event object.
|
|
144
|
+
*
|
|
140
145
|
* @returns Nothing.
|
|
141
146
|
*/
|
|
142
147
|
const onBlur = (event:SyntheticEvent):void => setValueState((
|
|
143
148
|
oldValueState:ValueState
|
|
144
149
|
):ValueState => {
|
|
145
|
-
let changed
|
|
150
|
+
let changed = false
|
|
146
151
|
|
|
147
152
|
if (oldValueState.modelState.focused) {
|
|
148
153
|
properties.focused = false
|
|
@@ -179,6 +184,7 @@ export const RequireableCheckboxInner = function(
|
|
|
179
184
|
* Triggered on any change events. Consolidates properties object and
|
|
180
185
|
* triggers given on change callbacks.
|
|
181
186
|
* @param event - Potential event object.
|
|
187
|
+
*
|
|
182
188
|
* @returns Nothing.
|
|
183
189
|
*/
|
|
184
190
|
const onChange = (event?:SyntheticEvent):void => {
|
|
@@ -201,6 +207,7 @@ export const RequireableCheckboxInner = function(
|
|
|
201
207
|
/**
|
|
202
208
|
* Triggered when ever the value changes.
|
|
203
209
|
* @param event - Event object.
|
|
210
|
+
*
|
|
204
211
|
* @returns Nothing.
|
|
205
212
|
*/
|
|
206
213
|
const onChangeValue = (event:SyntheticEvent):void => {
|
|
@@ -215,7 +222,7 @@ export const RequireableCheckboxInner = function(
|
|
|
215
222
|
if (oldValueState.value === properties.value)
|
|
216
223
|
return oldValueState
|
|
217
224
|
|
|
218
|
-
let stateChanged
|
|
225
|
+
let stateChanged = false
|
|
219
226
|
|
|
220
227
|
const result:ValueState =
|
|
221
228
|
{...oldValueState, value: properties.value as boolean|null}
|
|
@@ -259,6 +266,7 @@ export const RequireableCheckboxInner = function(
|
|
|
259
266
|
/**
|
|
260
267
|
* Triggered on click events.
|
|
261
268
|
* @param event - Mouse event object.
|
|
269
|
+
*
|
|
262
270
|
* @returns Nothing.
|
|
263
271
|
*/
|
|
264
272
|
const onClick = (event:ReactMouseEvent):void => {
|
|
@@ -271,6 +279,7 @@ export const RequireableCheckboxInner = function(
|
|
|
271
279
|
/**
|
|
272
280
|
* Triggered on focus events.
|
|
273
281
|
* @param event - Focus event object.
|
|
282
|
+
*
|
|
274
283
|
* @returns Nothing.
|
|
275
284
|
*/
|
|
276
285
|
const onFocus = (event:ReactFocusEvent):void => {
|
|
@@ -283,11 +292,12 @@ export const RequireableCheckboxInner = function(
|
|
|
283
292
|
/**
|
|
284
293
|
* Triggers on start interacting with the input.
|
|
285
294
|
* @param event - Event object which triggered interaction.
|
|
295
|
+
*
|
|
286
296
|
* @returns Nothing.
|
|
287
297
|
*/
|
|
288
298
|
const onTouch = (event:ReactFocusEvent|ReactMouseEvent):void =>
|
|
289
299
|
setValueState((oldValueState:ValueState):ValueState => {
|
|
290
|
-
let changedState
|
|
300
|
+
let changedState = false
|
|
291
301
|
|
|
292
302
|
if (!oldValueState.modelState.focused) {
|
|
293
303
|
properties.focused = true
|
|
@@ -335,7 +345,7 @@ export const RequireableCheckboxInner = function(
|
|
|
335
345
|
|
|
336
346
|
const initialValue:boolean|null = determineInitialValue<boolean>(
|
|
337
347
|
givenProps,
|
|
338
|
-
RequireableCheckbox.defaultProperties.model
|
|
348
|
+
RequireableCheckbox.defaultProperties.model.default,
|
|
339
349
|
givenProps.checked
|
|
340
350
|
)
|
|
341
351
|
/*
|
|
@@ -386,6 +396,7 @@ export const RequireableCheckboxInner = function(
|
|
|
386
396
|
setValueState =
|
|
387
397
|
wrapStateSetter<ValueState>(setValueState, currentValueState)
|
|
388
398
|
// endregion
|
|
399
|
+
// region export references
|
|
389
400
|
useImperativeHandle(
|
|
390
401
|
reference,
|
|
391
402
|
():Adapter & {
|
|
@@ -411,45 +422,48 @@ export const RequireableCheckboxInner = function(
|
|
|
411
422
|
strict={RequireableCheckbox.strict}
|
|
412
423
|
themeConfiguration={properties.themeConfiguration}
|
|
413
424
|
tooltip={properties.tooltip}
|
|
414
|
-
><div
|
|
415
|
-
className={[styles['requireable-checkbox']]
|
|
416
|
-
.concat(properties.className ?? [])
|
|
417
|
-
.join(' ')
|
|
418
|
-
}
|
|
419
|
-
style={properties.styles}
|
|
420
425
|
>
|
|
421
|
-
<
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
id={properties.id || properties.name}
|
|
426
|
-
indeterminate={properties.value === null}
|
|
427
|
-
inputRef={inputReference}
|
|
428
|
-
label={(
|
|
429
|
-
properties.invalid &&
|
|
430
|
-
(
|
|
431
|
-
properties.showInitialValidationState ||
|
|
432
|
-
/*
|
|
433
|
-
Material inputs show their validation state at least
|
|
434
|
-
after a blur event so we synchronize error appearances.
|
|
435
|
-
*/
|
|
436
|
-
properties.visited
|
|
437
|
-
)
|
|
438
|
-
) ?
|
|
439
|
-
<Theme use="error">
|
|
440
|
-
{properties.description || properties.name}
|
|
441
|
-
</Theme> :
|
|
442
|
-
properties.description || properties.name
|
|
426
|
+
<div
|
|
427
|
+
className={[styles['requireable-checkbox']]
|
|
428
|
+
.concat(properties.className ?? [])
|
|
429
|
+
.join(' ')
|
|
443
430
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
431
|
+
style={properties.styles}
|
|
432
|
+
>
|
|
433
|
+
<Checkbox
|
|
434
|
+
checked={Boolean(properties.value)}
|
|
435
|
+
disabled={properties.disabled}
|
|
436
|
+
foundationRef={foundationRef}
|
|
437
|
+
id={properties.id || properties.name}
|
|
438
|
+
indeterminate={properties.value === null}
|
|
439
|
+
inputRef={inputReference}
|
|
440
|
+
label={(
|
|
441
|
+
properties.invalid &&
|
|
442
|
+
(
|
|
443
|
+
properties.showInitialValidationState ||
|
|
444
|
+
/*
|
|
445
|
+
Material inputs show their validation state at
|
|
446
|
+
least after a blur event so we synchronize error
|
|
447
|
+
appearances.
|
|
448
|
+
*/
|
|
449
|
+
properties.visited
|
|
450
|
+
)
|
|
451
|
+
) ?
|
|
452
|
+
<Theme use="error">
|
|
453
|
+
{properties.description || properties.name}
|
|
454
|
+
</Theme> :
|
|
455
|
+
properties.description || properties.name
|
|
456
|
+
}
|
|
457
|
+
name={properties.name}
|
|
458
|
+
onBlur={onBlur}
|
|
459
|
+
onChange={onChangeValue}
|
|
460
|
+
onClick={onClick}
|
|
461
|
+
onFocus={onFocus}
|
|
462
|
+
ripple={properties.ripple}
|
|
463
|
+
value={`${properties.value as unknown as string}`}
|
|
464
|
+
/>
|
|
465
|
+
</div>
|
|
466
|
+
</WrapConfigurations>
|
|
453
467
|
// endregion
|
|
454
468
|
} as ForwardRefRenderFunction<Adapter, Props>
|
|
455
469
|
// NOTE: This is useful in react dev tools.
|
|
@@ -458,13 +472,14 @@ RequireableCheckboxInner.displayName = 'RequireableCheckbox'
|
|
|
458
472
|
* Wrapping web component compatible react component.
|
|
459
473
|
* @property static:defaultModelState - Initial model state.
|
|
460
474
|
* @property static:defaultProperties - Initial property configuration.
|
|
461
|
-
* @property static:propTypes - Triggers reacts runtime property value checks
|
|
475
|
+
* @property static:propTypes - Triggers reacts runtime property value checks.
|
|
462
476
|
* @property static:strict - Indicates whether we should wrap render output in
|
|
463
477
|
* reacts strict component.
|
|
464
478
|
* @property static:wrapped - Wrapped component.
|
|
465
479
|
*
|
|
466
480
|
* @param props - Given components properties.
|
|
467
481
|
* @param reference - Reference object to forward internal state.
|
|
482
|
+
*
|
|
468
483
|
* @returns React elements.
|
|
469
484
|
*/
|
|
470
485
|
export const RequireableCheckbox:CheckboxComponent =
|
|
@@ -5,6 +5,7 @@ import { ConfigurationProperties } from '../type';
|
|
|
5
5
|
/**
|
|
6
6
|
* Wraps a theme provider, strict wrapper and tooltip to given element if
|
|
7
7
|
* corresponding configurations are provided.
|
|
8
|
+
* @param properties - Component provided properties.
|
|
8
9
|
* @param properties.children - Component or string to wrap.
|
|
9
10
|
* @param properties.strict - Indicates whether to render in strict mode.
|
|
10
11
|
* @param properties.themeConfiguration - Optional theme configurations.
|
|
@@ -12,11 +13,23 @@ import { ConfigurationProperties } from '../type';
|
|
|
12
13
|
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
13
14
|
* component by merging the theme styles directly onto it. Useful when you
|
|
14
15
|
* don't want to mess with layout.
|
|
16
|
+
*
|
|
15
17
|
* @returns Wrapped content.
|
|
16
18
|
*/
|
|
17
19
|
export declare const WrapConfigurations: FunctionComponent<ConfigurationProperties & {
|
|
18
20
|
children: ReactElement;
|
|
19
21
|
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Component factory to dynamically create a wrapped component.
|
|
24
|
+
* @param WrappedComponent - Component to wrap.
|
|
25
|
+
* @param options - Options configure wrapping.
|
|
26
|
+
* @param options.withReference - Indicates whether to add a mutable reference
|
|
27
|
+
* to wrapping component.
|
|
28
|
+
* @param options.withThemeWrapper - Indicates whether all theme configurations
|
|
29
|
+
* should be provided.
|
|
30
|
+
*
|
|
31
|
+
* @returns Created wrapped component.
|
|
32
|
+
*/
|
|
20
33
|
export declare function createWrapConfigurationsComponent<Type extends AnyFunction = AnyFunction, Reference = unknown>(WrappedComponent: Type, options?: {
|
|
21
34
|
withReference?: boolean | null;
|
|
22
35
|
withThemeWrapper?: boolean;
|
|
@@ -19,24 +19,24 @@
|
|
|
19
19
|
// region imports
|
|
20
20
|
import {AnyFunction, FirstParameter} from 'clientnode/type'
|
|
21
21
|
import {
|
|
22
|
-
ComponentType,
|
|
23
22
|
forwardRef,
|
|
24
23
|
ForwardRefRenderFunction,
|
|
25
24
|
FunctionComponent,
|
|
26
25
|
MutableRefObject,
|
|
27
26
|
ReactElement
|
|
28
27
|
} from 'react'
|
|
29
|
-
import {Theme
|
|
28
|
+
import {Theme} from '@rmwc/theme'
|
|
30
29
|
import {ThemePropT} from '@rmwc/types'
|
|
31
30
|
|
|
32
31
|
import {WrapStrict} from './WrapStrict'
|
|
33
32
|
import {WrapThemeProvider} from './WrapThemeProvider'
|
|
34
33
|
import {WrapTooltip} from './WrapTooltip'
|
|
35
|
-
import {ConfigurationProperties
|
|
36
|
-
//
|
|
34
|
+
import {ConfigurationProperties} from '../type'
|
|
35
|
+
// endregion
|
|
37
36
|
/**
|
|
38
37
|
* Wraps a theme provider, strict wrapper and tooltip to given element if
|
|
39
38
|
* corresponding configurations are provided.
|
|
39
|
+
* @param properties - Component provided properties.
|
|
40
40
|
* @param properties.children - Component or string to wrap.
|
|
41
41
|
* @param properties.strict - Indicates whether to render in strict mode.
|
|
42
42
|
* @param properties.themeConfiguration - Optional theme configurations.
|
|
@@ -44,6 +44,7 @@ import {ConfigurationProperties, Properties} from '../type'
|
|
|
44
44
|
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
45
45
|
* component by merging the theme styles directly onto it. Useful when you
|
|
46
46
|
* don't want to mess with layout.
|
|
47
|
+
*
|
|
47
48
|
* @returns Wrapped content.
|
|
48
49
|
*/
|
|
49
50
|
export const WrapConfigurations:FunctionComponent<
|
|
@@ -56,7 +57,17 @@ export const WrapConfigurations:FunctionComponent<
|
|
|
56
57
|
</WrapThemeProvider>
|
|
57
58
|
</WrapTooltip>
|
|
58
59
|
</WrapStrict>
|
|
59
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Component factory to dynamically create a wrapped component.
|
|
62
|
+
* @param WrappedComponent - Component to wrap.
|
|
63
|
+
* @param options - Options configure wrapping.
|
|
64
|
+
* @param options.withReference - Indicates whether to add a mutable reference
|
|
65
|
+
* to wrapping component.
|
|
66
|
+
* @param options.withThemeWrapper - Indicates whether all theme configurations
|
|
67
|
+
* should be provided.
|
|
68
|
+
*
|
|
69
|
+
* @returns Created wrapped component.
|
|
70
|
+
*/
|
|
60
71
|
export function createWrapConfigurationsComponent<
|
|
61
72
|
Type extends AnyFunction = AnyFunction, Reference = unknown
|
|
62
73
|
>(
|
|
@@ -91,6 +102,7 @@ export function createWrapConfigurationsComponent<
|
|
|
91
102
|
}
|
|
92
103
|
</WrapConfigurations>
|
|
93
104
|
}
|
|
105
|
+
|
|
94
106
|
return options.withReference ?
|
|
95
107
|
forwardRef(component as ForwardRefRenderFunction<typeof component>) :
|
|
96
108
|
component
|
|
@@ -2,6 +2,12 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
import { Renderable } from '../type';
|
|
3
3
|
/**
|
|
4
4
|
* Generic strict wrapper component.
|
|
5
|
+
* @param properties - Provided component properties.
|
|
6
|
+
* @param properties.children - Components to wrap.
|
|
7
|
+
* @param properties.strict - Indicates whether to wrap with strict indicating
|
|
8
|
+
* component.
|
|
9
|
+
*
|
|
10
|
+
* @returns React component.
|
|
5
11
|
*/
|
|
6
12
|
export declare const WrapStrict: FunctionComponent<{
|
|
7
13
|
children: Renderable;
|
|
@@ -23,12 +23,19 @@ import {Renderable} from '../type'
|
|
|
23
23
|
// endregion
|
|
24
24
|
/**
|
|
25
25
|
* Generic strict wrapper component.
|
|
26
|
+
* @param properties - Provided component properties.
|
|
27
|
+
* @param properties.children - Components to wrap.
|
|
28
|
+
* @param properties.strict - Indicates whether to wrap with strict indicating
|
|
29
|
+
* component.
|
|
30
|
+
*
|
|
31
|
+
* @returns React component.
|
|
26
32
|
*/
|
|
27
33
|
export const WrapStrict:FunctionComponent<{
|
|
28
34
|
children:Renderable
|
|
29
35
|
strict:boolean
|
|
30
36
|
}> = ({children, strict}):ReactElement =>
|
|
31
37
|
strict ? <StrictMode>{children}</StrictMode> : <>{children}</>
|
|
38
|
+
|
|
32
39
|
export default WrapStrict
|
|
33
40
|
// region vim modline
|
|
34
41
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
@@ -2,11 +2,13 @@ import { FunctionComponent, ReactElement } from 'react';
|
|
|
2
2
|
import { ThemeProviderProps } from '@rmwc/theme';
|
|
3
3
|
/**
|
|
4
4
|
* Wraps a theme provider to given element if a configuration is provided.
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* @param properties - Component provided properties.
|
|
6
|
+
* @param properties.children - Component or string to wrap.
|
|
7
|
+
* @param properties.configuration - Potential theme provider configuration.
|
|
8
|
+
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
9
|
+
* component by merging the theme styles directly onto it. Useful when you
|
|
10
|
+
* don't want to mess with layout.
|
|
11
|
+
*
|
|
10
12
|
* @returns Wrapped content.
|
|
11
13
|
*/
|
|
12
14
|
export declare const WrapThemeProvider: FunctionComponent<{
|
|
@@ -22,11 +22,13 @@ import {ThemeProvider, ThemeProviderProps} from '@rmwc/theme'
|
|
|
22
22
|
// endregion
|
|
23
23
|
/**
|
|
24
24
|
* Wraps a theme provider to given element if a configuration is provided.
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* @param properties - Component provided properties.
|
|
26
|
+
* @param properties.children - Component or string to wrap.
|
|
27
|
+
* @param properties.configuration - Potential theme provider configuration.
|
|
28
|
+
* @param properties.wrap - Instead of injecting a div tag, wrap a child
|
|
29
|
+
* component by merging the theme styles directly onto it. Useful when you
|
|
30
|
+
* don't want to mess with layout.
|
|
31
|
+
*
|
|
30
32
|
* @returns Wrapped content.
|
|
31
33
|
*/
|
|
32
34
|
export const WrapThemeProvider:FunctionComponent<{
|
|
@@ -38,6 +40,7 @@ export const WrapThemeProvider:FunctionComponent<{
|
|
|
38
40
|
{children}
|
|
39
41
|
</ThemeProvider> :
|
|
40
42
|
children
|
|
43
|
+
|
|
41
44
|
export default WrapThemeProvider
|
|
42
45
|
// region vim modline
|
|
43
46
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
@@ -3,8 +3,10 @@ import { Properties } from '../type';
|
|
|
3
3
|
/**
|
|
4
4
|
* Wraps given component with a tooltip component with given tooltip
|
|
5
5
|
* configuration.
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
6
|
+
* @param properties - Component provided properties.
|
|
7
|
+
* @param properties.children - Component or string to wrap.
|
|
8
|
+
* @param properties.options - Tooltip options.
|
|
9
|
+
*
|
|
8
10
|
* @returns Wrapped given content.
|
|
9
11
|
*/
|
|
10
12
|
export declare const WrapTooltip: FunctionComponent<{
|
|
@@ -26,8 +26,10 @@ import {Properties} from '../type'
|
|
|
26
26
|
/**
|
|
27
27
|
* Wraps given component with a tooltip component with given tooltip
|
|
28
28
|
* configuration.
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
29
|
+
* @param properties - Component provided properties.
|
|
30
|
+
* @param properties.children - Component or string to wrap.
|
|
31
|
+
* @param properties.options - Tooltip options.
|
|
32
|
+
*
|
|
31
33
|
* @returns Wrapped given content.
|
|
32
34
|
*/
|
|
33
35
|
export const WrapTooltip:FunctionComponent<{
|
|
@@ -37,7 +39,10 @@ export const WrapTooltip:FunctionComponent<{
|
|
|
37
39
|
if (typeof options === 'string')
|
|
38
40
|
return <Tooltip
|
|
39
41
|
content={<Typography use="caption">{options}</Typography>}
|
|
40
|
-
|
|
42
|
+
>
|
|
43
|
+
<div className="generic-tooltip">{children}</div>
|
|
44
|
+
</Tooltip>
|
|
45
|
+
|
|
41
46
|
if (options !== null && typeof options === 'object') {
|
|
42
47
|
if (typeof options.content === 'string')
|
|
43
48
|
options = {
|
|
@@ -46,12 +51,15 @@ export const WrapTooltip:FunctionComponent<{
|
|
|
46
51
|
{options.content}
|
|
47
52
|
</Typography>
|
|
48
53
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
|
|
55
|
+
return <Tooltip {...options}>
|
|
56
|
+
<div className="generic-tooltip">{children}</div>
|
|
57
|
+
</Tooltip>
|
|
52
58
|
}
|
|
59
|
+
|
|
53
60
|
return <>{children}</>
|
|
54
61
|
}
|
|
62
|
+
|
|
55
63
|
export default WrapTooltip
|
|
56
64
|
// region vim modline
|
|
57
65
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|