@khanacademy/wonder-blocks-dropdown 11.0.3 → 12.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["<no source>","../src/components/action-item.module.css","../src/components/check.module.css","../src/components/checkbox.module.css","../src/components/option-item.module.css","../src/components/separator-item.module.css","../src/components/dropdown-core.module.css","../src/components/action-menu.module.css","../../wonder-blocks-styles/src/styles/focus-styles.css","../src/components/select-opener.module.css","../src/components/combobox-live-region.module.css","../src/components/combobox-multiple-selection.module.css","../src/components/combobox.module.css","../src/components/listbox.module.css","../src/components/custom-opener.module.css"],"names":[],"mappings":"AAAA,eCAA;;;;;;;;;;;;;;;;;;;;;;EAsBE,CAEF;IACI;QACI,6DAA6D;QAC7D,uDAAuD;;QAEvD;yEACiE;QACjE,0BAA0B;IAC9B;;IAEA;yDACqD;IACrD;;QAEI,8DAA8D;QAC9D;+CACuC;QACvC,wDAAwD;;QAExD;iDACyC;QACzC;+CACuC;IAC3C;;IAEA;;kCAE8B;IAC9B;QACI,cAAc;IAClB;;IAEA;QACI,uDAAuD;;QAEvD,gEAAgE;QAChE,6DAA6D;IACjE;;IAEA;QACI,+DAA+D;QAC/D,+CAA+C;IACnD;;IAEA;QACI,kDAAkD;QAClD,sCAAsC;QACtC,mBAAmB;;QAEnB;qDAC6C;QAC7C,6EAA6E;QAC7E,yBAAyB;QACzB,iBAAiB;QACjB,gBAAgB;QAChB,uBAAuB;IAC3B;AACJ;CDjFA;;AAAA,eEAA;;;;;;;;;;;;EAYE,CAEF;IACI;QACI,kBAAkB;QAClB,qCAAqC;;QAErC,gEAAgE;QAChE,yCAAyC;QACzC,0CAA0C;IAC9C;;IAEA;QACI,kBAAkB;IACtB;AACJ;CF3BA;;AAAA,eGAA;;;;;;;;;;;;;;;EAeE,CAEF;IACI;QACI,kBAAkB;;QAElB,gEAAgE;QAChE,yCAAyC;QACzC,0CAA0C;QAC1C,qCAAqC;QACrC,4DAA4D;;QAE5D,6DAA6D;QAC7D,wHAAwH;QACxH,kBAAkB;QAClB,yCAAyC;QACzC,mBAAmB;QACnB,0DAA0D;IAC9D;;IAEA;QACI,eAAe;QACf,4DAA4D;QAC5D,uDAAuD;IAC3D;;IAEA;QACI,2DAA2D;QAC3D,mEAAmE;IACvE;;IAEA;oCACgC;IAChC;QACI,kBAAkB;QAClB,uBAAuB;QACvB,wBAAwB;IAC5B;AACJ;CHrDA;;AAAA,eIAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BE,CAEF;IACI;QACI,6DAA6D;QAC7D;8DACsD;QACtD,mBAAmB;;QAEnB,gEAAgE;QAChE,yCAAyC;IAC7C;;IAEA;;QAEI,4DAA4D;IAChE;;IAEA;;MAEE;;IAEF;;sGAEkG;IAClG;QACI,aAAa;QACb,gBAAgB;IACpB;;IAEA;;;;;uBAKmB;IACnB;;;QAGI,8DAA8D;QAC9D;+CACuC;QACvC,wDAAwD;;QAExD;iDACyC;QACzC;+CACuC;IAC3C;;IAEA;;MAEE;;IAEF;yEACqE;IACrE;;QAEI,8DAA8D;QAC9D;+CACuC;QACvC,wDAAwD;QACxD;+CACuC;IAC3C;;IAEA;0BACsB;IACtB;QACI,aAAa;QACb,gBAAgB;IACpB;;IAEA;QACI,kDAAkD;QAClD,sCAAsC;QACtC,mBAAmB;;QAEnB;qDAC6C;QAC7C,6EAA6E;QAC7E,yBAAyB;QACzB,iBAAiB;;QAEjB,4DAA4D;QAC5D,gBAAgB;QAChB,uBAAuB;IAC3B;AACJ;CJpHA;;AAAA,eKAA;;;;;;;;;;EAUE,CAEF;IACI;QACI;8DACsD;QACtD,eAAe;QACf,mBAAmB;QACnB,uCAAuC;IAC3C;AACJ;CLpBA;;AAAA,eMAA;;;;;;;;;;;;;;;;;;;EAmBE,CAEF;IACI,wBAAwB;IACxB,qBAAqB;AACzB,CAEA;IACI;QACI,sEAAsE;QACtE,yDAAyD;QACzD,gEAAgE;QAChE,kEAAkE;QAClE;8DACsD;QACtD,uDAAuD;;QAEvD;;uDAE+C;QAC/C,kIAAkI;QAClI,wCAAwC;IAC5C;;IAEA;QACI,oBAAoB;QACpB,kBAAkB;IACtB;;IAEA;QACI,gBAAgB;IACpB;;IAEA;QACI,8DAA8D;QAC9D,kBAAkB;QAClB,6CAA6C;IACjD;;IAEA;QACI,iCAAiC;QACjC,6CAA6C;;QAE7C;6CACqC;QACrC,oBAAoB;QACpB,gBAAgB;IACpB;AACJ;CNnEA;;AAAA,eOAA;;;;;;;EAOE,CAEF,iEAAiE,CACjE;IACI,uDAAuD;AAC3D;CPZA;;AAAA,eQAA;;;;;;;;;;;;;;EAcE,CCZF;;;;;;;;;;;;;;;;;;;;;;;EAuBE,CAEF,oCAAoC,CACpC;IACI,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,8BAA8B;IAC9B,gBAAgB;;IAEhB;;yCAEqC;IACrC;4DACwD;IACxD,6DAA6D;IAC7D,aAAa;IACb,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;;IAEnB;qEACiE;IACjE,0BAA0B;;IAE1B,sBAAsB;IACtB,4DAA4D;IAC5D;oDACgD;IAChD,uDAAuD;IACvD,eAAe;;IAEf;qCACiC;IACjC;QACI;wDACgD;IACpD;;IAEA;;yEAEqE;IACrE;IDnDA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;ICiD7C;;IAEA;QACI;;;;mDAI2C;IAC/C;;IAEA;QACI,4CAA4C;QAC5C,mBAAmB;;QAEnB;qDAC6C;QAC7C,6EAA6E;QAC7E,yBAAyB;QACzB,iBAAiB;QACjB,gBAAgB;QAChB,uBAAuB;IAC3B;;IAEA;QACI,0CAA0C;IAC9C;AACJ,CAEA;IACI,6DAA6D;IAC7D;qDACiD;IACjD,wDAAwD;IACxD,mBAAmB;;IAEnB;QACI,gBAAgB;IACpB;;IAEA;QACI;+CACuC;IAC3C;AACJ,CAEA;IACI,0DAA0D;IAC1D;kDAC8C;IAC9C,qDAAqD;;IAErD;QACI;;;;mDAI2C;IAC/C;AACJ,CAEA;IACI,wDAAwD;AAC5D,CAEA;IACI,yDAAyD;AAC7D,CAEA,4DAA4D,CAC5D;IACI;oDACgD;;IAEhD;;iDAE6C;IAC7C;QACI;;;;mDAI2C;IAC/C;AACJ,CAEA;IACI,6DAA6D;IAC7D,kDAAkD;;IAElD;QACI,gBAAgB;IACpB;;IAEA;QACI;+CACuC;IAC3C;;IAEA;;mEAE+D;IAC/D;QACI,wDAAwD;IAC5D;AACJ;CT7KA;;AAAA,eUAA;;;;;;;EAOE,CAEF;IACI,SAAS;IACT,sIAAsI;IACtI,sBAAsB;IACtB,eAAe;IACf,qJAAqJ;IACrJ,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,kBAAkB;IAClB,gBAAgB;AACpB;CVpBA;;AAAA,eQAA;;;;;;;;;;;;;;EAcE,CGZF;;;;;;;;;;;;;EAaE,CAEF;IACI;QACI,mBAAmB;QACnB,8BAA8B;QAC9B,8CAA8C;IAClD;;IAEA;QACI,yCAAyC;QACzC,8BAA8B;QAC9B,mBAAmB;QACnB,gBAAgB;QAChB,yCAAyC;IAC7C;;IAEA;;;oEAGgE;IAChE;;;;;IHpBA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;IGsB7C;AACJ;CX3CA;;AAAA,eQAA;;;;;;;;;;;;;;EAcE,CIZF;;;;;;;;;;;;;;;;;;;;;;EAsBE,CAEF;IACI,sCAAsC;IACtC;QACI,mBAAmB;QACnB,mBAAmB;QACnB,iBAAiB;QACjB,qBAAqB;;QAErB,yDAAyD;QACzD,gEAAgE;QAChE,6DAA6D;QAC7D;8DACsD;QACtD,iEAAiE;QACjE,gBAAgB;IACpB;;IAEA;IJ3BA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;IIyB7C;;IAEA;QACI,6DAA6D;QAC7D;yDACiD;QACjD,wDAAwD;IAC5D;;IAEA;QACI,0DAA0D;QAC1D;sDAC8C;QAC9C,qDAAqD;IACzD;;IAEA;;MAEE;IACF;QACI,uBAAuB;QACvB,gBAAgB;QAChB,gBAAgB;QAChB,YAAY;QACZ,aAAa;QACb,UAAU;QACV,0CAA0C;QAC1C,iBAAiB;QACjB,oBAAoB;QACpB,gBAAgB;;QAEhB;;oEAE4D;QAC5D;YACI,aAAa;YACb,YAAY;YACZ,gBAAgB;QACpB;;QAEA;6DACqD;QACrD;YACI,gBAAgB;QACpB;;QAEA;4CACoC;QACpC;YACI,gBAAgB;QACpB;IACJ;;IAEA;;MAEE;IACF;QACI,kBAAkB;QAClB,yCAAyC;QACzC,SAAS;IACb;;IAEA;QACI,yBAAyB;IAC7B;;IAEA;;;;;;;MAOE;IACF;;;;QAII,sDAAsD;IAC1D;;IAEA;;QAEI,aAAa;QACb,gBAAgB;IACpB;;IAEA;;;MAGE;IACF;QACI;;oBAEY;QACZ,2CAA2C;IAC/C;;IAEA;QACI,kCAAkC;;QAElC;;kDAE0C;QAC1C,qBAAqB;IACzB;AACJ,CAEA;;;EAGE,CACF;IACI;QACI,sEAAsE;QACtE,yDAAyD;QACzD;8DACsD;QACtD,uDAAuD;;QAEvD;;uDAE+C;QAC/C,kIAAkI;QAClI,wCAAwC;QACxC,gBAAgB;IACpB;;IAEA;QACI,oBAAoB;QACpB,kBAAkB;IACtB;AACJ;CZjLA;;AAAA,eaAA;;;;;;;;;EASE,CAEF;IACI;QACI,sEAAsE;QACtE,aAAa;;QAEb,WAAW;QACX,gEAAgE;QAChE,kEAAkE;IACtE;;IAEA;QACI,mEAAmE;IACvE;AACJ;CbxBA;;AAAA,eQAA;;;;;;;;;;;;;;EAcE,CMZF;;;;;;;;;;;;;;EAcE,CAEF;IACI,0DAA0D;IAC1D,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,SAAS;IACT,UAAU;IACV,mBAAmB;;IAEnB,mDAAmD;IACnD,0BAA0B;;IAE1B,+DAA+D;IAC/D;INlBA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;IMgB7C;;IAEA;QACI,mBAAmB;QACnB,aAAa;QACb,mBAAmB;QACnB,8BAA8B;IAClC;AACJ,CAEA;IACI,mBAAmB;AACvB;CdhDA","file":"index.css","sourcesContent":[null,"/**\n * ActionItem styles\n *\n * Every rule is nested inside `.root` — the marker class ActionItem adds to\n * the `DetailCell` root, which carries no declarations of its own. The root is\n * a `Cell` and the label a `BodyText`; both ship rules in the same\n * `@layer shared`, and this component overrides properties they set\n * (`min-block-size`, padding, `border-radius`, the focus ring and the\n * horizontal rule's `::after` on the cell; `font-weight` and `line-height` on\n * the label). The published bundle loads this stylesheet *before* those\n * packages', so at equal specificity they would win; the compound selector\n * makes the outcome depend on specificity instead.\n *\n * The Aphrodite version was unlayered `!important`, so it beat every Cell\n * state rule. Cell's most specific `border-radius` rule is\n * `.clickable:focus-visible:active` (0,3,0), so the focus rule also lists\n * `:focus:active` (0,4,0) to keep its radius while pressed.\n *\n * Rules are declared in composition order: actionItem → shared → indent.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.actionItem {\n /* The dropdown item height (`DROPDOWN_ITEM_HEIGHT` in JS). */\n min-block-size: var(--wb-c-dropdown-item-sizing-height);\n\n /* This removes the 300ms click delay on mobile browsers by indicating\n * that \"double-tap to zoom\" shouldn't be used on this element. */\n touch-action: manipulation;\n }\n\n /* Override the default focus state for the cell element, so that it can\n * be added programmatically to the button element. */\n &.actionItem:focus,\n &.actionItem:focus:active {\n border-radius: var(--wb-c-dropdown-item-border-radius-default);\n outline: var(--wb-border-width-medium) solid\n var(--wb-semanticColor-focus-outer);\n outline-offset: calc(var(--wb-border-width-medium) * -1);\n\n /* We need to use a thicker box-shadow to ensure that the inner ring\n * is visible when the cell is focused. */\n box-shadow: inset 0 0 0 calc(var(--wb-border-width-medium) * 2)\n var(--wb-semanticColor-focus-inner);\n }\n\n /* Hide the left bar indicator when focused, so the focus ring doesn't\n * overlap with it.\n * @see cell-core.module.css */\n &.actionItem:focus::after {\n content: unset;\n }\n\n &.shared {\n min-block-size: var(--wb-c-dropdown-item-sizing-height);\n\n /* Make sure that the item is always at least as tall as 40px. */\n padding-block: var(--wb-c-dropdown-item-layout-padding-block);\n }\n\n &.indent {\n /* Cell's internal padding + checkbox width + checkbox margin */\n padding-inline-start: var(--wb-sizing-size_320);\n }\n\n & .label {\n font-weight: var(--wb-c-dropdown-item-font-weight);\n line-height: var(--wb-sizing-size_200);\n white-space: nowrap;\n\n /* Safari only honours the prefixed form, and the CSS pipeline has no\n * autoprefixer (Aphrodite used to add it). */\n /* stylelint-disable-next-line property-no-vendor-prefix -- Safari needs it */\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n}\n","/**\n * Check styles (the selection indicator `OptionItem` uses for single\n * selection).\n *\n * The check is a `PhosphorIcon`, whose size class (same `@layer shared`) sets\n * `block-size`. The published bundle loads this stylesheet *before* the icon\n * package's, so the rules are qualified with the `.root` marker class\n * (applied to the same element) to win on specificity rather than load\n * order.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.check {\n align-self: center;\n block-size: var(--wb-sizing-size_160);\n\n /* Semantically, this are the constants for a small-sized icon */\n min-block-size: var(--wb-sizing-size_160);\n min-inline-size: var(--wb-sizing-size_160);\n }\n\n &.hidden {\n visibility: hidden;\n }\n}\n","/**\n * Checkbox styles (the selection indicator `OptionItem` uses for multiple\n * selection).\n *\n * Every rule is nested inside `.root` — the marker class on the checkbox\n * `View`, which carries no declarations of its own. The box is a `View`\n * (whose `.default` class resets `border`) and the check inside it a\n * `PhosphorIcon`; both ship rules in the same `@layer shared`. The published\n * bundle loads this stylesheet *before* those packages', so the compound\n * selectors make the outcome depend on specificity instead.\n *\n * Rules are declared in composition order: checkbox → selected → disabled.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.checkbox {\n align-self: center;\n\n /* Semantically, this are the constants for a small-sized icon */\n min-block-size: var(--wb-sizing-size_160);\n min-inline-size: var(--wb-sizing-size_160);\n block-size: var(--wb-sizing-size_160);\n background: var(--wb-semanticColor-input-default-background);\n\n /* TODO(WB-1864): Use the correct token once TB is updated. */\n /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- no 3px radius token yet; see the TODO above */\n border-radius: 3px;\n border-width: var(--wb-border-width-thin);\n border-style: solid;\n border-color: var(--wb-semanticColor-input-default-border);\n }\n\n &.selected {\n border-width: 0;\n background: var(--wb-semanticColor-input-checked-background);\n color: var(--wb-semanticColor-input-checked-foreground);\n }\n\n &.disabled {\n border-color: var(--wb-semanticColor-input-disabled-border);\n background-color: var(--wb-semanticColor-input-disabled-background);\n }\n\n /* The border of 1px on the selected, disabled checkbox pushes the check\n * out of place. Move it back. */\n & .checkDisabled {\n position: absolute;\n inset-block-start: -1px;\n inset-inline-start: -1px;\n }\n}\n","/**\n * OptionItem styles. Its `Check` and `Checkbox` indicators have their own\n * modules (`check.module.css`, `checkbox.module.css`).\n *\n * Every rule is nested inside `.root` — the marker class OptionItem adds to\n * the `DetailCell` root, which carries no declarations of its own. The root is\n * a `Cell` (`.wrapper`, `.detail`, `.clickable`, `.disabled`) and the label is\n * a `BodyText`. Both ship rules in the same `@layer shared`, and this\n * component overrides properties they set (padding, `min-block-size`,\n * `border-radius` and the focus ring on the cell; `font-weight` and\n * `line-height` on the label). The published\n * bundle loads this stylesheet *before* those packages', so at equal\n * specificity they would win; the compound selector makes the outcome depend\n * on specificity instead.\n *\n * The Aphrodite version was unlayered `!important`, so it beat every Cell\n * state rule. Cell's most specific `border-radius` rule is\n * `.clickable:focus-visible:active` (0,3,0), so each state rule that sets\n * `border-radius` also lists its `:focus-visible:active` / `:focus:active`\n * combination (0,4,0) to keep winning in that state.\n *\n * Between the rules in this file, source order reproduces the Aphrodite\n * merge order:\n *\n * optionItem → (press) → listbox / select variants → disabled focus reset\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.optionItem {\n padding-block: var(--wb-c-dropdown-item-layout-padding-block);\n padding-inline: var(--wb-c-dropdown-item-layout-padding-inlineStart)\n var(--wb-c-dropdown-item-layout-padding-inlineEnd);\n white-space: nowrap;\n\n /* Make sure that the item is always at least as tall as 40px. */\n min-block-size: var(--wb-sizing-size_400);\n }\n\n &.optionItem:active,\n &.optionItem:focus-visible:active {\n border-radius: var(--wb-c-dropdown-item-border-radius-press);\n }\n\n /**\n * Specific styles for Listbox and Combobox.\n */\n\n /* This does not apply here as we use visual focus (instead of real DOM\n * focus).\n * @see https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant */\n &.listboxOptionItem:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n /* Override the default focus state for the cell element, so that it can\n * be added programmatically to the button element. Declared after the\n * reset above, which it overrides at equal specificity. The plain\n * `.listboxOptionItemFocused` selector (0,2,0) still loses to the press\n * rule above, so a pressed item gets the press radius unless it is also\n * focus-visible. */\n &.listboxOptionItemFocused,\n &.listboxOptionItemFocused:focus-visible,\n &.listboxOptionItemFocused:focus-visible:active {\n border-radius: var(--wb-c-dropdown-item-border-radius-default);\n outline: var(--wb-border-width-medium) solid\n var(--wb-semanticColor-focus-outer);\n outline-offset: calc(var(--wb-border-width-medium) * -1);\n\n /* We need to use a thicker box-shadow to ensure that the inner ring\n * is visible when the cell is focused. */\n box-shadow: inset 0 0 0 calc(var(--wb-border-width-medium) * 2)\n var(--wb-semanticColor-focus-inner);\n }\n\n /**\n * Specific styles for MultiSelect and SingleSelect.\n */\n\n /* Allows programmatic focus to be applied to the item. Declared after the\n * press rule: a focused item keeps its focus radius while pressed. */\n &.selectOptionItem:focus,\n &.selectOptionItem:focus:active {\n border-radius: var(--wb-c-dropdown-item-border-radius-default);\n outline: var(--wb-border-width-medium) solid\n var(--wb-semanticColor-focus-outer);\n outline-offset: calc(var(--wb-border-width-medium) * -1);\n box-shadow: inset 0 0 0 calc(var(--wb-border-width-medium) * 2)\n var(--wb-semanticColor-focus-inner);\n }\n\n /* A disabled item never shows the focus ring. (0,4,0): outranks every\n * focus rule above. */\n &.optionItem[aria-disabled=\"true\"]:focus {\n outline: none;\n box-shadow: none;\n }\n\n & .label {\n font-weight: var(--wb-c-dropdown-item-font-weight);\n line-height: var(--wb-sizing-size_200);\n white-space: nowrap;\n\n /* Safari only honours the prefixed form, and the CSS pipeline has no\n * autoprefixer (Aphrodite used to add it). */\n /* stylelint-disable-next-line property-no-vendor-prefix -- Safari needs it */\n -webkit-user-select: none;\n user-select: none;\n\n /* added to truncate strings that are longer than expected */\n overflow: hidden;\n text-overflow: ellipsis;\n }\n}\n","/**\n * SeparatorItem styles\n *\n * The separator is a `View`, whose own `.default` class (same\n * `@layer shared`) resets `border`, `margin` and `min-block-size`. The\n * published bundle loads this stylesheet *before* core's, so the rule is\n * qualified with the `.root` marker class (applied to the same element) to\n * win on specificity rather than load order.\n *\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.separator {\n border-block-start: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n block-size: 1px;\n min-block-size: 1px;\n margin-block: var(--wb-sizing-size_040);\n }\n}\n","/**\n * DropdownCore styles\n *\n * The menu is portaled out of the wrapper by `DropdownPopper`, so its rules\n * nest under `.menu` — a marker class on the menu container itself, which\n * carries no declarations of its own. The container and the list are `View`s,\n * the empty state a `BodyText` and the filter a `SearchField`; all of them\n * ship rules in the same `@layer shared`, and this component overrides\n * properties they set (`padding`, `border` on the container; `margin` on the\n * empty state; `margin`, `min-block-size` and `position` on the search\n * field). The published bundle loads this stylesheet *before* those\n * packages', so the compound selectors make the outcome depend on specificity\n * rather than load order.\n *\n * Consumer `style` / `dropdownStyle` overrides are emitted unlayered, so they\n * still win over everything here.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.menuWrapper {\n inline-size: fit-content;\n max-inline-size: 100%;\n}\n\n.menu {\n &.dropdown {\n background-color: var(--wb-semanticColor-core-background-base-default);\n border-radius: var(--wb-c-dropdown-listbox-border-radius);\n padding-block: var(--wb-c-dropdown-listbox-layout-padding-block);\n padding-inline: var(--wb-c-dropdown-listbox-layout-padding-inline);\n border: solid var(--wb-border-width-thin)\n var(--wb-semanticColor-core-border-neutral-subtle);\n box-shadow: var(--wb-c-dropdown-listbox-shadow-default);\n\n /* We use a custom property to set the max height of the dropdown.\n * This comes from the maxHeight custom modifier.\n * @see ../util/popper-max-height-modifier.ts */\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties -- set at runtime by the popper modifier, not a token */\n max-block-size: var(--popper-max-height);\n }\n\n &.hidden {\n pointer-events: none;\n visibility: hidden;\n }\n\n & .listboxOrMenu {\n overflow-y: auto;\n }\n\n & .noResult {\n color: var(--wb-semanticColor-core-foreground-neutral-default);\n align-self: center;\n margin-block-start: var(--wb-sizing-size_060);\n }\n\n & .searchField {\n margin: var(--wb-sizing-size_080);\n margin-block-start: var(--wb-sizing-size_040);\n\n /* Set `min-block-size` to \"auto\" to stop the search field from having\n * a height of 0 and being cut off. */\n min-block-size: auto;\n position: sticky;\n }\n}\n","/**\n * ActionMenu styles\n *\n * Passed to `DropdownCore` as part of `dropdownStyle`. No package this menu\n * renders sets `inset-block-start`, so the class needs no extra specificity.\n *\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n/* This is to adjust the space between the menu and the opener. */\n.menuTopSpace {\n inset-block-start: calc(-1 * var(--wb-sizing-size_040));\n}\n","/*\n * Cross-package focus-visible mixin.\n *\n * Authors include the mixin via:\n *\n * @import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n *\n * .my-component:focus-visible {\n * @apply --wb-focus-visible;\n * }\n *\n * postcss-import resolves the @import through the workspace and\n * @csstools/postcss-mixins expands the @apply at build time\n * (CSS Mixins Level 1 syntax — note the leading `--` on the name).\n */\n@mixin --wb-focus-visible() {\n box-shadow: 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n outline: var(--wb-border-width-medium) solid\n var(--wb-semanticColor-focus-outer);\n outline-offset: var(--wb-border-width-medium);\n}\n","@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n/**\n * SelectOpener styles\n *\n * The opener is an `addStyle(\"button\")`, whose element reset lives in\n * `@layer shared.reset`, so rules directly in `@layer shared` outrank it\n * without extra specificity. Its children are a `BodyText` and a\n * `PhosphorIcon`, which ship rules in the same `@layer shared` (`BodyText`\n * resets `margin`); those rules nest under `.opener` so they win on\n * specificity rather than stylesheet load order.\n *\n * Aphrodite merged the `style` array into one class, re-ordering a pseudo\n * key to the end whenever a later style set it again. The modifier classes\n * are declared in that array order:\n *\n * opener → disabled → error → placeholder → disabledPlaceholder →\n * press → readOnly\n *\n * which reproduces the merged result for every combination, e.g. an errored,\n * disabled opener keeps the press shadow in its `:focus:active` ring because\n * `error` came after `disabled`.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n/* TODO: Dedupe with Button styles */\n.opener {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: space-between;\n block-size: 40px;\n\n /* This asymmetry arises from the Icon on the right side, which has extra\n * padding built in. To have the component look more balanced, we need to\n * take off some paddingRight here. */\n padding-inline: var(--wb-c-dropdown-opener-layout-padding-inlineStart)\n var(--wb-c-dropdown-opener-layout-padding-inlineEnd);\n border-radius: var(--wb-c-dropdown-opener-border-radius-rest);\n outline: none;\n text-decoration: none;\n box-sizing: border-box;\n white-space: nowrap;\n\n /* This removes the 300ms click delay on mobile browsers by indicating\n * that \"double-tap to zoom\" shouldn't be used on this element. */\n touch-action: manipulation;\n\n /* Theming (default) */\n background: var(--wb-semanticColor-input-default-background);\n border: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-input-default-border);\n color: var(--wb-semanticColor-input-default-foreground);\n cursor: pointer;\n\n /* Use box shadow to make the border in the press state look thicker\n * without changing the border. */\n &:active {\n box-shadow: 0 0 0 var(--wb-border-width-thin)\n var(--wb-semanticColor-input-default-border);\n }\n\n /* Using :focus instead of :focus-visible to ensure the focus ring is\n * visible when the button is focused (even when clicked). This makes the\n * focus behaviour more consistent with the other field components. */\n &:focus {\n @apply --wb-focus-visible;\n }\n\n &:focus:active {\n box-shadow:\n 0 0 0 var(--wb-border-width-thin)\n var(--wb-semanticColor-input-default-border),\n 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n }\n\n & .text {\n margin-inline-end: var(--wb-sizing-size_080);\n white-space: nowrap;\n\n /* Safari only honours the prefixed form, and the CSS pipeline has no\n * autoprefixer (Aphrodite used to add it). */\n /* stylelint-disable-next-line property-no-vendor-prefix -- Safari needs it */\n -webkit-user-select: none;\n user-select: none;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n & .caret {\n min-inline-size: var(--wb-sizing-size_160);\n }\n}\n\n.disabled {\n background: var(--wb-semanticColor-input-disabled-background);\n border: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-input-disabled-border);\n color: var(--wb-semanticColor-input-disabled-foreground);\n cursor: not-allowed;\n\n &:active {\n box-shadow: none;\n }\n\n &:focus:active {\n box-shadow: 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n }\n}\n\n.error {\n background: var(--wb-semanticColor-input-error-background);\n border: var(--wb-c-dropdown-opener-border-width-error) solid\n var(--wb-semanticColor-input-error-border);\n color: var(--wb-semanticColor-input-error-foreground);\n\n &:focus:active {\n box-shadow:\n 0 0 0 var(--wb-border-width-thin)\n var(--wb-semanticColor-input-default-border),\n 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n }\n}\n\n.placeholder {\n color: var(--wb-semanticColor-input-default-placeholder);\n}\n\n.disabledPlaceholder {\n color: var(--wb-semanticColor-input-disabled-placeholder);\n}\n\n/* Applied while Enter/Space is held down (tracked in JS). */\n.press {\n box-shadow: 0 0 0 var(--wb-border-width-thin)\n var(--wb-semanticColor-input-default-border);\n\n /* We merge the focus styles with the press styles so that the focus ring\n * is visible when the button is pressed. Declared after `.opener:focus`,\n * which it overrides at equal specificity. */\n &:focus-visible {\n box-shadow:\n 0 0 0 var(--wb-border-width-thin)\n var(--wb-semanticColor-input-default-border),\n 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n }\n}\n\n.readOnly {\n background: var(--wb-semanticColor-input-readOnly-background);\n color: var(--wb-semanticColor-input-readOnly-text);\n\n &:active {\n box-shadow: none;\n }\n\n &:focus:active {\n box-shadow: 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n }\n\n /* A read-only placeholder keeps the placeholder colour (the Aphrodite\n * version re-applied `placeholder` after `readOnly`). (0,2,0) so it also\n * beats `.disabledPlaceholder`, as the re-applied style did. */\n &.placeholder {\n color: var(--wb-semanticColor-input-default-placeholder);\n }\n}\n","/**\n * Combobox live region styles\n *\n * The live region is an `addStyle(\"span\")`, which ships no styles of its own,\n * so the class needs no extra specificity.\n *\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.srOnly {\n border: 0;\n /* stylelint-disable-next-line property-no-deprecated -- the standard visually-hidden pattern; kept as-is from the Aphrodite version */\n clip: rect(0, 0, 0, 0);\n block-size: 1px;\n /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- part of the standard visually-hidden pattern, not a design spacing value */\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n inline-size: 1px;\n}\n","@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n/**\n * Combobox selected-items group styles\n *\n * Every rule nests inside `.root` — a marker class on the group, which\n * carries no declarations of its own. The group is a `View` and each item a\n * `Button`; both ship rules in the same `@layer shared`, and this component\n * overrides properties they set (`flex-direction` and `padding` on the view;\n * `block-size`, `padding-inline` and the focus ring on the button). The\n * published bundle loads this stylesheet *before* those packages', so the\n * compound selectors make the outcome depend on specificity instead.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.container {\n flex-flow: row wrap;\n gap: var(--wb-sizing-size_080);\n padding-block-start: var(--wb-sizing-size_080);\n }\n\n & .item {\n font-size: var(--wb-font-body-size-small);\n justify-content: space-between;\n align-items: center;\n block-size: auto;\n padding-inline: var(--wb-sizing-size_080);\n }\n\n /* The item focused via the keyboard (visual focus only). The Aphrodite\n * version beat every `Button` state, so this also lists the hover /\n * press states (Button's hover and press rules are (0,2,0); its\n * secondary focus-visible + hover / press rules are (0,3,0)). */\n & .itemFocused,\n & .itemFocused:hover,\n & .itemFocused:active,\n & .itemFocused:focus-visible:hover,\n & .itemFocused:focus-visible:active {\n @apply --wb-focus-visible;\n }\n}\n","@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n/**\n * Combobox styles\n *\n * The wrapper rules nest inside `.root` — a marker class on the wrapper,\n * which carries no declarations of its own. The wrapper and the start-icon\n * container are `View`s, the input is a `TextField` and the clear / toggle\n * buttons are `IconButton`s. All of them ship rules in the same\n * `@layer shared`, and this component overrides properties they set. The\n * published bundle loads this stylesheet *before* those packages', so at\n * equal specificity they would win; the compound selectors make the outcome\n * depend on specificity instead. Where `TextField` or `IconButton` use state\n * selectors, the resets below repeat the same selector under `.root`, which\n * outranks it by one class.\n *\n * The listbox (or \"no items\" cell) is portaled out of the wrapper, so its\n * rules nest under a separate `.menu` marker on that element.\n *\n * The Aphrodite version was unlayered `!important`, so it beat every rule in\n * those packages; the consumer's `style` (on the input) still does.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n /* TODO(WB-2007): Adopt design specs */\n &.wrapper {\n flex-flow: row wrap;\n align-items: center;\n inline-size: 100%;\n max-inline-size: 100%;\n\n /* The following styles are to emulate the input styles */\n background: var(--wb-semanticColor-core-background-base-default);\n border-radius: var(--wb-c-dropdown-opener-border-radius-rest);\n border: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n padding-inline: var(--wb-c-dropdown-opener-layout-padding-inline);\n overflow: hidden;\n }\n\n &.focused {\n @apply --wb-focus-visible;\n }\n\n &.disabled {\n background: var(--wb-semanticColor-input-disabled-background);\n border: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-input-disabled-border);\n color: var(--wb-semanticColor-input-disabled-foreground);\n }\n\n &.error {\n background: var(--wb-semanticColor-input-error-background);\n border: var(--wb-c-dropdown-opener-border-width-error) solid\n var(--wb-semanticColor-input-error-border);\n color: var(--wb-semanticColor-input-error-foreground);\n }\n\n /**\n * Combobox input styles\n */\n & .combobox {\n /* reset input styles */\n appearance: none;\n background: none;\n border: none;\n outline: none;\n padding: 0;\n min-inline-size: var(--wb-sizing-size_040);\n inline-size: auto;\n display: inline-grid;\n grid-area: 1 / 2;\n\n /* The combobox wrapper handles the focus and press indicators, so we\n * reset the TextField's own focus and press states to avoid showing a\n * duplicate focus ring / press border on the inner input. */\n &:focus-visible {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n /* Matches the TextField's press selector so this reset takes\n * precedence over the press box shadow it applies. */\n &:active:not([aria-disabled=\"true\"], [readonly]) {\n box-shadow: none;\n }\n\n /* Matches the TextField's selector so this reset takes precedence\n * over the box shadow it applies. */\n &:focus-visible:active:not([aria-disabled=\"true\"], [readonly]) {\n box-shadow: none;\n }\n }\n\n /**\n * Arrow button styles\n */\n & .button {\n position: absolute;\n inset-inline-end: var(--wb-sizing-size_0);\n margin: 0;\n }\n\n & .buttonOpen {\n transform: rotate(180deg);\n }\n\n /**\n * The dropdown toggle button is not directly focusable (`tabIndex={-1}`)\n * and its state is already communicated by the combobox input, so we\n * remove the IconButton's hover, focus, and press styles to keep it\n * visually static. Values are reset to match the tertiary/neutral rest\n * state. The `[aria-disabled=\"true\"]` variants outrank IconButton's\n * disabled state resets.\n */\n & .openButtonResetStates:hover,\n & .openButtonResetStates:active,\n & .openButtonResetStates[aria-disabled=\"true\"]:hover,\n & .openButtonResetStates[aria-disabled=\"true\"]:active {\n border-color: var(--wb-semanticColor-core-transparent);\n }\n\n & .openButtonResetStates:focus-visible,\n & .openButtonResetStates[aria-disabled=\"true\"]:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n /**\n * Clear selection button. Declared after `.button`, which also sets\n * `inset-inline-end`.\n */\n & .clearButton {\n /* The clear button is positioned to the left of the arrow button.\n * This is calculated based on the padding + width of the arrow\n * button. */\n inset-inline-end: var(--wb-sizing-size_360);\n }\n\n & .iconWrapper {\n padding: var(--wb-sizing-size_040);\n\n /* View has a default minInlineSize of 0, which causes the label text\n * to encroach on the icon when it needs to truncate. We can fix this\n * by setting the minInlineSize to auto. */\n min-inline-size: auto;\n }\n}\n\n/**\n * Listbox custom styles. Applied to the `Listbox` (or the \"no items\"\n * `DetailCell`), which is portaled out of `.root`.\n */\n.menu {\n &.listbox {\n background-color: var(--wb-semanticColor-core-background-base-default);\n border-radius: var(--wb-c-dropdown-listbox-border-radius);\n border: solid var(--wb-border-width-thin)\n var(--wb-semanticColor-core-border-neutral-subtle);\n box-shadow: var(--wb-c-dropdown-listbox-shadow-default);\n\n /* We use a custom property to set the max height of the dropdown.\n * This comes from the maxHeight custom modifier.\n * @see ../util/popper-max-height-modifier.ts */\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties -- set at runtime by the popper modifier, not a token */\n max-block-size: var(--popper-max-height);\n overflow-y: auto;\n }\n\n &.hidden {\n pointer-events: none;\n visibility: hidden;\n }\n}\n","/**\n * Listbox styles\n *\n * The listbox is a `View`, whose own `.default` class (same `@layer shared`)\n * resets `padding`. The published bundle loads this stylesheet *before*\n * core's, so the rules are qualified with the `.root` marker class (applied to\n * the same element) to win on specificity rather than load order.\n *\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n &.listbox {\n background-color: var(--wb-semanticColor-core-background-base-default);\n outline: none;\n\n /* layout */\n padding-block: var(--wb-c-dropdown-listbox-layout-padding-block);\n padding-inline: var(--wb-c-dropdown-listbox-layout-padding-inline);\n }\n\n &.disabled {\n color: var(--wb-semanticColor-action-secondary-disabled-foreground);\n }\n}\n","@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n/**\n * CustomOpener styles\n *\n * The opener is an `addStyle(\"button\")`, whose element reset lives in\n * `@layer shared.reset`, so `.reset` outranks it without extra specificity.\n * The label is a `BodyText`, which sets `display: block` in the same\n * `@layer shared`; its rule nests under `.reset` so it wins on specificity\n * rather than stylesheet load order.\n *\n * The consumer's `styles.root` / `styles.label` are emitted unlayered, so\n * they win over everything here.\n *\n * Nesting is native CSS: every `&` is explicit and resolves to the flat\n * selector it replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.reset {\n /* CSS button reset — consumers start from a blank slate */\n appearance: none;\n background: none;\n border: none;\n box-sizing: border-box;\n cursor: pointer;\n font: inherit;\n margin: 0;\n padding: 0;\n text-align: inherit;\n\n /* Removes the 300ms tap delay on mobile browsers */\n touch-action: manipulation;\n\n /* WB focus ring — always applied, no need to add it yourself */\n &:focus-visible {\n @apply --wb-focus-visible;\n }\n\n & .label {\n align-items: center;\n display: flex;\n flex-direction: row;\n gap: var(--wb-sizing-size_020);\n }\n}\n\n.disabled {\n cursor: not-allowed;\n}\n"]}
package/dist/index.js CHANGED
@@ -4,11 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var aphrodite = require('aphrodite');
8
7
  var wonderBlocksCell = require('@khanacademy/wonder-blocks-cell');
