@ssa-ui-kit/core 2.10.0 → 2.11.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.
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/RadioBase.d.ts +2 -0
- package/dist/components/Radio/types.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/types.d.ts +2 -2
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RadioProps } from './types';
|
|
2
|
-
declare const Radio: ({ id, name, value, isChecked, isDisabled, isRequired,
|
|
2
|
+
declare const Radio: ({ id, name, value, isChecked, isDisabled, isRequired, text, colors, className, onChange, }: RadioProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Radio;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RadioGroupProps } from './types';
|
|
2
|
-
declare const RadioGroup: ({ name, isRequired,
|
|
2
|
+
declare const RadioGroup: ({ name, isRequired, externalState, onChange, children, className, }: RadioGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default RadioGroup;
|
|
@@ -2,8 +2,8 @@ import { RadioProps } from '../Radio/types';
|
|
|
2
2
|
export interface RadioGroupProps {
|
|
3
3
|
name: string;
|
|
4
4
|
isRequired?: boolean;
|
|
5
|
-
|
|
5
|
+
externalState?: string | number;
|
|
6
6
|
className?: string;
|
|
7
|
-
onChange: (value: string) => void;
|
|
7
|
+
onChange: (value: string | number) => void;
|
|
8
8
|
children?: React.ReactElement<RadioProps>[] | React.ReactElement<RadioProps>;
|
|
9
9
|
}
|
package/dist/index.js
CHANGED
|
@@ -4363,8 +4363,9 @@ const FormHelperText = ({
|
|
|
4363
4363
|
const RadioBase = /*#__PURE__*/base_default()(Label_Label, true ? {
|
|
4364
4364
|
target: "efp6u1p0"
|
|
4365
4365
|
} : 0)("display:inline-flex;flex-grow:0;align-items:center;cursor:pointer;gap:5px;&:has(input:disabled){cursor:default;}input:focus+svg{filter:drop-shadow(\n ", ({
|
|
4366
|
-
theme
|
|
4367
|
-
|
|
4366
|
+
theme,
|
|
4367
|
+
focusShadowColor
|
|
4368
|
+
}) => `-4px 4px 10px ${focusShadowColor || theme.colors.green40}`, "\n );}input{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}span{font-size:14px;font-weight:100;}" + ( true ? "" : 0));
|
|
4368
4369
|
;// ./src/components/Radio/Radio.tsx
|
|
4369
4370
|
|
|
4370
4371
|
|
|
@@ -4378,17 +4379,22 @@ const Radio = ({
|
|
|
4378
4379
|
isChecked,
|
|
4379
4380
|
isDisabled,
|
|
4380
4381
|
isRequired,
|
|
4381
|
-
onChange,
|
|
4382
4382
|
text,
|
|
4383
|
-
|
|
4383
|
+
colors,
|
|
4384
|
+
className,
|
|
4385
|
+
onChange
|
|
4384
4386
|
}) => {
|
|
4385
4387
|
const theme = (0,react_namespaceObject.useTheme)();
|
|
4386
4388
|
const autoGenId = (0,external_react_namespaceObject.useId)();
|
|
4387
4389
|
const [isHovered, setIsHovered] = (0,external_react_namespaceObject.useState)(false);
|
|
4388
4390
|
const radioId = id || autoGenId;
|
|
4391
|
+
const disabledColor = colors?.disabled || theme.colors.greyFocused40;
|
|
4392
|
+
const hoveredColor = colors?.hovered || theme.colors.green60;
|
|
4393
|
+
const defaultColor = colors?.default || theme.colors.green;
|
|
4389
4394
|
return (0,jsx_runtime_namespaceObject.jsxs)(RadioBase, {
|
|
4390
4395
|
htmlFor: radioId,
|
|
4391
4396
|
className: className,
|
|
4397
|
+
focusShadowColor: colors?.focusShadow,
|
|
4392
4398
|
onMouseEnter: () => setIsHovered(true),
|
|
4393
4399
|
onMouseLeave: () => setIsHovered(false),
|
|
4394
4400
|
children: [(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
@@ -4403,7 +4409,7 @@ const Radio = ({
|
|
|
4403
4409
|
}), (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
4404
4410
|
name: isChecked ? 'radio-on' : 'circle',
|
|
4405
4411
|
size: 20,
|
|
4406
|
-
color:
|
|
4412
|
+
color: isDisabled ? disabledColor : isHovered ? hoveredColor : defaultColor
|
|
4407
4413
|
}), text ? (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
4408
4414
|
"data-testid": id,
|
|
4409
4415
|
children: text
|
|
@@ -4424,12 +4430,15 @@ const RadioGroupBase = /*#__PURE__*/base_default()("div", true ? {
|
|
|
4424
4430
|
const RadioGroup = ({
|
|
4425
4431
|
name,
|
|
4426
4432
|
isRequired,
|
|
4427
|
-
|
|
4433
|
+
externalState,
|
|
4428
4434
|
onChange,
|
|
4429
4435
|
children,
|
|
4430
4436
|
className
|
|
4431
4437
|
}) => {
|
|
4432
|
-
const [activeValue, setActiveValue] = (0,external_react_namespaceObject.useState)(
|
|
4438
|
+
const [activeValue, setActiveValue] = (0,external_react_namespaceObject.useState)(externalState);
|
|
4439
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
4440
|
+
setActiveValue(externalState);
|
|
4441
|
+
}, [externalState]);
|
|
4433
4442
|
const onRadioValueChange = value => {
|
|
4434
4443
|
setActiveValue(value);
|
|
4435
4444
|
onChange(value);
|
|
@@ -18618,7 +18627,7 @@ const RadioWidget = props => {
|
|
|
18618
18627
|
return (0,jsx_runtime_namespaceObject.jsx)(RadioGroup_RadioGroup, {
|
|
18619
18628
|
name: name,
|
|
18620
18629
|
onChange: handleChange,
|
|
18621
|
-
|
|
18630
|
+
externalState: selectedIndex,
|
|
18622
18631
|
isRequired: required,
|
|
18623
18632
|
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
18624
18633
|
[`> label`]: {
|