@luscii-healthtech/web-ui 44.0.1 → 44.1.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.
@@ -2420,6 +2420,69 @@ 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: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 LabeledCheckbox = React__namespace.default.forwardRef((props, ref) => {
2461
+ const { children, label, helperText, errorText, className, inputClassName } = props, attributes = __rest(props, ["children", "label", "helperText", "errorText", "className", "inputClassName"]);
2462
+ const { id, disabled } = attributes;
2463
+ const semanticId = React__namespace.default.useId();
2464
+ return jsxRuntime.jsxs(Stack, { as: "label", axis: "x", gap: "xs", htmlFor: id, className: classNames__default.default("ui:cursor-pointer", {
2465
+ "ui:cursor-not-allowed": disabled
2466
+ }, className), children: [jsxRuntime.jsx("div", { className: "ui:flex ui:flex-row", 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(
2467
+ /**
2468
+ * Need a slight top margin to align with the checkbox indicator (height 24px). On
2469
+ * small screens the text is larger (line-height: 24px). That matches the indicator
2470
+ * height exactly, so no margin is needed there. On larger screens the line-height
2471
+ * is 20px, so we add a small margin-top to center the first line of text to the indicator.
2472
+ */
2473
+ "ui:sm:mt-[2px]",
2474
+ {
2475
+ "ui:text-text-neutral-secondary-disabled": disabled
2476
+ }
2477
+ ), children: children || label }), jsxRuntime.jsx(HelperAndErrorText, { helperText, errorText, describingId: semanticId })] })] });
2478
+ });
2479
+
2480
+ const LabeledCheckboxGroup = (props) => {
2481
+ const { children, title, className } = props;
2482
+ const semanticId = React__namespace.default.useId();
2483
+ 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 })] });
2484
+ };
2485
+
2423
2486
  const Chip = ({ accessory, leadingIcon, onClick, text }) => {
2424
2487
  return jsxRuntime.jsx(SecondaryButton, { className: "ui:bg-transparent! ui:px-s! ui:radius-xxxxs!", onClick, leadingIcon, trailingIcon: accessory, children: text });
2425
2488
  };
@@ -2469,14 +2532,6 @@ const NotificationBanner = (_a) => {
2469
2532
  }), "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
2533
  };
2471
2534
 
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
2535
  const StyledRadio = React__namespace.default.forwardRef((props, ref) => {
2481
2536
  const { className } = props, attributes = __rest(props, ["className"]);
2482
2537
  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 +3153,6 @@ const FlyOutMenu = {
3098
3153
  ChildrenItem: FlyOutMenuChildrenItem
3099
3154
  };
3100
3155
 
3101
- const LabelText = (props) => {
3102
- return jsxRuntime.jsx(Text, Object.assign({}, props));
3103
- };
3104
-
3105
3156
  const LabeledDatePicker = (_a) => {
3106
3157
  var { className: classNameFromProps, label, helperText, errorText } = _a, props = __rest(_a, ["className", "label", "helperText", "errorText"]);
3107
3158
  const helperErrorTextId = React__namespace.default.useId();
@@ -6526,6 +6577,8 @@ exports.InfoIcon = InfoIcon;
6526
6577
  exports.Input = Input;
6527
6578
  exports.InputSelect = InputSelectWithSubComponents;
6528
6579
  exports.LabelText = LabelText;
6580
+ exports.LabeledCheckbox = LabeledCheckbox;
6581
+ exports.LabeledCheckboxGroup = LabeledCheckboxGroup;
6529
6582
  exports.LabeledDatePicker = LabeledDatePicker;
6530
6583
  exports.LabeledInput = LabeledInput;
6531
6584
  exports.LabeledRadio = LabeledRadio;