9
- var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
10
8
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
11
- var wonderBlocksStyles = require('@khanacademy/wonder-blocks-styles');
9
+ var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
12
10
  var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
13
11
  var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
14
12
  var checkIcon = require('@phosphor-icons/core/bold/check-bold.svg');
@@ -59,49 +57,63 @@ var caretDownIcon__default$1 = /*#__PURE__*/_interopDefaultLegacy(caretDownIcon$
59
57
  var xIcon__default = /*#__PURE__*/_interopDefaultLegacy(xIcon);
60
58
  var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
61
59
 
62
- const selectDropdownStyle={marginBlock:wonderBlocksTokens.sizing.size_080};const filterableDropdownStyle={minHeight:100};const DROPDOWN_ITEM_HEIGHT=40;const MAX_VISIBLE_ITEMS=9;const SEPARATOR_ITEM_HEIGHT=9;
60
+ var modules_69f286da={"root":"wb-action-item-root-4beca087","actionItem":"wb-action-item-actionItem-4beca087","shared":"wb-action-item-shared-4beca087","indent":"wb-action-item-indent-4beca087","label":"wb-action-item-label-4beca087"};
61
+
62
+ class ActionItemInner extends React__namespace.Component{render(){const{disabled,horizontalRule,href,target,indent,label,lang,leftAccessory,rightAccessory,onClick,role,style,subtitle1,subtitle2,testId,active,"aria-label":ariaLabel,forwardedRef}=this.props;const defaultStyle=[modules_69f286da.root,modules_69f286da.actionItem,style];const labelComponent=typeof label==="string"?jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"div",lang:lang,style:modules_69f286da.label,children:label}):typeof label.type==="string"?React__namespace.cloneElement(label,{lang,...label.props,className:[modules_69f286da.label,label.props.className].filter(Boolean).join(" ")}):React__namespace.cloneElement(label,{lang,style:modules_69f286da.label,...label.props});return jsxRuntime.jsx(wonderBlocksCell.DetailCell,{disabled:disabled,horizontalRule:horizontalRule,leftAccessory:leftAccessory,rightAccessory:rightAccessory,styles:{root:[defaultStyle,modules_69f286da.shared,indent&&modules_69f286da.indent]},role:role,testId:testId,subtitle1:subtitle1,title:labelComponent,subtitle2:subtitle2,href:href,target:target,onClick:onClick,active:active,"aria-label":ariaLabel,ref:forwardedRef})}}ActionItemInner.defaultProps={disabled:false,horizontalRule:"none",indent:false,role:"menuitem"};const isComponentOf$1=instance=>{if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="object"&&type!==null&&"__IS_ACTION_ITEM__"in type&&type.__IS_ACTION_ITEM__===true};const ActionItem=React__namespace.forwardRef(function ActionItem(props,ref){return jsxRuntime.jsx(ActionItemInner,{...props,forwardedRef:ref})});ActionItem.isComponentOf=isComponentOf$1;ActionItem.__IS_ACTION_ITEM__=true;var ActionItem$1 = ActionItem;
63
+
64
+ var modules_11110e2b={"root":"wb-check-root-eeb4a0c6","check":"wb-check-check-eeb4a0c6","hidden":"wb-check-hidden-eeb4a0c6"};
63
65
 
64
- var themeDefault = {listbox:{border:{radius:wonderBlocksTokens.border.radius.radius_040},layout:{padding:{inline:wonderBlocksTokens.sizing.size_0,block:wonderBlocksTokens.sizing.size_040}},shadow:{default:wonderBlocksTokens.boxShadow.mid}},opener:{border:{width:{error:wonderBlocksTokens.border.width.thin},radius:{rest:wonderBlocksTokens.border.radius.radius_040}},layout:{padding:{inline:wonderBlocksTokens.sizing.size_160,inlineStart:wonderBlocksTokens.sizing.size_160,inlineEnd:wonderBlocksTokens.sizing.size_120}}},item:{border:{radius:{default:wonderBlocksTokens.border.radius.radius_040,press:wonderBlocksTokens.border.radius.radius_040}},layout:{padding:{block:wonderBlocksTokens.sizing.size_100,inlineStart:wonderBlocksTokens.sizing.size_080,inlineEnd:wonderBlocksTokens.sizing.size_160}},font:{weight:wonderBlocksTokens.font.weight.regular}}};
66
+ const Check=function(props){const{selected,disabled}=props;const iconColor=disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.strong:wonderBlocksTokens.semanticColor.core.foreground.instructive.default;return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{color:iconColor,icon:checkIcon__default["default"],size:"small",style:[modules_11110e2b.root,modules_11110e2b.check,!selected&&modules_11110e2b.hidden]})};var Check$1 = Check;
65
67
 
66
- var theme = wonderBlocksTokens.mapValuesToCssVars(themeDefault,"--wb-c-dropdown-");
68
+ var modules_e5c25e2a={"root":"wb-checkbox-root-7b154847","checkbox":"wb-checkbox-checkbox-7b154847","selected":"wb-checkbox-selected-7b154847","disabled":"wb-checkbox-disabled-7b154847","checkDisabled":"wb-checkbox-checkDisabled-7b154847"};
67
69
 
68
- class ActionItemInner extends React__namespace.Component{render(){const{disabled,horizontalRule,href,target,indent,label,lang,leftAccessory,rightAccessory,onClick,role,style,subtitle1,subtitle2,testId,active,"aria-label":ariaLabel,forwardedRef}=this.props;const defaultStyle=[styles$c.wrapper,style];const labelComponent=typeof label==="string"?jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"div",lang:lang,style:styles$c.label,children:label}):React__namespace.cloneElement(label,{lang,style:styles$c.label,...label.props});return jsxRuntime.jsx(wonderBlocksCell.DetailCell,{disabled:disabled,horizontalRule:horizontalRule,leftAccessory:leftAccessory,rightAccessory:rightAccessory,styles:{root:[defaultStyle,styles$c.shared,indent&&styles$c.indent]},role:role,testId:testId,subtitle1:subtitle1,title:labelComponent,subtitle2:subtitle2,href:href,target:target,onClick:onClick,active:active,"aria-label":ariaLabel,ref:forwardedRef})}}ActionItemInner.defaultProps={disabled:false,horizontalRule:"none",indent:false,role:"menuitem"};const isComponentOf$1=instance=>{if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="object"&&type!==null&&"__IS_ACTION_ITEM__"in type&&type.__IS_ACTION_ITEM__===true};const ActionItem=React__namespace.forwardRef(function ActionItem(props,ref){return jsxRuntime.jsx(ActionItemInner,{...props,forwardedRef:ref})});ActionItem.isComponentOf=isComponentOf$1;ActionItem.__IS_ACTION_ITEM__=true;const styles$c=aphrodite.StyleSheet.create({wrapper:{minBlockSize:DROPDOWN_ITEM_HEIGHT,touchAction:"manipulation",":focus":{borderRadius:theme.item.border.radius.default,outline:wonderBlocksStyles.focusStyles.focus[":focus-visible"].outline,outlineOffset:`calc(${wonderBlocksTokens.border.width.medium} * -1)`,boxShadow:`inset 0 0 0 calc(${wonderBlocksTokens.border.width.medium}*2) ${wonderBlocksTokens.semanticColor.focus.inner}`,[":after"]:{content:"unset"}}},shared:{minBlockSize:DROPDOWN_ITEM_HEIGHT,paddingBlock:theme.item.layout.padding.block},label:{fontWeight:theme.item.font.weight,lineHeight:wonderBlocksTokens.sizing.size_200,whiteSpace:"nowrap",userSelect:"none",overflow:"hidden",textOverflow:"ellipsis"},indent:{paddingInlineStart:wonderBlocksTokens.sizing.size_320}});
70
+ const Checkbox=function(props){const{disabled,selected}=props;return jsxRuntime.jsx(wonderBlocksCore.View,{className:"checkbox",style:[modules_e5c25e2a.root,modules_e5c25e2a.checkbox,selected&&!disabled&&modules_e5c25e2a.selected,disabled&&modules_e5c25e2a.disabled],children:selected&&jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:checkIcon__default["default"],size:"small",className:"check",style:[{width:wonderBlocksTokens.sizing.size_120,height:wonderBlocksTokens.sizing.size_120,margin:wonderBlocksTokens.sizing.size_020},disabled&&selected&&modules_e5c25e2a.checkDisabled]})})};var Checkbox$1 = Checkbox;
69
71
 
70
- const Check=function(props){const{selected,disabled}=props;const iconColor=disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.strong:wonderBlocksTokens.semanticColor.core.foreground.instructive.default;return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{color:iconColor,icon:checkIcon__default["default"],size:"small",style:[styles$b.bounds,!selected&&styles$b.hide]})};const styles$b=aphrodite.StyleSheet.create({bounds:{alignSelf:"center",height:wonderBlocksTokens.sizing.size_160,minBlockSize:wonderBlocksTokens.sizing.size_160,minInlineSize:wonderBlocksTokens.sizing.size_160},hide:{visibility:"hidden"}});
72
+ var modules_6e7b3e81={"root":"wb-option-item-root-e4b75fee","optionItem":"wb-option-item-optionItem-e4b75fee","listboxOptionItem":"wb-option-item-listboxOptionItem-e4b75fee","listboxOptionItemFocused":"wb-option-item-listboxOptionItemFocused-e4b75fee","selectOptionItem":"wb-option-item-selectOptionItem-e4b75fee","label":"wb-option-item-label-e4b75fee"};
71
73
 
