@engagebay/engagebay-form-module 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engagebay/engagebay-form-module",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "Provide base form components to reacho",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -11,6 +11,7 @@ import { handleChange } from ".";
11
11
  import { LoaderWithText } from "../../util/LoaderWithText";
12
12
  import SVGIcon from "../../util/svg/SVGIcon";
13
13
  import { FormContextType } from "../context/FormContext";
14
+ import Tippy from "@tippyjs/react";
14
15
  import {
15
16
  FieldOptionsSchema,
16
17
  FormFieldSchema,
@@ -45,7 +46,7 @@ const RenderListOptions = forwardRef<HTMLUListElement, RenderListOptionsProps>(
45
46
  queryCallback,
46
47
  createCallback,
47
48
  },
48
- ref
49
+ ref,
49
50
  ) => {
50
51
  const [query, setQuery] = useState<string>("");
51
52
  const [createdListItems, setCreatedListItems] = useState<
@@ -90,7 +91,7 @@ const RenderListOptions = forwardRef<HTMLUListElement, RenderListOptionsProps>(
90
91
  .filter((result) => result.label)
91
92
  .filter(
92
93
  (option, index, self) =>
93
- index === self.findIndex((obj) => obj.value === option.value)
94
+ index === self.findIndex((obj) => obj.value === option.value),
94
95
  ),
95
96
  ]; // removing duplicate values
96
97
 
@@ -178,7 +179,7 @@ const RenderListOptions = forwardRef<HTMLUListElement, RenderListOptionsProps>(
178
179
  <>
179
180
  <div className="flex items-center justify-between gap-x-1.5">
180
181
  <span
181
- className={`block truncate w-full !max-w-[150px] space-x-2 ${
182
+ className={`block truncate w-full ${fieldConfig.customClassNames?.optionClassName} space-x-2 ${
182
183
  selected ? "font-medium" : "font-normal"
183
184
  }`}
184
185
  >
@@ -318,7 +319,7 @@ const RenderListOptions = forwardRef<HTMLUListElement, RenderListOptionsProps>(
318
319
  </div>
319
320
  </ListboxOptions>
320
321
  );
321
- }
322
+ },
322
323
  );
323
324
 
324
325
  export default RenderListOptions;
@@ -326,7 +327,7 @@ export function renderListBoxValue(
326
327
  formContext: FormContextType,
327
328
  fieldConfig: FormFieldSchema,
328
329
  listOptions: FieldOptionsSchema[],
329
- onChange?: (value: any) => void
330
+ onChange?: (value: any) => void,
330
331
  ): JSX.Element {
331
332
  let value = formContext.getValues(fieldConfig.name);
332
333
  const renderAsString = () => {
@@ -338,10 +339,17 @@ export function renderListBoxValue(
338
339
  return icon ? (
339
340
  <span className="flex items-center fs-8 whitespace-nowrap text-gray-500">
340
341
  <span>{icon}</span>
341
- <span>{label} </span>
342
+
343
+ <Tippy content={label} delay={500}>
344
+ <span className="block truncate">{label}</span>
345
+ </Tippy>
342
346
  </span>
347
+ ) : label ? (
348
+ <Tippy content={<>{label}</>} delay={500}>
349
+ <span className="block truncate">{label}</span>
350
+ </Tippy>
343
351
  ) : (
344
- label || getPlaceholder()
352
+ getPlaceholder()
345
353
  );
346
354
  };
347
355
  const renderAsArray = () => {
@@ -370,7 +378,12 @@ export function renderListBoxValue(
370
378
 
371
379
  return (
372
380
  <span key={option?.value} className="form-selected-badge">
373
- <span className="form-selected-badge-name">{option?.label}</span>
381
+ <Tippy content={option?.label} delay={500}>
382
+ <span className="form-selected-badge-name">
383
+ {option?.label}
384
+ </span>
385
+ </Tippy>
386
+
374
387
  {getDeleteButton(opt)}
375
388
  </span>
376
389
  );