fis-component 0.0.22 → 0.0.23

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.
Files changed (28) hide show
  1. package/dist/cjs/index.js +72 -4
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/src/components/Avatar/Avatar.stories.d.ts +1 -1
  4. package/dist/cjs/types/src/components/{GroupButton/GroupButton.stories.d.ts → ButtonGroup/ButtonGroup.stories.d.ts} +2 -2
  5. package/dist/{esm/types/src/components/GroupButton → cjs/types/src/components/ButtonGroup}/index.d.ts +2 -2
  6. package/dist/cjs/types/src/components/{GroupRadio → RadioGroup}/index.d.ts +2 -2
  7. package/dist/cjs/types/src/index.d.ts +3 -1
  8. package/dist/esm/index.js +70 -4
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/types/src/components/Avatar/Avatar.stories.d.ts +1 -1
  11. package/dist/esm/types/src/components/{GroupButton/GroupButton.stories.d.ts → ButtonGroup/ButtonGroup.stories.d.ts} +2 -2
  12. package/dist/{cjs/types/src/components/GroupButton → esm/types/src/components/ButtonGroup}/index.d.ts +2 -2
  13. package/dist/esm/types/src/components/{GroupRadio → RadioGroup}/index.d.ts +2 -2
  14. package/dist/esm/types/src/index.d.ts +3 -1
  15. package/dist/index.d.ts +42 -2
  16. package/package.json +1 -1
  17. /package/dist/cjs/types/src/components/{GroupButton → ButtonGroup}/styles.d.ts +0 -0
  18. /package/dist/cjs/types/src/components/{GroupCheckbox/GroupCheckbox.stories.d.ts → CheckboxGroup/CheckboxGroup.stories.d.ts} +0 -0
  19. /package/dist/cjs/types/src/components/{GroupCheckbox → CheckboxGroup}/index.d.ts +0 -0
  20. /package/dist/cjs/types/src/components/{GroupCheckbox → CheckboxGroup}/styles.d.ts +0 -0
  21. /package/dist/cjs/types/src/components/{GroupRadio/GroupRadio.stories.d.ts → RadioGroup/RadioGroup.stories.d.ts} +0 -0
  22. /package/dist/cjs/types/src/components/{GroupRadio → RadioGroup}/styles.d.ts +0 -0
  23. /package/dist/esm/types/src/components/{GroupButton → ButtonGroup}/styles.d.ts +0 -0
  24. /package/dist/esm/types/src/components/{GroupCheckbox/GroupCheckbox.stories.d.ts → CheckboxGroup/CheckboxGroup.stories.d.ts} +0 -0
  25. /package/dist/esm/types/src/components/{GroupCheckbox → CheckboxGroup}/index.d.ts +0 -0
  26. /package/dist/esm/types/src/components/{GroupCheckbox → CheckboxGroup}/styles.d.ts +0 -0
  27. /package/dist/esm/types/src/components/{GroupRadio/GroupRadio.stories.d.ts → RadioGroup/RadioGroup.stories.d.ts} +0 -0
  28. /package/dist/esm/types/src/components/{GroupRadio → RadioGroup}/styles.d.ts +0 -0
@@ -1,4 +1,4 @@
1
1
  import { Meta } from "@storybook/react";
2
2
  declare const _default: Meta;
3
3
  export default _default;
4
- export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./index").AvatarProps>;
4
+ export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").AvatarProps>;
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import FISGroupButton from ".";
3
- declare const meta: Meta<typeof FISGroupButton>;
2
+ import FISButtonGroup from ".";
3
+ declare const meta: Meta<typeof FISButtonGroup>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
@@ -28,5 +28,5 @@ export interface GroupButtonProps {
28
28
  /** List of button options */
29
29
  options: ButtonOption[];
30
30
  }
31
- declare const FISGroupButton: React.FC<GroupButtonProps>;
32
- export default FISGroupButton;
31
+ declare const FISButtonGroup: React.FC<GroupButtonProps>;
32
+ export default FISButtonGroup;
@@ -16,6 +16,6 @@ type RadioGroupProps<T extends Value> = {
16
16
  onFocus?: () => void;
17
17
  onBlur?: () => void;
18
18
  };