72
- const Checkbox=function(props){const{disabled,selected}=props;return jsxRuntime.jsx(wonderBlocksCore.View,{className:"checkbox",style:[styles$a.checkbox,selected&&!disabled&&styles$a.selected,disabled&&styles$a.disabledCheckbox],children:selected&&jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:checkIcon__default["default"],size:"small",className:"check",style:[{width:wonderBlocksTokens.sizing.size_120,height:wonderBlocksTokens.sizing.size_120,margin:wonderBlocksTokens.sizing.size_020},disabled&&selected&&styles$a.disabledCheckFormatting]})})};const checkboxTokens={color:{default:{border:wonderBlocksTokens.semanticColor.input.default.border,background:wonderBlocksTokens.semanticColor.input.default.background},disabled:{border:wonderBlocksTokens.semanticColor.input.disabled.border,background:wonderBlocksTokens.semanticColor.input.disabled.background},selected:{background:wonderBlocksTokens.semanticColor.input.checked.background,foreground:wonderBlocksTokens.semanticColor.input.checked.foreground}}};const styles$a=aphrodite.StyleSheet.create({checkbox:{alignSelf:"center",minBlockSize:wonderBlocksTokens.sizing.size_160,minInlineSize:wonderBlocksTokens.sizing.size_160,height:wonderBlocksTokens.sizing.size_160,background:checkboxTokens.color.default.background,borderRadius:3,borderWidth:wonderBlocksTokens.border.width.thin,borderStyle:"solid",borderColor:checkboxTokens.color.default.border},selected:{borderWidth:0,background:checkboxTokens.color.selected.background,color:checkboxTokens.color.selected.foreground},disabledCheckbox:{borderColor:checkboxTokens.color.disabled.border,backgroundColor:checkboxTokens.color.disabled.background},disabledCheckFormatting:{position:"absolute",insetBlockStart:-1,insetInlineStart:-1}});
74
+ class OptionItemInner extends React__namespace.Component{getCheckComponent(){if(this.props.variant==="check"){return Check$1}else {return Checkbox$1}}render(){const{disabled,focused,label,selected,testId,leftAccessory,horizontalRule,parentComponent,rightAccessory,style,subtitle1,subtitle2,value,onClick,onToggle,variant,role,forwardedRef,...sharedProps}=this.props;const CheckComponent=this.getCheckComponent();const defaultStyle=[modules_6e7b3e81.root,modules_6e7b3e81.optionItem,style];const listboxStyles=[modules_6e7b3e81.listboxOptionItem,focused&&modules_6e7b3e81.listboxOptionItemFocused];const selectStyles=[modules_6e7b3e81.selectOptionItem];return jsxRuntime.jsx(wonderBlocksCell.DetailCell,{disabled:disabled,horizontalRule:horizontalRule,styles:{root:[defaultStyle,parentComponent==="listbox"?listboxStyles:selectStyles]},"aria-selected":selected?"true":"false",role:role,testId:testId,leftAccessory:jsxRuntime.jsx(jsxRuntime.Fragment,{children:leftAccessory?jsxRuntime.jsxs(wonderBlocksCore.View,{style:{flexDirection:"row",gap:wonderBlocksTokens.sizing.size_080},children:[jsxRuntime.jsx(CheckComponent,{disabled:disabled,selected:selected}),leftAccessory]}):jsxRuntime.jsx(CheckComponent,{disabled:disabled,selected:selected})}),rightAccessory:rightAccessory,subtitle1:subtitle1,title:jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"div",style:modules_6e7b3e81.label,children:label}),subtitle2:subtitle2,onClick:this.handleClick,tabIndex:parentComponent==="listbox"?-1:undefined,...sharedProps,ref:forwardedRef})}constructor(...args){super(...args),this.handleClick=()=>{const{onClick,onToggle,value}=this.props;onToggle(value);if(onClick){onClick();}};}}OptionItemInner.defaultProps={disabled:false,focused:false,horizontalRule:"none",onToggle:()=>void 0,role:"option",selected:false};const isComponentOf=instance=>{if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="object"&&type!==null&&"__IS_OPTION_ITEM__"in type&&type.__IS_OPTION_ITEM__===true};const OptionItem=React__namespace.forwardRef(function OptionItem(props,ref){return jsxRuntime.jsx(OptionItemInner,{...props,forwardedRef:ref})});OptionItem.isComponentOf=isComponentOf;OptionItem.__IS_OPTION_ITEM__=true;var OptionItem$1 = OptionItem;
73
75
 
74
- class OptionItemInner extends React__namespace.Component{getCheckComponent(){if(this.props.variant==="check"){return Check}else {return Checkbox}}render(){const{disabled,focused,label,selected,testId,leftAccessory,horizontalRule,parentComponent,rightAccessory,style,subtitle1,subtitle2,value,onClick,onToggle,variant,role,forwardedRef,...sharedProps}=this.props;const CheckComponent=this.getCheckComponent();const defaultStyle=[styles$9.optionItem,style];const listboxStyles=[styles$9.listboxOptionItem,focused&&styles$9.listboxOptionItemFocused];const selectStyles=[styles$9.selectOptionItem];return jsxRuntime.jsx(wonderBlocksCell.DetailCell,{disabled:disabled,horizontalRule:horizontalRule,styles:{root:[defaultStyle,parentComponent==="listbox"?listboxStyles:selectStyles]},"aria-selected":selected?"true":"false",role:role,testId:testId,leftAccessory:jsxRuntime.jsx(jsxRuntime.Fragment,{children:leftAccessory?jsxRuntime.jsxs(wonderBlocksCore.View,{style:{flexDirection:"row",gap:wonderBlocksTokens.sizing.size_080},children:[jsxRuntime.jsx(CheckComponent,{disabled:disabled,selected:selected}),leftAccessory]}):jsxRuntime.jsx(CheckComponent,{disabled:disabled,selected:selected})}),rightAccessory:rightAccessory,subtitle1:subtitle1,title:jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"div",style:styles$9.label,children:label}),subtitle2:subtitle2,onClick:this.handleClick,tabIndex:parentComponent==="listbox"?-1:undefined,...sharedProps,ref:forwardedRef})}constructor(...args){super(...args),this.handleClick=()=>{const{onClick,onToggle,value}=this.props;onToggle(value);if(onClick){onClick();}};}}OptionItemInner.defaultProps={disabled:false,focused:false,horizontalRule:"none",onToggle:()=>void 0,role:"option",selected:false};const isComponentOf=instance=>{if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="object"&&type!==null&&"__IS_OPTION_ITEM__"in type&&type.__IS_OPTION_ITEM__===true};const OptionItem=React__namespace.forwardRef(function OptionItem(props,ref){return jsxRuntime.jsx(OptionItemInner,{...props,forwardedRef:ref})});OptionItem.isComponentOf=isComponentOf;OptionItem.__IS_OPTION_ITEM__=true;const focusedStyle={borderRadius:theme.item.border.radius.default,outline:wonderBlocksStyles.focusStyles.focus[":focus-visible"].outline,outlineOffset:`calc(${wonderBlocksTokens.border.width.medium} * -1)`,boxShadow:`inset 0 0 0 calc(${wonderBlocksTokens.border.width.medium}*2) ${wonderBlocksTokens.semanticColor.focus.inner}`};const resetFocusStyle={outline:"none",boxShadow:"none"};const styles$9=aphrodite.StyleSheet.create({optionItem:{paddingBlock:theme.item.layout.padding.block,paddingInlineStart:theme.item.layout.padding.inlineStart,paddingInlineEnd:theme.item.layout.padding.inlineEnd,whiteSpace:"nowrap",minBlockSize:wonderBlocksTokens.sizing.size_400,":active":{borderRadius:theme.item.border.radius.press},[":is([aria-disabled=true])"]:{":focus":resetFocusStyle}},listboxOptionItem:{":focus-visible":resetFocusStyle},listboxOptionItemFocused:{...focusedStyle,":focus-visible":focusedStyle},selectOptionItem:{":focus":focusedStyle},label:{fontWeight:theme.item.font.weight,lineHeight:wonderBlocksTokens.sizing.size_200,whiteSpace:"nowrap",userSelect:"none",overflow:"hidden",textOverflow:"ellipsis"},hide:{visibility:"hidden"}});
76
+ var modules_0c819e85={"root":"wb-separator-item-root-91691150","separator":"wb-separator-item-separator-91691150"};
75
77
 
76
- class SeparatorItem extends React__namespace.Component{static isComponentOf(instance){if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="function"&&"__IS_SEPARATOR_ITEM__"in type&&type.__IS_SEPARATOR_ITEM__===true}render(){return jsxRuntime.jsx(wonderBlocksCore.View,{style:[styles$8.separator,this.props.style],"aria-hidden":"true"})}}SeparatorItem.__IS_SEPARATOR_ITEM__=true;const styles$8=aphrodite.StyleSheet.create({separator:{borderBlockStart:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,height:1,minBlockSize:1,marginBlock:wonderBlocksTokens.sizing.size_040}});
78
+ class SeparatorItem extends React__namespace.Component{static isComponentOf(instance){if(typeof instance!=="object"||instance===null){return false}const type="type"in instance?instance.type:undefined;return typeof type==="function"&&"__IS_SEPARATOR_ITEM__"in type&&type.__IS_SEPARATOR_ITEM__===true}render(){return jsxRuntime.jsx(wonderBlocksCore.View,{style:[modules_0c819e85.root,modules_0c819e85.separator,this.props.style],"aria-hidden":"true"})}}SeparatorItem.__IS_SEPARATOR_ITEM__=true;
77
79
 
78
- const DropdownOpener=React__namespace.forwardRef((props,ref)=>{const{disabled=false,readOnly=false,testId,text,opened,"aria-controls":ariaControls,"aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-label":ariaLabel,id,role,onBlur,onClick,children,error}=props;const renderAnchorChildren=(eventState,clickableChildrenProps)=>{const renderedChildren=children({...eventState,text,opened});const childrenProps=renderedChildren.props;const childrenTestId=childrenProps?.testId||childrenProps?.["data-testid"];const renderedAriaLabel=childrenProps["aria-label"]??ariaLabel;return React__namespace.cloneElement(renderedChildren,{...clickableChildrenProps,ref,"aria-label":renderedAriaLabel??undefined,"aria-invalid":error,disabled,"aria-controls":ariaControls,role,id,"aria-expanded":opened?"true":"false","aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-disabled":readOnly||disabled||undefined,onClick:childrenProps.onClick?e=>{childrenProps.onClick(e);clickableChildrenProps.onClick(e);}:clickableChildrenProps.onClick,"data-testid":childrenTestId||testId,onBlur:onBlur?e=>{onBlur(e);clickableChildrenProps.onBlur(e);}:clickableChildrenProps.onBlur})};return jsxRuntime.jsx(wonderBlocksClickable.ClickableBehavior,{onClick:onClick,disabled:disabled||readOnly,tabIndex:0,children:(eventState,handlers)=>renderAnchorChildren(eventState,handlers)})});DropdownOpener.displayName="DropdownOpener";
80
+ const DropdownOpener=React__namespace.forwardRef((props,ref)=>{const{disabled=false,readOnly=false,testId,text,opened,"aria-controls":ariaControls,"aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-label":ariaLabel,id,role,onBlur,onClick,children,error}=props;const renderAnchorChildren=(eventState,clickableChildrenProps)=>{const renderedChildren=children({...eventState,text,opened});const childrenProps=renderedChildren.props;const childrenTestId=childrenProps?.testId||childrenProps?.["data-testid"];const renderedAriaLabel=childrenProps["aria-label"]??ariaLabel;return React__namespace.cloneElement(renderedChildren,{...clickableChildrenProps,ref,"aria-label":renderedAriaLabel??undefined,"aria-invalid":error,disabled,"aria-controls":ariaControls,role,id,"aria-expanded":opened?"true":"false","aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-disabled":readOnly||disabled||undefined,onClick:childrenProps.onClick?e=>{childrenProps.onClick(e);clickableChildrenProps.onClick(e);}:clickableChildrenProps.onClick,"data-testid":childrenTestId||testId,onBlur:onBlur?e=>{onBlur(e);clickableChildrenProps.onBlur(e);}:clickableChildrenProps.onBlur})};return jsxRuntime.jsx(wonderBlocksClickable.ClickableBehavior,{onClick:onClick,disabled:disabled||readOnly,tabIndex:0,children:(eventState,handlers)=>renderAnchorChildren(eventState,handlers)})});DropdownOpener.displayName="DropdownOpener";var DropdownOpener$1 = DropdownOpener;
79
81
 
80
- class DropdownVirtualizedItem extends React__namespace.Component{render(){const{data,index,style}=this.props;const item=data[index];if(SeparatorItem.isComponentOf(item.component)){return React__namespace.cloneElement(item.component,{style})}else {const{component,populatedProps,onClick,role,ref}=item;return React__namespace.cloneElement(component,{style,...populatedProps,key:index,onClick,ref:item.focusable&&ref,role})}}}
82
+ class DropdownVirtualizedItem extends React__namespace.Component{render(){const{data,index,style}=this.props;const item=data[index];if(SeparatorItem.isComponentOf(item.component)){return React__namespace.cloneElement(item.component,{style})}else {const{component,populatedProps,onClick,role,ref}=item;return React__namespace.cloneElement(component,{style,...populatedProps,key:index,onClick,ref:item.focusable&&ref,role})}}}var DropdownVirtualizedItem$1 = DropdownVirtualizedItem;
83
+
84
+ const ITEM_HEIGHT=40;({listbox:{border:{radius:wonderBlocksTokens.border.radius.radius_040},layout:{padding:{inline:wonderBlocksTokens.sizing.size_0,block:wonderBlocksTokens.sizing.size_040}},shadow:{default:wonderBlocksTokens.boxShadow.mid}},opener:{border:{width:{error:wonderBlocksTokens.border.width.thin},radius:{rest:wonderBlocksTokens.border.radius.radius_040}},layout:{padding:{inline:wonderBlocksTokens.sizing.size_160,inlineStart:wonderBlocksTokens.sizing.size_160,inlineEnd:wonderBlocksTokens.sizing.size_120}}},item:{border:{radius:{default:wonderBlocksTokens.border.radius.radius_040,press:wonderBlocksTokens.border.radius.radius_040}},layout:{padding:{block:wonderBlocksTokens.sizing.size_100,inlineStart:wonderBlocksTokens.sizing.size_080,inlineEnd:wonderBlocksTokens.sizing.size_160}},font:{weight:wonderBlocksTokens.font.weight.regular},sizing:{height:`${ITEM_HEIGHT}px`}}});
85
+
86
+ const selectDropdownStyle={marginBlock:wonderBlocksTokens.sizing.size_080};const filterableDropdownStyle={minHeight:100};const DROPDOWN_ITEM_HEIGHT=ITEM_HEIGHT;const MAX_VISIBLE_ITEMS=9;const SEPARATOR_ITEM_HEIGHT=9;
81
87
 
82
88
  function getDropdownMenuHeight(items,initialHeight=0){return items.slice(0,MAX_VISIBLE_ITEMS).reduce((sum,item)=>{if(SeparatorItem.isComponentOf(item.component)){return sum+SEPARATOR_ITEM_HEIGHT}else {return sum+DROPDOWN_ITEM_HEIGHT}},initialHeight)}
83
89
 
84
- class DropdownCoreVirtualized extends React__namespace.Component{componentDidMount(){const{schedule}=this.props;schedule.animationFrame(()=>{this.setWidth();});}componentDidUpdate(prevProps){const{data,listRef}=this.props;if(prevProps.data.length!==data.length){this.setHeight();if(listRef&&listRef.current){listRef.current.resetAfterIndex(1);}}}setWidth(){const rootNode=ReactDOM__namespace.findDOMNode(this);const parentNode=rootNode?.parentElement;if(parentNode){const width=parentNode.getBoundingClientRect().width;this.setState({width});}}setHeight(){const height=getDropdownMenuHeight(this.props.data);this.setState({height});}renderInitialItems(){const{data}=this.props;const allComponents=data.map(e=>e.component);const longestItems=React__namespace.Children.toArray(allComponents).filter(Boolean).sort((a,b)=>{if(b.props.label&&a.props.label){return b.props.label.length-a.props.label.length}return -1}).slice(0,MAX_VISIBLE_ITEMS);return longestItems.map(item=>React__namespace.cloneElement(item,{style:{visibility:"hidden"}}))}renderVirtualizedList(width,height){const{data,listRef}=this.props;return jsxRuntime.jsx(reactWindow.VariableSizeList,{height:height,itemCount:data.length,itemSize:this.getItemSize,itemData:data,style:{overflowX:"hidden"},width:width,overscanCount:5,ref:listRef,children:DropdownVirtualizedItem})}render(){const{width,height}=this.state;if(width==null){return this.renderInitialItems()}else {return this.renderVirtualizedList(width,height)}}constructor(props){super(props),this.getItemSize=index=>{const item=this.props.data[index];if(SeparatorItem.isComponentOf(item.component)){return SEPARATOR_ITEM_HEIGHT}else {return DROPDOWN_ITEM_HEIGHT}};this.state={height:getDropdownMenuHeight(props.data),width:props.width};}}var DropdownCoreVirtualized$1 = wonderBlocksTiming.withActionScheduler(DropdownCoreVirtualized);
90
+ class DropdownCoreVirtualized extends React__namespace.Component{componentDidMount(){const{schedule}=this.props;schedule.animationFrame(()=>{this.setWidth();});}componentDidUpdate(prevProps){const{data,listRef}=this.props;if(prevProps.data.length!==data.length){this.setHeight();if(listRef&&listRef.current){listRef.current.resetAfterIndex(1);}}}setWidth(){const rootNode=ReactDOM__namespace.findDOMNode(this);const parentNode=rootNode?.parentElement;if(parentNode){const width=parentNode.getBoundingClientRect().width;this.setState({width});}}setHeight(){const height=getDropdownMenuHeight(this.props.data);this.setState({height});}renderInitialItems(){const{data}=this.props;const allComponents=data.map(e=>e.component);const longestItems=React__namespace.Children.toArray(allComponents).filter(Boolean).sort((a,b)=>{if(b.props.label&&a.props.label){return b.props.label.length-a.props.label.length}return -1}).slice(0,MAX_VISIBLE_ITEMS);return longestItems.map(item=>React__namespace.cloneElement(item,{style:{visibility:"hidden"}}))}renderVirtualizedList(width,height){const{data,listRef}=this.props;return jsxRuntime.jsx(reactWindow.VariableSizeList,{height:height,itemCount:data.length,itemSize:this.getItemSize,itemData:data,style:{overflowX:"hidden"},width:width,overscanCount:5,ref:listRef,children:DropdownVirtualizedItem$1})}render(){const{width,height}=this.state;if(width==null){return this.renderInitialItems()}else {return this.renderVirtualizedList(width,height)}}constructor(props){super(props),this.getItemSize=index=>{const item=this.props.data[index];if(SeparatorItem.isComponentOf(item.component)){return SEPARATOR_ITEM_HEIGHT}else {return DROPDOWN_ITEM_HEIGHT}};this.state={height:getDropdownMenuHeight(props.data),width:props.width};}}var DropdownCoreVirtualized$1 = wonderBlocksTiming.withActionScheduler(DropdownCoreVirtualized);
85
91
 
86
92
  function modifyMaxHeight({state,options}){const overflow=core.detectOverflow(state,options);const{y}=state.modifiersData.preventOverflow||{x:0,y:0};const{height}=state.rects.popper;const[basePlacement]=state.placement.split("-");const heightProp=basePlacement==="top"?"top":"bottom";const maxHeight=height-overflow[heightProp]-y;state.styles.popper={...state.styles.popper,maxHeight:`${maxHeight}px`,["--popper-max-height"]:`${maxHeight}px`};}const maxHeightModifier={name:"maxHeight",enabled:true,phase:"main",options:{padding:DROPDOWN_ITEM_HEIGHT},requiresIfExists:["offset","preventOverflow","flip"],fn:modifyMaxHeight};
87
93
 
88
- const modifiers=[{name:"preventOverflow",options:{rootBoundary:"viewport",altAxis:true,tether:false}},maxHeightModifier];const DropdownPopper=function({children,alignment="left",onPopperElement,referenceElement}){const modalHost=wonderBlocksModal.maybeGetPortalMountedModalHostElement(referenceElement)||document.querySelector("body");if(!modalHost){return null}const placement=alignment==="left"?"bottom-start":alignment==="right"?"bottom-end":alignment;return ReactDOM__namespace.createPortal(jsxRuntime.jsx(reactPopper.Popper,{innerRef:node=>{if(node&&onPopperElement){onPopperElement(node);}},referenceElement:referenceElement,strategy:"fixed",placement:placement,modifiers:modifiers,children:({placement,ref,style,hasPopperEscaped,isReferenceHidden})=>{const shouldHidePopper=!!(hasPopperEscaped||isReferenceHidden);return jsxRuntime.jsx("div",{ref:ref,style:{...style,maxInlineSize:"100%"},"data-testid":"dropdown-popper","data-placement":placement,children:children(shouldHidePopper)})}}),modalHost)};
94
+ const modifiers=[{name:"preventOverflow",options:{rootBoundary:"viewport",altAxis:true,tether:false}},maxHeightModifier];const DropdownPopper=function({children,alignment="left",onPopperElement,referenceElement}){const modalHost=wonderBlocksModal.maybeGetPortalMountedModalHostElement(referenceElement)||document.querySelector("body");if(!modalHost){return null}const placement=alignment==="left"?"bottom-start":alignment==="right"?"bottom-end":alignment;return ReactDOM__namespace.createPortal(jsxRuntime.jsx(reactPopper.Popper,{innerRef:node=>{if(node&&onPopperElement){onPopperElement(node);}},referenceElement:referenceElement,strategy:"fixed",placement:placement,modifiers:modifiers,children:({placement,ref,style,hasPopperEscaped,isReferenceHidden})=>{const shouldHidePopper=!!(hasPopperEscaped||isReferenceHidden);return jsxRuntime.jsx("div",{ref:ref,style:{...style,maxInlineSize:"100%"},"data-testid":"dropdown-popper","data-placement":placement,children:children(shouldHidePopper)})}}),modalHost)};var DropdownPopper$1 = DropdownPopper;
89
95
 
90
96
  function getStringForKey(key){if(key.length===1||!/^[A-Z]/i.test(key)){return key}return ""}function debounce(callback,wait){let timeout;return function executedFunction(...args){const later=()=>{clearTimeout(timeout);callback(...args);};clearTimeout(timeout);timeout=setTimeout(later,wait);}}function isString(x){return typeof x==="string"}function getLabel(props){if(isString(props.label)){return props.label}if(isString(props.labelAsText)){return props.labelAsText}return ""}function getSelectOpenerLabel(showOpenerLabelAsText,props){if(showOpenerLabelAsText){return getLabel(props)}return props.label}function getListboxLabelProps({ariaLabel,ariaLabelledBy,openerElement}){const openerLabel=getOpenerLabel(openerElement);const labelId=ariaLabelledBy||openerLabel?.id;if(labelId){return {"aria-labelledby":labelId}}const label=openerLabel?.textContent||ariaLabel;return label?{"aria-label":label}:{}}function getOpenerLabel(openerElement){if(!openerElement||!("labels"in openerElement)){return undefined}return openerElement.labels?.[0]}
91
97
 
