@aristobyte-ui/radio 2.1.8 → 2.2.0

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.
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Radio = void 0;
37
- var React = __importStar(require("react"));
38
- require("./Radio.scss");
39
- var Radio = function (_a) {
40
- var children = _a.children, value = _a.value, checked = _a.checked, name = _a.name, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.highlightLabel, highlightLabel = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.variant, variant = _e === void 0 ? 'default' : _e, _f = _a.appearance, appearance = _f === void 0 ? 'default' : _f, _g = _a.alignLabel, alignLabel = _g === void 0 ? 'right' : _g, onChange = _a.onChange, _h = _a.className, className = _h === void 0 ? '' : _h, _j = _a.style, style = _j === void 0 ? {} : _j;
41
- var handleChange = function () {
42
- if (!disabled && onChange) {
43
- onChange(value);
44
- }
45
- };
46
- return (React.createElement("label", { className: "radio ".concat("radio-align-label--".concat(alignLabel), " ").concat("radio-appearance--".concat(appearance), " ").concat("radio-variant--".concat(variant), " ").concat("radio-size--".concat(size), " ").concat(disabled ? 'radio--disabled' : '', " ").concat(className), style: style },
47
- React.createElement("input", { type: "radio", name: name, value: value, checked: checked, disabled: disabled, onChange: handleChange, className: "radio__input" }),
48
- React.createElement("span", { className: "radio__control" }),
49
- children && (React.createElement("span", { className: "radio__label ".concat(highlightLabel ? 'radio__label--highlight-label' : '') }, children))));
50
- };
51
- exports.Radio = Radio;
@@ -1,15 +0,0 @@
1
- @use '@aristobyte-ui/utils/aristobyte-ui.settings' as *;
2
-
3
- .radio-group {
4
- display: flex;
5
- gap: 20px;
6
- min-width: max-content;
7
-
8
- &--horizontal {
9
- flex-direction: row;
10
- }
11
-
12
- &--vertical {
13
- flex-direction: column;
14
- }
15
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
- var __read = (this && this.__read) || function (o, n) {
48
- var m = typeof Symbol === "function" && o[Symbol.iterator];
49
- if (!m) return o;
50
- var i = m.call(o), r, ar = [], e;
51
- try {
52
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
- }
54
- catch (error) { e = { error: error }; }
55
- finally {
56
- try {
57
- if (r && !r.done && (m = i["return"])) m.call(i);
58
- }
59
- finally { if (e) throw e.error; }
60
- }
61
- return ar;
62
- };
63
- Object.defineProperty(exports, "__esModule", { value: true });
64
- exports.RadioGroup = void 0;
65
- var React = __importStar(require("react"));
66
- var Radio_1 = require("../Radio");
67
- require("./RadioGroup.scss");
68
- var RadioGroup = function (_a) {
69
- var name = _a.name, value = _a.value, onChange = _a.onChange, children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.highlightLabel, highlightLabel = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.variant, variant = _e === void 0 ? 'default' : _e, _f = _a.appearance, appearance = _f === void 0 ? 'outline' : _f, _g = _a.align, align = _g === void 0 ? 'horizontal' : _g, _h = _a.alignLabel, alignLabel = _h === void 0 ? 'right' : _h, _j = _a.className, className = _j === void 0 ? '' : _j, _k = _a.style, style = _k === void 0 ? {} : _k;
70
- var uniqueId = React.useId();
71
- var _l = __read(React.useState(value), 2), currentValue = _l[0], setCurrentValue = _l[1];
72
- var radios = React.Children.toArray(children).filter(function (child) { return React.isValidElement(child) && child.type === Radio_1.Radio; });
73
- var handleChange = function (currentRadioValue) {
74
- if (onChange) {
75
- onChange(currentRadioValue);
76
- }
77
- setCurrentValue(currentRadioValue);
78
- };
79
- return (React.createElement("div", { key: uniqueId, className: "radio-group ".concat("radio-group--".concat(align), " ").concat(className), style: style }, radios.map(function (_a) {
80
- var _b, _c, _d, _e, _f, _g;
81
- var props = _a.props;
82
- return (React.createElement(Radio_1.Radio, __assign({}, props, { key: "".concat(name, "-").concat(props.value, "-").concat(uniqueId), name: "".concat(name, "-").concat(props.value, "-").concat(uniqueId), checked: props.value === currentValue, onChange: function () { return handleChange(props.value); }, disabled: (_b = props.disabled) !== null && _b !== void 0 ? _b : disabled, size: (_c = props.size) !== null && _c !== void 0 ? _c : size, variant: (_d = props.variant) !== null && _d !== void 0 ? _d : variant, appearance: (_e = props.appearance) !== null && _e !== void 0 ? _e : appearance, highlightLabel: (_f = props.highlightLabel) !== null && _f !== void 0 ? _f : highlightLabel, alignLabel: (_g = props.alignLabel) !== null && _g !== void 0 ? _g : alignLabel })));
83
- })));
84
- };
85
- exports.RadioGroup = RadioGroup;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Radio"), exports);
18
- __exportStar(require("./RadioGroup"), exports);
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components"), exports);