@luscii-healthtech/web-ui 55.0.1 → 55.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.
- package/dist/index.development.js +91 -29
- 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/Select/Select.types.d.ts +39 -0
- package/dist/src/components/Select/SelectDropdownIndicator.d.ts +5 -0
- package/dist/src/components/Select/SelectMultiValueLabel.d.ts +10 -0
- package/dist/src/components/Select/SelectOption.d.ts +12 -0
- package/dist/src/components/Select/SelectOptionAvatar.d.ts +19 -0
- package/dist/src/generated/components/Select/Select.types.d.ts +39 -0
- package/dist/src/generated/components/Select/SelectDropdownIndicator.d.ts +5 -0
- package/dist/src/generated/components/Select/SelectMultiValueLabel.d.ts +10 -0
- package/dist/src/generated/components/Select/SelectOption.d.ts +12 -0
- package/dist/src/generated/components/Select/SelectOptionAvatar.d.ts +19 -0
- package/dist/src/generated/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/stories/LabeledSelectSearchable.stories.d.ts +1 -1
- package/dist/stories/Select.stories.d.ts +86 -30
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -4463,16 +4463,50 @@ function SectionItemWithContent(props) {
|
|
|
4463
4463
|
var css_248z$2 = ".customized-select [class*=MenuList] [class*=option]::after {\n position: absolute;\n content: \"\";\n background: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22%3E %3Cg transform%3D%22translate(1.5%2C 0.5)%22%3E %3Cpath fill%3D%22none%22 fill-rule%3D%22evenodd%22 stroke%3D%22%230074DD%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22 stroke-width%3D%222%22 d%3D%22M12.643 3.357L6.03 9.97l-2.674 2.674L0 9.286%22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\") no-repeat center;\n right: 12px;\n height: 1rem;\n width: 1rem;\n}";
|
|
4464
4464
|
styleInject(css_248z$2);
|
|
4465
4465
|
|
|
4466
|
-
const SelectDropdownIndicator = (props) => jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(ChevronDownIcon, {}) }));
|
|
4466
|
+
const SelectDropdownIndicator = (props) => jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: props.isMulti ? jsxRuntime.jsx(ChevronDoubleIcon, {}) : jsxRuntime.jsx(ChevronDownIcon, {}) }));
|
|
4467
4467
|
|
|
4468
4468
|
const SelectLoadingIndicator = (props) => jsxRuntime.jsx(LoadingIndicator, Object.assign({ asSpinner: true, spinnerColor: "gray" }, props.innerProps, { style: props.getStyles("loadingIndicator", props) }));
|
|
4469
4469
|
|
|
4470
|
+
const SelectOptionAvatar = ({ avatar }) => {
|
|
4471
|
+
var _a, _b;
|
|
4472
|
+
return jsxRuntime.jsx(Avatar, {
|
|
4473
|
+
size: "xsmall",
|
|
4474
|
+
color: avatar.isSelf ? "primary" : "slate",
|
|
4475
|
+
// First code point + combining marks, so a decomposed "Ángela" keeps its accent.
|
|
4476
|
+
initials: (_b = (_a = avatar.initials.trim().match(/^.\p{M}*/u)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "",
|
|
4477
|
+
src: avatar.src,
|
|
4478
|
+
alt: avatar.alt,
|
|
4479
|
+
className: "ui:shrink-0 ui:border ui:border-solid ui:border-border-neutral-secondary-default"
|
|
4480
|
+
});
|
|
4481
|
+
};
|
|
4482
|
+
|
|
4483
|
+
const SelectMultiValueLabel = (props) => {
|
|
4484
|
+
var _a;
|
|
4485
|
+
const avatar = (_a = props.data) === null || _a === void 0 ? void 0 : _a.avatar;
|
|
4486
|
+
return jsxRuntime.jsx(ReactSelect.components.MultiValueLabel, Object.assign({}, props, { children: avatar ? jsxRuntime.jsxs("span", { className: "ui:flex ui:items-center ui:gap-f_base", children: [jsxRuntime.jsx(SelectOptionAvatar, { avatar }), props.children] }) : props.children }));
|
|
4487
|
+
};
|
|
4488
|
+
|
|
4489
|
+
const SelectOption = (props) => {
|
|
4490
|
+
var _a;
|
|
4491
|
+
const avatar = (_a = props.data) === null || _a === void 0 ? void 0 : _a.avatar;
|
|
4492
|
+
return jsxRuntime.jsx(ReactSelect.components.Option, Object.assign({}, props, { children: props.isMulti && avatar ? jsxRuntime.jsxs("span", { className: "ui:flex ui:items-center ui:gap-f_base", children: [jsxRuntime.jsx(SelectOptionAvatar, { avatar }), props.children] }) : props.children }));
|
|
4493
|
+
};
|
|
4494
|
+
|
|
4495
|
+
const MULTI_FONT_SIZE = "14px";
|
|
4496
|
+
const MULTI_LINE_HEIGHT = "var(--ui-semantic-size-m, 20px)";
|
|
4497
|
+
const MULTI_MIN_HEIGHT = "44px";
|
|
4498
|
+
const RADIUS_S = "var(--ui-semantic-radius-s, 4px)";
|
|
4499
|
+
const SPACING_XS = "var(--ui-semantic-spacing-xs, 2px)";
|
|
4500
|
+
const SPACING_S = "var(--ui-semantic-spacing-s, 4px)";
|
|
4501
|
+
const SPACING_BASE = "var(--ui-semantic-spacing-base, 8px)";
|
|
4502
|
+
const SPACING_M = "var(--ui-semantic-spacing-m, 12px)";
|
|
4470
4503
|
function generateCustomStyles(hasError) {
|
|
4471
4504
|
return {
|
|
4472
4505
|
option: (baseStyles, state) => {
|
|
4473
4506
|
return Object.assign(Object.assign({}, baseStyles), {
|
|
4474
4507
|
fontWeight: state.isSelected ? "bold" : "normal",
|
|
4475
|
-
fontSize: "14px",
|
|
4508
|
+
fontSize: state.isMulti ? MULTI_FONT_SIZE : "14px",
|
|
4509
|
+
lineHeight: state.isMulti ? MULTI_LINE_HEIGHT : void 0,
|
|
4476
4510
|
// tailwind blue-50
|
|
4477
4511
|
backgroundColor: state.isFocused ? "#F2FAFD" : "none",
|
|
4478
4512
|
color: "inherit",
|
|
@@ -4496,30 +4530,55 @@ function generateCustomStyles(hasError) {
|
|
|
4496
4530
|
input: (baseStyles) => {
|
|
4497
4531
|
return Object.assign(Object.assign({}, baseStyles), { padding: 0, margin: 0 });
|
|
4498
4532
|
},
|
|
4499
|
-
multiValue: (baseStyles) => {
|
|
4533
|
+
multiValue: (baseStyles, state) => {
|
|
4534
|
+
var _a;
|
|
4535
|
+
const hasAvatar = Boolean((_a = state.data) === null || _a === void 0 ? void 0 : _a.avatar);
|
|
4500
4536
|
return Object.assign(Object.assign({}, baseStyles), {
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
borderRadius:
|
|
4504
|
-
|
|
4537
|
+
backgroundColor: hasAvatar ? "var(--ui-color-background-neutral-secondary-default, #ffffff)" : "var(--ui-color-background-info-primary-default, #d7e3fb)",
|
|
4538
|
+
border: hasAvatar ? "1px solid var(--ui-color-border-neutral-secondary-default, #cbd5e1)" : "none",
|
|
4539
|
+
borderRadius: RADIUS_S,
|
|
4540
|
+
// Clip the children so their backgrounds respect the corner radius.
|
|
4541
|
+
overflow: "hidden",
|
|
4542
|
+
margin: 0
|
|
4505
4543
|
});
|
|
4506
4544
|
},
|
|
4507
|
-
multiValueLabel: (baseStyles) => {
|
|
4545
|
+
multiValueLabel: (baseStyles, state) => {
|
|
4546
|
+
var _a;
|
|
4547
|
+
const hasAvatar = Boolean((_a = state.data) === null || _a === void 0 ? void 0 : _a.avatar);
|
|
4508
4548
|
return Object.assign(Object.assign({}, baseStyles), {
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4549
|
+
color: hasAvatar ? "var(--ui-color-text-neutral-primary-default, #162130)" : "var(--ui-color-text-info-primary-default, #112d9c)",
|
|
4550
|
+
fontSize: MULTI_FONT_SIZE,
|
|
4551
|
+
lineHeight: MULTI_LINE_HEIGHT,
|
|
4552
|
+
// Shorthand resets react-select's narrower `paddingLeft` default.
|
|
4553
|
+
// No avatar → more leading space, nothing holds the label off the edge.
|
|
4554
|
+
padding: `${SPACING_S} ${SPACING_S} ${SPACING_S} ${hasAvatar ? SPACING_BASE : SPACING_M}`
|
|
4512
4555
|
});
|
|
4513
4556
|
},
|
|
4514
|
-
multiValueRemove: (baseStyles) => {
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4557
|
+
multiValueRemove: (baseStyles, state) => {
|
|
4558
|
+
var _a;
|
|
4559
|
+
const hasAvatar = Boolean((_a = state.data) === null || _a === void 0 ? void 0 : _a.avatar);
|
|
4560
|
+
const color = hasAvatar ? "var(--ui-color-icon-brand-primary-default, #1e40af)" : "var(--ui-color-text-info-primary-default, #112d9c)";
|
|
4561
|
+
return Object.assign(Object.assign({}, baseStyles), {
|
|
4562
|
+
color,
|
|
4563
|
+
// react-select hardcodes a 14px cross here (its ClearIndicator gets 20).
|
|
4564
|
+
// Resize to the design's 20px via the SVG, and drop the vertical padding
|
|
4565
|
+
// so the button's 24px content box stays under the 28px label and the
|
|
4566
|
+
// tag height — and so the control height — is unchanged. The button is a
|
|
4567
|
+
// stretched flex child, so the hit area is still the full 28px.
|
|
4568
|
+
padding: `${SPACING_XS} ${SPACING_S}`,
|
|
4569
|
+
"& svg": { width: "20px", height: "20px" },
|
|
4570
|
+
borderRadius: 0,
|
|
4571
|
+
"&:hover": {
|
|
4572
|
+
backgroundColor: hasAvatar ? "var(--ui-color-background-neutral-primary-default, #f5f7fa)" : "var(--ui-color-background-info-primary-hovered, #b3cafc)",
|
|
4573
|
+
color
|
|
4574
|
+
}
|
|
4575
|
+
});
|
|
4520
4576
|
},
|
|
4521
|
-
valueContainer: (baseStyles) => {
|
|
4522
|
-
return Object.assign(Object.assign({}, baseStyles), {
|
|
4577
|
+
valueContainer: (baseStyles, state) => {
|
|
4578
|
+
return Object.assign(Object.assign(Object.assign({}, baseStyles), { margin: 0 }), state.isMulti ? {
|
|
4579
|
+
gap: SPACING_BASE,
|
|
4580
|
+
padding: `${SPACING_BASE} ${SPACING_BASE} ${SPACING_BASE} ${SPACING_M}`
|
|
4581
|
+
} : { padding: ".5rem" });
|
|
4523
4582
|
},
|
|
4524
4583
|
control: (baseStyles, state) => {
|
|
4525
4584
|
const navyBlue = "rgb(30 64 175)";
|
|
@@ -4533,19 +4592,20 @@ function generateCustomStyles(hasError) {
|
|
|
4533
4592
|
const validatedBorderColor = hasError ? red : defaultBorderColor;
|
|
4534
4593
|
const defaultOutline = hasError ? lightRedTransparent : darkBlue;
|
|
4535
4594
|
const validatedOutline = `2px solid ${state.isFocused ? defaultOutline : "transparent"}`;
|
|
4595
|
+
const multiOnly = state.isMulti;
|
|
4536
4596
|
return Object.assign(Object.assign({}, baseStyles), {
|
|
4537
|
-
fontSize: "14px",
|
|
4597
|
+
fontSize: multiOnly ? MULTI_FONT_SIZE : "14px",
|
|
4538
4598
|
transition: "border 0.3s ease-in-out",
|
|
4539
4599
|
// primary outline
|
|
4540
|
-
outline: validatedOutline,
|
|
4541
|
-
outlineOffset: "-2px",
|
|
4542
|
-
borderColor: validatedBorderColor,
|
|
4600
|
+
outline: multiOnly ? void 0 : validatedOutline,
|
|
4601
|
+
outlineOffset: multiOnly ? void 0 : "-2px",
|
|
4602
|
+
borderColor: multiOnly ? hasError ? red : state.isFocused || state.menuIsOpen ? "var(--ui-color-border-neutral-primary-selected, #1e40af)" : "var(--ui-color-border-neutral-secondary-default, #cbd5e1)" : validatedBorderColor,
|
|
4543
4603
|
borderWidth: "1px !important",
|
|
4544
4604
|
borderStyle: "solid",
|
|
4545
|
-
borderRadius: "4px",
|
|
4546
|
-
minHeight:
|
|
4547
|
-
height:
|
|
4548
|
-
boxShadow: `0px 1px 2px ${lightShadow}`,
|
|
4605
|
+
borderRadius: multiOnly ? RADIUS_S : "4px",
|
|
4606
|
+
minHeight: multiOnly ? MULTI_MIN_HEIGHT : void 0,
|
|
4607
|
+
height: multiOnly ? void 0 : "44px",
|
|
4608
|
+
boxShadow: multiOnly ? "none" : `0px 1px 2px ${lightShadow}`,
|
|
4549
4609
|
"&:hover": {
|
|
4550
4610
|
borderColor: mediumGray,
|
|
4551
4611
|
// selector for the chevron
|
|
@@ -4557,7 +4617,7 @@ function generateCustomStyles(hasError) {
|
|
|
4557
4617
|
},
|
|
4558
4618
|
// The placeholder has the following css prop: grid-area: 1/1/2/3;
|
|
4559
4619
|
// And grid-area doesn't work on IE11, so we need to style it slightly different.
|
|
4560
|
-
placeholder: (baseStyles) => Object.assign(Object.assign({}, baseStyles), { fontWeight: 100, color: "#6B7280", margin: 0 }),
|
|
4620
|
+
placeholder: (baseStyles, state) => Object.assign(Object.assign(Object.assign({}, baseStyles), { fontWeight: 100, color: "#6B7280", margin: 0 }), state.isMulti ? { fontSize: MULTI_FONT_SIZE, lineHeight: MULTI_LINE_HEIGHT } : {}),
|
|
4561
4621
|
singleValue: (baseStyles) => {
|
|
4562
4622
|
return Object.assign(Object.assign({}, baseStyles), { fontSize: "14px" });
|
|
4563
4623
|
},
|
|
@@ -4631,7 +4691,9 @@ const Select = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
|
4631
4691
|
components: {
|
|
4632
4692
|
SelectContainer: CustomContainer,
|
|
4633
4693
|
DropdownIndicator: SelectDropdownIndicator,
|
|
4634
|
-
LoadingIndicator: SelectLoadingIndicator
|
|
4694
|
+
LoadingIndicator: SelectLoadingIndicator,
|
|
4695
|
+
MultiValueLabel: SelectMultiValueLabel,
|
|
4696
|
+
Option: SelectOption
|
|
4635
4697
|
}
|
|
4636
4698
|
});
|
|
4637
4699
|
if (isCreatable) {
|