92
- const VIRTUALIZE_THRESHOLD=125;const isFocusableElement=value=>typeof value==="object"&&value!==null&&"nodeType"in value&&value.nodeType===1&&"focus"in value&&typeof value.focus==="function";const sameItemsFocusable=(prevItems,currentItems)=>{if(prevItems.length!==currentItems.length){return false}for(let i=0;i<prevItems.length;i++){if(prevItems[i].focusable!==currentItems[i].focusable){return false}}return true};const createItemRefs=items=>{const itemRefs=[];for(let i=0;i<items.length;i++){if(items[i].focusable){const ref=React__namespace.createRef();itemRefs.push({ref,originalIndex:i});}}return itemRefs};const DropdownCore=props=>{const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const{"aria-invalid":ariaInvalid,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-required":ariaRequired,alignment="left",autoFocus=true,className,disabled,dropdownStyle,enableTypeAhead=true,id,initialFocusedIndex,isFilterable,items,labels,onOpenChanged,onSearchTextChanged,open,opener,openerElement,role,searchText,selectionType="single",style}=props;const schedule=wonderBlocksTiming.useActionScheduler();const openRef=wonderBlocksCore.useLatestRef(open);const onOpenChangedRef=wonderBlocksCore.useLatestRef(onOpenChanged);const rootRef=React__namespace.useRef(null);const popperElementRef=React__namespace.useRef(undefined);const virtualizedListRef=React__namespace.useRef(null);const searchFieldRef=React__namespace.useRef(null);const textSuggestionRef=React__namespace.useRef("");const committedItemsRef=React__namespace.useRef({itemRefs:[],prevItems:items});const{itemRefs:prevItemRefs,prevItems}=committedItemsRef.current;const shouldCreateItemRefs=prevItemRefs.length===0&&open||!sameItemsFocusable(prevItems,items);const derivedItems=shouldCreateItemRefs?{itemRefs:createItemRefs(items),sameItemsFocusable:false}:{itemRefs:prevItemRefs,sameItemsFocusable:true};const itemRefsRef=React__namespace.useRef(derivedItems.itemRefs);React__namespace.useEffect(()=>{committedItemsRef.current={itemRefs:derivedItems.itemRefs,prevItems:items};itemRefsRef.current=derivedItems.itemRefs;});const hasSearchField=React__namespace.useCallback(()=>{return !!isFilterable},[isFilterable]);const isSearchFieldFocused=React__namespace.useCallback(()=>{return hasSearchField()&&document.activeElement===searchFieldRef.current},[hasSearchField]);const focusSearchField=React__namespace.useCallback(()=>{if(searchFieldRef.current){searchFieldRef.current.focus();}},[]);const focusedIndexRef=React__namespace.useRef(-1);const focusedOriginalIndexRef=React__namespace.useRef(-1);const itemsClickedRef=React__namespace.useRef(false);const resetFocusedIndex=React__namespace.useCallback(()=>{if(typeof initialFocusedIndex!=="undefined"){focusedIndexRef.current=initialFocusedIndex;}else {if(hasSearchField()&&!isSearchFieldFocused()){return focusSearchField()}focusedIndexRef.current=0;}},[focusSearchField,hasSearchField,initialFocusedIndex,isSearchFieldFocused]);const initializedRef=React__namespace.useRef(false);if(!initializedRef.current){initializedRef.current=true;resetFocusedIndex();}const shouldVirtualizeList=React__namespace.useCallback(()=>{return items.length>VIRTUALIZE_THRESHOLD},[items]);const focusCurrentItem=React__namespace.useCallback(onFocus=>{const focusedItemRef=itemRefsRef.current[focusedIndexRef.current];if(!focusedItemRef){return}const{current:virtualizedList}=virtualizedListRef;if(virtualizedList){virtualizedList.scrollToItem(focusedItemRef.originalIndex);}const focusNode=()=>{if(!openRef.current){return}const currentFocusedItemRef=itemRefsRef.current[focusedIndexRef.current];const refValue=currentFocusedItemRef.ref.current;const node=isFocusableElement(refValue)?refValue:null;if(refValue==null&&shouldVirtualizeList()){schedule.animationFrame(focusNode);return}if(node){schedule.timeout(()=>{node.focus();},0);focusedOriginalIndexRef.current=currentFocusedItemRef.originalIndex;if(onFocus){onFocus(node);}}};if(shouldVirtualizeList()){schedule.animationFrame(focusNode);}else {focusNode();}},[openRef,schedule,shouldVirtualizeList]);const scheduleToFocusCurrentItem=React__namespace.useCallback(onFocus=>{if(shouldVirtualizeList()){schedule.animationFrame(()=>{focusCurrentItem(onFocus);});}else {focusCurrentItem(onFocus);}},[focusCurrentItem,schedule,shouldVirtualizeList]);const maybeFocusInitialItem=React__namespace.useCallback(()=>{if(!autoFocus){return}if(open){resetFocusedIndex();scheduleToFocusCurrentItem();}else if(!open){itemsClickedRef.current=false;}},[autoFocus,open,resetFocusedIndex,scheduleToFocusCurrentItem]);React__namespace.useEffect(()=>{if(!open){return}const handleInteract=event=>{const target=event.target;const thisElement=rootRef.current;if(thisElement&&!thisElement.contains(target)&&popperElementRef.current&&!popperElementRef.current.contains(target)){onOpenChangedRef.current(false);}};document.addEventListener("mouseup",handleInteract);document.addEventListener("touchend",handleInteract);return ()=>{document.removeEventListener("mouseup",handleInteract);document.removeEventListener("touchend",handleInteract);}},[open,onOpenChangedRef]);wonderBlocksCore.useOnMountEffect(()=>{maybeFocusInitialItem();});const prevRenderRef=React__namespace.useRef(null);React__namespace.useEffect(()=>{const prevProps=prevRenderRef.current;prevRenderRef.current={open,searchText,derivedItems};if(!prevProps||prevProps.derivedItems===derivedItems){return}if(prevProps.open!==open){maybeFocusInitialItem();}else if(open){const{itemRefs,sameItemsFocusable}=derivedItems;if(sameItemsFocusable||prevProps.searchText!==searchText){return}else {const newFocusableIndex=itemRefs.findIndex(ref=>ref.originalIndex===focusedOriginalIndexRef.current);if(newFocusableIndex===-1){focusedIndexRef.current=0;itemsClickedRef.current=false;scheduleToFocusCurrentItem();}else {focusedIndexRef.current=newFocusableIndex;}}}});const focusPreviousItem=React__namespace.useCallback(()=>{if(isSearchFieldFocused()){focusedIndexRef.current=itemRefsRef.current.length-1;}else if(focusedIndexRef.current===0){if(hasSearchField()){return focusSearchField()}focusedIndexRef.current=itemRefsRef.current.length-1;}else {focusedIndexRef.current-=1;}scheduleToFocusCurrentItem();},[focusSearchField,hasSearchField,isSearchFieldFocused,scheduleToFocusCurrentItem]);const focusNextItem=React__namespace.useCallback(()=>{if(isSearchFieldFocused()){focusedIndexRef.current=0;}else if(focusedIndexRef.current===itemRefsRef.current.length-1){if(hasSearchField()){return focusSearchField()}focusedIndexRef.current=0;}else {focusedIndexRef.current+=1;}scheduleToFocusCurrentItem();},[focusSearchField,hasSearchField,isSearchFieldFocused,scheduleToFocusCurrentItem]);const restoreTabOrder=React__namespace.useCallback(()=>{if(openerElement){openerElement.focus();}},[openerElement]);const handleKeyDownDebounceResult=React__namespace.useCallback(key=>{const foundIndex=items.filter(item=>item.focusable).findIndex(({component})=>{if(SeparatorItem.isComponentOf(component)){return false}if(OptionItem.isComponentOf(component)){const optionItemProps=component.props;return getLabel(optionItemProps).toLowerCase().startsWith(key.toLowerCase())}return false});if(foundIndex>=0){const isClosed=!open;if(isClosed){onOpenChanged(true);}focusedIndexRef.current=foundIndex;scheduleToFocusCurrentItem(node=>{if(selectionType==="single"&&isClosed&&node){node.click();onOpenChanged(false);}});}textSuggestionRef.current="";},[items,onOpenChanged,open,scheduleToFocusCurrentItem,selectionType]);const handleKeyDownDebounceResultRef=React__namespace.useRef(handleKeyDownDebounceResult);handleKeyDownDebounceResultRef.current=handleKeyDownDebounceResult;const handleKeyDownDebounced=React__namespace.useMemo(()=>debounce(key=>handleKeyDownDebounceResultRef.current(key),500),[]);const handleKeyDown=event=>{const key=event.key;if(enableTypeAhead&&getStringForKey(key)){event.stopPropagation();textSuggestionRef.current+=key;handleKeyDownDebounced(textSuggestionRef.current);}if(!open){if(key===wonderBlocksCore.keys.down){event.preventDefault();onOpenChanged(true);return}return}switch(key){case wonderBlocksCore.keys.tab:if(isSearchFieldFocused()&&searchText){return}restoreTabOrder();onOpenChanged(false);return;case wonderBlocksCore.keys.space:if(isSearchFieldFocused()){return}event.preventDefault();return;case wonderBlocksCore.keys.up:event.preventDefault();focusPreviousItem();return;case wonderBlocksCore.keys.down:event.preventDefault();focusNextItem();return}};const handleKeyUp=event=>{const key=event.key;switch(key){case wonderBlocksCore.keys.space:if(isSearchFieldFocused()){return}event.preventDefault();return;case wonderBlocksCore.keys.escape:if(open){event.stopPropagation();restoreTabOrder();onOpenChanged(false);}return}};const handleClickFocus=index=>{itemsClickedRef.current=true;focusedIndexRef.current=index;focusedOriginalIndexRef.current=derivedItems.itemRefs[focusedIndexRef.current].originalIndex;};const handleDropdownMouseUp=event=>{if(event.nativeEvent.stopImmediatePropagation){event.nativeEvent.stopImmediatePropagation();}else {event.stopPropagation();}};const getItemRole=()=>{switch(role){case"listbox":return "option";case"menu":return "menuitem";default:throw new Error(`Expected "listbox" or "menu" for role, but receieved "${role}" instead.`)}};const maybeRenderNoResults=()=>{const noResults=labels?.noResults||strings.noResults;const numResults=items.length;if(numResults===0){return jsxRuntime.jsx(wonderBlocksTypography.BodyText,{style:styles$7.noResult,testId:"dropdown-core-no-results",children:noResults})}return null};const handleItemClick=(focusIndex,item)=>{handleClickFocus(focusIndex);if(item.component.props.onClick){item.component.props.onClick();}if(item.populatedProps.onClick){item.populatedProps.onClick();}};const renderList=()=>{let focusCounter=0;const itemRole=getItemRole();return items.map((item,index)=>{if(SeparatorItem.isComponentOf(item.component)){return item.component}const{component,focusable,populatedProps}=item;if(focusable){focusCounter+=1;}const focusIndex=focusCounter-1;const currentRef=derivedItems.itemRefs[focusIndex]?derivedItems.itemRefs[focusIndex].ref:null;return React__namespace.cloneElement(component,{...populatedProps,key:index,onClick:()=>{handleItemClick(focusIndex,item);},ref:focusable?currentRef:null,role:populatedProps.role||itemRole})})};const parseVirtualizedItems=()=>{let focusCounter=0;const itemRole=getItemRole();return items.map((item,index)=>{const{populatedProps}=item;if(!SeparatorItem.isComponentOf(item.component)&&item.focusable){focusCounter+=1;}const focusIndex=focusCounter-1;return {...item,role:populatedProps.role||itemRole,ref:item.focusable&&derivedItems.itemRefs[focusIndex]?derivedItems.itemRefs[focusIndex].ref:null,onClick:()=>{handleItemClick(focusIndex,item);}}})};const renderVirtualizedList=()=>{const virtualizedItems=parseVirtualizedItems();return jsxRuntime.jsx(DropdownCoreVirtualized$1,{data:virtualizedItems,listRef:virtualizedListRef})};const handleSearchTextChanged=searchText=>{if(onSearchTextChanged){onSearchTextChanged(searchText);}};const renderSearchField=()=>{return jsxRuntime.jsx(SearchField__default["default"],{clearAriaLabel:labels?.clearSearch||strings.iconAltClearSearch,onChange:handleSearchTextChanged,placeholder:labels?.filter||strings.filter,ref:searchFieldRef,style:styles$7.searchInputStyle,value:searchText||""})};const renderDropdownMenu=(listRenderer,isReferenceHidden)=>{const openerStyle=openerElement&&window.getComputedStyle(openerElement);const minDropdownWidth=openerStyle?openerStyle.getPropertyValue("width"):0;return jsxRuntime.jsxs(wonderBlocksCore.View,{onMouseUp:handleDropdownMouseUp,style:[styles$7.dropdown,isReferenceHidden&&styles$7.hidden,dropdownStyle],testId:"dropdown-core-container",children:[isFilterable&&renderSearchField(),jsxRuntime.jsx(wonderBlocksCore.View,{id:id,role:role,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,style:[styles$7.listboxOrMenu,{minInlineSize:minDropdownWidth}],"aria-invalid":role==="listbox"?ariaInvalid:undefined,"aria-required":role==="listbox"?ariaRequired:undefined,children:listRenderer}),maybeRenderNoResults()]})};const renderDropdown=()=>{const listRenderer=shouldVirtualizeList()?renderVirtualizedList():renderList();return jsxRuntime.jsx(DropdownPopper,{alignment:alignment,onPopperElement:popperElement=>{popperElementRef.current=popperElement;},referenceElement:openerElement,children:isReferenceHidden=>renderDropdownMenu(listRenderer,isReferenceHidden)})};return jsxRuntime.jsxs(wonderBlocksCore.View,{ref:rootRef,onKeyDown:!disabled?handleKeyDown:undefined,onKeyUp:!disabled?handleKeyUp:undefined,style:[styles$7.menuWrapper,style],className:className,children:[opener,open&&renderDropdown()]})};const styles$7=aphrodite.StyleSheet.create({menuWrapper:{width:"fit-content",maxInlineSize:"100%"},dropdown:{backgroundColor:wonderBlocksTokens.semanticColor.core.background.base.default,borderRadius:theme.listbox.border.radius,paddingBlock:theme.listbox.layout.padding.block,paddingInline:theme.listbox.layout.padding.inline,border:`solid ${wonderBlocksTokens.border.width.thin} ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,boxShadow:theme.listbox.shadow.default,maxBlockSize:"var(--popper-max-height)"},listboxOrMenu:{overflowY:"auto"},hidden:{pointerEvents:"none",visibility:"hidden"},noResult:{color:wonderBlocksTokens.semanticColor.core.foreground.neutral.default,alignSelf:"center",marginBlockStart:wonderBlocksTokens.sizing.size_060},searchInputStyle:{margin:wonderBlocksTokens.sizing.size_080,marginBlockStart:wonderBlocksTokens.sizing.size_040,minBlockSize:"auto",position:"sticky"},srOnly:{border:0,clip:"rect(0,0,0,0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",width:1}});
98
+ var modules_f4b6cc92={"menuWrapper":"wb-dropdown-core-menuWrapper-a2b0ee43","menu":"wb-dropdown-core-menu-a2b0ee43","dropdown":"wb-dropdown-core-dropdown-a2b0ee43","hidden":"wb-dropdown-core-hidden-a2b0ee43","listboxOrMenu":"wb-dropdown-core-listboxOrMenu-a2b0ee43","noResult":"wb-dropdown-core-noResult-a2b0ee43","searchField":"wb-dropdown-core-searchField-a2b0ee43"};
99
+
100
+ const VIRTUALIZE_THRESHOLD=125;const isFocusableElement=value=>typeof value==="object"&&value!==null&&"nodeType"in value&&value.nodeType===1&&"focus"in value&&typeof value.focus==="function";const sameItemsFocusable=(prevItems,currentItems)=>{if(prevItems.length!==currentItems.length){return false}for(let i=0;i<prevItems.length;i++){if(prevItems[i].focusable!==currentItems[i].focusable){return false}}return true};const createItemRefs=items=>{const itemRefs=[];for(let i=0;i<items.length;i++){if(items[i].focusable){const ref=React__namespace.createRef();itemRefs.push({ref,originalIndex:i});}}return itemRefs};const DropdownCore=props=>{const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const{"aria-invalid":ariaInvalid,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-required":ariaRequired,alignment="left",autoFocus=true,className,disabled,dropdownStyle,enableTypeAhead=true,id,initialFocusedIndex,isFilterable,items,labels,onOpenChanged,onSearchTextChanged,open,opener,openerElement,role,searchText,selectionType="single",style}=props;const schedule=wonderBlocksTiming.useActionScheduler();const openRef=wonderBlocksCore.useLatestRef(open);const onOpenChangedRef=wonderBlocksCore.useLatestRef(onOpenChanged);const rootRef=React__namespace.useRef(null);const popperElementRef=React__namespace.useRef(undefined);const virtualizedListRef=React__namespace.useRef(null);const searchFieldRef=React__namespace.useRef(null);const textSuggestionRef=React__namespace.useRef("");const committedItemsRef=React__namespace.useRef({itemRefs:[],prevItems:items});const{itemRefs:prevItemRefs,prevItems}=committedItemsRef.current;const shouldCreateItemRefs=prevItemRefs.length===0&&open||!sameItemsFocusable(prevItems,items);const derivedItems=shouldCreateItemRefs?{itemRefs:createItemRefs(items),sameItemsFocusable:false}:{itemRefs:prevItemRefs,sameItemsFocusable:true};const itemRefsRef=React__namespace.useRef(derivedItems.itemRefs);React__namespace.useEffect(()=>{committedItemsRef.current={itemRefs:derivedItems.itemRefs,prevItems:items};itemRefsRef.current=derivedItems.itemRefs;});const hasSearchField=React__namespace.useCallback(()=>{return !!isFilterable},[isFilterable]);const isSearchFieldFocused=React__namespace.useCallback(()=>{return hasSearchField()&&document.activeElement===searchFieldRef.current},[hasSearchField]);const focusSearchField=React__namespace.useCallback(()=>{if(searchFieldRef.current){searchFieldRef.current.focus();}},[]);const focusedIndexRef=React__namespace.useRef(-1);const focusedOriginalIndexRef=React__namespace.useRef(-1);const itemsClickedRef=React__namespace.useRef(false);const resetFocusedIndex=React__namespace.useCallback(()=>{if(typeof initialFocusedIndex!=="undefined"){focusedIndexRef.current=initialFocusedIndex;}else {if(hasSearchField()&&!isSearchFieldFocused()){return focusSearchField()}focusedIndexRef.current=0;}},[focusSearchField,hasSearchField,initialFocusedIndex,isSearchFieldFocused]);const initializedRef=React__namespace.useRef(false);if(!initializedRef.current){initializedRef.current=true;resetFocusedIndex();}const shouldVirtualizeList=React__namespace.useCallback(()=>{return items.length>VIRTUALIZE_THRESHOLD},[items]);const focusCurrentItem=React__namespace.useCallback(onFocus=>{const focusedItemRef=itemRefsRef.current[focusedIndexRef.current];if(!focusedItemRef){return}const{current:virtualizedList}=virtualizedListRef;if(virtualizedList){virtualizedList.scrollToItem(focusedItemRef.originalIndex);}const focusNode=()=>{if(!openRef.current){return}const currentFocusedItemRef=itemRefsRef.current[focusedIndexRef.current];const refValue=currentFocusedItemRef.ref.current;const node=isFocusableElement(refValue)?refValue:null;if(refValue==null&&shouldVirtualizeList()){schedule.animationFrame(focusNode);return}if(node){schedule.timeout(()=>{node.focus();},0);focusedOriginalIndexRef.current=currentFocusedItemRef.originalIndex;if(onFocus){onFocus(node);}}};if(shouldVirtualizeList()){schedule.animationFrame(focusNode);}else {focusNode();}},[openRef,schedule,shouldVirtualizeList]);const scheduleToFocusCurrentItem=React__namespace.useCallback(onFocus=>{if(shouldVirtualizeList()){schedule.animationFrame(()=>{focusCurrentItem(onFocus);});}else {focusCurrentItem(onFocus);}},[focusCurrentItem,schedule,shouldVirtualizeList]);const maybeFocusInitialItem=React__namespace.useCallback(()=>{if(!autoFocus){return}if(open){resetFocusedIndex();scheduleToFocusCurrentItem();}else if(!open){itemsClickedRef.current=false;}},[autoFocus,open,resetFocusedIndex,scheduleToFocusCurrentItem]);React__namespace.useEffect(()=>{if(!open){return}const handleInteract=event=>{const target=event.target;const thisElement=rootRef.current;if(thisElement&&!thisElement.contains(target)&&popperElementRef.current&&!popperElementRef.current.contains(target)){onOpenChangedRef.current(false);}};document.addEventListener("mouseup",handleInteract);document.addEventListener("touchend",handleInteract);return ()=>{document.removeEventListener("mouseup",handleInteract);document.removeEventListener("touchend",handleInteract);}},[open,onOpenChangedRef]);wonderBlocksCore.useOnMountEffect(()=>{maybeFocusInitialItem();});const prevRenderRef=React__namespace.useRef(null);React__namespace.useEffect(()=>{const prevProps=prevRenderRef.current;prevRenderRef.current={open,searchText,derivedItems};if(!prevProps||prevProps.derivedItems===derivedItems){return}if(prevProps.open!==open){maybeFocusInitialItem();}else if(open){const{itemRefs,sameItemsFocusable}=derivedItems;if(sameItemsFocusable||prevProps.searchText!==searchText){return}else {const newFocusableIndex=itemRefs.findIndex(ref=>ref.originalIndex===focusedOriginalIndexRef.current);if(newFocusableIndex===-1){focusedIndexRef.current=0;itemsClickedRef.current=false;scheduleToFocusCurrentItem();}else {focusedIndexRef.current=newFocusableIndex;}}}});const focusPreviousItem=React__namespace.useCallback(()=>{if(isSearchFieldFocused()){focusedIndexRef.current=itemRefsRef.current.length-1;}else if(focusedIndexRef.current===0){if(hasSearchField()){return focusSearchField()}focusedIndexRef.current=itemRefsRef.current.length-1;}else {focusedIndexRef.current-=1;}scheduleToFocusCurrentItem();},[focusSearchField,hasSearchField,isSearchFieldFocused,scheduleToFocusCurrentItem]);const focusNextItem=React__namespace.useCallback(()=>{if(isSearchFieldFocused()){focusedIndexRef.current=0;}else if(focusedIndexRef.current===itemRefsRef.current.length-1){if(hasSearchField()){return focusSearchField()}focusedIndexRef.current=0;}else {focusedIndexRef.current+=1;}scheduleToFocusCurrentItem();},[focusSearchField,hasSearchField,isSearchFieldFocused,scheduleToFocusCurrentItem]);const restoreTabOrder=React__namespace.useCallback(()=>{if(openerElement){openerElement.focus();}},[openerElement]);const handleKeyDownDebounceResult=React__namespace.useCallback(key=>{const foundIndex=items.filter(item=>item.focusable).findIndex(({component})=>{if(SeparatorItem.isComponentOf(component)){return false}if(OptionItem$1.isComponentOf(component)){const optionItemProps=component.props;return getLabel(optionItemProps).toLowerCase().startsWith(key.toLowerCase())}return false});if(foundIndex>=0){const isClosed=!open;if(isClosed){onOpenChanged(true);}focusedIndexRef.current=foundIndex;scheduleToFocusCurrentItem(node=>{if(selectionType==="single"&&isClosed&&node){node.click();onOpenChanged(false);}});}textSuggestionRef.current="";},[items,onOpenChanged,open,scheduleToFocusCurrentItem,selectionType]);const handleKeyDownDebounceResultRef=React__namespace.useRef(handleKeyDownDebounceResult);handleKeyDownDebounceResultRef.current=handleKeyDownDebounceResult;const handleKeyDownDebounced=React__namespace.useMemo(()=>debounce(key=>handleKeyDownDebounceResultRef.current(key),500),[]);const handleKeyDown=event=>{const key=event.key;if(enableTypeAhead&&getStringForKey(key)){event.stopPropagation();textSuggestionRef.current+=key;handleKeyDownDebounced(textSuggestionRef.current);}if(!open){if(key===wonderBlocksCore.keys.down){event.preventDefault();onOpenChanged(true);return}return}switch(key){case wonderBlocksCore.keys.tab:if(isSearchFieldFocused()&&searchText){return}restoreTabOrder();onOpenChanged(false);return;case wonderBlocksCore.keys.space:if(isSearchFieldFocused()){return}event.preventDefault();return;case wonderBlocksCore.keys.up:event.preventDefault();focusPreviousItem();return;case wonderBlocksCore.keys.down:event.preventDefault();focusNextItem();return}};const handleKeyUp=event=>{const key=event.key;switch(key){case wonderBlocksCore.keys.space:if(isSearchFieldFocused()){return}event.preventDefault();return;case wonderBlocksCore.keys.escape:if(open){event.stopPropagation();restoreTabOrder();onOpenChanged(false);}return}};const handleClickFocus=index=>{itemsClickedRef.current=true;focusedIndexRef.current=index;focusedOriginalIndexRef.current=derivedItems.itemRefs[focusedIndexRef.current].originalIndex;};const handleDropdownMouseUp=event=>{if(event.nativeEvent.stopImmediatePropagation){event.nativeEvent.stopImmediatePropagation();}else {event.stopPropagation();}};const getItemRole=()=>{switch(role){case"listbox":return "option";case"menu":return "menuitem";default:throw new Error(`Expected "listbox" or "menu" for role, but receieved "${role}" instead.`)}};const maybeRenderNoResults=()=>{const noResults=labels?.noResults||strings.noResults;const numResults=items.length;if(numResults===0){return jsxRuntime.jsx(wonderBlocksTypography.BodyText,{style:modules_f4b6cc92.noResult,testId:"dropdown-core-no-results",children:noResults})}return null};const handleItemClick=(focusIndex,item)=>{handleClickFocus(focusIndex);if(item.component.props.onClick){item.component.props.onClick();}if(item.populatedProps.onClick){item.populatedProps.onClick();}};const renderList=()=>{let focusCounter=0;const itemRole=getItemRole();return items.map((item,index)=>{if(SeparatorItem.isComponentOf(item.component)){return item.component}const{component,focusable,populatedProps}=item;if(focusable){focusCounter+=1;}const focusIndex=focusCounter-1;const currentRef=derivedItems.itemRefs[focusIndex]?derivedItems.itemRefs[focusIndex].ref:null;return React__namespace.cloneElement(component,{...populatedProps,key:index,onClick:()=>{handleItemClick(focusIndex,item);},ref:focusable?currentRef:null,role:populatedProps.role||itemRole})})};const parseVirtualizedItems=()=>{let focusCounter=0;const itemRole=getItemRole();return items.map((item,index)=>{const{populatedProps}=item;if(!SeparatorItem.isComponentOf(item.component)&&item.focusable){focusCounter+=1;}const focusIndex=focusCounter-1;return {...item,role:populatedProps.role||itemRole,ref:item.focusable&&derivedItems.itemRefs[focusIndex]?derivedItems.itemRefs[focusIndex].ref:null,onClick:()=>{handleItemClick(focusIndex,item);}}})};const renderVirtualizedList=()=>{const virtualizedItems=parseVirtualizedItems();return jsxRuntime.jsx(DropdownCoreVirtualized$1,{data:virtualizedItems,listRef:virtualizedListRef})};const handleSearchTextChanged=searchText=>{if(onSearchTextChanged){onSearchTextChanged(searchText);}};const renderSearchField=()=>{return jsxRuntime.jsx(SearchField__default["default"],{clearAriaLabel:labels?.clearSearch||strings.iconAltClearSearch,onChange:handleSearchTextChanged,placeholder:labels?.filter||strings.filter,ref:searchFieldRef,style:modules_f4b6cc92.searchField,value:searchText||""})};const renderDropdownMenu=(listRenderer,isReferenceHidden)=>{const openerStyle=openerElement&&window.getComputedStyle(openerElement);const minDropdownWidth=openerStyle?openerStyle.getPropertyValue("width"):0;return jsxRuntime.jsxs(wonderBlocksCore.View,{onMouseUp:handleDropdownMouseUp,style:[modules_f4b6cc92.menu,modules_f4b6cc92.dropdown,isReferenceHidden&&modules_f4b6cc92.hidden,dropdownStyle],testId:"dropdown-core-container",children:[isFilterable&&renderSearchField(),jsxRuntime.jsx(wonderBlocksCore.View,{id:id,role:role,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,style:[modules_f4b6cc92.listboxOrMenu,{minInlineSize:minDropdownWidth}],"aria-invalid":role==="listbox"?ariaInvalid:undefined,"aria-required":role==="listbox"?ariaRequired:undefined,children:listRenderer}),maybeRenderNoResults()]})};const renderDropdown=()=>{const listRenderer=shouldVirtualizeList()?renderVirtualizedList():renderList();return jsxRuntime.jsx(DropdownPopper$1,{alignment:alignment,onPopperElement:popperElement=>{popperElementRef.current=popperElement;},referenceElement:openerElement,children:isReferenceHidden=>renderDropdownMenu(listRenderer,isReferenceHidden)})};return jsxRuntime.jsxs(wonderBlocksCore.View,{ref:rootRef,onKeyDown:!disabled?handleKeyDown:undefined,onKeyUp:!disabled?handleKeyUp:undefined,style:[modules_f4b6cc92.menuWrapper,style],className:className,children:[opener,open&&renderDropdown()]})};var DropdownCore$1 = DropdownCore;
101
+
102
+ const ActionMenuOpenerCore=React__namespace.forwardRef(function ActionMenuOpenerCore(props,ref){const{children,disabled,waiting:_,testId,opened,"aria-label":ariaLabel,...restProps}=props;return jsxRuntime.jsx(Button__default["default"],{"aria-expanded":opened?"true":"false","aria-haspopup":"menu",kind:"tertiary","aria-label":ariaLabel,disabled:disabled,...restProps,testId:testId,endIcon:caretDownIcon__default["default"],ref:ref,children:children})});var ActionMenuOpenerCore$1 = ActionMenuOpenerCore;
93
103
 
94
- const ActionMenuOpenerCore=React__namespace.forwardRef(function ActionMenuOpenerCore(props,ref){const{children,disabled,waiting:_,testId,opened,"aria-label":ariaLabel,...restProps}=props;return jsxRuntime.jsx(Button__default["default"],{"aria-expanded":opened?"true":"false","aria-haspopup":"menu",kind:"tertiary","aria-label":ariaLabel,disabled:disabled,...restProps,testId:testId,endIcon:caretDownIcon__default["default"],ref:ref,children:children})});
104
+ var modules_94e5168f={"menuTopSpace":"wb-action-menu-menuTopSpace-dc603e87"};
95
105
 
96
- const ActionMenu=React__namespace.forwardRef(function ActionMenu({alignment="left","aria-label":ariaLabel,disabled=false,children,menuText,opened:openedProp,onToggle,onChange,selectedValues,testId,dropdownStyle,style,className,opener,dropdownId,id},ref){const[internalOpened,setInternalOpened]=React__namespace.useState(false);const[openerElement,setOpenerElement]=React__namespace.useState(null);const generatedUniqueOpenerId=React__namespace.useId();const generatedUniqueDropdownId=React__namespace.useId();const uniqueOpenerId=id??generatedUniqueOpenerId;const uniqueDropdownId=dropdownId??generatedUniqueDropdownId;const opened=typeof openedProp==="boolean"?openedProp:internalOpened;const handleOpenChanged=React__namespace.useCallback(newOpened=>{setInternalOpened(newOpened);if(onToggle){onToggle(newOpened);}},[onToggle]);const handleItemSelected=React__namespace.useCallback(()=>{handleOpenChanged(false);openerElement?.focus();},[handleOpenChanged,openerElement]);const handleOptionSelected=React__namespace.useCallback(selectedValue=>{if(!onChange||!selectedValues){return}if(selectedValues.includes(selectedValue)){const index=selectedValues.indexOf(selectedValue);const updatedSelection=[...selectedValues.slice(0,index),...selectedValues.slice(index+1)];onChange(updatedSelection);}else {onChange([...selectedValues,selectedValue]);}handleItemSelected();},[onChange,selectedValues,handleItemSelected]);const getMenuItems=React__namespace.useCallback(()=>{const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const isOptionItemIncluded=allChildren.some(item=>OptionItem.isComponentOf(item));return allChildren.map(item=>{const{value,disabled}=item.props;const itemObject={component:item,focusable:ActionItem.isComponentOf(item)||OptionItem.isComponentOf(item)?!disabled:false,populatedProps:{}};if(ActionItem.isComponentOf(item)){return {...itemObject,populatedProps:{indent:isOptionItemIncluded,onClick:handleItemSelected}}}else if(OptionItem.isComponentOf(item)){const selected=selectedValues?selectedValues.includes(value):false;return {...itemObject,populatedProps:{onToggle:handleOptionSelected,selected,variant:"check",role:"menuitemcheckbox","aria-checked":selected,"aria-selected":undefined}}}else {return itemObject}})},[children,selectedValues,handleItemSelected,handleOptionSelected]);const handleOpenerRef=React__namespace.useCallback(node=>{if(node instanceof HTMLElement||node==null){setOpenerElement(node??null);}else {setOpenerElement(document.getElementById(uniqueOpenerId));}},[uniqueOpenerId]);React__namespace.useEffect(()=>{if(openerElement?.isConnected){return}setOpenerElement(document.getElementById(uniqueOpenerId));},[openerElement,opener,uniqueOpenerId]);React__namespace.useImperativeHandle(ref,()=>openerElement,[openerElement]);const handleClick=React__namespace.useCallback(e=>{handleOpenChanged(!opened);},[handleOpenChanged,opened]);const renderOpener=(numItems,dropdownId)=>{return jsxRuntime.jsx(DropdownOpener,{id:uniqueOpenerId,"aria-controls":dropdownId,"aria-haspopup":"menu",onClick:handleClick,disabled:numItems===0||disabled,text:menuText,ref:handleOpenerRef,testId:opener?undefined:testId,opened:opened,role:"button","aria-label":ariaLabel,children:opener?opener:openerProps=>{const{text,opened,...eventState}=openerProps;return jsxRuntime.jsx(ActionMenuOpenerCore,{...eventState,disabled:disabled,opened:!!opened,testId:testId,children:menuText})}})};const items=getMenuItems();return jsxRuntime.jsx(DropdownCore,{id:uniqueDropdownId,role:"menu",style:style,className:className,opener:renderOpener(items.length,uniqueDropdownId),alignment:alignment,open:opened,items:items,openerElement:openerElement??undefined,onOpenChanged:handleOpenChanged,dropdownStyle:[styles$6.menuTopSpace,dropdownStyle],"aria-labelledby":uniqueOpenerId})});const styles$6=aphrodite.StyleSheet.create({caret:{marginInlineStart:wonderBlocksTokens.sizing.size_040},opener:{whiteSpace:"nowrap",userSelect:"none",overflow:"hidden",textOverflow:"ellipsis"},menuTopSpace:{insetBlockStart:`calc(-1 * ${wonderBlocksTokens.sizing.size_040})`}});
106
+ const ActionMenu=React__namespace.forwardRef(function ActionMenu({alignment="left","aria-label":ariaLabel,disabled=false,children,menuText,opened:openedProp,onToggle,onChange,selectedValues,testId,dropdownStyle,style,className,opener,dropdownId,id},ref){const[internalOpened,setInternalOpened]=React__namespace.useState(false);const[openerElement,setOpenerElement]=React__namespace.useState(null);const generatedUniqueOpenerId=React__namespace.useId();const generatedUniqueDropdownId=React__namespace.useId();const uniqueOpenerId=id??generatedUniqueOpenerId;const uniqueDropdownId=dropdownId??generatedUniqueDropdownId;const opened=typeof openedProp==="boolean"?openedProp:internalOpened;const handleOpenChanged=React__namespace.useCallback(newOpened=>{setInternalOpened(newOpened);if(onToggle){onToggle(newOpened);}},[onToggle]);const handleItemSelected=React__namespace.useCallback(()=>{handleOpenChanged(false);openerElement?.focus();},[handleOpenChanged,openerElement]);const handleOptionSelected=React__namespace.useCallback(selectedValue=>{if(!onChange||!selectedValues){return}if(selectedValues.includes(selectedValue)){const index=selectedValues.indexOf(selectedValue);const updatedSelection=[...selectedValues.slice(0,index),...selectedValues.slice(index+1)];onChange(updatedSelection);}else {onChange([...selectedValues,selectedValue]);}handleItemSelected();},[onChange,selectedValues,handleItemSelected]);const getMenuItems=React__namespace.useCallback(()=>{const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const isOptionItemIncluded=allChildren.some(item=>OptionItem$1.isComponentOf(item));return allChildren.map(item=>{const{value,disabled}=item.props;const itemObject={component:item,focusable:ActionItem$1.isComponentOf(item)||OptionItem$1.isComponentOf(item)?!disabled:false,populatedProps:{}};if(ActionItem$1.isComponentOf(item)){return {...itemObject,populatedProps:{indent:isOptionItemIncluded,onClick:handleItemSelected}}}else if(OptionItem$1.isComponentOf(item)){const selected=selectedValues?selectedValues.includes(value):false;return {...itemObject,populatedProps:{onToggle:handleOptionSelected,selected,variant:"check",role:"menuitemcheckbox","aria-checked":selected,"aria-selected":undefined}}}else {return itemObject}})},[children,selectedValues,handleItemSelected,handleOptionSelected]);const handleOpenerRef=React__namespace.useCallback(node=>{if(node instanceof HTMLElement||node==null){setOpenerElement(node??null);}else {setOpenerElement(document.getElementById(uniqueOpenerId));}},[uniqueOpenerId]);React__namespace.useEffect(()=>{if(openerElement?.isConnected){return}setOpenerElement(document.getElementById(uniqueOpenerId));},[openerElement,opener,uniqueOpenerId]);React__namespace.useImperativeHandle(ref,()=>openerElement,[openerElement]);const handleClick=React__namespace.useCallback(e=>{handleOpenChanged(!opened);},[handleOpenChanged,opened]);const renderOpener=(numItems,dropdownId)=>{return jsxRuntime.jsx(DropdownOpener$1,{id:uniqueOpenerId,"aria-controls":dropdownId,"aria-haspopup":"menu",onClick:handleClick,disabled:numItems===0||disabled,text:menuText,ref:handleOpenerRef,testId:opener?undefined:testId,opened:opened,role:"button","aria-label":ariaLabel,children:opener?opener:openerProps=>{const{text,opened,...eventState}=openerProps;return jsxRuntime.jsx(ActionMenuOpenerCore$1,{...eventState,disabled:disabled,opened:!!opened,testId:testId,children:menuText})}})};const items=getMenuItems();return jsxRuntime.jsx(DropdownCore$1,{id:uniqueDropdownId,role:"menu",style:style,className:className,opener:renderOpener(items.length,uniqueDropdownId),alignment:alignment,open:opened,items:items,openerElement:openerElement??undefined,onOpenChanged:handleOpenChanged,dropdownStyle:[modules_94e5168f.menuTopSpace,dropdownStyle],"aria-labelledby":uniqueOpenerId})});var ActionMenu$1 = ActionMenu;
97
107
 
98
- const StyledButton$1=wonderBlocksCore.addStyle("button");class SelectOpener extends React__namespace.Component{render(){const{children,disabled,readOnly,error,id,isPlaceholder,open,testId,"aria-label":ariaLabel,"aria-required":ariaRequired,"aria-controls":ariaControls,onBlur,onOpenChanged,...sharedProps}=this.props;const iconColor=disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.default:wonderBlocksTokens.semanticColor.core.foreground.neutral.default;const style=[styles$5.shared,styles$5.default,disabled&&styles$5.disabled,error&&styles$5.error,isPlaceholder&&styles$5.placeholder,isPlaceholder&&disabled&&styles$5.disabledPlaceholder,!disabled&&!readOnly&&this.state.pressed&&styles$5.press,readOnly&&styles$5.readOnly,readOnly&&isPlaceholder&&styles$5.placeholder];const allowInteraction=!disabled&&!readOnly;return jsxRuntime.jsxs(StyledButton$1,{...sharedProps,"aria-disabled":readOnly||disabled||undefined,"aria-expanded":open?"true":"false","aria-invalid":error,"aria-label":ariaLabel??undefined,"aria-required":ariaRequired,"aria-haspopup":"listbox","aria-controls":ariaControls,"data-testid":testId,id:id,role:"combobox",type:"button",style:style,onClick:allowInteraction?this.handleClick:undefined,onKeyDown:allowInteraction?this.handleKeyDown:undefined,onKeyUp:allowInteraction?this.handleKeyUp:undefined,onBlur:onBlur,children:[jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"span",style:styles$5.text,children:children||jsxRuntime.jsx("span",{"aria-hidden":"true",children:" "})}),jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:caretDownIcon__default["default"],color:iconColor,size:"small",style:styles$5.caret,"aria-hidden":"true"})]})}constructor(props){super(props),this.handleClick=e=>{const{open}=this.props;this.props.onOpenChanged(!open);},this.handleKeyDown=e=>{const keyName=e.key;if(keyName===wonderBlocksCore.keys.enter||keyName===wonderBlocksCore.keys.space){this.setState({pressed:true});e.preventDefault();}},this.handleKeyUp=e=>{const keyName=e.key;if(keyName===wonderBlocksCore.keys.enter||keyName===wonderBlocksCore.keys.space){this.setState({pressed:false});this.handleClick(e);}};this.state={pressed:false};}}SelectOpener.defaultProps={disabled:false,readOnly:false,error:false,isPlaceholder:false};const PRESS_SHADOW=`0 0 0 ${wonderBlocksTokens.border.width.thin} ${wonderBlocksTokens.semanticColor.input.default.border}`;const styles$5=aphrodite.StyleSheet.create({shared:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"space-between",color:wonderBlocksTokens.semanticColor.core.foreground.neutral.strong,height:DROPDOWN_ITEM_HEIGHT,paddingInlineStart:theme.opener.layout.padding.inlineStart,paddingInlineEnd:theme.opener.layout.padding.inlineEnd,borderWidth:0,borderRadius:theme.opener.border.radius.rest,borderStyle:"solid",outline:"none",textDecoration:"none",boxSizing:"border-box",whiteSpace:"nowrap",touchAction:"manipulation"},text:{marginInlineEnd:wonderBlocksTokens.sizing.size_080,whiteSpace:"nowrap",userSelect:"none",overflow:"hidden",textOverflow:"ellipsis"},caret:{minInlineSize:wonderBlocksTokens.sizing.size_160},default:{background:wonderBlocksTokens.semanticColor.input.default.background,border:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.input.default.border}`,color:wonderBlocksTokens.semanticColor.input.default.foreground,cursor:"pointer",":active":{boxShadow:PRESS_SHADOW},":focus":{...wonderBlocksStyles.focusStyles.focus[":focus-visible"]},[":focus:active"]:{boxShadow:`${PRESS_SHADOW}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`}},error:{background:wonderBlocksTokens.semanticColor.input.error.background,border:`${theme.opener.border.width.error} solid ${wonderBlocksTokens.semanticColor.input.error.border}`,color:wonderBlocksTokens.semanticColor.input.error.foreground,[":focus:active"]:{boxShadow:`${PRESS_SHADOW}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`}},disabled:{background:wonderBlocksTokens.semanticColor.input.disabled.background,border:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.input.disabled.border}`,color:wonderBlocksTokens.semanticColor.input.disabled.foreground,cursor:"not-allowed",":active":{boxShadow:"none"},[":focus:active"]:{boxShadow:wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}},press:{boxShadow:PRESS_SHADOW,":focus-visible":{boxShadow:`${PRESS_SHADOW}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`}},placeholder:{color:wonderBlocksTokens.semanticColor.input.default.placeholder},disabledPlaceholder:{color:wonderBlocksTokens.semanticColor.input.disabled.placeholder},readOnly:{background:wonderBlocksTokens.semanticColor.input.readOnly.background,color:wonderBlocksTokens.semanticColor.input.readOnly.text,":active":{boxShadow:"none"},[":focus:active"]:{boxShadow:wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}}});
108
+ var modules_c540ed62={"opener":"wb-select-opener-opener-1732ec34","text":"wb-select-opener-text-1732ec34","caret":"wb-select-opener-caret-1732ec34","disabled":"wb-select-opener-disabled-1732ec34","error":"wb-select-opener-error-1732ec34","placeholder":"wb-select-opener-placeholder-1732ec34","disabledPlaceholder":"wb-select-opener-disabledPlaceholder-1732ec34","press":"wb-select-opener-press-1732ec34","readOnly":"wb-select-opener-readOnly-1732ec34"};
109
+
110
+ const StyledButton$1=wonderBlocksCore.addStyle("button");class SelectOpener extends React__namespace.Component{render(){const{children,disabled,readOnly,error,id,isPlaceholder,open,testId,"aria-label":ariaLabel,"aria-required":ariaRequired,"aria-controls":ariaControls,onBlur,onOpenChanged,...sharedProps}=this.props;const iconColor=disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.default:wonderBlocksTokens.semanticColor.core.foreground.neutral.default;const style=[modules_c540ed62.opener,disabled&&modules_c540ed62.disabled,error&&modules_c540ed62.error,isPlaceholder&&modules_c540ed62.placeholder,isPlaceholder&&disabled&&modules_c540ed62.disabledPlaceholder,!disabled&&!readOnly&&this.state.pressed&&modules_c540ed62.press,readOnly&&modules_c540ed62.readOnly];const allowInteraction=!disabled&&!readOnly;return jsxRuntime.jsxs(StyledButton$1,{...sharedProps,"aria-disabled":readOnly||disabled||undefined,"aria-expanded":open?"true":"false","aria-invalid":error,"aria-label":ariaLabel??undefined,"aria-required":ariaRequired,"aria-haspopup":"listbox","aria-controls":ariaControls,"data-testid":testId,id:id,role:"combobox",type:"button",style:style,onClick:allowInteraction?this.handleClick:undefined,onKeyDown:allowInteraction?this.handleKeyDown:undefined,onKeyUp:allowInteraction?this.handleKeyUp:undefined,onBlur:onBlur,children:[jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"span",style:modules_c540ed62.text,children:children||jsxRuntime.jsx("span",{"aria-hidden":"true",children:" "})}),jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:caretDownIcon__default["default"],color:iconColor,size:"small",style:modules_c540ed62.caret,"aria-hidden":"true"})]})}constructor(props){super(props),this.handleClick=e=>{const{open}=this.props;this.props.onOpenChanged(!open);},this.handleKeyDown=e=>{const keyName=e.key;if(keyName===wonderBlocksCore.keys.enter||keyName===wonderBlocksCore.keys.space){this.setState({pressed:true});e.preventDefault();}},this.handleKeyUp=e=>{const keyName=e.key;if(keyName===wonderBlocksCore.keys.enter||keyName===wonderBlocksCore.keys.space){this.setState({pressed:false});this.handleClick(e);}};this.state={pressed:false};}}SelectOpener.defaultProps={disabled:false,readOnly:false,error:false,isPlaceholder:false};
99
111
 
