kiban-design-system 1.1.8-hotfix.0 → 1.1.9-hotfix.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2245,6 +2245,7 @@ const useTheme = () => {
2245
2245
  * options can be selected or not
2246
2246
  * @param {string} SelectProps.placeholder - Select Placeholder
2247
2247
  * @param {string} SelectProps.selectLabel - Select Label
2248
+ * @param {object} InputTextProps.secondaryAction - Text for show icon inside right input.
2248
2249
  * @param {string[]} SelectProps.selected - Selected data to highlight in the render
2249
2250
  * of the list items
2250
2251
  * @param {Function} SelectProps.onChange - Action that is triggered by selecting
@@ -2264,7 +2265,7 @@ const useTheme = () => {
2264
2265
  * @param {string} InputTextProps.ariaLabel - Label to use in automatic tests
2265
2266
  * @returns {symbol} - Element Select
2266
2267
  */
2267
- const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, selected, onChange, searchPlaceholder, searchLabel, helperText, isHelperMode, isDisabled = false, tooltip, isDanger, isReadOnly = false, id, emptyState, onBlur, isRequired, tooltipLabel, action, showSearch = true, }) => {
2268
+ const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, secondaryAction, selected, onChange, searchPlaceholder, searchLabel, helperText, isHelperMode, isDisabled = false, tooltip, isDanger, isReadOnly = false, id, emptyState, onBlur, isRequired, tooltipLabel, action, showSearch = true, }) => {
2268
2269
  const [isActivePopover, setIsActive] = useState(false);
2269
2270
  const selectActivatorRef = useRef(null);
2270
2271
  const [parentCoord, setParentCoords] = useState();
@@ -2439,8 +2440,12 @@ const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, se
2439
2440
  setParentCoords(selectActivatorRef.current.getBoundingClientRect());
2440
2441
  }
2441
2442
  }, [selectActivatorRef]);
2443
+ const showLabelContainer = label || secondaryAction;
2442
2444
  const tooltipLabelMarkup = useMemo(() => tooltipLabel ? (jsx(AlphaTooltip, Object.assign({ content: tooltipLabel.content, theme: tooltipLabel.theme, width: 'default', parentTooltip: parentCoord }, { children: jsx("span", Object.assign({ className: 'Select__TooltipLabelContainer' }, { children: jsx(Icon, { name: tooltipLabel.icon || 'Info' }, void 0) }), void 0) }), void 0)) : null, [tooltipLabel, parentCoord]);
2443
- return (jsxs("div", Object.assign({ className: `Select ${isMultiple ? 'Select--isMultiple' : ''}`, ref: selectActivatorRef }, { children: [label && (jsxs("div", Object.assign({ className: 'Select__label' }, { children: [jsx("label", { children: label }, void 0), isRequired && jsx("span", Object.assign({ className: 'Select__label-required' }, { children: "*" }), void 0), tooltipLabelMarkup] }), void 0)), tooltip ? renderWithTooltip() : renderInput(), helperText && jsx("div", Object.assign({ className: 'Select__helperText' }, { children: helperText }), void 0)] }), void 0));
2445
+ const secondaryActionMarkup = secondaryAction ? (jsx("div", Object.assign({ className: 'Select__labelContainer--secondaryAction' }, { children: jsx(Button, Object.assign({ type: 'button', onClick: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.onClick, contentAlign: 'center' }, { children: secondaryAction.text }), void 0) }), void 0)) : null;
2446
+ const requiredMarkup = isRequired ? (jsx("span", Object.assign({ className: 'Select__labelContainer--required' }, { children: "*" }), void 0)) : null;
2447
+ const labelContainerMarkup = showLabelContainer ? (jsxs("div", Object.assign({ className: 'Select__labelContainer' }, { children: [label && (jsxs("label", Object.assign({ className: 'Select__labelContainer--label' }, { children: [label, requiredMarkup, tooltipLabelMarkup] }), void 0)), secondaryActionMarkup] }), void 0)) : null;
2448
+ return (jsxs("div", Object.assign({ className: `Select ${isMultiple ? 'Select--isMultiple' : ''}`, ref: selectActivatorRef }, { children: [labelContainerMarkup, tooltip ? renderWithTooltip() : renderInput(), helperText && jsx("div", Object.assign({ className: 'Select__helperText' }, { children: helperText }), void 0)] }), void 0));
2444
2449
  };
2445
2450
 
2446
2451
  // these aren't really private, but nor are they really useful to document
