@luscii-healthtech/web-ui 44.0.1 → 44.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.
- package/dist/index.development.js +107 -12
- 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/Checkbox/Checkbox.d.ts +13 -0
- package/dist/src/components/Checkbox/LabeledCheckbox.d.ts +75 -0
- package/dist/src/components/Checkbox/LabeledCheckboxCardGroup.d.ts +26 -0
- package/dist/src/components/Checkbox/LabeledCheckboxGroup.d.ts +23 -0
- package/dist/src/components/Checkbox/StyledCheckbox.d.ts +4 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/stories/LabeledCheckbox.stories.d.ts +36 -0
- package/dist/web-ui-tailwind.css +201 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -2420,6 +2420,109 @@ function Label(props) {
|
|
|
2420
2420
|
}
|
|
2421
2421
|
const Checkbox = React__namespace.default.forwardRef((props, ref) => jsxRuntime.jsx(CheckboxInner, Object.assign({}, props, { innerRef: ref })));
|
|
2422
2422
|
|
|
2423
|
+
const HelperAndErrorText = (props) => {
|
|
2424
|
+
const showHelperText = Boolean(props.helperText) && !props.errorText;
|
|
2425
|
+
if (showHelperText) {
|
|
2426
|
+
return jsxRuntime.jsx(Box, { id: props.describingId, children: jsxRuntime.jsx(Text, { variant: "sm", color: "slate-500", children: props.helperText }) });
|
|
2427
|
+
}
|
|
2428
|
+
return jsxRuntime.jsx(Box, { id: props.describingId, children: props.errorText && jsxRuntime.jsx(Text, { variant: "sm", color: "red", children: props.errorText }) });
|
|
2429
|
+
};
|
|
2430
|
+
|
|
2431
|
+
const LabelText = (props) => {
|
|
2432
|
+
return jsxRuntime.jsx(Text, Object.assign({}, props));
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2435
|
+
const StyledCheckbox = React__namespace.default.forwardRef((props, ref) => {
|
|
2436
|
+
const { className } = props, attributes = __rest(props, ["className"]);
|
|
2437
|
+
return jsxRuntime.jsx("input", Object.assign({ ref, type: "checkbox" }, attributes, { className: classNames__default.default(
|
|
2438
|
+
"ui:block ui:appearance-none ui:w-6 ui:h-6 ui:rounded",
|
|
2439
|
+
"ui:cursor-pointer ui:disabled:cursor-not-allowed",
|
|
2440
|
+
// Default styles
|
|
2441
|
+
"ui:border ui:border-border-neutral-primary-default ui:bg-white",
|
|
2442
|
+
// Hovered styles
|
|
2443
|
+
"ui:hover:border-border-neutral-primary-hovered",
|
|
2444
|
+
// Checked styles
|
|
2445
|
+
"ui:checked:bg-icon-brand-primary-default ui:checked:border-border-brand-primary-default ui:checked:before:scale-[1]",
|
|
2446
|
+
// Disabled styles
|
|
2447
|
+
"ui:disabled:border-border-neutral-primary-disabled",
|
|
2448
|
+
// Disabled and checked styles
|
|
2449
|
+
"ui:disabled:checked:bg-background-brand-primary-disabled",
|
|
2450
|
+
// Checked and hovered styles
|
|
2451
|
+
"ui:checked:hover:bg-icon-brand-primary-hover",
|
|
2452
|
+
"ui:transition-colors ui:duration-150 ui:ease-in-out",
|
|
2453
|
+
"ui:before:content-[''] ui:before:block ui:before:w-full ui:before:h-full",
|
|
2454
|
+
"ui:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M13.0421%200.43918C13.3233%200.720471%2013.4812%201.10193%2013.4812%201.49968C13.4812%201.89743%2013.3233%202.27889%2013.0421%202.56018L5.54207%2010.0602C5.26078%2010.3414%204.87931%2010.4994%204.48157%2010.4994C4.08382%2010.4994%203.70236%2010.3414%203.42107%2010.0602L0.421068%207.06018C0.147831%206.77728%20-0.00336092%206.39837%205.6704e-05%206.00508C0.00347433%205.61178%200.161228%205.23556%200.43934%204.95745C0.717452%204.67934%201.09367%204.52159%201.48697%204.51817C1.88026%204.51475%202.25916%204.66594%202.54207%204.93918L4.48157%206.87868L10.9211%200.43918C11.2024%200.157973%2011.5838%200%2011.9816%200C12.3793%200%2012.7608%200.157973%2013.0421%200.43918Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:before:bg-center ui:before:bg-no-repeat",
|
|
2455
|
+
"ui:before:scale-[0] ui:before:transition-[scale] ui:before:duration-200 ui:before:ease-[cubic-bezier(.17,.67,.16,1.5)]",
|
|
2456
|
+
className
|
|
2457
|
+
) }));
|
|
2458
|
+
});
|
|
2459
|
+
|
|
2460
|
+
const LabeledCheckboxBase = React__namespace.default.forwardRef((props, ref) => {
|
|
2461
|
+
const { variant = "regular", children, label, helperText, errorText, className, inputClassName, aside } = props, attributes = __rest(props, ["variant", "children", "label", "helperText", "errorText", "className", "inputClassName", "aside"]);
|
|
2462
|
+
const { id, disabled } = attributes;
|
|
2463
|
+
const semanticId = React__namespace.default.useId();
|
|
2464
|
+
const isCard = variant === "card";
|
|
2465
|
+
return jsxRuntime.jsxs(Stack, { as: "label", axis: "x", gap: "xs", htmlFor: id, className: classNames__default.default(
|
|
2466
|
+
"ui:cursor-pointer",
|
|
2467
|
+
{
|
|
2468
|
+
"ui:cursor-not-allowed": disabled
|
|
2469
|
+
},
|
|
2470
|
+
/**
|
|
2471
|
+
* Card styles
|
|
2472
|
+
*/
|
|
2473
|
+
{
|
|
2474
|
+
"ui:p-m ui:radius-xxs ui:transition-shadow": isCard,
|
|
2475
|
+
// Default styles
|
|
2476
|
+
"ui:ring ui:ring:1 ui:ring-border-neutral-primary-default ui:bg-white": isCard,
|
|
2477
|
+
// Hovered styles
|
|
2478
|
+
"ui:hover:ring-border-neutral-primary-hovered": isCard,
|
|
2479
|
+
// Checked styles
|
|
2480
|
+
"ui:has-checked:not-has-disabled:bg-background-neutral-secondary-hovered ui:has-checked:ring-border-brand-primary-default ui:has-checked:not-has-disabled:ring-2 ui:ring-border-brand-primary-default": isCard,
|
|
2481
|
+
// Disabled styles
|
|
2482
|
+
"ui:has-disabled:ring-border-neutral-primary-disabled": isCard,
|
|
2483
|
+
// Disabled and checked styles
|
|
2484
|
+
"ui:has-disabled:checked:bg-background-brand-primary-disabled": isCard,
|
|
2485
|
+
// Checked and hovered styles
|
|
2486
|
+
"ui:has-checked:not-has-disabled:bg-background-neutral-secondary-hovered ui:has-checked:not-has-disabled:ring-2 ui:hover:has-checked:not-has-disabled:ring-border-brand-primary-hovered": isCard
|
|
2487
|
+
},
|
|
2488
|
+
className
|
|
2489
|
+
), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(StyledCheckbox, Object.assign({ "aria-describedby": semanticId }, attributes, { ref, className: inputClassName })) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(LabelText, { className: classNames__default.default(
|
|
2490
|
+
/**
|
|
2491
|
+
* Need a slight top margin to align with the checkbox indicator (height 24px). On
|
|
2492
|
+
* small screens the text is larger (line-height: 24px). That matches the indicator
|
|
2493
|
+
* height exactly, so no margin is needed there. On larger screens the line-height
|
|
2494
|
+
* is 20px, so we add a small margin-top to center the first line of text to the indicator.
|
|
2495
|
+
*/
|
|
2496
|
+
"ui:sm:mt-[2px]",
|
|
2497
|
+
{
|
|
2498
|
+
"ui:text-text-neutral-secondary-disabled": disabled
|
|
2499
|
+
}
|
|
2500
|
+
), children: children || label }), jsxRuntime.jsx(HelperAndErrorText, { helperText, errorText, describingId: semanticId })] }), aside && jsxRuntime.jsx("div", { className: "ui:ml-auto ui:flex-shrink-0", children: aside })] });
|
|
2501
|
+
});
|
|
2502
|
+
const LabeledCheckbox = React__namespace.default.forwardRef((props, ref) => {
|
|
2503
|
+
return jsxRuntime.jsx(LabeledCheckboxBase, Object.assign({}, props, { ref, variant: "regular" }));
|
|
2504
|
+
});
|
|
2505
|
+
const LabeledCheckboxCard = React__namespace.default.forwardRef((props, ref) => {
|
|
2506
|
+
return jsxRuntime.jsx(LabeledCheckboxBase, Object.assign({}, props, { ref, variant: "card" }));
|
|
2507
|
+
});
|
|
2508
|
+
|
|
2509
|
+
const LabeledCheckboxGroup = (props) => {
|
|
2510
|
+
const { children, title, className } = props;
|
|
2511
|
+
const semanticId = React__namespace.default.useId();
|
|
2512
|
+
return jsxRuntime.jsxs(Stack, { as: "fieldset", "aria-describedby": semanticId, className: classNames__default.default(className), gap: "xxs", children: [title && jsxRuntime.jsx("legend", { className: "ui:contents", children: jsxRuntime.jsx(Text, { children: title }) }), jsxRuntime.jsx(Stack, { gap: "m", children }), jsxRuntime.jsx(HelperAndErrorText, { helperText: props.helperText, errorText: props.errorText, describingId: semanticId })] });
|
|
2513
|
+
};
|
|
2514
|
+
|
|
2515
|
+
const LabeledCheckboxCardGroup = (props) => {
|
|
2516
|
+
const { children, title, className, columns = 2, helperText, errorText } = props, attributes = __rest(props, ["children", "title", "className", "columns", "helperText", "errorText"]);
|
|
2517
|
+
const semanticId = React__namespace.default.useId();
|
|
2518
|
+
return jsxRuntime.jsxs(Stack, Object.assign({ as: "fieldset", "aria-describedby": semanticId, className, gap: "xxs" }, attributes, { children: [title && jsxRuntime.jsx("legend", { className: "ui:contents", children: jsxRuntime.jsx(Text, { children: title }) }), jsxRuntime.jsx("div", { className: classNames__default.default("ui:grid ui:gap-x-m ui:gap-y-xs ui:items-start", {
|
|
2519
|
+
"ui:grid-cols-1": columns === 1,
|
|
2520
|
+
"ui:grid-cols-2": columns === 2,
|
|
2521
|
+
"ui:grid-cols-3": columns === 3,
|
|
2522
|
+
"ui:grid-cols-4": columns === 4
|
|
2523
|
+
}), children }), jsxRuntime.jsx(HelperAndErrorText, { helperText, errorText, describingId: semanticId })] }));
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2423
2526
|
const Chip = ({ accessory, leadingIcon, onClick, text }) => {
|
|
2424
2527
|
return jsxRuntime.jsx(SecondaryButton, { className: "ui:bg-transparent! ui:px-s! ui:radius-xxxxs!", onClick, leadingIcon, trailingIcon: accessory, children: text });
|
|
2425
2528
|
};
|
|
@@ -2469,14 +2572,6 @@ const NotificationBanner = (_a) => {
|
|
|
2469
2572
|
}), "data-test-id": "notification-text", color: colour, children: text }), linkProps && jsxRuntime.jsx(Link, { "data-test-id": "notification-text-link", "aria-disabled": !linkProps.enabled, rel: "noopener", target: "_blank", onClick: linkProps.handleClick, children: linkProps.text })] })] })] }));
|
|
2470
2573
|
};
|
|
2471
2574
|
|
|
2472
|
-
const HelperAndErrorText = (props) => {
|
|
2473
|
-
const showHelperText = Boolean(props.helperText) && !props.errorText;
|
|
2474
|
-
if (showHelperText) {
|
|
2475
|
-
return jsxRuntime.jsx(Box, { id: props.describingId, children: jsxRuntime.jsx(Text, { variant: "sm", color: "slate-500", children: props.helperText }) });
|
|
2476
|
-
}
|
|
2477
|
-
return jsxRuntime.jsx(Box, { id: props.describingId, children: props.errorText && jsxRuntime.jsx(Text, { variant: "sm", color: "red", children: props.errorText }) });
|
|
2478
|
-
};
|
|
2479
|
-
|
|
2480
2575
|
const StyledRadio = React__namespace.default.forwardRef((props, ref) => {
|
|
2481
2576
|
const { className } = props, attributes = __rest(props, ["className"]);
|
|
2482
2577
|
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 })) });
|
|
@@ -3098,10 +3193,6 @@ const FlyOutMenu = {
|
|
|
3098
3193
|
ChildrenItem: FlyOutMenuChildrenItem
|
|
3099
3194
|
};
|
|
3100
3195
|
|
|
3101
|
-
const LabelText = (props) => {
|
|
3102
|
-
return jsxRuntime.jsx(Text, Object.assign({}, props));
|
|
3103
|
-
};
|
|
3104
|
-
|
|
3105
3196
|
const LabeledDatePicker = (_a) => {
|
|
3106
3197
|
var { className: classNameFromProps, label, helperText, errorText } = _a, props = __rest(_a, ["className", "label", "helperText", "errorText"]);
|
|
3107
3198
|
const helperErrorTextId = React__namespace.default.useId();
|
|
@@ -6526,6 +6617,10 @@ exports.InfoIcon = InfoIcon;
|
|
|
6526
6617
|
exports.Input = Input;
|
|
6527
6618
|
exports.InputSelect = InputSelectWithSubComponents;
|
|
6528
6619
|
exports.LabelText = LabelText;
|
|
6620
|
+
exports.LabeledCheckbox = LabeledCheckbox;
|
|
6621
|
+
exports.LabeledCheckboxCard = LabeledCheckboxCard;
|
|
6622
|
+
exports.LabeledCheckboxCardGroup = LabeledCheckboxCardGroup;
|
|
6623
|
+
exports.LabeledCheckboxGroup = LabeledCheckboxGroup;
|
|
6529
6624
|
exports.LabeledDatePicker = LabeledDatePicker;
|
|
6530
6625
|
exports.LabeledInput = LabeledInput;
|
|
6531
6626
|
exports.LabeledRadio = LabeledRadio;
|