100
112
  function hasValue(value){return value?value.length>0:false}function useSelectValidation({value,disabled=false,validate,onValidate,required,open}){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const[errorMessage,setErrorMessage]=React__namespace.useState(()=>validate&&hasValue(value)&&!disabled&&validate(value)||null);const handleValidation=React__namespace.useCallback(newValue=>{if(disabled){return}if(validate){const error=newValue!==undefined&&validate(newValue)||null;setErrorMessage(error);if(onValidate){onValidate(error);}if(error){return}}if(required){const requiredString=typeof required==="string"?required:strings.requiredFieldMessage;const error=hasValue(newValue)?null:requiredString;setErrorMessage(error);if(onValidate){onValidate(error);}}},[disabled,validate,setErrorMessage,onValidate,required,strings.requiredFieldMessage]);wonderBlocksCore.useOnMountEffect(()=>{if(hasValue(value)){handleValidation(value);}});function onOpenerBlurValidation(){if(!open&&required&&!hasValue(value)){handleValidation(value);}}const onDropdownClosedValidation=()=>{if(required&&!hasValue(value)){handleValidation(value);}};const onSelectionValidation=newValue=>{handleValidation(newValue);};const onSelectedValuesChangeValidation=()=>{setErrorMessage(null);if(onValidate){onValidate(null);}};return {errorMessage,onOpenerBlurValidation,onDropdownClosedValidation,onSelectionValidation,onSelectedValuesChangeValidation}}
101
113
 
