kiban-design-system 1.0.245-alpha.0 → 1.0.247-alpha.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
@@ -2243,6 +2243,7 @@ const useTheme = () => {
2243
2243
  * options can be selected or not
2244
2244
  * @param {string} SelectProps.placeholder - Select Placeholder
2245
2245
  * @param {string} SelectProps.selectLabel - Select Label
2246
+ * @param {object} InputTextProps.secondaryAction - Text for show icon inside right input.
2246
2247
  * @param {string[]} SelectProps.selected - Selected data to highlight in the render
2247
2248
  * of the list items
2248
2249
  * @param {Function} SelectProps.onChange - Action that is triggered by selecting
@@ -2262,7 +2263,7 @@ const useTheme = () => {
2262
2263
  * @param {string} InputTextProps.ariaLabel - Label to use in automatic tests
2263
2264
  * @returns {symbol} - Element Select
2264
2265
  */
2265
- 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, }) => {
2266
+ 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, }) => {
2266
2267
  const [isActivePopover, setIsActive] = useState(false);
2267
2268
  const selectActivatorRef = useRef(null);
2268
2269
  const [parentCoord, setParentCoords] = useState();
@@ -2437,8 +2438,12 @@ const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, se
2437
2438
  setParentCoords(selectActivatorRef.current.getBoundingClientRect());
2438
2439
  }
2439
2440
  }, [selectActivatorRef]);
2441
+ const showLabelContainer = label || secondaryAction;
2440
2442
  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]);
2441
- 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));
2443
+ 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;
2444
+ const requiredMarkup = isRequired ? (jsx("span", Object.assign({ className: 'Select__labelContainer--required' }, { children: "*" }), void 0)) : null;
2445
+ 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;
2446
+ 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));
2442
2447
  };
2443
2448
 
2444
2449
  // these aren't really private, but nor are they really useful to document
@@ -24584,17 +24589,17 @@ function Form({ ariaLabel, data, fields, fieldsSection, iconHelperText, onChange
24584
24589
  return jsx(Fragment, { children: formMarkup }, void 0);
24585
24590
  }
24586
24591
 
24587
- const SectionForm = ({ ariaLabel, data, fields, fieldsSection, iconDeletable, iconHelperText, onChange, onDelete, tagRemoveIcon, isDeletable, extraPropsField, }) => {
24592
+ const SectionForm = ({ ariaLabel, data, fields, fieldsSection, iconDeletable, iconHelperText, onChange, onDelete, tagRemoveIcon, isDeletable, extraPropsField, columnsSize: columnsSizeProps = 3, }) => {
24588
24593
  // eslint-disable-next-line
24589
24594
  // @ts-ignore
24590
- const wrapperMarkup = jsx(Grid.Item, { size: 3 }, void 0);
24595
+ const wrapperMarkup = jsx(Grid.Item, { size: columnsSizeProps }, void 0);
24591
24596
  const formMarkup = (jsx(Form, { ariaLabel: ariaLabel, data: data, fields: fields, fieldsSection: fieldsSection, iconHelperText: iconHelperText, onChange: onChange, fieldWrapperElement: wrapperMarkup, tagRemoveIcon: tagRemoveIcon, extraPropsField: extraPropsField }, void 0));
24592
24597
  const gridMarkup = jsx(Grid, Object.assign({ isMultiline: true }, { children: formMarkup }), void 0);
24593
24598
  return (jsx(DeletableSection, Object.assign({ ariaLabel: ariaLabel, onDelete: onDelete, iconDeletable: iconDeletable, isDeletable: isDeletable }, { children: gridMarkup }), void 0));
24594
24599
  };
24595
24600
 
24596
24601
  const COMPONENT_NAME$a = 'DynamicForm';
24597
- const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, iconDeletable, iconHelperText, labelDivider, onChange, onAddForm, tagRemoveIcon, deletableFormArray, extraPropsFieldsArray, }) => {
24602
+ const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, iconDeletable, iconHelperText, labelDivider, onChange, onAddForm, tagRemoveIcon, deletableFormArray, extraPropsFieldsArray, columnsSize, }) => {
24598
24603
  const { theme } = useTheme();
24599
24604
  const handleChange = (contact, id) => {
24600
24605
  if (onChange) {
@@ -24619,7 +24624,7 @@ const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, ico
24619
24624
  const extraProps = extraPropsFieldsArray && index < extraPropsFieldsArray.length
24620
24625
  ? extraPropsFieldsArray[index]
24621
24626
  : undefined;
24622
- 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}}`));
24627
+ 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}}`));
24623
24628
  };
24624
24629
  const contactsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$a}__SectionFormWrapper` }, { children: dataFormArray.map(renderForm) }), void 0));
24625
24630
  const dividerMarkup = labelDivider && jsx(Divider, { label: labelDivider }, void 0);