@@ -24586,17 +24591,17 @@ function Form({ ariaLabel, data, fields, fieldsSection, iconHelperText, onChange
24586
24591
  return jsx(Fragment, { children: formMarkup }, void 0);
24587
24592
  }
24588
24593
 
24589
- const SectionForm = ({ ariaLabel, data, fields, fieldsSection, iconDeletable, iconHelperText, onChange, onDelete, tagRemoveIcon, isDeletable, extraPropsField, }) => {
24594
+ const SectionForm = ({ ariaLabel, data, fields, fieldsSection, iconDeletable, iconHelperText, onChange, onDelete, tagRemoveIcon, isDeletable, extraPropsField, columnsSize: columnsSizeProps = 3, }) => {
24590
24595
  // eslint-disable-next-line
24591
24596
  // @ts-ignore
24592
- const wrapperMarkup = jsx(Grid.Item, { size: 3 }, void 0);
24597
+ const wrapperMarkup = jsx(Grid.Item, { size: columnsSizeProps }, void 0);
24593
24598
  const formMarkup = (jsx(Form, { ariaLabel: ariaLabel, data: data, fields: fields, fieldsSection: fieldsSection, iconHelperText: iconHelperText, onChange: onChange, fieldWrapperElement: wrapperMarkup, tagRemoveIcon: tagRemoveIcon, extraPropsField: extraPropsField }, void 0));
24594
24599
  const gridMarkup = jsx(Grid, Object.assign({ isMultiline: true }, { children: formMarkup }), void 0);
24595
24600
  return (jsx(DeletableSection, Object.assign({ ariaLabel: ariaLabel, onDelete: onDelete, iconDeletable: iconDeletable, isDeletable: isDeletable }, { children: gridMarkup }), void 0));
24596
24601
  };
24597
24602
 
24598
24603
  const COMPONENT_NAME$a = 'DynamicForm';
24599
- const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, iconDeletable, iconHelperText, labelDivider, onChange, onAddForm, tagRemoveIcon, deletableFormArray, extraPropsFieldsArray, }) => {
24604
+ const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, iconDeletable, iconHelperText, labelDivider, onChange, onAddForm, tagRemoveIcon, deletableFormArray, extraPropsFieldsArray, columnsSize, }) => {
24600
24605
  const { theme } = useTheme();
24601
24606
  const handleChange = (contact, id) => {
24602
24607
  if (onChange) {
@@ -24621,7 +24626,7 @@ const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, ico
24621
24626
  const extraProps = extraPropsFieldsArray && index < extraPropsFieldsArray.length
24622
24627
  ? extraPropsFieldsArray[index]
24623
24628
  : undefined;
24624
- return (jsx(SectionForm, { ariaLabel: ariaLabel, data: form, fields: fields, fieldsSection: fieldsSection, iconDeletable: iconDeletable, iconHelperText: iconHelperText, onChange: (formData) => handleChange(formData, form.id || ''), onDelete: () => handleDelete(form.id || ''), tagRemoveIcon: tagRemoveIcon, isDeletable: isDeletable, extraPropsField: extraProps }, `DynamicForm-${form.id}-${index}}`));
24629
+ return (jsx(SectionForm, { ariaLabel: ariaLabel, data: form, fields: fields, fieldsSection: fieldsSection, iconDeletable: iconDeletable, iconHelperText: iconHelperText, onChange: (formData) => handleChange(formData, form.id || ''), onDelete: () => handleDelete(form.id || ''), tagRemoveIcon: tagRemoveIcon, isDeletable: isDeletable, extraPropsField: extraProps, columnsSize: columnsSize }, `DynamicForm-${form.id}-${index}}`));
24625
24630
  };
24626
24631
  const contactsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$a}__SectionFormWrapper` }, { children: dataFormArray.map(renderForm) }), void 0));
24627
24632
  const dividerMarkup = labelDivider && jsx(Divider, { label: labelDivider }, void 0);
@@ -30564,11 +30569,11 @@ const AlphaZipCodeInput = ({ label, isRequired, items, onBlur, onFocus, onChange
30564
30569
  const renderLabelItem = (item) => (jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__ItemWrapper` }, { children: [jsx("div", Object.assign({ className: `${COMPONENT_NAME}__Item__Value` }, { children: item.cp }), void 0), jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__Item__Description` }, { children: [item.municipality, ", ", item.city, ", ", item.state] }), void 0)] }), void 0));
30565
30570
  const itemsOptions = items.map((item) => ({
30566
30571
  label: renderLabelItem(item),
30567
- value: item.cp,
30572
+ value: item.id,
30568
30573
  }));
30569
30574
  const optionListMarkup = items.length > 0 ? (jsx(OptionList, { items: itemsOptions, selected: [''], onChange: handleOnSelectItem }, void 0)) : null;
30570
30575
  const emptyItemsMarkup = items.length === 0 ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME}__EmptyItems` }, { children: labelEmpty }), void 0)) : null;
30571
- const popoverMarkup = useMemo(() => (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: showPopover, isFullWidth: true, onClose: () => setShowPopover(false), isFixed: true }, { children: jsxs(Popover$1.Pane, { children: [optionListMarkup, emptyItemsMarkup] }, void 0) }), void 0)), [items, value, showPopover]);
30576
+ const popoverMarkup = useMemo(() => (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: showPopover, isFullWidth: true, onClose: () => setShowPopover(false), isFixed: true }, { children: jsxs(Popover$1.Pane, { children: [optionListMarkup, emptyItemsMarkup] }, void 0) }), void 0)), [items, value, showPopover, isFocusActive]);
30572
30577
  return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__Wrapper` }, { children: [labelMarkup, popoverMarkup] }), void 0));
30573
30578
  };
30574
30579