102
- const SingleSelect=props=>{const selectedIndex=React__namespace.useRef(0);const isInitialRender=React__namespace.useRef(true);const{children,error=false,id,opener,placeholder,selectedValue,testId,alignment="left",autoFocus=true,dropdownStyle,enableTypeAhead=true,isFilterable,labels:propLabels,onChange,onToggle,opened,style,className,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled=false,readOnly=false,dropdownId,validate,onValidate,required,showOpenerLabelAsText=true,...sharedProps}=props;const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSearch:propLabels?.clearSearch||strings.iconAltClearSearch,filter:propLabels?.filter||strings.filter,noResults:propLabels?.noResults||strings.noResults,someResults:propLabels?.someResults||(numResults=>strings.numItems({num:numResults}))}),[strings,propLabels]);const[open,setOpen]=React__namespace.useState(false);const[searchText,setSearchText]=React__namespace.useState("");const[openerElement,setOpenerElement]=React__namespace.useState();const{errorMessage,onOpenerBlurValidation,onDropdownClosedValidation,onSelectionValidation}=useSelectValidation({value:selectedValue,disabled,validate,onValidate,required,open});const hasError=error||!!errorMessage;React__namespace.useEffect(()=>{if(disabled||readOnly){setOpen(false);}else if(typeof opened==="boolean"){setOpen(opened);}},[disabled,opened,readOnly]);const handleOpenChanged=opened=>{setOpen(opened);setSearchText("");if(onToggle){onToggle(opened);}if(!opened){onDropdownClosedValidation();}};const handleToggle=newSelectedValue=>{if(newSelectedValue!==selectedValue){onChange(newSelectedValue);}if(open&&openerElement){openerElement.focus();}setOpen(false);if(onToggle){onToggle(false);}onSelectionValidation(newSelectedValue);};const mapOptionItemsToDropdownItems=children=>{let indexCounter=0;selectedIndex.current=0;return children.map(option=>{const{disabled,value}=option.props;const selected=selectedValue===value;if(selected){selectedIndex.current=indexCounter;}if(!disabled){indexCounter+=1;}return {component:option,focusable:!disabled,populatedProps:{onToggle:handleToggle,selected:selected,variant:"check"}}})};const filterChildren=children=>{const lowercasedSearchText=searchText.toLowerCase();return children.filter(({props})=>!searchText||getLabel(props).toLowerCase().indexOf(lowercasedSearchText)>-1)};const getMenuItems=children=>{return mapOptionItemsToDropdownItems(isFilterable?filterChildren(children):children)};const handleSearchTextChanged=searchText=>{setSearchText(searchText);};const handleOpenerRef=node=>{const openerElement=ReactDOM__namespace.findDOMNode(node);setOpenerElement(openerElement);};const handleClick=e=>{handleOpenChanged(!open);};const handleAnnouncement=message=>{wonderBlocksAnnouncer.announceMessage({message,level:"polite"});};const childrenRef=React__namespace.useRef(children);childrenRef.current=children;const announceSelectedItem=()=>{const optionItems=React__namespace.Children.toArray(childrenRef.current);const selectedItem=optionItems.find(option=>option.props.value===selectedValue);if(selectedItem){const label=getLabel(selectedItem.props);if(label){handleAnnouncement(label);}}};React__namespace.useEffect(()=>{if(isInitialRender.current){isInitialRender.current=false;return}announceSelectedItem();},[selectedValue]);const computedRequired=ariaRequired??!!required;const renderOpener=(isDisabled,dropdownId)=>{const items=React__namespace.Children.toArray(children);const selectedItem=items.find(option=>option.props.value===selectedValue);let menuContent;if(selectedItem){menuContent=getSelectOpenerLabel(showOpenerLabelAsText,selectedItem.props);}else {menuContent=placeholder;}const dropdownOpener=jsxRuntime.jsx(wonderBlocksCore.Id,{id:id,children:uniqueOpenerId=>{return opener?jsxRuntime.jsx(DropdownOpener,{id:uniqueOpenerId,"aria-label":ariaLabel,"aria-controls":dropdownId,"aria-required":computedRequired,"aria-haspopup":"listbox",onClick:handleClick,disabled:isDisabled,ref:handleOpenerRef,role:"combobox",text:menuContent,opened:open,error:hasError,onBlur:onOpenerBlurValidation,readOnly:readOnly,children:opener}):jsxRuntime.jsx(SelectOpener,{...sharedProps,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-controls":dropdownId,"aria-required":computedRequired,disabled:isDisabled,id:uniqueOpenerId,error:hasError,isPlaceholder:!selectedItem,onOpenChanged:handleOpenChanged,open:open,ref:handleOpenerRef,testId:testId,onBlur:onOpenerBlurValidation,readOnly:readOnly,children:menuContent})}});return dropdownOpener};const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const numEnabledOptions=allChildren.filter(option=>!option.props.disabled).length;const items=getMenuItems(allChildren);const isDisabled=numEnabledOptions===0||disabled;const disableInteraction=isDisabled||readOnly;const listboxLabelProps=getListboxLabelProps({ariaLabel,ariaLabelledBy,openerElement});const{someResults}=labels;const someResultsRef=React__namespace.useRef(someResults);someResultsRef.current=someResults;const openRef=React__namespace.useRef(open);openRef.current=open;React__namespace.useEffect(()=>{if(openRef.current){handleAnnouncement(someResultsRef.current(items.length));}},[items.length]);return jsxRuntime.jsx(wonderBlocksCore.Id,{id:dropdownId,children:uniqueDropdownId=>jsxRuntime.jsx(DropdownCore,{id:uniqueDropdownId,role:"listbox",selectionType:"single",alignment:alignment,autoFocus:autoFocus,enableTypeAhead:enableTypeAhead,dropdownStyle:[isFilterable&&filterableDropdownStyle,selectDropdownStyle,dropdownStyle],initialFocusedIndex:selectedIndex.current,items:items,onOpenChanged:handleOpenChanged,open:open,opener:renderOpener(isDisabled,uniqueDropdownId),openerElement:openerElement,style:style,className:className,isFilterable:isFilterable,onSearchTextChanged:isFilterable?handleSearchTextChanged:undefined,searchText:isFilterable?searchText:"",labels:labels,...listboxLabelProps,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled:disableInteraction})})};
114
+ const SingleSelect=props=>{const selectedIndex=React__namespace.useRef(0);const isInitialRender=React__namespace.useRef(true);const{children,error=false,id,opener,placeholder,selectedValue,testId,alignment="left",autoFocus=true,dropdownStyle,enableTypeAhead=true,isFilterable,labels:propLabels,onChange,onToggle,opened,style,className,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled=false,readOnly=false,dropdownId,validate,onValidate,required,showOpenerLabelAsText=true,...sharedProps}=props;const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSearch:propLabels?.clearSearch||strings.iconAltClearSearch,filter:propLabels?.filter||strings.filter,noResults:propLabels?.noResults||strings.noResults,someResults:propLabels?.someResults||(numResults=>strings.numItems({num:numResults}))}),[strings,propLabels]);const[open,setOpen]=React__namespace.useState(false);const[searchText,setSearchText]=React__namespace.useState("");const[openerElement,setOpenerElement]=React__namespace.useState();const{errorMessage,onOpenerBlurValidation,onDropdownClosedValidation,onSelectionValidation}=useSelectValidation({value:selectedValue,disabled,validate,onValidate,required,open});const hasError=error||!!errorMessage;React__namespace.useEffect(()=>{if(disabled||readOnly){setOpen(false);}else if(typeof opened==="boolean"){setOpen(opened);}},[disabled,opened,readOnly]);const handleOpenChanged=opened=>{setOpen(opened);setSearchText("");if(onToggle){onToggle(opened);}if(!opened){onDropdownClosedValidation();}};const handleToggle=newSelectedValue=>{if(newSelectedValue!==selectedValue){onChange(newSelectedValue);}if(open&&openerElement){openerElement.focus();}setOpen(false);if(onToggle){onToggle(false);}onSelectionValidation(newSelectedValue);};const mapOptionItemsToDropdownItems=children=>{let indexCounter=0;selectedIndex.current=0;return children.map(option=>{const{disabled,value}=option.props;const selected=selectedValue===value;if(selected){selectedIndex.current=indexCounter;}if(!disabled){indexCounter+=1;}return {component:option,focusable:!disabled,populatedProps:{onToggle:handleToggle,selected:selected,variant:"check"}}})};const filterChildren=children=>{const lowercasedSearchText=searchText.toLowerCase();return children.filter(({props})=>!searchText||getLabel(props).toLowerCase().indexOf(lowercasedSearchText)>-1)};const getMenuItems=children=>{return mapOptionItemsToDropdownItems(isFilterable?filterChildren(children):children)};const handleSearchTextChanged=searchText=>{setSearchText(searchText);};const handleOpenerRef=node=>{const openerElement=ReactDOM__namespace.findDOMNode(node);setOpenerElement(openerElement);};const handleClick=e=>{handleOpenChanged(!open);};const handleAnnouncement=message=>{wonderBlocksAnnouncer.announceMessage({message,level:"polite"});};const childrenRef=React__namespace.useRef(children);childrenRef.current=children;const announceSelectedItem=()=>{const optionItems=React__namespace.Children.toArray(childrenRef.current);const selectedItem=optionItems.find(option=>option.props.value===selectedValue);if(selectedItem){const label=getLabel(selectedItem.props);if(label){handleAnnouncement(label);}}};React__namespace.useEffect(()=>{if(isInitialRender.current){isInitialRender.current=false;return}announceSelectedItem();},[selectedValue]);const computedRequired=ariaRequired??!!required;const renderOpener=(isDisabled,dropdownId)=>{const items=React__namespace.Children.toArray(children);const selectedItem=items.find(option=>option.props.value===selectedValue);let menuContent;if(selectedItem){menuContent=getSelectOpenerLabel(showOpenerLabelAsText,selectedItem.props);}else {menuContent=placeholder;}const dropdownOpener=jsxRuntime.jsx(wonderBlocksCore.Id,{id:id,children:uniqueOpenerId=>{return opener?jsxRuntime.jsx(DropdownOpener$1,{id:uniqueOpenerId,"aria-label":ariaLabel,"aria-controls":dropdownId,"aria-required":computedRequired,"aria-haspopup":"listbox",onClick:handleClick,disabled:isDisabled,ref:handleOpenerRef,role:"combobox",text:menuContent,opened:open,error:hasError,onBlur:onOpenerBlurValidation,readOnly:readOnly,children:opener}):jsxRuntime.jsx(SelectOpener,{...sharedProps,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-controls":dropdownId,"aria-required":computedRequired,disabled:isDisabled,id:uniqueOpenerId,error:hasError,isPlaceholder:!selectedItem,onOpenChanged:handleOpenChanged,open:open,ref:handleOpenerRef,testId:testId,onBlur:onOpenerBlurValidation,readOnly:readOnly,children:menuContent})}});return dropdownOpener};const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const numEnabledOptions=allChildren.filter(option=>!option.props.disabled).length;const items=getMenuItems(allChildren);const isDisabled=numEnabledOptions===0||disabled;const disableInteraction=isDisabled||readOnly;const listboxLabelProps=getListboxLabelProps({ariaLabel,ariaLabelledBy,openerElement});const{someResults}=labels;const someResultsRef=React__namespace.useRef(someResults);someResultsRef.current=someResults;const openRef=React__namespace.useRef(open);openRef.current=open;React__namespace.useEffect(()=>{if(openRef.current){handleAnnouncement(someResultsRef.current(items.length));}},[items.length]);return jsxRuntime.jsx(wonderBlocksCore.Id,{id:dropdownId,children:uniqueDropdownId=>jsxRuntime.jsx(DropdownCore$1,{id:uniqueDropdownId,role:"listbox",selectionType:"single",alignment:alignment,autoFocus:autoFocus,enableTypeAhead:enableTypeAhead,dropdownStyle:[isFilterable&&filterableDropdownStyle,selectDropdownStyle,dropdownStyle],initialFocusedIndex:selectedIndex.current,items:items,onOpenChanged:handleOpenChanged,open:open,opener:renderOpener(isDisabled,uniqueDropdownId),openerElement:openerElement,style:style,className:className,isFilterable:isFilterable,onSearchTextChanged:isFilterable?handleSearchTextChanged:undefined,searchText:isFilterable?searchText:"",labels:labels,...listboxLabelProps,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled:disableInteraction})})};var SingleSelect$1 = SingleSelect;
103
115
 
104
- const MultiSelect=props=>{const isInitialRender=React__namespace.useRef(true);const{id,opener,testId,alignment="left",dropdownStyle,implicitAllEnabled,isFilterable,labels:propLabels,onChange,onToggle,opened,selectedValues=[],shortcuts=false,style,className,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled=false,readOnly=false,error=false,children,dropdownId,showOpenerLabelAsText=true,validate,onValidate,required,...sharedProps}=props;const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSearch:propLabels?.clearSearch||strings.iconAltClearSearch,filter:propLabels?.filter||strings.filter,noResults:propLabels?.noResults||strings.noResults,selectAllLabel:propLabels?.selectAllLabel||(numOptions=>strings.selectAllWithCount({num:numOptions})),selectNoneLabel:propLabels?.selectNoneLabel||strings.selectNone,noneSelected:propLabels?.noneSelected||strings.zeroItems,someSelected:propLabels?.someSelected||(numSelectedValues=>strings.numItems({num:numSelectedValues})),allSelected:propLabels?.allSelected||strings.allItems}),[strings,propLabels]);const[open,setOpen]=React__namespace.useState(false);const[searchText,setSearchText]=React__namespace.useState("");const[lastSelectedValues,setLastSelectedValues]=React__namespace.useState([]);const[openerElement,setOpenerElement]=React__namespace.useState();const{errorMessage,onOpenerBlurValidation,onDropdownClosedValidation,onSelectionValidation,onSelectedValuesChangeValidation}=useSelectValidation({value:selectedValues,disabled,validate,onValidate,required,open});const hasError=error||!!errorMessage;React__namespace.useEffect(()=>{if(disabled||readOnly){setOpen(false);}else if(typeof opened==="boolean"){setOpen(opened);}},[disabled,opened,readOnly]);const handleOpenChanged=opened=>{setOpen(opened);setSearchText("");setLastSelectedValues(selectedValues);if(onToggle){onToggle(opened);}if(!opened){if(lastSelectedValues!==selectedValues){onSelectionValidation(selectedValues);}else {onDropdownClosedValidation();}}};const handleToggle=selectedValue=>{if(selectedValues.includes(selectedValue)){const index=selectedValues.indexOf(selectedValue);const updatedSelection=[...selectedValues.slice(0,index),...selectedValues.slice(index+1)];onChange(updatedSelection);}else {onChange([...selectedValues,selectedValue]);}onSelectedValuesChangeValidation();};const handleSelectAll=()=>{const allChildren=React__namespace.Children.toArray(children);const selected=allChildren.filter(option=>!!option&&!option.props.disabled).map(option=>option.props.value);onChange(selected);onSelectedValuesChangeValidation();};const handleSelectNone=()=>{onChange([]);onSelectedValuesChangeValidation();};const getMenuTextOrNode=React__namespace.useCallback(children=>{const{noneSelected,someSelected,allSelected}=labels;const numSelectedAll=children.filter(option=>!option.props.disabled).length;const noSelectionText=implicitAllEnabled?allSelected:noneSelected;switch(selectedValues.length){case 0:return noSelectionText;case 1:const selectedItem=children.find(option=>option.props.value===selectedValues[0]);if(selectedItem){const selectedLabel=getSelectOpenerLabel(showOpenerLabelAsText,selectedItem?.props);if(selectedLabel){return selectedLabel}else {return someSelected(1)}}return noSelectionText;case numSelectedAll:return allSelected;default:return someSelected(selectedValues.length)}},[implicitAllEnabled,labels,selectedValues,showOpenerLabelAsText]);const getShortcuts=numOptions=>{const{selectAllLabel,selectNoneLabel}=labels;if(shortcuts&&!searchText){const selectAllDisabled=numOptions===selectedValues.length;const selectAll={component:jsxRuntime.jsx(ActionItem,{disabled:selectAllDisabled,label:selectAllLabel(numOptions),indent:true,onClick:handleSelectAll}),focusable:!selectAllDisabled,populatedProps:{}};const selectNoneDisabled=selectedValues.length===0;const selectNone={component:jsxRuntime.jsx(ActionItem,{disabled:selectNoneDisabled,label:selectNoneLabel,indent:true,onClick:handleSelectNone}),focusable:!selectNoneDisabled,populatedProps:{}};const separator={component:jsxRuntime.jsx(SeparatorItem,{},"shortcuts-separator"),focusable:false,populatedProps:{}};return [selectAll,selectNone,separator]}else {return []}};const getMenuItems=children=>{if(!isFilterable){return children.map(mapOptionItemToDropdownItem)}const lowercasedSearchText=searchText.toLowerCase();const filteredChildren=children.filter(({props})=>!searchText||getLabel(props).toLowerCase().indexOf(lowercasedSearchText)>-1);const lastSelectedChildren=[];const restOfTheChildren=[];for(const child of filteredChildren){if(lastSelectedValues.includes(child.props.value)){lastSelectedChildren.push(child);}else {restOfTheChildren.push(child);}}const lastSelectedItems=lastSelectedChildren.map(mapOptionItemToDropdownItem);if(lastSelectedChildren.length&&restOfTheChildren.length){lastSelectedItems.push({component:jsxRuntime.jsx(SeparatorItem,{},"selected-separator"),focusable:false,populatedProps:{}});}return [...lastSelectedItems,...restOfTheChildren.map(mapOptionItemToDropdownItem)]};const mapOptionItemToDropdownItem=option=>{const{disabled,value}=option.props;return {component:option,focusable:!disabled,populatedProps:{onToggle:handleToggle,selected:selectedValues.includes(value),variant:"checkbox"}}};const handleOpenerRef=node=>{const openerElement=ReactDOM__namespace.findDOMNode(node);setOpenerElement(openerElement);};const handleSearchTextChanged=searchText=>{setSearchText(searchText);};const handleClick=e=>{handleOpenChanged(!open);};const handleAnnouncement=message=>{wonderBlocksAnnouncer.announceMessage({message,level:"polite"});};const maybeGetOpenerStringValue=React__namespace.useCallback((children,openerContent)=>{let openerStringValue;if(selectedValues.length===1){const selectedItem=children.find(option=>option.props.value===selectedValues[0]);openerStringValue=selectedItem?getLabel(selectedItem?.props):undefined;}else if(typeof openerContent==="string"){openerStringValue=openerContent;}return openerStringValue},[selectedValues]);const prevOpenRef=React__namespace.useRef(open);const selectionChangedRef=React__namespace.useRef(false);const childrenRef=React__namespace.useRef(children);childrenRef.current=children;const getMenuTextOrNodeRef=React__namespace.useRef(getMenuTextOrNode);getMenuTextOrNodeRef.current=getMenuTextOrNode;const maybeGetOpenerStringValueRef=React__namespace.useRef(maybeGetOpenerStringValue);maybeGetOpenerStringValueRef.current=maybeGetOpenerStringValue;const announceOpenerValue=()=>{const optionItems=React__namespace.Children.toArray(childrenRef.current);const openerContent=getMenuTextOrNodeRef.current(optionItems);const openerStringValue=maybeGetOpenerStringValueRef.current(optionItems,openerContent);if(openerStringValue){handleAnnouncement(openerStringValue);}};React__namespace.useEffect(()=>{if(isInitialRender.current){isInitialRender.current=false;prevOpenRef.current=open;return}const justOpened=open&&!prevOpenRef.current;const justClosed=!open&&prevOpenRef.current;prevOpenRef.current=open;if(justOpened){selectionChangedRef.current=false;}else if(justClosed){if(selectionChangedRef.current){announceOpenerValue();selectionChangedRef.current=false;}}else if(open){selectionChangedRef.current=true;announceOpenerValue();}},[selectedValues,open]);const computedRequired=ariaRequired??!!required;const renderOpener=(allChildren,isDisabled,dropdownId)=>{const{noneSelected}=labels;const openerContent=getMenuTextOrNode(allChildren);const dropdownOpener=jsxRuntime.jsx(wonderBlocksCore.Id,{id:id,children:uniqueOpenerId=>{return opener?jsxRuntime.jsx(DropdownOpener,{id:uniqueOpenerId,error:hasError,"aria-label":ariaLabel,"aria-controls":dropdownId,"aria-required":computedRequired,"aria-haspopup":"listbox",onClick:handleClick,onBlur:onOpenerBlurValidation,disabled:isDisabled,ref:handleOpenerRef,role:"combobox",text:openerContent,opened:open,readOnly:readOnly,children:opener}):jsxRuntime.jsx(SelectOpener,{...sharedProps,error:hasError,disabled:isDisabled,id:uniqueOpenerId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-controls":dropdownId,"aria-required":computedRequired,isPlaceholder:openerContent===noneSelected,onOpenChanged:handleOpenChanged,onBlur:onOpenerBlurValidation,open:open,ref:handleOpenerRef,testId:testId,readOnly:readOnly,children:openerContent})}});return dropdownOpener};const{clearSearch,filter,noResults,someSelected}=labels;const listboxLabelProps=getListboxLabelProps({ariaLabel,ariaLabelledBy,openerElement});const someSelectedRef=React__namespace.useRef(someSelected);someSelectedRef.current=someSelected;const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const numEnabledOptions=allChildren.filter(option=>!option.props.disabled).length;const filteredItems=getMenuItems(allChildren);const isDisabled=numEnabledOptions===0||disabled;const disableInteraction=isDisabled||readOnly;React__namespace.useEffect(()=>{if(searchText){handleAnnouncement(someSelectedRef.current(filteredItems.length));}},[filteredItems.length,someSelectedRef]);return jsxRuntime.jsx(wonderBlocksCore.Id,{id:dropdownId,children:uniqueDropdownId=>jsxRuntime.jsx(DropdownCore,{id:uniqueDropdownId,role:"listbox",alignment:alignment,dropdownStyle:[isFilterable&&filterableDropdownStyle,selectDropdownStyle,dropdownStyle],isFilterable:isFilterable,items:[...getShortcuts(numEnabledOptions),...filteredItems],onOpenChanged:handleOpenChanged,open:open,opener:renderOpener(allChildren,isDisabled,uniqueDropdownId),openerElement:openerElement,selectionType:"multi",style:style,className:className,onSearchTextChanged:isFilterable?handleSearchTextChanged:undefined,searchText:isFilterable?searchText:"",labels:{clearSearch,filter,noResults,someResults:someSelected},...listboxLabelProps,"aria-invalid":ariaInvalid,"aria-required":computedRequired,disabled:disableInteraction})})};
116
+ const MultiSelect=props=>{const isInitialRender=React__namespace.useRef(true);const{id,opener,testId,alignment="left",dropdownStyle,implicitAllEnabled,isFilterable,labels:propLabels,onChange,onToggle,opened,selectedValues=[],shortcuts=false,style,className,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,disabled=false,readOnly=false,error=false,children,dropdownId,showOpenerLabelAsText=true,validate,onValidate,required,...sharedProps}=props;const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSearch:propLabels?.clearSearch||strings.iconAltClearSearch,filter:propLabels?.filter||strings.filter,noResults:propLabels?.noResults||strings.noResults,selectAllLabel:propLabels?.selectAllLabel||(numOptions=>strings.selectAllWithCount({num:numOptions})),selectNoneLabel:propLabels?.selectNoneLabel||strings.selectNone,noneSelected:propLabels?.noneSelected||strings.zeroItems,someSelected:propLabels?.someSelected||(numSelectedValues=>strings.numItems({num:numSelectedValues})),allSelected:propLabels?.allSelected||strings.allItems}),[strings,propLabels]);const[open,setOpen]=React__namespace.useState(false);const[searchText,setSearchText]=React__namespace.useState("");const[lastSelectedValues,setLastSelectedValues]=React__namespace.useState([]);const[openerElement,setOpenerElement]=React__namespace.useState();const{errorMessage,onOpenerBlurValidation,onDropdownClosedValidation,onSelectionValidation,onSelectedValuesChangeValidation}=useSelectValidation({value:selectedValues,disabled,validate,onValidate,required,open});const hasError=error||!!errorMessage;React__namespace.useEffect(()=>{if(disabled||readOnly){setOpen(false);}else if(typeof opened==="boolean"){setOpen(opened);}},[disabled,opened,readOnly]);const handleOpenChanged=opened=>{setOpen(opened);setSearchText("");setLastSelectedValues(selectedValues);if(onToggle){onToggle(opened);}if(!opened){if(lastSelectedValues!==selectedValues){onSelectionValidation(selectedValues);}else {onDropdownClosedValidation();}}};const handleToggle=selectedValue=>{if(selectedValues.includes(selectedValue)){const index=selectedValues.indexOf(selectedValue);const updatedSelection=[...selectedValues.slice(0,index),...selectedValues.slice(index+1)];onChange(updatedSelection);}else {onChange([...selectedValues,selectedValue]);}onSelectedValuesChangeValidation();};const handleSelectAll=()=>{const allChildren=React__namespace.Children.toArray(children);const selected=allChildren.filter(option=>!!option&&!option.props.disabled).map(option=>option.props.value);onChange(selected);onSelectedValuesChangeValidation();};const handleSelectNone=()=>{onChange([]);onSelectedValuesChangeValidation();};const getMenuTextOrNode=React__namespace.useCallback(children=>{const{noneSelected,someSelected,allSelected}=labels;const numSelectedAll=children.filter(option=>!option.props.disabled).length;const noSelectionText=implicitAllEnabled?allSelected:noneSelected;switch(selectedValues.length){case 0:return noSelectionText;case 1:const selectedItem=children.find(option=>option.props.value===selectedValues[0]);if(selectedItem){const selectedLabel=getSelectOpenerLabel(showOpenerLabelAsText,selectedItem?.props);if(selectedLabel){return selectedLabel}else {return someSelected(1)}}return noSelectionText;case numSelectedAll:return allSelected;default:return someSelected(selectedValues.length)}},[implicitAllEnabled,labels,selectedValues,showOpenerLabelAsText]);const getShortcuts=numOptions=>{const{selectAllLabel,selectNoneLabel}=labels;if(shortcuts&&!searchText){const selectAllDisabled=numOptions===selectedValues.length;const selectAll={component:jsxRuntime.jsx(ActionItem$1,{disabled:selectAllDisabled,label:selectAllLabel(numOptions),indent:true,onClick:handleSelectAll}),focusable:!selectAllDisabled,populatedProps:{}};const selectNoneDisabled=selectedValues.length===0;const selectNone={component:jsxRuntime.jsx(ActionItem$1,{disabled:selectNoneDisabled,label:selectNoneLabel,indent:true,onClick:handleSelectNone}),focusable:!selectNoneDisabled,populatedProps:{}};const separator={component:jsxRuntime.jsx(SeparatorItem,{},"shortcuts-separator"),focusable:false,populatedProps:{}};return [selectAll,selectNone,separator]}else {return []}};const getMenuItems=children=>{if(!isFilterable){return children.map(mapOptionItemToDropdownItem)}const lowercasedSearchText=searchText.toLowerCase();const filteredChildren=children.filter(({props})=>!searchText||getLabel(props).toLowerCase().indexOf(lowercasedSearchText)>-1);const lastSelectedChildren=[];const restOfTheChildren=[];for(const child of filteredChildren){if(lastSelectedValues.includes(child.props.value)){lastSelectedChildren.push(child);}else {restOfTheChildren.push(child);}}const lastSelectedItems=lastSelectedChildren.map(mapOptionItemToDropdownItem);if(lastSelectedChildren.length&&restOfTheChildren.length){lastSelectedItems.push({component:jsxRuntime.jsx(SeparatorItem,{},"selected-separator"),focusable:false,populatedProps:{}});}return [...lastSelectedItems,...restOfTheChildren.map(mapOptionItemToDropdownItem)]};const mapOptionItemToDropdownItem=option=>{const{disabled,value}=option.props;return {component:option,focusable:!disabled,populatedProps:{onToggle:handleToggle,selected:selectedValues.includes(value),variant:"checkbox"}}};const handleOpenerRef=node=>{const openerElement=ReactDOM__namespace.findDOMNode(node);setOpenerElement(openerElement);};const handleSearchTextChanged=searchText=>{setSearchText(searchText);};const handleClick=e=>{handleOpenChanged(!open);};const handleAnnouncement=message=>{wonderBlocksAnnouncer.announceMessage({message,level:"polite"});};const maybeGetOpenerStringValue=React__namespace.useCallback((children,openerContent)=>{let openerStringValue;if(selectedValues.length===1){const selectedItem=children.find(option=>option.props.value===selectedValues[0]);openerStringValue=selectedItem?getLabel(selectedItem?.props):undefined;}else if(typeof openerContent==="string"){openerStringValue=openerContent;}return openerStringValue},[selectedValues]);const prevOpenRef=React__namespace.useRef(open);const selectionChangedRef=React__namespace.useRef(false);const childrenRef=React__namespace.useRef(children);childrenRef.current=children;const getMenuTextOrNodeRef=React__namespace.useRef(getMenuTextOrNode);getMenuTextOrNodeRef.current=getMenuTextOrNode;const maybeGetOpenerStringValueRef=React__namespace.useRef(maybeGetOpenerStringValue);maybeGetOpenerStringValueRef.current=maybeGetOpenerStringValue;const announceOpenerValue=()=>{const optionItems=React__namespace.Children.toArray(childrenRef.current);const openerContent=getMenuTextOrNodeRef.current(optionItems);const openerStringValue=maybeGetOpenerStringValueRef.current(optionItems,openerContent);if(openerStringValue){handleAnnouncement(openerStringValue);}};React__namespace.useEffect(()=>{if(isInitialRender.current){isInitialRender.current=false;prevOpenRef.current=open;return}const justOpened=open&&!prevOpenRef.current;const justClosed=!open&&prevOpenRef.current;prevOpenRef.current=open;if(justOpened){selectionChangedRef.current=false;}else if(justClosed){if(selectionChangedRef.current){announceOpenerValue();selectionChangedRef.current=false;}}else if(open){selectionChangedRef.current=true;announceOpenerValue();}},[selectedValues,open]);const computedRequired=ariaRequired??!!required;const renderOpener=(allChildren,isDisabled,dropdownId)=>{const{noneSelected}=labels;const openerContent=getMenuTextOrNode(allChildren);const dropdownOpener=jsxRuntime.jsx(wonderBlocksCore.Id,{id:id,children:uniqueOpenerId=>{return opener?jsxRuntime.jsx(DropdownOpener$1,{id:uniqueOpenerId,error:hasError,"aria-label":ariaLabel,"aria-controls":dropdownId,"aria-required":computedRequired,"aria-haspopup":"listbox",onClick:handleClick,onBlur:onOpenerBlurValidation,disabled:isDisabled,ref:handleOpenerRef,role:"combobox",text:openerContent,opened:open,readOnly:readOnly,children:opener}):jsxRuntime.jsx(SelectOpener,{...sharedProps,error:hasError,disabled:isDisabled,id:uniqueOpenerId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-controls":dropdownId,"aria-required":computedRequired,isPlaceholder:openerContent===noneSelected,onOpenChanged:handleOpenChanged,onBlur:onOpenerBlurValidation,open:open,ref:handleOpenerRef,testId:testId,readOnly:readOnly,children:openerContent})}});return dropdownOpener};const{clearSearch,filter,noResults,someSelected}=labels;const listboxLabelProps=getListboxLabelProps({ariaLabel,ariaLabelledBy,openerElement});const someSelectedRef=React__namespace.useRef(someSelected);someSelectedRef.current=someSelected;const allChildren=React__namespace.Children.toArray(children).filter(Boolean);const numEnabledOptions=allChildren.filter(option=>!option.props.disabled).length;const filteredItems=getMenuItems(allChildren);const isDisabled=numEnabledOptions===0||disabled;const disableInteraction=isDisabled||readOnly;React__namespace.useEffect(()=>{if(searchText){handleAnnouncement(someSelectedRef.current(filteredItems.length));}},[filteredItems.length,someSelectedRef]);return jsxRuntime.jsx(wonderBlocksCore.Id,{id:dropdownId,children:uniqueDropdownId=>jsxRuntime.jsx(DropdownCore$1,{id:uniqueDropdownId,role:"listbox",alignment:alignment,dropdownStyle:[isFilterable&&filterableDropdownStyle,selectDropdownStyle,dropdownStyle],isFilterable:isFilterable,items:[...getShortcuts(numEnabledOptions),...filteredItems],onOpenChanged:handleOpenChanged,open:open,opener:renderOpener(allChildren,isDisabled,uniqueDropdownId),openerElement:openerElement,selectionType:"multi",style:style,className:className,onSearchTextChanged:isFilterable?handleSearchTextChanged:undefined,searchText:isFilterable?searchText:"",labels:{clearSearch,filter,noResults,someResults:someSelected},...listboxLabelProps,"aria-invalid":ariaInvalid,"aria-required":computedRequired,disabled:disableInteraction})})};var MultiSelect$1 = MultiSelect;
105
117
 
106
118
  function updateMultipleSelection(previousSelection,value=""){if(!previousSelection){return [value]}return previousSelection.includes(value)?previousSelection.filter(item=>item!==value):[...previousSelection,value]}
107
119
 
@@ -109,22 +121,34 @@ function useListbox({children:options,disabled,disableSpaceSelection,id,onChange
109
121
 
110
122
  function useMultipleSelection({inputValue,isComboboxOpen,selected,onRemove}){const[focusedMultiSelectIndex,setFocusedMultiSelectIndex]=React__namespace.useState(-1);React__namespace.useEffect(()=>{if(!isComboboxOpen){setFocusedMultiSelectIndex(-1);}},[isComboboxOpen]);const handleKeyDown=React__namespace.useCallback(event=>{const{key}=event;if(!Array.isArray(selected)||selected.length===0){return}if(inputValue===""&&key==="ArrowLeft"){setFocusedMultiSelectIndex(prev=>{const newIndex=prev-1;return newIndex<0?selected?.length-1:newIndex});}if(inputValue===""&&key==="ArrowRight"){setFocusedMultiSelectIndex(prev=>{const newIndex=prev+1;return newIndex>=selected?.length?0:newIndex});}if(inputValue===""&&key==="Backspace"){let newSelected=[];if(focusedMultiSelectIndex<0){newSelected=selected?.slice(0,-1);}else {newSelected=selected.filter((_,index)=>index!==focusedMultiSelectIndex);}setFocusedMultiSelectIndex(-1);onRemove?.(newSelected);}if(focusedMultiSelectIndex>=0&&key==="Enter"){const newSelected=selected?.filter((_,index)=>index!==focusedMultiSelectIndex);onRemove?.(newSelected);setFocusedMultiSelectIndex(-1);}if(key==="ArrowDown"||key==="ArrowUp"){setFocusedMultiSelectIndex(-1);}if(key==="Escape"){setFocusedMultiSelectIndex(-1);}},[focusedMultiSelectIndex,inputValue,selected,onRemove]);return {focusedMultiSelectIndex,handleKeyDown}}
111
123
 
112
- const StyledSpan=wonderBlocksCore.addStyle("span");function ComboboxLiveRegion({focusedIndex,focusedMultiSelectIndex,labels:propLabels,selectedLabels,opened,options,selected,selectionType="single",testId}){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({closedState:propLabels?.closedState||strings.srComboboxClosed,liveRegionCurrentItem:propLabels?.liveRegionCurrentItem||(({current,index,total,disabled,focused,selected})=>{const states=[focused&&strings.srFocused,disabled&&strings.srDisabled,selected&&strings.srSelected].filter(Boolean);return strings.srCurrentItemDetails({current:[current,...states].join(" "),index:index+1,total})}),liveRegionListboxTotal:propLabels?.liveRegionListboxTotal||(total=>strings.srNumResultsAvailable({num:total})),liveRegionMultipleSelectionTotal:propLabels?.liveRegionMultipleSelectionTotal||(total=>strings.srNumSelectedOptions({num:total})),noItems:propLabels?.noItems||strings.noResults,selected:propLabels?.selected||(labels=>strings.srItemsSelected({labels})),selectionCleared:propLabels?.selectionCleared||strings.srSelectionCleared,unselected:propLabels?.unselected||(labels=>strings.srItemsNotSelected({labels}))}),[propLabels,strings]);const lastSelectedValue=React__namespace.useRef(null);const[message,setMessage]=React__namespace.useState("");React__namespace.useEffect(()=>{if(selected&&selected!==lastSelectedValue?.current){let newMessage="";const lastSelectedLength=lastSelectedValue?.current?.length??0;const selectedLength=selected?.length??0;if(Array.isArray(selected)&&selected.length>0){const currentLabels=selectedLabels.join(", ");const selectedState=selectedLength>lastSelectedLength?labels.selected(currentLabels):labels.unselected(currentLabels);newMessage=selectedState;}else {newMessage=labels.selected(selectedLabels[0]);}setMessage(newMessage);}if(selectionType==="single"&&!selected&&lastSelectedValue.current){setMessage(labels.selectionCleared);}lastSelectedValue.current=selected;if(selectionType==="multiple"&&!opened){setMessage(labels.closedState);}},[labels,labels.closedState,selectedLabels,opened,selected,selectionType]);const focusedElementDescription=React__namespace.useMemo(()=>{if(focusedMultiSelectIndex>=0){const label=selectedLabels[focusedMultiSelectIndex];return labels.liveRegionCurrentItem({current:label,focused:true,index:focusedMultiSelectIndex,total:selectedLabels.length})+" "+labels.liveRegionMultipleSelectionTotal(selectedLabels.length)}if(options.length===0){return labels.noItems}if(focusedIndex<0||!options[focusedIndex]){return ""}const currentItemProps=options[focusedIndex].props;const label=getLabel(currentItemProps);const totalResults=options.length;return labels.liveRegionCurrentItem({current:label,disabled:currentItemProps.disabled,focused:false,index:focusedIndex,selected:currentItemProps.selected,total:totalResults})+" "+labels.liveRegionListboxTotal(totalResults)},[focusedIndex,focusedMultiSelectIndex,labels,options,selectedLabels]);return jsxRuntime.jsx(StyledSpan,{role:"log","aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",style:styles$4.srOnly,"data-testid":testId?`${testId}-status`:undefined,children:opened?focusedElementDescription:message})}const styles$4=aphrodite.StyleSheet.create({srOnly:{border:0,clip:"rect(0,0,0,0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",width:1}});
124
+ var modules_db114d3e={"srOnly":"wb-combobox-live-region-srOnly-aac1c1e3"};
125
+
126
+ const StyledSpan=wonderBlocksCore.addStyle("span");function ComboboxLiveRegion({focusedIndex,focusedMultiSelectIndex,labels:propLabels,selectedLabels,opened,options,selected,selectionType="single",testId}){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({closedState:propLabels?.closedState||strings.srComboboxClosed,liveRegionCurrentItem:propLabels?.liveRegionCurrentItem||(({current,index,total,disabled,focused,selected})=>{const states=[focused&&strings.srFocused,disabled&&strings.srDisabled,selected&&strings.srSelected].filter(Boolean);return strings.srCurrentItemDetails({current:[current,...states].join(" "),index:index+1,total})}),liveRegionListboxTotal:propLabels?.liveRegionListboxTotal||(total=>strings.srNumResultsAvailable({num:total})),liveRegionMultipleSelectionTotal:propLabels?.liveRegionMultipleSelectionTotal||(total=>strings.srNumSelectedOptions({num:total})),noItems:propLabels?.noItems||strings.noResults,selected:propLabels?.selected||(labels=>strings.srItemsSelected({labels})),selectionCleared:propLabels?.selectionCleared||strings.srSelectionCleared,unselected:propLabels?.unselected||(labels=>strings.srItemsNotSelected({labels}))}),[propLabels,strings]);const lastSelectedValue=React__namespace.useRef(null);const[message,setMessage]=React__namespace.useState("");React__namespace.useEffect(()=>{if(selected&&selected!==lastSelectedValue?.current){let newMessage="";const lastSelectedLength=lastSelectedValue?.current?.length??0;const selectedLength=selected?.length??0;if(Array.isArray(selected)&&selected.length>0){const currentLabels=selectedLabels.join(", ");const selectedState=selectedLength>lastSelectedLength?labels.selected(currentLabels):labels.unselected(currentLabels);newMessage=selectedState;}else {newMessage=labels.selected(selectedLabels[0]);}setMessage(newMessage);}if(selectionType==="single"&&!selected&&lastSelectedValue.current){setMessage(labels.selectionCleared);}lastSelectedValue.current=selected;if(selectionType==="multiple"&&!opened){setMessage(labels.closedState);}},[labels,labels.closedState,selectedLabels,opened,selected,selectionType]);const focusedElementDescription=React__namespace.useMemo(()=>{if(focusedMultiSelectIndex>=0){const label=selectedLabels[focusedMultiSelectIndex];return labels.liveRegionCurrentItem({current:label,focused:true,index:focusedMultiSelectIndex,total:selectedLabels.length})+" "+labels.liveRegionMultipleSelectionTotal(selectedLabels.length)}if(options.length===0){return labels.noItems}if(focusedIndex<0||!options[focusedIndex]){return ""}const currentItemProps=options[focusedIndex].props;const label=getLabel(currentItemProps);const totalResults=options.length;return labels.liveRegionCurrentItem({current:label,disabled:currentItemProps.disabled,focused:false,index:focusedIndex,selected:currentItemProps.selected,total:totalResults})+" "+labels.liveRegionListboxTotal(totalResults)},[focusedIndex,focusedMultiSelectIndex,labels,options,selectedLabels]);return jsxRuntime.jsx(StyledSpan,{role:"log","aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",style:modules_db114d3e.srOnly,"data-testid":testId?`${testId}-status`:undefined,children:opened?focusedElementDescription:message})}
127
+
128
+ var modules_c1416a67={"root":"wb-combobox-multiple-selection-root-fdcc29f0","container":"wb-combobox-multiple-selection-container-fdcc29f0","item":"wb-combobox-multiple-selection-item-fdcc29f0","itemFocused":"wb-combobox-multiple-selection-itemFocused-fdcc29f0"};
129
+
130
+ const MultipleSelection=React__namespace.memo(function SelectedPills({disabled,focusedMultiSelectIndex,id,labels,onRemove,removeSelectedLabel,selected,testId}){return jsxRuntime.jsx(wonderBlocksCore.View,{role:"group",style:[modules_c1416a67.root,modules_c1416a67.container],id:id,children:selected.map((value,index)=>{const label=labels[index];const focused=index===focusedMultiSelectIndex;const uniqueId=id+index;return jsxRuntime.jsx(Button__default["default"],{id:uniqueId,testId:testId?`${testId}-item-${index}`:undefined,size:"small",style:[modules_c1416a67.item,focused&&modules_c1416a67.itemFocused],kind:"secondary",actionType:"neutral","aria-label":removeSelectedLabel(label),tabIndex:-1,onClick:()=>onRemove(value),endIcon:disabled?undefined:jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:xIcon__default["default"],size:"small"}),children:label},uniqueId)})})});
113
131
 
114
- const MultipleSelection=React__namespace.memo(function SelectedPills({disabled,focusedMultiSelectIndex,id,labels,onRemove,removeSelectedLabel,selected,testId}){return jsxRuntime.jsx(wonderBlocksCore.View,{role:"group",style:styles$3.container,id:id,children:selected.map((value,index)=>{const label=labels[index];const focused=index===focusedMultiSelectIndex;const uniqueId=id+index;return jsxRuntime.jsx(Button__default["default"],{id:uniqueId,testId:testId?`${testId}-item-${index}`:undefined,size:"small",style:[styles$3.item,focused&&styles$3.itemFocused],kind:"secondary",actionType:"neutral","aria-label":removeSelectedLabel(label),tabIndex:-1,onClick:()=>onRemove(value),endIcon:disabled?undefined:jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:xIcon__default["default"],size:"small"}),children:label},uniqueId)})})});const styles$3=aphrodite.StyleSheet.create({container:{flexDirection:"row",flexWrap:"wrap",gap:wonderBlocksTokens.sizing.size_080,paddingBlockStart:wonderBlocksTokens.sizing.size_080},item:{fontSize:wonderBlocksTokens.font.body.size.small,justifyContent:"space-between",alignItems:"center",height:"auto",paddingInline:wonderBlocksTokens.sizing.size_080},itemFocused:wonderBlocksStyles.focusStyles.focus[":focus-visible"]});
132
+ var modules_1cba4147={"root":"wb-listbox-root-1fcff703","listbox":"wb-listbox-listbox-1fcff703","disabled":"wb-listbox-disabled-1fcff703"};var styles$1 = modules_1cba4147;
115
133
 
116
- function StandaloneListbox(props){const{children,disabled,id,onChange,selectionType="single",style,tabIndex=0,testId,value,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby}=props;const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const{focusedIndex,isListboxFocused,renderList,selected,handleKeyDown,handleKeyUp,handleFocus,handleBlur}=useListbox({children,disabled,id:uniqueId,selectionType,value});React__namespace.useEffect(()=>{if(selected&&selected!==value){onChange?.(selected);}},[onChange,selected,value]);return jsxRuntime.jsx(wonderBlocksCore.View,{role:"listbox",id:uniqueId,style:[styles$2.listbox,style,disabled&&styles$2.disabled],tabIndex:tabIndex,testId:testId,"aria-disabled":disabled,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-multiselectable":selectionType==="multiple",onKeyDown:handleKeyDown,onKeyUp:handleKeyUp,onFocus:handleFocus,onBlur:handleBlur,"aria-activedescendant":isListboxFocused?renderList[focusedIndex].props.id:undefined,children:renderList})}function Listbox(props){const{children,disabled,id,selectionType="single",style,tabIndex=0,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby}=props;if(tabIndex===0){return jsxRuntime.jsx(StandaloneListbox,{...props})}return jsxRuntime.jsx(wonderBlocksCore.View,{role:"listbox",id:id,style:[styles$2.listbox,style,disabled&&styles$2.disabled],tabIndex:tabIndex,testId:testId,"aria-disabled":disabled,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-multiselectable":selectionType==="multiple",children:children})}const styles$2=aphrodite.StyleSheet.create({listbox:{backgroundColor:wonderBlocksTokens.semanticColor.core.background.base.default,outline:"none",paddingBlock:theme.listbox.layout.padding.block,paddingInline:theme.listbox.layout.padding.inline},disabled:{color:wonderBlocksTokens.semanticColor.action.secondary.disabled.foreground}});
134
+ function StandaloneListbox(props){const{children,disabled,id,onChange,selectionType="single",style,tabIndex=0,testId,value,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby}=props;const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const{focusedIndex,isListboxFocused,renderList,selected,handleKeyDown,handleKeyUp,handleFocus,handleBlur}=useListbox({children,disabled,id:uniqueId,selectionType,value});React__namespace.useEffect(()=>{if(selected&&selected!==value){onChange?.(selected);}},[onChange,selected,value]);return jsxRuntime.jsx(wonderBlocksCore.View,{role:"listbox",id:uniqueId,style:[styles$1.root,styles$1.listbox,style,disabled&&styles$1.disabled],tabIndex:tabIndex,testId:testId,"aria-disabled":disabled,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-multiselectable":selectionType==="multiple",onKeyDown:handleKeyDown,onKeyUp:handleKeyUp,onFocus:handleFocus,onBlur:handleBlur,"aria-activedescendant":isListboxFocused?renderList[focusedIndex].props.id:undefined,children:renderList})}function Listbox(props){const{children,disabled,id,selectionType="single",style,tabIndex=0,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby}=props;if(tabIndex===0){return jsxRuntime.jsx(StandaloneListbox,{...props})}return jsxRuntime.jsx(wonderBlocksCore.View,{role:"listbox",id:id,style:[styles$1.root,styles$1.listbox,style,disabled&&styles$1.disabled],tabIndex:tabIndex,testId:testId,"aria-disabled":disabled,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,"aria-multiselectable":selectionType==="multiple",children:children})}
117
135
 
118
- function Combobox({autoComplete,children,disabled,error,id,labels:propLabels,onChange,onToggle,opened,placeholder,selectionType="single",startIcon,testId,value="",loading,style,...ariaAttrs}){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSelection:propLabels?.clearSelection||strings.iconAltClearSelection,comboboxButton:propLabels?.comboboxButton||strings.iconAltToggleListbox,listbox:propLabels?.listbox||strings.optionsList,noItems:propLabels?.noItems||strings.noResults,removeSelected:propLabels?.removeSelected||(label=>strings.removeOption({label}))}),[propLabels,strings]);const liveRegionLabels=React__namespace.useMemo(()=>({closedState:propLabels?.closedState,liveRegionCurrentItem:propLabels?.liveRegionCurrentItem,liveRegionListboxTotal:propLabels?.liveRegionListboxTotal,liveRegionMultipleSelectionTotal:propLabels?.liveRegionMultipleSelectionTotal,noItems:propLabels?.noItems,selected:propLabels?.selected,selectionCleared:propLabels?.selectionCleared,unselected:propLabels?.unselected}),[propLabels]);const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const comboboxRef=React__namespace.useRef(null);const rootNodeRef=React__namespace.useRef(null);const[open,setOpen]=React__namespace.useState(opened??false);const isControlled=opened!==undefined;const openState=disabled?false:isControlled?opened:open;const[selectedValue,setSelectedValue]=React__namespace.useState(value);const isValueControlled=value!==""&&onChange!==undefined;const valueState=isValueControlled?value:selectedValue;const[currentOptions,setCurrentOptions]=React__namespace.useState(children);const{focusedIndex,isListboxFocused,setFocusedIndex,handleKeyDown,handleFocus,handleBlur,selected,setSelected,renderList}=useListbox({children:currentOptions,disabled,id:uniqueId,onChange:value=>handleChange(value),value:valueState,disableSpaceSelection:true,selectionType});const itemFromSelected=renderList.find(item=>item.props.value===selected)?.props;const labelFromSelected=itemFromSelected?getLabel(itemFromSelected):"";const initialValue=typeof value==="string"?labelFromSelected:"";const[inputValue,setInputValue]=React__namespace.useState(initialValue);const updateAfterSelectionChange=React__namespace.useCallback(value=>{setSelected(value);onChange?.(value);},[onChange,setSelected]);const{focusedMultiSelectIndex,handleKeyDown:handleMultipleSelectionKeyDown}=useMultipleSelection({inputValue,selected,onRemove:updateAfterSelectionChange,isComboboxOpen:openState});const updateOpenState=React__namespace.useCallback((newState,selectedLabel=labelFromSelected)=>{if(disabled||newState===openState){return}if(!isControlled){setOpen(newState);}if(!newState){setFocusedIndex(-1);if(selectionType==="multiple"){setInputValue("");}else {setInputValue(selectedLabel??"");}setCurrentOptions(children);}onToggle?.(newState);},[children,disabled,isControlled,labelFromSelected,onToggle,openState,selectionType,setFocusedIndex]);const handleChange=React__namespace.useCallback(value=>{if(value!==valueState){setSelectedValue(value);onChange?.(value);}if(selectionType==="single"&&typeof value==="string"){const itemFromSelected=renderList.find(item=>item.props.value===value)?.props;const labelFromSelected=itemFromSelected?getLabel(itemFromSelected):"";updateOpenState(false,labelFromSelected);}else if(Array.isArray(value)){setInputValue("");setCurrentOptions(children);}},[children,onChange,renderList,selectionType,updateOpenState,valueState]);const focusOnFilteredItem=React__namespace.useCallback((filtered,value)=>{const lowercasedSearchText=value.normalize("NFC").toLowerCase();const itemIndex=filtered.findIndex(item=>getLabel(item.props).normalize("NFC").toLowerCase().trim().includes(lowercasedSearchText));setFocusedIndex(itemIndex);},[setFocusedIndex]);const filterItems=React__namespace.useCallback(value=>{const lowercasedSearchText=value.normalize("NFC").toLowerCase();return children.filter(item=>getLabel(item.props).normalize("NFC").trim().toLowerCase().indexOf(lowercasedSearchText)>-1)},[children]);const onKeyDown=event=>{const{key}=event;const conditionsToOpen=key==="ArrowDown"||key==="ArrowUp"||key==="Backspace"||key.length===1;if(!openState&&conditionsToOpen){updateOpenState(true);}if(key==="ArrowLeft"||key==="ArrowRight"){setFocusedIndex(-1);}handleMultipleSelectionKeyDown(event);if(key==="Escape"&&openState){event.stopPropagation();updateOpenState(false);}handleKeyDown(event);};const handleOnRemoveClick=React__namespace.useCallback(value=>{const selectedValues=selected;const newValues=selectedValues.filter(selectedValue=>selectedValue!==value);updateAfterSelectionChange(newValues);},[selected,updateAfterSelectionChange]);const handleTextFieldChange=React__namespace.useCallback(value=>{setInputValue(value);let filteredItems=renderList;if(autoComplete==="list"){filteredItems=filterItems(value);setCurrentOptions(filteredItems);}focusOnFilteredItem(filteredItems,value);},[autoComplete,filterItems,focusOnFilteredItem,renderList]);const handleClearClick=React__namespace.useCallback(e=>{e.stopPropagation();setInputValue("");setSelected("");onChange?.("");comboboxRef.current?.focus();},[onChange,setSelected]);React__namespace.useEffect(()=>{if(openState){comboboxRef.current?.focus();}},[openState]);const selectedLabels=React__namespace.useMemo(()=>{if(Array.isArray(selected)){return selected.map(value=>{const item=children.find(item=>item.props.value===value);return item?getLabel(item?.props):""})}return [labelFromSelected]},[children,labelFromSelected,selected]);const maybeRenderStartIcon=()=>{if(!startIcon){return null}const startIconElement=React__namespace.cloneElement(startIcon,{size:"small",...startIcon.props,color:disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.default:startIcon.props.color??wonderBlocksTokens.semanticColor.core.foreground.neutral.default});return jsxRuntime.jsx(wonderBlocksCore.View,{style:styles$1.iconWrapper,children:startIconElement})};const pillIdPrefix=`${uniqueId}-pill-`;const textFieldId=React.useId();const currentActiveDescendant=!openState?undefined:focusedIndex>=0?renderList[focusedIndex]?.props?.id:pillIdPrefix+focusedMultiSelectIndex;const controlledWidget=!openState?undefined:focusedIndex>=0?uniqueId:pillIdPrefix;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(wonderBlocksCore.View,{onClick:()=>{updateOpenState(true);},ref:rootNodeRef,style:[styles$1.wrapper,isListboxFocused&&styles$1.focused,disabled&&styles$1.disabled,!disabled&&error&&styles$1.error],children:[jsxRuntime.jsx(ComboboxLiveRegion,{focusedIndex:focusedIndex,focusedMultiSelectIndex:focusedMultiSelectIndex,labels:liveRegionLabels,options:renderList,selectedLabels:selectedLabels,testId:testId,opened:openState,selected:selected,selectionType:selectionType}),selectionType==="multiple"&&Array.isArray(selected)&&jsxRuntime.jsx(MultipleSelection,{labels:selectedLabels,focusedMultiSelectIndex:focusedMultiSelectIndex,id:pillIdPrefix,selected:selected,onRemove:handleOnRemoveClick,disabled:disabled,testId:testId,removeSelectedLabel:labels.removeSelected}),maybeRenderStartIcon(),jsxRuntime.jsx(wonderBlocksForm.TextField,{id:textFieldId,testId:testId,style:[styles$1.combobox,style],value:inputValue,onChange:handleTextFieldChange,disabled:disabled,onFocus:()=>{updateOpenState(true);handleFocus();},placeholder:placeholder,onBlur:()=>{updateOpenState(false);handleBlur();},onKeyDown:onKeyDown,"aria-activedescendant":currentActiveDescendant,"aria-autocomplete":autoComplete,"aria-controls":controlledWidget,"aria-expanded":openState,"aria-invalid":!!error,ref:comboboxRef,autoComplete:"off",role:"combobox",...ariaAttrs}),inputValue&&!disabled&&jsxRuntime.jsx(IconButton__default["default"],{icon:xIcon__default["default"],onClick:handleClearClick,actionType:"neutral",kind:"tertiary",size:"medium",style:[styles$1.button,styles$1.clearButton],"aria-label":labels.clearSelection,testId:testId?`${testId}-clear`:undefined}),jsxRuntime.jsx(IconButton__default["default"],{disabled:disabled,icon:caretDownIcon__default$1["default"],onClick:e=>{e.stopPropagation();updateOpenState(!openState);},onMouseDown:e=>{e.preventDefault();},actionType:"neutral",kind:"tertiary",size:"medium",style:[styles$1.button,styles$1.openButtonResetStates,openState&&styles$1.buttonOpen],tabIndex:-1,"aria-controls":uniqueId,"aria-expanded":openState,"aria-label":labels.comboboxButton})]}),openState&&jsxRuntime.jsx(DropdownPopper,{alignment:"left",referenceElement:rootNodeRef?.current,children:isReferenceHidden=>jsxRuntime.jsx(wonderBlocksCore.View,{onMouseDown:e=>{e.preventDefault();},children:renderList.length===0?jsxRuntime.jsx(wonderBlocksCell.DetailCell,{title:labels.noItems,styles:{root:[styles$1.listbox,{minInlineSize:rootNodeRef?.current?.offsetWidth}]},horizontalRule:"none"}):jsxRuntime.jsx(Listbox,{id:uniqueId,tabIndex:-1,selectionType:selectionType,style:[styles$1.listbox,isReferenceHidden&&styles$1.hidden,{minInlineSize:rootNodeRef?.current?.offsetWidth}],testId:testId?`${testId}-listbox`:undefined,"aria-label":labels.listbox,"aria-labelledby":textFieldId,children:renderList})})})]})}const styles$1=aphrodite.StyleSheet.create({wrapper:{flexDirection:"row",alignItems:"center",width:"100%",maxInlineSize:"100%",flexWrap:"wrap",background:wonderBlocksTokens.semanticColor.core.background.base.default,borderRadius:theme.opener.border.radius.rest,border:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,paddingInline:theme.opener.layout.padding.inline,overflow:"hidden"},focused:wonderBlocksStyles.focusStyles.focus[":focus-visible"],disabled:{background:wonderBlocksTokens.semanticColor.input.disabled.background,border:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.input.disabled.border}`,color:wonderBlocksTokens.semanticColor.input.disabled.foreground},error:{background:wonderBlocksTokens.semanticColor.input.error.background,border:`${theme.opener.border.width.error} solid ${wonderBlocksTokens.semanticColor.input.error.border}`,color:wonderBlocksTokens.semanticColor.input.error.foreground},combobox:{appearance:"none",background:"none",border:"none",outline:"none",padding:0,minInlineSize:wonderBlocksTokens.sizing.size_040,width:"auto",display:"inline-grid",gridArea:"1 / 2",":focus-visible":{outline:"none",border:"none",boxShadow:"none"},[":active:not([aria-disabled='true']):not([readonly])"]:{boxShadow:"none"},[":focus-visible:active:not([aria-disabled='true']):not([readonly])"]:{boxShadow:"none"}},listbox:{backgroundColor:wonderBlocksTokens.semanticColor.core.background.base.default,borderRadius:theme.listbox.border.radius,border:`solid ${wonderBlocksTokens.border.width.thin} ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,boxShadow:theme.listbox.shadow.default,maxBlockSize:"var(--popper-max-height)",overflowY:"auto"},hidden:{pointerEvents:"none",visibility:"hidden"},button:{position:"absolute",insetInlineEnd:wonderBlocksTokens.sizing.size_0,margin:0},buttonOpen:{transform:"rotate(180deg)"},openButtonResetStates:{":hover":{borderColor:wonderBlocksTokens.semanticColor.core.transparent},":active":{borderColor:wonderBlocksTokens.semanticColor.core.transparent},":focus-visible":{outline:"none",boxShadow:"none"}},clearButton:{insetInlineEnd:wonderBlocksTokens.sizing.size_360},iconWrapper:{padding:wonderBlocksTokens.sizing.size_040,minInlineSize:"auto"}});
136
+ var modules_25092770={"root":"wb-combobox-root-93ad8b7e","wrapper":"wb-combobox-wrapper-93ad8b7e","focused":"wb-combobox-focused-93ad8b7e","disabled":"wb-combobox-disabled-93ad8b7e","error":"wb-combobox-error-93ad8b7e","combobox":"wb-combobox-combobox-93ad8b7e","button":"wb-combobox-button-93ad8b7e","buttonOpen":"wb-combobox-buttonOpen-93ad8b7e","openButtonResetStates":"wb-combobox-openButtonResetStates-93ad8b7e","clearButton":"wb-combobox-clearButton-93ad8b7e","iconWrapper":"wb-combobox-iconWrapper-93ad8b7e","menu":"wb-combobox-menu-93ad8b7e","listbox":"wb-combobox-listbox-93ad8b7e","hidden":"wb-combobox-hidden-93ad8b7e"};var styles = modules_25092770;
119
137
 
120
- const StyledButton=wonderBlocksCore.addStyle("button");const CustomOpener=React__namespace.forwardRef(function CustomOpener(props,ref){const{children,disabled,onClick,styles:stylesProp,testId,...restProps}=props;const injectedAriaDisabled=restProps["aria-disabled"];const ariaDisabled=injectedAriaDisabled??(disabled||undefined);return jsxRuntime.jsx(StyledButton,{...restProps,ref:ref,type:"button","aria-disabled":ariaDisabled,onClick:disabled?undefined:onClick,"data-testid":testId,style:[styles.reset,disabled&&styles.disabled,stylesProp?.root],children:jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"span",style:[styles.labelReset,stylesProp?.label],children:children})})});CustomOpener.displayName="CustomOpener";const styles=aphrodite.StyleSheet.create({reset:{appearance:"none",background:"none",border:"none",boxSizing:"border-box",cursor:"pointer",font:"inherit",margin:0,padding:0,textAlign:"inherit",touchAction:"manipulation",...wonderBlocksStyles.focusStyles.focus},labelReset:{alignItems:"center",display:"flex",flexDirection:"row",gap:wonderBlocksTokens.sizing.size_020},disabled:{cursor:"not-allowed"}});
138
+ function Combobox({autoComplete,children,disabled,error,id,labels:propLabels,onChange,onToggle,opened,placeholder,selectionType="single",startIcon,testId,value="",loading,style,...ariaAttrs}){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const labels=React__namespace.useMemo(()=>({clearSelection:propLabels?.clearSelection||strings.iconAltClearSelection,comboboxButton:propLabels?.comboboxButton||strings.iconAltToggleListbox,listbox:propLabels?.listbox||strings.optionsList,noItems:propLabels?.noItems||strings.noResults,removeSelected:propLabels?.removeSelected||(label=>strings.removeOption({label}))}),[propLabels,strings]);const liveRegionLabels=React__namespace.useMemo(()=>({closedState:propLabels?.closedState,liveRegionCurrentItem:propLabels?.liveRegionCurrentItem,liveRegionListboxTotal:propLabels?.liveRegionListboxTotal,liveRegionMultipleSelectionTotal:propLabels?.liveRegionMultipleSelectionTotal,noItems:propLabels?.noItems,selected:propLabels?.selected,selectionCleared:propLabels?.selectionCleared,unselected:propLabels?.unselected}),[propLabels]);const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const comboboxRef=React__namespace.useRef(null);const rootNodeRef=React__namespace.useRef(null);const[open,setOpen]=React__namespace.useState(opened??false);const isControlled=opened!==undefined;const openState=disabled?false:isControlled?opened:open;const[selectedValue,setSelectedValue]=React__namespace.useState(value);const isValueControlled=value!==""&&onChange!==undefined;const valueState=isValueControlled?value:selectedValue;const[currentOptions,setCurrentOptions]=React__namespace.useState(children);const{focusedIndex,isListboxFocused,setFocusedIndex,handleKeyDown,handleFocus,handleBlur,selected,setSelected,renderList}=useListbox({children:currentOptions,disabled,id:uniqueId,onChange:value=>handleChange(value),value:valueState,disableSpaceSelection:true,selectionType});const itemFromSelected=renderList.find(item=>item.props.value===selected)?.props;const labelFromSelected=itemFromSelected?getLabel(itemFromSelected):"";const initialValue=typeof value==="string"?labelFromSelected:"";const[inputValue,setInputValue]=React__namespace.useState(initialValue);const updateAfterSelectionChange=React__namespace.useCallback(value=>{setSelected(value);onChange?.(value);},[onChange,setSelected]);const{focusedMultiSelectIndex,handleKeyDown:handleMultipleSelectionKeyDown}=useMultipleSelection({inputValue,selected,onRemove:updateAfterSelectionChange,isComboboxOpen:openState});const updateOpenState=React__namespace.useCallback((newState,selectedLabel=labelFromSelected)=>{if(disabled||newState===openState){return}if(!isControlled){setOpen(newState);}if(!newState){setFocusedIndex(-1);if(selectionType==="multiple"){setInputValue("");}else {setInputValue(selectedLabel??"");}setCurrentOptions(children);}onToggle?.(newState);},[children,disabled,isControlled,labelFromSelected,onToggle,openState,selectionType,setFocusedIndex]);const handleChange=React__namespace.useCallback(value=>{if(value!==valueState){setSelectedValue(value);onChange?.(value);}if(selectionType==="single"&&typeof value==="string"){const itemFromSelected=renderList.find(item=>item.props.value===value)?.props;const labelFromSelected=itemFromSelected?getLabel(itemFromSelected):"";updateOpenState(false,labelFromSelected);}else if(Array.isArray(value)){setInputValue("");setCurrentOptions(children);}},[children,onChange,renderList,selectionType,updateOpenState,valueState]);const focusOnFilteredItem=React__namespace.useCallback((filtered,value)=>{const lowercasedSearchText=value.normalize("NFC").toLowerCase();const itemIndex=filtered.findIndex(item=>getLabel(item.props).normalize("NFC").toLowerCase().trim().includes(lowercasedSearchText));setFocusedIndex(itemIndex);},[setFocusedIndex]);const filterItems=React__namespace.useCallback(value=>{const lowercasedSearchText=value.normalize("NFC").toLowerCase();return children.filter(item=>getLabel(item.props).normalize("NFC").trim().toLowerCase().indexOf(lowercasedSearchText)>-1)},[children]);const onKeyDown=event=>{const{key}=event;const conditionsToOpen=key==="ArrowDown"||key==="ArrowUp"||key==="Backspace"||key.length===1;if(!openState&&conditionsToOpen){updateOpenState(true);}if(key==="ArrowLeft"||key==="ArrowRight"){setFocusedIndex(-1);}handleMultipleSelectionKeyDown(event);if(key==="Escape"&&openState){event.stopPropagation();updateOpenState(false);}handleKeyDown(event);};const handleOnRemoveClick=React__namespace.useCallback(value=>{const selectedValues=selected;const newValues=selectedValues.filter(selectedValue=>selectedValue!==value);updateAfterSelectionChange(newValues);},[selected,updateAfterSelectionChange]);const handleTextFieldChange=React__namespace.useCallback(value=>{setInputValue(value);let filteredItems=renderList;if(autoComplete==="list"){filteredItems=filterItems(value);setCurrentOptions(filteredItems);}focusOnFilteredItem(filteredItems,value);},[autoComplete,filterItems,focusOnFilteredItem,renderList]);const handleClearClick=React__namespace.useCallback(e=>{e.stopPropagation();setInputValue("");setSelected("");onChange?.("");comboboxRef.current?.focus();},[onChange,setSelected]);React__namespace.useEffect(()=>{if(openState){comboboxRef.current?.focus();}},[openState]);const selectedLabels=React__namespace.useMemo(()=>{if(Array.isArray(selected)){return selected.map(value=>{const item=children.find(item=>item.props.value===value);return item?getLabel(item?.props):""})}return [labelFromSelected]},[children,labelFromSelected,selected]);const maybeRenderStartIcon=()=>{if(!startIcon){return null}const startIconElement=React__namespace.cloneElement(startIcon,{size:"small",...startIcon.props,color:disabled?wonderBlocksTokens.semanticColor.core.foreground.disabled.default:startIcon.props.color??wonderBlocksTokens.semanticColor.core.foreground.neutral.default});return jsxRuntime.jsx(wonderBlocksCore.View,{style:styles.iconWrapper,children:startIconElement})};const pillIdPrefix=`${uniqueId}-pill-`;const textFieldId=React.useId();const currentActiveDescendant=!openState?undefined:focusedIndex>=0?renderList[focusedIndex]?.props?.id:pillIdPrefix+focusedMultiSelectIndex;const controlledWidget=!openState?undefined:focusedIndex>=0?uniqueId:pillIdPrefix;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(wonderBlocksCore.View,{onClick:()=>{updateOpenState(true);},ref:rootNodeRef,style:[styles.root,styles.wrapper,isListboxFocused&&styles.focused,disabled&&styles.disabled,!disabled&&error&&styles.error],children:[jsxRuntime.jsx(ComboboxLiveRegion,{focusedIndex:focusedIndex,focusedMultiSelectIndex:focusedMultiSelectIndex,labels:liveRegionLabels,options:renderList,selectedLabels:selectedLabels,testId:testId,opened:openState,selected:selected,selectionType:selectionType}),selectionType==="multiple"&&Array.isArray(selected)&&jsxRuntime.jsx(MultipleSelection,{labels:selectedLabels,focusedMultiSelectIndex:focusedMultiSelectIndex,id:pillIdPrefix,selected:selected,onRemove:handleOnRemoveClick,disabled:disabled,testId:testId,removeSelectedLabel:labels.removeSelected}),maybeRenderStartIcon(),jsxRuntime.jsx(wonderBlocksForm.TextField,{id:textFieldId,testId:testId,style:[styles.combobox,style],value:inputValue,onChange:handleTextFieldChange,disabled:disabled,onFocus:()=>{updateOpenState(true);handleFocus();},placeholder:placeholder,onBlur:()=>{updateOpenState(false);handleBlur();},onKeyDown:onKeyDown,"aria-activedescendant":currentActiveDescendant,"aria-autocomplete":autoComplete,"aria-controls":controlledWidget,"aria-expanded":openState,"aria-invalid":!!error,ref:comboboxRef,autoComplete:"off",role:"combobox",...ariaAttrs}),inputValue&&!disabled&&jsxRuntime.jsx(IconButton__default["default"],{icon:xIcon__default["default"],onClick:handleClearClick,actionType:"neutral",kind:"tertiary",size:"medium",style:[styles.button,styles.clearButton],"aria-label":labels.clearSelection,testId:testId?`${testId}-clear`:undefined}),jsxRuntime.jsx(IconButton__default["default"],{disabled:disabled,icon:caretDownIcon__default$1["default"],onClick:e=>{e.stopPropagation();updateOpenState(!openState);},onMouseDown:e=>{e.preventDefault();},actionType:"neutral",kind:"tertiary",size:"medium",style:[styles.button,styles.openButtonResetStates,openState&&styles.buttonOpen],tabIndex:-1,"aria-controls":uniqueId,"aria-expanded":openState,"aria-label":labels.comboboxButton})]}),openState&&jsxRuntime.jsx(DropdownPopper$1,{alignment:"left",referenceElement:rootNodeRef?.current,children:isReferenceHidden=>jsxRuntime.jsx(wonderBlocksCore.View,{onMouseDown:e=>{e.preventDefault();},children:renderList.length===0?jsxRuntime.jsx(wonderBlocksCell.DetailCell,{title:labels.noItems,styles:{root:[styles.menu,styles.listbox,{minInlineSize:rootNodeRef?.current?.offsetWidth}]},horizontalRule:"none"}):jsxRuntime.jsx(Listbox,{id:uniqueId,tabIndex:-1,selectionType:selectionType,style:[styles.menu,styles.listbox,isReferenceHidden&&styles.hidden,{minInlineSize:rootNodeRef?.current?.offsetWidth}],testId:testId?`${testId}-listbox`:undefined,"aria-label":labels.listbox,"aria-labelledby":textFieldId,children:renderList})})})]})}
121
139
 
122
- exports.ActionItem = ActionItem;
123
- exports.ActionMenu = ActionMenu;
140
+ var modules_f7a6dde9={"reset":"wb-custom-opener-reset-2d20d7fb","label":"wb-custom-opener-label-2d20d7fb","disabled":"wb-custom-opener-disabled-2d20d7fb"};
141
+
142
+ const StyledButton=wonderBlocksCore.addStyle("button");const CustomOpener=React__namespace.forwardRef(function CustomOpener(props,ref){const{children,disabled,onClick,styles:stylesProp,testId,...restProps}=props;const injectedAriaDisabled=restProps["aria-disabled"];const ariaDisabled=injectedAriaDisabled??(disabled||undefined);return jsxRuntime.jsx(StyledButton,{...restProps,ref:ref,type:"button","aria-disabled":ariaDisabled,onClick:disabled?undefined:onClick,"data-testid":testId,style:[modules_f7a6dde9.reset,disabled&&modules_f7a6dde9.disabled,stylesProp?.root],children:jsxRuntime.jsx(wonderBlocksTypography.BodyText,{tag:"span",style:[modules_f7a6dde9.label,stylesProp?.label],children:children})})});CustomOpener.displayName="CustomOpener";
143
+
144
+ exports.ActionItem = ActionItem$1;
145
+ exports.ActionMenu = ActionMenu$1;
124
146
  exports.Combobox = Combobox;
125
147
  exports.CustomOpener = CustomOpener;
126
148
  exports.Listbox = Listbox;
127
- exports.MultiSelect = MultiSelect;
128
- exports.OptionItem = OptionItem;
149
+ exports.MultiSelect = MultiSelect$1;
150
+ exports.OptionItem = OptionItem$1;
129
151
  exports.SeparatorItem = SeparatorItem;
130
- exports.SingleSelect = SingleSelect;
152
+ exports.SingleSelect = SingleSelect$1;
153
+
154
+ require("./index.css");