{"version":3,"file":"index.mjs","names":["useListItem","useSelect","clsx","Option","Props","O","SelectOption","t0","$","_c","label","activeIndex","selectedIndex","getItemProps","handleSelect","t1","ref","index","isActive","isSelected","t2","t3","t4","t5","t6","t7","onClick","t8","Badge","Option","SelectSelectionProps","O","multiple","SelectSelection","t0","$","_c","label","t1","undefined","t2","useInteractions","createContext","useContext","SelectContext","activeIndex","selectedIndex","getItemProps","ReturnType","handleSelect","index","useSelect","context","Error","ChangeEvent","ComponentProps","ReactNode","RefObject","useCallback","useEffect","useMemo","useRef","useState","FloatingFocusManager","FloatingList","FloatingPortal","Placement","autoUpdate","flip","offset","size","floatingUiSize","useClick","useDismiss","useFloating","useInteractions","useListNavigation","useMergeRefs","useRole","useTypeahead","SelectSelection","SelectSelectionProps","SelectContext","Option","clsx","Input","sizeVariant","Button","Dialog","ThemeColor","SelectValue","SelectChangeEventLike","target","type","value","name","SelectProps","variant","showArrow","selectionClassName","dialogClassName","width","floatingMinWidth","placement","options","O","color","placeholder","getSearchableValue","matchReg","RegExp","option","searchable","selectOptionComponent","props","selectSelectionComponent","defaultValue","onChange","e","zIndex","ref","HTMLDivElement","Omit","defaultGetSearchableValue","test","label","toLowerCase","trim","SelectLegacy","id","disabled","required","controlledValue","SelectSelectionCustomComponent","SelectOptionCustomComponent","onFocus","onBlur","isControlled","divSelectionRef","uncontrolledSelectedIndex","setUncontrolledSelectedIndex","pos","findIndex","o","search","setSearch","filteredOptions","filter","fn","selectedIndex","isOpen","setIsOpen","activeIndex","setActiveIndex","searchHasFocus","setSearchHasFocus","SelectSelectionComponent","handleSearchChange","HTMLInputElement","refs","floatingStyles","context","open","onOpenChange","whileElementsMounted","middleware","padding","apply","rects","elements","availableHeight","Object","assign","floating","style","Math","max","reference","firstChild","firstElementChild","HTMLElement","maxHeight","min","mergedRef","setReference","listRef","Array","labelsRef","isTypingRef","click","event","dismiss","role","listNav","focusItemOnHover","onNavigate","loop","typeahead","enabled","onMatch","undefined","onTypingChange","isTyping","current","getReferenceProps","getFloatingProps","getItemProps","map","i","handleSelect","index","selectContext","showCancelButton","focus","stopPropagation","setFloating","isActive","isSelected","node","onClick"],"sources":["../../../src/components/select-legacy/SelectOption.tsx","../../../src/components/select-legacy/SelectSelection.tsx","../../../src/components/select-legacy/useSelectContext.ts","../../../src/components/select-legacy/Select.tsx"],"sourcesContent":["import { useListItem } from \"@floating-ui/react\";\nimport { useSelect } from \".\";\nimport clsx from \"clsx\";\nimport { Option } from \"./interface\";\n\ntype Props<O extends Option> = O;\n\nexport function SelectOption<O extends Option>({ label }: Props<O>) {\n  const { activeIndex, selectedIndex, getItemProps, handleSelect } = useSelect();\n\n  const { ref, index } = useListItem({ label });\n  const isActive = activeIndex === index;\n  const isSelected = selectedIndex === index;\n\n  return (\n    <button\n      className={clsx(\"option\", isSelected ? \"bg-gray-2\" : isActive && \"bg-gray-1\")}\n      ref={ref}\n      role=\"option\"\n      data-presentation=\"compact\"\n      aria-selected={isActive && isSelected}\n      tabIndex={isActive ? 0 : -1}\n      {...getItemProps({\n        onClick: () => handleSelect(index),\n      })}\n    >\n      {label}\n    </button>\n  );\n}\n","import { Badge } from \"../badge\";\nimport type { Option } from \"./interface\";\n\nexport type SelectSelectionProps<O extends Option> = O & {\n  multiple?: boolean;\n};\n\nexport function SelectSelection<O extends Option>({\n  label,\n  multiple = false,\n}: SelectSelectionProps<O>) {\n  return multiple ? <Badge className=\"ml-1\">{label}</Badge> : <span>{label}</span>;\n}\n","import { useInteractions } from \"@floating-ui/react\";\nimport { createContext, useContext } from \"react\";\n\ninterface SelectContext {\n  activeIndex: number | null;\n  selectedIndex: number | null;\n  getItemProps: ReturnType<typeof useInteractions>[\"getItemProps\"];\n  handleSelect: (index: number | null) => void;\n}\n\nexport const SelectContext = createContext<SelectContext | null>(null);\n\nexport function useSelect() {\n  const context = useContext(SelectContext);\n  if (context === null) {\n    throw new Error(\"Select components must be wrapped in <Select>\");\n  }\n  return context;\n}\n","import {\n  ChangeEvent,\n  ComponentProps,\n  ReactNode,\n  RefObject,\n  useCallback,\n  useEffect,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport {\n  FloatingFocusManager,\n  FloatingList,\n  FloatingPortal,\n  Placement,\n  autoUpdate,\n  flip,\n  offset,\n  size as floatingUiSize,\n  useClick,\n  useDismiss,\n  useFloating,\n  useInteractions,\n  useListNavigation,\n  useMergeRefs,\n  useRole,\n  useTypeahead,\n} from \"@floating-ui/react\";\nimport { SelectSelection, SelectSelectionProps } from \"./SelectSelection\";\nimport { SelectContext } from \"./useSelectContext\";\n\nimport type { Option } from \"./interface\";\nimport clsx from \"clsx\";\nimport { Input, sizeVariant } from \"../fields/text/Input\";\nimport { Button } from \"../button/Button\";\nimport { Dialog } from \"../dialog/Dialog\";\nimport { ThemeColor } from \"../../types\";\n\n// readonly string[] -> nécessaire uniquement pour @conform-to/react\n// voir getSelectProps()\n// src/components/form/form.stories.tsx\nexport type SelectValue = number | string | readonly string[] | null;\ntype SelectChangeEventLike = {\n  target: {\n    type: \"select-one\";\n    value: SelectValue;\n    name: string;\n  };\n};\n\nexport type SelectProps<O extends Option = Option> = {\n  variant?: \"normal\" | \"ghost\";\n  showArrow?: boolean;\n  selectionClassName?: string;\n  dialogClassName?: string;\n  width?: number | string;\n  floatingMinWidth?: number;\n  placement?: Placement;\n  options: O[];\n  color?: ThemeColor;\n  size?: \"small\" | \"medium\" | \"large\" | \"custom\";\n  placeholder?: string;\n  getSearchableValue?: (matchReg: RegExp, option: O) => string;\n  searchable?: boolean;\n  selectOptionComponent?: (props: O) => ReactNode;\n  selectSelectionComponent?: (props: SelectSelectionProps<O>) => ReactNode;\n  defaultValue?: SelectValue;\n  value?: SelectValue;\n  onChange?: ((e: SelectChangeEventLike) => void) | null;\n  zIndex?: number;\n  ref?: RefObject<HTMLDivElement>;\n} & Omit<ComponentProps<\"select\">, \"onChange\" | \"value\" | \"defaultValue\" | \"multiple\" | \"size\">;\n\nfunction defaultGetSearchableValue(matchReg: RegExp, option: Option) {\n  return matchReg.test(option.label.toLowerCase().trim());\n}\n\nexport function SelectLegacy<O extends Option>({\n  id,\n  variant = \"normal\",\n  disabled = false,\n  showArrow = true,\n  selectionClassName,\n  dialogClassName,\n  width = \"100%\",\n  floatingMinWidth = 130,\n  placement = \"bottom\",\n  searchable = false,\n  required = true,\n  defaultValue,\n  name = \"\",\n  value: controlledValue,\n  onChange = null,\n  placeholder = \"Select ...\",\n  getSearchableValue,\n  selectSelectionComponent: SelectSelectionCustomComponent,\n  selectOptionComponent: SelectOptionCustomComponent,\n  options = [],\n  zIndex,\n  color = \"yellow\",\n  size = \"medium\",\n  ref,\n  onFocus,\n  onBlur,\n}: SelectProps<O>) {\n  const isControlled = typeof controlledValue !== \"undefined\";\n  const divSelectionRef = useRef<HTMLDivElement>(null!);\n\n  const [uncontrolledSelectedIndex, setUncontrolledSelectedIndex] = useState<number | null>(() => {\n    if (typeof defaultValue === \"undefined\") {\n      return null;\n    }\n    const pos = options.findIndex((o) => o.value === defaultValue);\n    return pos !== -1 ? pos : null;\n  });\n  const [search, setSearch] = useState(\"\");\n\n  const filteredOptions = useMemo(\n    () =>\n      options.filter((option) => {\n        if (!searchable || search.trim() === \"\") {\n          return true;\n        }\n        const fn = getSearchableValue ?? defaultGetSearchableValue;\n        const matchReg = new RegExp(search.toLowerCase().trim());\n        return fn(matchReg, option);\n      }),\n    [searchable, search, getSearchableValue, options],\n  );\n\n  let selectedIndex: number | null = null;\n  if (isControlled) {\n    if (controlledValue !== null) {\n      const pos = filteredOptions.findIndex((o) => o.value === controlledValue);\n      if (pos !== -1) {\n        selectedIndex = pos;\n      }\n    }\n  } else {\n    selectedIndex = uncontrolledSelectedIndex;\n  }\n\n  const [isOpen, setIsOpen] = useState(false);\n  const [activeIndex, setActiveIndex] = useState<number | null>(null);\n  const [searchHasFocus, setSearchHasFocus] = useState(false);\n\n  const SelectSelectionComponent = SelectSelectionCustomComponent ?? SelectSelection;\n\n  function handleSearchChange(e: ChangeEvent<HTMLInputElement>) {\n    setActiveIndex(null);\n    setSearch(e.target.value);\n  }\n\n  const { refs, floatingStyles, context } = useFloating({\n    placement,\n    open: isOpen,\n    onOpenChange: setIsOpen,\n    whileElementsMounted: autoUpdate,\n    middleware: [\n      offset(5),\n      flip({ padding: 10 }),\n      floatingUiSize({\n        apply({ rects, elements, availableHeight }) {\n          Object.assign(elements.floating.style, {\n            width: `${Math.max(floatingMinWidth, rects.reference.width)}px`,\n          });\n          const firstChild = elements.floating.firstElementChild as HTMLElement;\n          if (firstChild) {\n            firstChild.style.maxHeight = `${Math.min(availableHeight, 300)}px`;\n          }\n        },\n        padding: 10,\n      }),\n    ],\n  });\n\n  const mergedRef = useMergeRefs([refs.setReference, ref, divSelectionRef]);\n\n  const listRef = useRef<Array<HTMLElement | null>>([]);\n  const labelsRef = useRef<Array<string | null>>([]);\n  const isTypingRef = useRef(false);\n\n  const click = useClick(context, { event: \"mousedown\" });\n  const dismiss = useDismiss(context);\n  const role = useRole(context, { role: \"listbox\" });\n  const listNav = useListNavigation(context, {\n    listRef,\n    activeIndex,\n    focusItemOnHover: searchable ? false : true,\n    selectedIndex,\n    onNavigate: setActiveIndex,\n    loop: true,\n  });\n\n  const typeahead = useTypeahead(context, {\n    enabled: !searchHasFocus,\n    listRef: labelsRef,\n    activeIndex,\n    selectedIndex,\n    onMatch: isOpen ? setActiveIndex : undefined,\n    onTypingChange(isTyping) {\n      isTypingRef.current = isTyping;\n    },\n  });\n\n  const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([\n    listNav,\n    typeahead,\n    click,\n    dismiss,\n    role,\n  ]);\n\n  useEffect(() => {\n    if (SelectOptionCustomComponent) {\n      return;\n    }\n    filteredOptions.map((option, i) => {\n      labelsRef.current[i] = option.label;\n    });\n  }, [search, filteredOptions, SelectOptionCustomComponent]);\n\n  const handleSelect = useCallback(\n    (index: number | null) => {\n      setIsOpen(false);\n      setSearch(\"\");\n\n      const event: SelectChangeEventLike = {\n        target: {\n          type: \"select-one\",\n          name,\n          value: index === null ? null : filteredOptions[index].value,\n        },\n      };\n      onChange?.(event);\n\n      if (!isControlled) {\n        setUncontrolledSelectedIndex(index);\n      }\n    },\n    [isControlled, onChange, filteredOptions, name],\n  );\n\n  const selectContext = useMemo(\n    () => ({\n      activeIndex,\n      selectedIndex,\n      getItemProps,\n      handleSelect,\n    }),\n    [activeIndex, selectedIndex, getItemProps, handleSelect],\n  );\n\n  const showCancelButton = !required && selectedIndex !== null;\n\n  return (\n    <div>\n      <input\n        className=\"hidden-focusable\"\n        tabIndex={-1}\n        id={id}\n        name={name}\n        value={selectedIndex !== null ? filteredOptions[selectedIndex].value : \"\"}\n        onFocus={() => void divSelectionRef.current.focus()}\n        readOnly\n      />\n      <div\n        data-color={color}\n        aria-disabled={disabled}\n        className={clsx(\n          \"p8n-input-text box-border flex cursor-pointer rounded-[calc(var(--h-input)/2)] -outline-offset-1\",\n          selectionClassName,\n          sizeVariant[size],\n          isOpen && \"focus\",\n        )}\n        data-variant={variant}\n        ref={mergedRef}\n        tabIndex={0}\n        style={{\n          width: typeof width === \"number\" ? `${width}px` : width,\n        }}\n        {...getReferenceProps({ onFocus, onBlur })}\n      >\n        <span className=\"flex flex-1 items-center truncate px-2\">\n          {selectedIndex !== null ? (\n            <SelectSelectionComponent {...filteredOptions[selectedIndex]} key={selectedIndex} />\n          ) : (\n            placeholder\n          )}\n        </span>\n        {showCancelButton && (\n          <Button\n            withRipple={false}\n            type=\"button\"\n            icon\n            variant=\"text\"\n            color=\"gray\"\n            onMouseDown={(e) => {\n              // we don't want dropdown to open\n              e.stopPropagation();\n            }}\n            onClick={() => {\n              handleSelect(null);\n            }}\n          >\n            <i className=\"fe-cancel\"></i>\n          </Button>\n        )}\n        {!showCancelButton && showArrow && (\n          <Button\n            color=\"gray\"\n            withRipple={false}\n            icon\n            variant=\"text\"\n            focusable={false}\n            type=\"button\"\n            size=\"input\"\n          >\n            <i className={isOpen ? \"fe-angle-up\" : \"fe-angle-down\"}></i>\n          </Button>\n        )}\n      </div>\n      <FloatingPortal>\n        <SelectContext.Provider value={selectContext}>\n          {isOpen && (\n            <FloatingFocusManager context={context} modal={false}>\n              <div\n                className=\"z-dialog outline-hidden\"\n                data-testid=\"select-list\"\n                ref={refs.setFloating}\n                style={{\n                  ...floatingStyles,\n                  zIndex,\n                }}\n                {...getFloatingProps()}\n              >\n                <Dialog\n                  placement={context.placement}\n                  className={clsx(\n                    \"motion-safe:animate-fade-in-list max-h-80 overflow-auto\",\n                    dialogClassName,\n                  )}\n                  rounded={!dialogClassName}\n                >\n                  {searchable && (\n                    <div className=\"p-2\">\n                      <Input\n                        color=\"gray\"\n                        placeholder=\"Search\"\n                        tabIndex={selectedIndex === null ? 0 : -1}\n                        value={search}\n                        onChange={handleSearchChange}\n                        onFocus={() => setSearchHasFocus(true)}\n                        onBlur={() => setSearchHasFocus(false)}\n                      ></Input>\n                    </div>\n                  )}\n                  {SelectOptionCustomComponent ? (\n                    <FloatingList elementsRef={listRef} labelsRef={labelsRef}>\n                      {filteredOptions.map((option) => (\n                        <SelectOptionCustomComponent {...option} key={option.value} />\n                      ))}\n                    </FloatingList>\n                  ) : (\n                    filteredOptions.map((option, index) => {\n                      const isActive = activeIndex === index;\n                      const isSelected = selectedIndex === index;\n\n                      return (\n                        <button\n                          key={option.value}\n                          className={clsx(\n                            \"option\",\n                            isSelected ? \"bg-gray-2\" : isActive && \"bg-gray-1\",\n                          )}\n                          data-presentation=\"compact\"\n                          role=\"option\"\n                          aria-selected={isActive && isSelected}\n                          tabIndex={isActive ? 0 : -1}\n                          ref={(node) => {\n                            listRef.current[index] = node;\n                          }}\n                          {...getItemProps({\n                            onClick: () => handleSelect(index),\n                          })}\n                        >\n                          {option.label}\n                        </button>\n                      );\n                    })\n                  )}\n                </Dialog>\n              </div>\n            </FloatingFocusManager>\n          )}\n        </SelectContext.Provider>\n      </FloatingPortal>\n    </div>\n  );\n}\n"],"mappings":";;;;;;;;;;AAOA,SAAOM,aAAAC,IAAA;CAAA,MAAAC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