19
- declare function RadioGroup<T extends Value>({ className, groupLabel, options, name, value, direction, disabled, getOptionDisabled, onChange, onFocus, onBlur, }: RadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
20
- export default RadioGroup;
19
+ declare function FISRadioGroup<T extends Value>({ className, groupLabel, options, name, value, direction, disabled, getOptionDisabled, onChange, onFocus, onBlur, }: RadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
20
+ export default FISRadioGroup;
21
21
  export type { RadioGroupProps };
@@ -3,10 +3,12 @@ export type { ThemeType } from "./styles/design-system";
3
3
  export { default as FISButton } from "./components/Button";
4
4
  export { default as FISLinkButton } from "./components/LinkButton";
5
5
  export { default as FISIconButton } from "./components/IconButton";
6
- export { default as FISGroupButton } from "./components/GroupButton";
6
+ export { default as FISButtonGroup } from "./components/ButtonGroup";
7
7
  export { default as FISBreadcrumb } from "./components/Breadcrumb";
8
8
  export { default as FISRadio } from "./components/Radio";
9
+ export { default as FISRadioGroup } from "./components/RadioGroup";
9
10
  export { default as FISCheckbox } from "./components/Checkbox";
11
+ export { default as FISCheckboxGroup } from "./components/CheckboxGroup";
10
12
  export { default as FISInputField } from "./components/Input/InputField";
11
13
  export { default as FISInputText } from "./components/Input/InputText";
12
14
  export { default as FISInputLabel } from "./components/Input/InputLabel";
package/dist/esm/index.js CHANGED
@@ -4946,6 +4946,7 @@ const FISIconButton = forwardRef((props, ref) => {
4946
4946
  const { type, children, active = false, size = "md", variant = "primary", icon: iconProp, ...rest } = props;
4947
4947
  return (jsx(ButtonStyled, { ...rest, ref: ref, "$variant": variant, "$size": size, "$active": active, children: iconProp }));
4948
4948
  });
4949
+ FISIconButton.displayName = "FISIconButton";
4949
4950
 
4950
4951
  const GroupButtonContainerStyled = dt.div `
4951
4952
  overflow: hidden;
@@ -5216,7 +5217,7 @@ const IconStyled = dt.span `
5216
5217
  align-items: center;
5217
5218
  `;
5218
5219
 
5219
- const FISGroupButton = ({ className, size = "md", disabled = false, options, variant, }) => {
5220
+ const FISButtonGroup = ({ className, size = "md", disabled = false, options, variant, }) => {
5220
5221
  return (jsx(GroupButtonContainerStyled, { className: className, children: options.map((option, index) => (createElement(Button, { ...option, key: index, disabledContainer: disabled, size: size, variant: variant }))) }));
5221
5222
  };
5222
5223
  const Button = ({ disabledContainer, startIcon: startIconProp, endIcon: endIconProp, size = "md", variant = "default", label, disabled, ...rest }) => {
@@ -5227,7 +5228,7 @@ const Button = ({ disabledContainer, startIcon: startIconProp, endIcon: endIconP
5227
5228
  return (jsxs(ButtonItemStyled, { ...rest, disabled: disabledContainer || disabled, "$onlyIcon": onlyIcon, "$size": size, "$variant": variant, children: [startIcon, label && jsx("span", { className: "button-content", children: label }), endIcon] }));
5228
5229
  };
5229
5230
 
5230
- const DivContainerSC$3 = dt.div `
5231
+ const DivContainerSC$4 = dt.div `
5231
5232
  display: flex;
5232
5233
  align-items: center;
5233
5234
  `;
@@ -5307,8 +5308,9 @@ const BreadcrumbEllipsis = () => (jsxs(Fragment, { children: [jsx(DivIconDotSC,
5307
5308
  const FISBreadcrumb = ({ items, className }) => {
5308
5309
  if (items.length === 0)
5309
5310
  return null;
5310
- return (jsxs(DivContainerSC$3, { className: className, children: [items?.[0]?.icon && (jsxs(Fragment, { children: [jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsx(SeparatorIcon, {})] })), items.length > MAX_VISIBLE_ITEMS ? (jsxs(Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))), jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, `end-${index}`)))] })) : (jsx(Fragment, { children: items.slice(1).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))) }))] }));
5311
+ return (jsxs(DivContainerSC$4, { className: className, children: [items?.[0]?.icon && (jsxs(Fragment, { children: [jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsx(SeparatorIcon, {})] })), items.length > MAX_VISIBLE_ITEMS ? (jsxs(Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))), jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, `end-${index}`)))] })) : (jsx(Fragment, { children: items.slice(1).map((item, index) => (jsxs(React.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))) }))] }));
5311
5312
  };
5313
+ FISBreadcrumb.displayName = "FISBreadcrumb";
5312
5314
 
5313
5315
  const SpanRadioControlSC = dt.span `
5314
5316
  display: inline-flex;
@@ -5496,6 +5498,39 @@ const FISRadio = forwardRef(({ className, children, subLabel, checked = false, d
5496
5498
  });
5497
5499
  FISRadio.displayName = "FISRadio";
5498
5500
 
5501
+ const DivContainerSC$3 = dt.div `
5502
+ display: flex;
5503
+ flex-wrap: wrap;
5504
+ gap: 20px;
5505
+
5506
+ ${(props) => props.$direction === "row"
5507
+ ? lt `
5508
+ flex-direction: row;
5509
+ `
5510
+ : lt `
5511
+ flex-direction: column;
5512
+ `}
5513
+ `;
5514
+ const DivScreenReaderLabelSC$1 = dt.div `
5515
+ position: absolute;
5516
+ width: 1px;
5517
+ height: 1px;
5518
+ padding: 0;
5519
+ margin: -1px;
5520
+ overflow: hidden;
5521
+ clip: rect(0, 0, 0, 0);
5522
+ white-space: nowrap;
5523
+ border: 0;
5524
+ `;
5525
+
5526
+ function FISRadioGroup({ className, groupLabel, options, name, value, direction = "row", disabled, getOptionDisabled, onChange, onFocus, onBlur, }) {
5527
+ const groupId = "radio-group-" + useId();
5528
+ const handleChange = (option) => {
5529
+ onChange(option.value);
5530
+ };
5531
+ return (jsxs(DivContainerSC$3, { role: "radiogroup", className: className, "aria-labelledby": groupId, "$direction": direction, children: [jsx(DivScreenReaderLabelSC$1, { id: groupId, children: groupLabel }), options.map((option) => (jsx(FISRadio, { value: option.value, name: name, disabled: getOptionDisabled?.(option) ?? disabled, checked: option.value === value, onChange: () => handleChange(option), onFocus: onFocus, onBlur: onBlur, children: option.label }, option.value)))] }));
5532
+ }
5533
+
5499
5534
  const CheckboxControlStyled = dt.span `
