@festo-ui/react 9.0.1-dev.763 → 9.0.1-dev.764

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.
@@ -119,11 +119,15 @@
119
119
  position: relative;
120
120
  }
121
121
 
122
- .fr-combobox-option:hover, .fr-combobox-option:focus {
122
+ .fr-combobox-option:hover, .fr-combobox-option.fr-focus {
123
123
  background-color: var(--fwe-gray-100);
124
124
  outline: none;
125
125
  }
126
126
 
127
+ .fr-combobox-option.fr-selected {
128
+ background-color: var(--fwe-gray-200);
129
+ }
130
+
127
131
  .fr-combobox-option:last-child {
128
132
  border-bottom: none;
129
133
  }
@@ -133,6 +137,10 @@
133
137
  cursor: default;
134
138
  }
135
139
 
140
+ .fr-combobox-option.fr-disabled:hover, .fr-combobox-option.fr-disabled:focus, .fr-combobox-option.fr-disabled.fr-focus {
141
+ background-color: #0000;
142
+ }
143
+
136
144
  .fr-combobox-option-content {
137
145
  white-space: nowrap;
138
146
  text-overflow: ellipsis;
@@ -1,15 +1,16 @@
1
1
  import './ComboBox.scss';
2
- import { type ComponentPropsWithoutRef, type Ref } from 'react';
3
- export interface ComboBoxOptionType<T> {
2
+ import { type Ref } from 'react';
3
+ import type { ComponentBase } from '../../utils/types';
4
+ export interface ComboBoxOptionProps<T> {
4
5
  readonly label: string;
5
6
  readonly data: T;
6
7
  readonly disabled?: boolean;
7
8
  }
8
- export interface ComboBoxProps<T> extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'defaultValue'> {
9
+ export interface ComboBoxProps<T> extends ComponentBase {
9
10
  readonly defaultValue?: T;
10
11
  readonly value?: T;
11
12
  readonly label?: string;
12
- readonly options?: ComboBoxOptionType<T>[];
13
+ readonly options?: ComboBoxOptionProps<T>[];
13
14
  readonly required?: boolean;
14
15
  readonly onChange?: (value: T) => void;
15
16
  readonly disabled?: boolean;
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./ComboBox.css";
3
3
  import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react";
4
4
  import classnames from "classnames";
5
- import { forwardRef, useMemo, useState } from "react";
5
+ import { forwardRef, useMemo, useRef, useState } from "react";
6
6
  import { useControlled } from "../../utils/useControlled.js";
7
7
  import { useId } from "../../utils/useId.js";
8
8
  function getHighlightedLabel(label, query) {
@@ -39,6 +39,7 @@ function getHighlightedLabel(label, query) {
39
39
  }
40
40
  function ComboBoxComponent({ defaultValue = '', value: controlled, label, options = [], onChange, required = false, disabled, name, id: idProp, hint, error, placeholder, onInputChange, emptyMessage = 'No results found', className, ...props }, ref) {
41
41
  const id = useId(idProp);
42
+ const controlRef = useRef(null);
42
43
  const [value, setValue] = useControlled({
43
44
  controlled,
44
45
  default: defaultValue,
@@ -57,7 +58,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
57
58
  options,
58
59
  query
59
60
  ]);
60
- function handleSelect(option) {
61
+ function handleChange(option) {
61
62
  if (!option) return;
62
63
  setValue(option.data);
63
64
  setQuery('');
@@ -74,7 +75,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
74
75
  });
75
76
  return /*#__PURE__*/ jsx(Combobox, {
76
77
  value: selectedOption ?? null,
77
- onChange: handleSelect,
78
+ onChange: handleChange,
78
79
  disabled: disabled,
79
80
  immediate: true,
80
81
  children: /*#__PURE__*/ jsxs("div", {
@@ -93,6 +94,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
93
94
  }),
94
95
  /*#__PURE__*/ jsxs("div", {
95
96
  className: "fr-combobox-control",
97
+ ref: controlRef,
96
98
  children: [
97
99
  /*#__PURE__*/ jsx(ComboboxInput, {
98
100
  className: inputClasses,
@@ -114,6 +116,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
114
116
  /*#__PURE__*/ jsxs(ComboboxOptions, {
115
117
  className: classnames('fr-combobox-options-container', 'fr-combobox-options'),
116
118
  as: "ul",
119
+ portal: false,
117
120
  anchor: {
118
121
  to: 'bottom start',
119
122
  gap: 20,
@@ -133,7 +136,7 @@ function ComboBoxComponent({ defaultValue = '', value: controlled, label, option
133
136
  as: "li",
134
137
  className: ({ focus, selected, disabled: isDisabled })=>classnames('fr-combobox-option', {
135
138
  'fr-selected': selected,
136
- 'fr-active': focus,
139
+ 'fr-focus': focus,
137
140
  'fr-disabled': isDisabled
138
141
  }),
139
142
  children: /*#__PURE__*/ jsx("span", {
package/dist/index.d.ts CHANGED
@@ -45,8 +45,8 @@ export { type TabItemAppearance, Tabs, type TabsConfiguration, type TabsProps, t
45
45
  export { TabPane, type TabPaneProps } from './components/tab/tab-pane/TabPane';
46
46
  export { TableHeaderCell, type TableHeaderCellProps, } from './components/table-header-cell/TableHeaderCell';
47
47
  export { Checkbox, type CheckboxProps } from './forms/checkbox/Checkbox';
48
- export { ComboBox, type ComboBoxOptionType, type ComboBoxProps, } from './forms/combobox/ComboBox';
49
- export { RadioButton, type RadioButtonProps as RadioProps, } from './forms/radio/RadioButton';
48
+ export { ComboBox, type ComboBoxOptionProps, type ComboBoxProps, } from './forms/combobox/ComboBox';
49
+ export { RadioButton, type RadioButtonProps, } from './forms/radio/RadioButton';
50
50
  export { RadioGroup, type RadioGroupProps } from './forms/radio/RadioGroup';
51
51
  export { Segment, type SegmentConfiguration, type SegmentProps, } from './forms/segment/Segment';
52
52
  export { SegmentControl, type SegmentControlProps, } from './forms/segment/segment-control/SegmentControl';
@@ -1,3 +1,10 @@
1
+ import type { CSSProperties } from 'react';
2
+ export interface ComponentBase {
3
+ className?: string;
4
+ style?: CSSProperties;
5
+ 'data-testid'?: string;
6
+ id?: string;
7
+ }
1
8
  export interface ClassNameProps {
2
9
  className?: string;
3
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@festo-ui/react",
3
- "version": "9.0.1-dev.763",
3
+ "version": "9.0.1-dev.764",
4
4
  "author": "Festo UI (styleguide@festo.com)",
5
5
  "copyright": "Copyright (c) 2025 Festo SE & Co. KG. All rights reserved.",
6
6
  "license": "apache-2.0",