mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-26 00:21:36 +01:00
Merge branch 'dev' into 'master'
Add "inline" option to RadioSet See merge request turris/reforis/foris-js!124
This commit is contained in:
commit
ad99a2034d
92
package-lock.json
generated
92
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "5.1.0",
|
"version": "5.1.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -5906,9 +5906,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"copy-webpack-plugin": {
|
"copy-webpack-plugin": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz",
|
||||||
"integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==",
|
"integrity": "sha512-Uh7crJAco3AjBvgAy9Z75CjK8IG+gxaErro71THQ+vv/bl4HaQcpkexAY8KVW/T6D2W2IRr+couF/knIRkZMIQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"cacache": "^12.0.3",
|
"cacache": "^12.0.3",
|
||||||
|
@ -5921,7 +5921,7 @@
|
||||||
"normalize-path": "^3.0.0",
|
"normalize-path": "^3.0.0",
|
||||||
"p-limit": "^2.2.1",
|
"p-limit": "^2.2.1",
|
||||||
"schema-utils": "^1.0.0",
|
"schema-utils": "^1.0.0",
|
||||||
"serialize-javascript": "^2.1.2",
|
"serialize-javascript": "^4.0.0",
|
||||||
"webpack-log": "^2.0.0"
|
"webpack-log": "^2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -5962,6 +5962,15 @@
|
||||||
"ajv-keywords": "^3.1.0"
|
"ajv-keywords": "^3.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"serialize-javascript": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"randombytes": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"slash": {
|
"slash": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
|
||||||
|
@ -15717,12 +15726,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"serialize-javascript": {
|
|
||||||
"version": "2.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
|
|
||||||
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"serve-index": {
|
"serve-index": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
|
||||||
|
@ -16879,25 +16882,6 @@
|
||||||
"supports-hyperlinks": "^2.0.0"
|
"supports-hyperlinks": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"terser": {
|
|
||||||
"version": "4.6.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.6.7.tgz",
|
|
||||||
"integrity": "sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"commander": "^2.20.0",
|
|
||||||
"source-map": "~0.6.1",
|
|
||||||
"source-map-support": "~0.5.12"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"source-map": {
|
|
||||||
"version": "0.6.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
|
||||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"terser-webpack-plugin": {
|
"terser-webpack-plugin": {
|
||||||
"version": "2.3.8",
|
"version": "2.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
|
||||||
|
@ -18108,20 +18092,51 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"terser-webpack-plugin": {
|
"terser-webpack-plugin": {
|
||||||
"version": "1.4.3",
|
"version": "1.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz",
|
||||||
"integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
|
"integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"cacache": "^12.0.2",
|
"cacache": "^12.0.2",
|
||||||
"find-cache-dir": "^2.1.0",
|
"find-cache-dir": "^2.1.0",
|
||||||
"is-wsl": "^1.1.0",
|
"is-wsl": "^1.1.0",
|
||||||
"schema-utils": "^1.0.0",
|
"schema-utils": "^1.0.0",
|
||||||
"serialize-javascript": "^2.1.2",
|
"serialize-javascript": "^4.0.0",
|
||||||
"source-map": "^0.6.1",
|
"source-map": "^0.6.1",
|
||||||
"terser": "^4.1.2",
|
"terser": "^4.1.2",
|
||||||
"webpack-sources": "^1.4.0",
|
"webpack-sources": "^1.4.0",
|
||||||
"worker-farm": "^1.7.0"
|
"worker-farm": "^1.7.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"serialize-javascript": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"randombytes": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"terser": {
|
||||||
|
"version": "4.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
|
||||||
|
"integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"commander": "^2.20.0",
|
||||||
|
"source-map": "~0.6.1",
|
||||||
|
"source-map-support": "~0.5.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"worker-farm": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
|
||||||
|
"integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"errno": "~0.1.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18483,15 +18498,6 @@
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"worker-farm": {
|
|
||||||
"version": "1.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
|
|
||||||
"integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"errno": "~0.1.7"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"worker-rpc": {
|
"worker-rpc": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.1.tgz",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "5.1.0",
|
"version": "5.1.1",
|
||||||
"description": "Set of components and utils for Foris and its plugins.",
|
"description": "Set of components and utils for Foris and its plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
* Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
|
@ -33,9 +33,18 @@ RadioSet.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
/** Help text message . */
|
/** Help text message . */
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
|
inline: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function RadioSet({ name, label, choices, value, helpText, ...props }) {
|
export function RadioSet({
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
choices,
|
||||||
|
value,
|
||||||
|
helpText,
|
||||||
|
inline,
|
||||||
|
...props
|
||||||
|
}) {
|
||||||
const uid = useUID();
|
const uid = useUID();
|
||||||
const radios = choices.map((choice, key) => {
|
const radios = choices.map((choice, key) => {
|
||||||
const id = `${name}-${key}`;
|
const id = `${name}-${key}`;
|
||||||
|
@ -48,6 +57,7 @@ export function RadioSet({ name, label, choices, value, helpText, ...props }) {
|
||||||
value={choice.value}
|
value={choice.value}
|
||||||
helpText={choice.helpText}
|
helpText={choice.helpText}
|
||||||
checked={choice.value === value}
|
checked={choice.value === value}
|
||||||
|
inline={inline}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -76,15 +86,16 @@ Radio.propTypes = {
|
||||||
PropTypes.arrayOf(PropTypes.node),
|
PropTypes.arrayOf(PropTypes.node),
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
|
inline: PropTypes.bool,
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Radio({ label, id, helpText, ...props }) {
|
export function Radio({ label, id, helpText, inline, ...props }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={`custom-control custom-radio ${
|
className={`custom-control custom-radio ${
|
||||||
!helpText ? "custom-control-inline" : ""
|
inline ? "custom-control-inline" : ""
|
||||||
}`.trim()}
|
}`.trim()}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
|
|
@ -23,7 +23,7 @@ Switch.propTypes = {
|
||||||
export function Switch({ label, helpText, switchHeading, ...props }) {
|
export function Switch({ label, helpText, switchHeading, ...props }) {
|
||||||
const uid = useUID();
|
const uid = useUID();
|
||||||
return (
|
return (
|
||||||
<div className="form-group">
|
<div className="form-group switch">
|
||||||
<div
|
<div
|
||||||
className={`custom-control custom-switch ${
|
className={`custom-control custom-switch ${
|
||||||
!helpText ? "custom-control-inline" : ""
|
!helpText ? "custom-control-inline" : ""
|
||||||
|
|
|
@ -11,7 +11,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
|
||||||
Radios set label
|
Radios set label
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-radio custom-control-inline"
|
class="custom-control custom-radio"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
checked=""
|
checked=""
|
||||||
|
@ -29,7 +29,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-radio custom-control-inline"
|
class="custom-control custom-radio"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="custom-control-input"
|
class="custom-control-input"
|
||||||
|
@ -46,7 +46,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-radio custom-control-inline"
|
class="custom-control custom-radio"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="custom-control-input"
|
class="custom-control-input"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exports[`<Switch/> Render switch 1`] = `
|
exports[`<Switch/> Render switch 1`] = `
|
||||||
<div
|
<div
|
||||||
class="form-group"
|
class="form-group switch"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-switch"
|
class="custom-control custom-switch"
|
||||||
|
@ -30,7 +30,7 @@ exports[`<Switch/> Render switch 1`] = `
|
||||||
|
|
||||||
exports[`<Switch/> Render uncheked switch 1`] = `
|
exports[`<Switch/> Render uncheked switch 1`] = `
|
||||||
<div
|
<div
|
||||||
class="form-group"
|
class="form-group switch"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-switch"
|
class="custom-control custom-switch"
|
||||||
|
|
|
@ -255,7 +255,7 @@ exports[`<WiFiSettings/> Snapshot both modules disabled. 1`] = `
|
||||||
>
|
>
|
||||||
<form>
|
<form>
|
||||||
<div
|
<div
|
||||||
class="form-group"
|
class="form-group switch"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-switch custom-control-inline switch-heading"
|
class="custom-control custom-switch custom-control-inline switch-heading"
|
||||||
|
@ -277,7 +277,7 @@ exports[`<WiFiSettings/> Snapshot both modules disabled. 1`] = `
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div
|
<div
|
||||||
class="form-group"
|
class="form-group switch"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="custom-control custom-switch custom-control-inline switch-heading"
|
class="custom-control custom-switch custom-control-inline switch-heading"
|
||||||
|
@ -423,7 +423,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ </div>
|
+ </div>
|
||||||
<hr />
|
<hr />
|
||||||
<div
|
<div
|
||||||
class=\\"form-group\\"
|
class=\\"form-group switch\\"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -501,10 +580,11 @@
|
@@ -501,10 +580,11 @@
|
||||||
|
@ -560,7 +560,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ GHz
|
+ GHz
|
||||||
+ </label>
|
+ </label>
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"custom-control custom-radio custom-control-inline\\"
|
+ class=\\"custom-control custom-radio\\"
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ class=\\"custom-control-input\\"
|
+ class=\\"custom-control-input\\"
|
||||||
|
@ -577,7 +577,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ </label>
|
+ </label>
|
||||||
+ </div>
|
+ </div>
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"custom-control custom-radio custom-control-inline\\"
|
+ class=\\"custom-control custom-radio\\"
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ checked=\\"\\"
|
+ checked=\\"\\"
|
||||||
|
@ -876,7 +876,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ </select>
|
+ </select>
|
||||||
+ </div>
|
+ </div>
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"form-group\\"
|
+ class=\\"form-group switch\\"
|
||||||
+ >
|
+ >
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"custom-control custom-switch\\"
|
+ class=\\"custom-control custom-switch\\"
|
||||||
|
@ -905,7 +905,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ </div>
|
+ </div>
|
||||||
<hr />
|
<hr />
|
||||||
<div
|
<div
|
||||||
class=\\"form-group\\"
|
class=\\"form-group switch\\"
|
||||||
>
|
>
|
||||||
<div"
|
<div"
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user