5500
5535
  display: inline-flex;
5501
5536
  align-items: center;
@@ -5691,6 +5726,36 @@ const FISCheckbox = forwardRef(({ className, children, subLabel, checked = false
5691
5726
  });
5692
5727
  FISCheckbox.displayName = "FISCheckbox";
5693
5728
 
5729
+ const DivGroupContainerSC = dt.div `
5730
+ display: flex;
5731
+ flex-wrap: wrap;
5732
+ gap: 20px;
5733
+ flex-direction: ${props => props.$direction};
5734
+ `;
5735
+ const DivScreenReaderLabelSC = dt.div `
5736
+ position: absolute;
5737
+ width: 1px;
5738
+ height: 1px;
5739
+ padding: 0;
5740
+ margin: -1px;
5741
+ overflow: hidden;
5742
+ clip: rect(0, 0, 0, 0);
5743
+ white-space: nowrap;
5744
+ border: 0;
5745
+ `;
5746
+
5747
+ function FISCheckboxGroup({ className, groupLabel, options, value = [], direction = "row", disabled, getOptionDisabled, onChange, onFocus, onBlur, }) {
5748
+ const groupId = "checkbox-group-" + useId();
5749
+ const validValue = value.filter((v) => options.some((option) => option.value === v));
5750
+ const handleChange = (option) => {
5751
+ const nextValue = validValue.includes(option.value)
5752
+ ? validValue.filter((v) => v !== option.value)
5753
+ : [...validValue, option.value];
5754
+ onChange(nextValue);
5755
+ };
5756
+ return (jsxs(DivGroupContainerSC, { role: "group", className: className, "$direction": direction, "aria-labelledby": groupId, children: [jsx(DivScreenReaderLabelSC, { id: groupId, children: groupLabel }), options.map((option) => (jsx(FISCheckbox, { value: option.value, disabled: getOptionDisabled?.(option) ?? disabled, checked: value.includes(option.value), onChange: () => handleChange(option), onFocus: onFocus, onBlur: onBlur, children: option.label }, option.value)))] }));
5757
+ }
5758
+
5694
5759
  var classnames = {exports: {}};
5695
5760
 
5696
5761
  /*!
@@ -6610,6 +6675,7 @@ const DivBadge = dt.div `
6610
6675
  const FISAvatar = ({ className, src, alt = "Avatar", badge = "rounded", size = "xl", icon, status = "green", color = "neutral", letter, isBadgeDot = true, }) => {
6611
6676
  return (jsxs(DivContainer, { className: className, "$size": size, "$badge": badge, "$color": color, children: [src ? (jsx(ImgAvatar, { "$size": size, "$badge": badge, src: src, alt: alt })) : icon ? (jsx(DivIcon, { "$size": size, "$badge": badge, children: icon })) : (jsx(SpanLetter, { "$size": size, "$badge": badge, "$color": color, children: letter?.slice(0, 2) })), isBadgeDot && jsx(DivBadge, { "$size": size, "$status": status })] }));
6612
6677
  };
6678
+ FISAvatar.displayName = "FISAvatar";
6613
6679
 
6614
6680
  const DicContainerSC = dt.div `
6615
6681
  display: flex;
@@ -7058,5 +7124,5 @@ const FISInputStepper = forwardRef((props) => {
7058
7124
  });
7059
7125
  FISInputStepper.displayName = "FISInputStepper";
7060
7126
 
7061
- export { FISAvatar, FISBreadcrumb, FISButton, FISCheckbox, FISGroupButton, FISIconButton, FISInputField, FISInputLabel, FISInputStepper, FISInputText, FISLinkButton, FISRadio, FISTextArea, FISThemeProvider };
7127
+ export { FISAvatar, FISBreadcrumb, FISButton, FISButtonGroup, FISCheckbox, FISCheckboxGroup, FISIconButton, FISInputField, FISInputLabel, FISInputStepper, FISInputText, FISLinkButton, FISRadio, FISRadioGroup, FISTextArea, FISThemeProvider };
7062
7128
  //# sourceMappingURL=index.js.map