@luscii-healthtech/web-ui 59.2.0 → 60.0.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/esm/components/Radio/LabeledRadio.js +11 -5
- package/dist/esm/components/Radio/LabeledRadio.js.map +1 -1
- package/dist/index.development.js +11 -5
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/Radio/LabeledRadio.d.ts +14 -4
- package/dist/src/generated/components/Radio/LabeledRadio.d.ts +14 -4
- package/dist/stories/LabeledRadio.stories.d.ts +4 -0
- package/package.json +1 -1
|
@@ -8,19 +8,25 @@ import { HelperAndErrorText } from '../forms/shared/HelperAndErrorText.js';
|
|
|
8
8
|
import { LabelText } from '../forms/shared/LabelText.js';
|
|
9
9
|
import { StyledRadio } from './StyledRadio.js';
|
|
10
10
|
|
|
11
|
+
const RADIO_COLUMN_CLASS_NAME = "ui:w-4";
|
|
12
|
+
const RADIO_COLUMN_GAP = "m";
|
|
11
13
|
const LabeledRadio = React__default.forwardRef((props, ref) => {
|
|
12
14
|
const { children, label, helperText, errorText, className, inputClassName } = props, attributes = __rest(props, ["children", "label", "helperText", "errorText", "className", "inputClassName"]);
|
|
13
15
|
const { id, disabled } = attributes;
|
|
14
16
|
const semanticId = React__default.useId();
|
|
15
|
-
return
|
|
17
|
+
return (
|
|
18
|
+
// Always rendered, so toggling `children` doesn't remount the radio (and lose its focus or state).
|
|
19
|
+
// Without children it has no effect on the layout.
|
|
20
|
+
jsxs("div", { className: children ? "ui:flex ui:flex-col ui:items-start ui:gap-f_s" : "ui:contents", children: [jsxs(Stack, { as: "label", axis: "x", _gap: RADIO_COLUMN_GAP, htmlFor: id, className: classNames("ui:radio-form-field-label", className), children: [jsxs("div", { className: "ui:relative ui:flex ui:flex-row ui:items-center ui:self-start", children: [jsx(Text, { "aria-hidden": true, className: classNames(RADIO_COLUMN_CLASS_NAME, "ui:opacity-0"), children: "CENTER" }), jsx("div", { className: "ui:absolute", children: jsx(StyledRadio, Object.assign({ "aria-describedby": semanticId }, attributes, { ref, className: inputClassName })) })] }), jsxs("div", { children: [jsx(RadioLabel, { label, disabled }), jsx(HelperAndErrorText, { helperText, errorText, describingId: semanticId })] })] }), children ? jsxs(Stack, { axis: "x", _gap: RADIO_COLUMN_GAP, className: "ui:self-stretch", children: [jsx("div", { className: classNames(RADIO_COLUMN_CLASS_NAME, "ui:shrink-0") }), jsx("div", { className: "ui:min-w-0 ui:flex-1", children })] }) : null] })
|
|
21
|
+
);
|
|
16
22
|
});
|
|
17
23
|
function RadioLabel(props) {
|
|
18
|
-
const {
|
|
19
|
-
if (!label
|
|
24
|
+
const { label, disabled } = props;
|
|
25
|
+
if (!label) {
|
|
20
26
|
return null;
|
|
21
27
|
}
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
28
|
+
if (typeof label !== "string" && typeof label !== "number") {
|
|
29
|
+
return label;
|
|
24
30
|
}
|
|
25
31
|
return jsx(LabelText, { color: disabled ? "slate-500" : void 0, children: label });
|
|
26
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabeledRadio.js","sources":["../../../../../../src/components/Radio/LabeledRadio.tsx"],"sourcesContent":[null],"names":["React","_jsxs","_jsx"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"LabeledRadio.js","sources":["../../../../../../src/components/Radio/LabeledRadio.tsx"],"sourcesContent":[null],"names":["React","_jsxs","_jsx"],"mappings":";;;;;;;;;;AAkEA,MAAM,uBAAA,GAA0B,QAAA;AAChC,MAAM,gBAAA,GAAmB,GAAA;AAsBlB,MAAM,YAAA,GAAeA,cAAA,CAAM,UAAA,CAChC,CAAC,OAAO,GAAA,KAAO;AACb,EAAA,MAAM,EACJ,QAAA,EACA,KAAA,EACA,YACA,SAAA,EACA,SAAA,EACA,gBAAc,GAEZ,KAAA,EADC,oBACD,KAAA,EARE,CAAA,UAAA,EAAA,OAAA,E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U,iBAAA,EAAiB,QAAA,EAAA,CAEjEC,GAAA,UACE,SAAA,EAAW,WAAW,uBAAA,EAAyB,aAAa,CAAA,EAAC,CAAA,EAE/DA,GAAA,CAAA,KAAA,EAAA,EAAK,WAAU,sBAAA,YAAgC,CAAO,CAAA,EAAA,CAAA,GAEtD,IAAI,GAAA;AAAA;AAGd,CAAC;AAQH,SAAS,WAAW,KAAA,EAAsB;AACxC,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAQ,GAAK,KAAA;AAE5B,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,OAAO,UAAU,QAAA,EAAU;AAC1D,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OACEA,GAAA,CAAC,aAAU,KAAA,EAAO,WAAW,WAAA,GAAc,MAAA,YAAY,KAAA,EAAK,CAAA;AAEhE;;"}
|
|
@@ -2286,19 +2286,25 @@ const StyledRadio = React__namespace.default.forwardRef((props, ref) => {
|
|
|
2286
2286
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("input", Object.assign({ type: "radio" }, attributes, { className: classNames__default.default("ui:appearance-none ui:w-4 ui:h-4 ui:rounded-full ui:border ui:border-slate-300 ui:bg-white", "ui:checked:grid ui:checked:place-content-center ui:checked:before:scale-[1] ui:checked:bg-primary ui:checked:border-primary", "ui:transition-colors ui:duration-100 ui:ease-in-out", "ui:before:content-[' '] ui:before:w-1.5 ui:before:h-1.5 ui:before:bg-white ui:before:rounded ui:before:scale-[0]", "ui:before:transition-transform ui:before:duration-200 ui:before:ease-[cubic-bezier(.47,.34,.52,1.39)]", className), ref })) });
|
|
2287
2287
|
});
|
|
2288
2288
|
|
|
2289
|
+
const RADIO_COLUMN_CLASS_NAME = "ui:w-4";
|
|
2290
|
+
const RADIO_COLUMN_GAP = "m";
|
|
2289
2291
|
const LabeledRadio = React__namespace.default.forwardRef((props, ref) => {
|
|
2290
2292
|
const { children, label, helperText, errorText, className, inputClassName } = props, attributes = __rest(props, ["children", "label", "helperText", "errorText", "className", "inputClassName"]);
|
|
2291
2293
|
const { id, disabled } = attributes;
|
|
2292
2294
|
const semanticId = React__namespace.default.useId();
|
|
2293
|
-
return
|
|
2295
|
+
return (
|
|
2296
|
+
// Always rendered, so toggling `children` doesn't remount the radio (and lose its focus or state).
|
|
2297
|
+
// Without children it has no effect on the layout.
|
|
2298
|
+
jsxRuntime.jsxs("div", { className: children ? "ui:flex ui:flex-col ui:items-start ui:gap-f_s" : "ui:contents", children: [jsxRuntime.jsxs(Stack, { as: "label", axis: "x", _gap: RADIO_COLUMN_GAP, htmlFor: id, className: classNames__default.default("ui:radio-form-field-label", className), children: [jsxRuntime.jsxs("div", { className: "ui:relative ui:flex ui:flex-row ui:items-center ui:self-start", children: [jsxRuntime.jsx(Text, { "aria-hidden": true, className: classNames__default.default(RADIO_COLUMN_CLASS_NAME, "ui:opacity-0"), children: "CENTER" }), jsxRuntime.jsx("div", { className: "ui:absolute", children: jsxRuntime.jsx(StyledRadio, Object.assign({ "aria-describedby": semanticId }, attributes, { ref, className: inputClassName })) })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(RadioLabel, { label, disabled }), jsxRuntime.jsx(HelperAndErrorText, { helperText, errorText, describingId: semanticId })] })] }), children ? jsxRuntime.jsxs(Stack, { axis: "x", _gap: RADIO_COLUMN_GAP, className: "ui:self-stretch", children: [jsxRuntime.jsx("div", { className: classNames__default.default(RADIO_COLUMN_CLASS_NAME, "ui:shrink-0") }), jsxRuntime.jsx("div", { className: "ui:min-w-0 ui:flex-1", children })] }) : null] })
|
|
2299
|
+
);
|
|
2294
2300
|
});
|
|
2295
2301
|
function RadioLabel(props) {
|
|
2296
|
-
const {
|
|
2297
|
-
if (!label
|
|
2302
|
+
const { label, disabled } = props;
|
|
2303
|
+
if (!label) {
|
|
2298
2304
|
return null;
|
|
2299
2305
|
}
|
|
2300
|
-
if (
|
|
2301
|
-
return
|
|
2306
|
+
if (typeof label !== "string" && typeof label !== "number") {
|
|
2307
|
+
return label;
|
|
2302
2308
|
}
|
|
2303
2309
|
return jsxRuntime.jsx(LabelText, { color: disabled ? "slate-500" : void 0, children: label });
|
|
2304
2310
|
}
|