no-frills-ui 0.0.14-rc.2 → 0.0.14-rc.3

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
@@ -326,35 +326,35 @@ const StyledCard = /*#__PURE__*/ styled("div", {
326
326
  const Card = /*#__PURE__*/ React.forwardRef(CardComponent);
327
327
 
328
328
  const Step$1 = /*#__PURE__*/ styled(Card, {
329
- target: "e1l2mhfb0",
329
+ target: "ex87x7i0",
330
330
  label: "Step"
331
331
  })("transition:all 0.6s ease;overflow:visible;", (props)=>props.open && `margin: 20px 5px;`);
332
332
  const StepHeader = /*#__PURE__*/ styled("button", {
333
- target: "e1l2mhfb1",
333
+ target: "ex87x7i1",
334
334
  label: "StepHeader"
335
335
  })("padding:20px 15px;display:flex;justify-content:space-between;background:none;border:none;border-radius:10px;width:100%;font-size:inherit;color:", getThemeValue(THEME_NAME.TEXT_COLOR_DARK), ";&:focus-visible{box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}& input{appearance:none;margin:0;}", (props)=>props.open && `border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};`, " ", (props)=>props.open && `border-radius: 10px 10px 0 0;`, " ", (props)=>props.disabled && `color: ${getThemeValue(THEME_NAME.DISABLED)};`);
336
336
  const HeaderContainer = /*#__PURE__*/ styled("div", {
337
- target: "e1l2mhfb2",
337
+ target: "ex87x7i2",
338
338
  label: "HeaderContainer"
339
339
  })("display:flex;align-items:center;min-width:40px;& svg{vertical-align:top;margin-right:10px;fill:", (props)=>props.open ? getThemeValue(THEME_NAME.PRIMARY) : props.completed ? getThemeValue(THEME_NAME.SUCCESS) : getThemeValue(THEME_NAME.LIGHT_GREY), ";transform:", (props)=>props.open ? 'scale(0.8)' : 'scale(0.6)', ";transition:all 0.3s ease;min-width:24px;}");
340
340
  const ExpandContainer = /*#__PURE__*/ styled("div", {
341
- target: "e1l2mhfb3",
341
+ target: "ex87x7i3",
342
342
  label: "ExpandContainer"
343
343
  })("display:flex;align-items:center;& svg{vertical-align:top;margin-right:10px;transition:all 0.6s ease;fill:currentColor;}", (props)=>props.open ? `& svg { transform: rotate(180deg); }` : '');
344
344
  const StepBody = /*#__PURE__*/ styled("div", {
345
- target: "e1l2mhfb4",
345
+ target: "ex87x7i4",
346
346
  label: "StepBody"
347
347
  })("transition:all 0.6s ease;overflow:hidden;height:", (props)=>props.height || 0, "px;");
348
348
  const AccordionBadge = /*#__PURE__*/ styled(Badge, {
349
- target: "e1l2mhfb5",
349
+ target: "ex87x7i5",
350
350
  label: "AccordionBadge"
351
351
  })("margin-right:15px;");
352
352
  const AccordionStepBody = /*#__PURE__*/ styled("div", {
353
- target: "e1l2mhfb6",
353
+ target: "ex87x7i6",
354
354
  label: "AccordionStepBody"
355
355
  })("padding:20px 15px;");
356
356
  const AccordionStepFooter = /*#__PURE__*/ styled("div", {
357
- target: "e1l2mhfb7",
357
+ target: "ex87x7i7",
358
358
  label: "AccordionStepFooter"
359
359
  })("display:flex;justify-content:flex-end;padding:10px 15px;border-top:1px solid ", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";");
360
360
  /**
@@ -384,6 +384,7 @@ const AccordionStepFooter = /*#__PURE__*/ styled("div", {
384
384
  completed: completed,
385
385
  children: [
386
386
  /*#__PURE__*/ jsxRuntime.jsxs(StepHeader, {
387
+ type: "button",
387
388
  open: open,
388
389
  disabled: disabled,
389
390
  onClick: onStepClick,
@@ -522,12 +523,12 @@ const StyledIconButton = /*#__PURE__*/ styled("button", {
522
523
  }
523
524
  const IconButton = /*#__PURE__*/ React.forwardRef(IconButtonComponent);
524
525
 
525
- const Container$a = /*#__PURE__*/ styled("span", {
526
- target: "eg8hsap0",
526
+ const Container$b = /*#__PURE__*/ styled("span", {
527
+ target: "e3nd8sw0",
527
528
  label: "Container"
528
529
  })("padding:5px;padding-left:15px;border-radius:16px;background-color:", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";display:inline-flex;margin:5px;line-height:20px;align-items:center;");
529
530
  const Button$1 = /*#__PURE__*/ styled("button", {
530
- target: "eg8hsap1",
531
+ target: "e3nd8sw1",
531
532
  label: "Button"
532
533
  })("color:", getThemeValue(THEME_NAME.BACKGROUND), ";background-color:", getThemeValue(THEME_NAME.DISABLED), ";border-radius:50%;border:none;padding:4px;display:inline-flex;margin-left:5px;&:focus-within{outline:4px solid ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}");
533
534
  /**
@@ -547,13 +548,14 @@ const Button$1 = /*#__PURE__*/ styled("button", {
547
548
  e.stopPropagation();
548
549
  }
549
550
  };
550
- return /*#__PURE__*/ jsxRuntime.jsxs(Container$a, {
551
+ return /*#__PURE__*/ jsxRuntime.jsxs(Container$b, {
551
552
  ...rest,
552
553
  ref: ref,
553
554
  onKeyUp: keyUpHandler,
554
555
  children: [
555
556
  label,
556
557
  /*#__PURE__*/ jsxRuntime.jsx(Button$1, {
558
+ type: "button",
557
559
  onClick: onCloseClick,
558
560
  onKeyDown: buttonKeyDownHandler,
559
561
  "aria-label": closeButtonAriaLabel ?? `Remove ${label}`,
@@ -582,7 +584,7 @@ const DragContext = React.createContext(null);
582
584
  target: "ertl9d71",
583
585
  label: "DragKnob"
584
586
  })("padding-top:8px;cursor:move;touch-action:none;color:", getThemeValue(THEME_NAME.DISABLED), ";");
585
- /** Container for the children */ const Container$9 = /*#__PURE__*/ styled("div", {
587
+ /** Container for the children */ const Container$a = /*#__PURE__*/ styled("div", {
586
588
  target: "ertl9d72",
587
589
  label: "Container"
588
590
  })("flex:1;");
@@ -824,14 +826,14 @@ const DragContext = React.createContext(null);
824
826
  tabIndex: -1,
825
827
  children: /*#__PURE__*/ jsxRuntime.jsx(CheckCircle, {})
826
828
  }),
827
- /*#__PURE__*/ jsxRuntime.jsx(Container$9, {
829
+ /*#__PURE__*/ jsxRuntime.jsx(Container$a, {
828
830
  children: children
829
831
  })
830
832
  ]
831
833
  });
832
834
  }
833
835
 
834
- /** Container Component */ const Container$8 = /*#__PURE__*/ styled("div", {
836
+ /** Container Component */ const Container$9 = /*#__PURE__*/ styled("div", {
835
837
  target: "e18d6tqk0",
836
838
  label: "Container"
837
839
  })("flex:1;display:flex;position:relative;flex-wrap:wrap;flex-direction:", (props)=>props.orientation === ORIENTATION.HORIZONTAL ? 'row' : 'column', ";");
@@ -934,7 +936,7 @@ const DragContext = React.createContext(null);
934
936
  setDragOver,
935
937
  i18n
936
938
  },
937
- children: /*#__PURE__*/ jsxRuntime.jsx(Container$8, {
939
+ children: /*#__PURE__*/ jsxRuntime.jsx(Container$9, {
938
940
  ...rest,
939
941
  ref: ref,
940
942
  orientation: orientation,
@@ -961,11 +963,16 @@ const DragContext = React.createContext(null);
961
963
  }
962
964
  const DragAndDrop = /*#__PURE__*/ React.forwardRef(DragAndDropComponent);
963
965
 
966
+ // Container for the ChipInput
967
+ const Container$8 = /*#__PURE__*/ styled("div", {
968
+ target: "e7l19410",
969
+ label: "Container"
970
+ })("margin:10px 5px;");
964
971
  // Label component for the ChipInput
965
972
  const Label$6 = /*#__PURE__*/ styled("label", {
966
- target: "e1pr4bi70",
973
+ target: "e7l19411",
967
974
  label: "Label"
968
- })("display:inline-flex;flex-direction:column;flex:1;position:relative;margin:10px 5px;color:inherit;padding:0 8px;border-radius:3px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";width:", (props)=>typeof props.width === 'number' ? `${props.width}px` : props.width || '250px', ";max-width:100%;&:has(:focus),&:has(:active){border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:has(:focus) > span,&:has(:active) > span{color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:has(:disabled){border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";}&:has(:disabled) > span{color:", getThemeValue(THEME_NAME.DISABLED), ";}&:has(:focus:invalid){border-color:", getThemeValue(THEME_NAME.ERROR), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}", (props)=>props.touched ? `
975
+ })("display:inline-flex;flex-direction:column;flex:1;position:relative;color:inherit;padding:0 8px;border-radius:3px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";width:", (props)=>typeof props.width === 'number' ? `${props.width}px` : props.width || '250px', ";max-width:100%;&:has(:focus),&:has(:active){border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:has(:focus) > span,&:has(:active) > span{color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:has(:disabled){border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";}&:has(:disabled) > span{color:", getThemeValue(THEME_NAME.DISABLED), ";}&:has(:focus:invalid){border-color:", getThemeValue(THEME_NAME.ERROR), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}", (props)=>props.touched ? `
969
976
  &:has(:invalid) {
970
977
  border-color: ${getThemeValue(THEME_NAME.ERROR)};
971
978
  }
@@ -993,12 +1000,12 @@ const Label$6 = /*#__PURE__*/ styled("label", {
993
1000
  ` : '');
994
1001
  // Error message container
995
1002
  const ErrorContainer$6 = /*#__PURE__*/ styled("div", {
996
- target: "e1pr4bi71",
1003
+ target: "e7l19412",
997
1004
  label: "ErrorContainer"
998
1005
  })("color:", getThemeValue(THEME_NAME.ERROR), ";padding-top:3px;font-size:12px;line-height:14px;margin-left:3px;");
999
1006
  // Visually hidden but accessible to screen readers
1000
1007
  const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1001
- target: "e1pr4bi72",
1008
+ target: "e7l19413",
1002
1009
  label: "VisuallyHidden"
1003
1010
  })("position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;& li{list-style:none;}");
1004
1011
  /**
@@ -1014,7 +1021,7 @@ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1014
1021
  * />
1015
1022
  * ```
1016
1023
  */ function ChipInputComponent(props, ref) {
1017
- const { value: propValue = [], closeButtonAriaLabel = `Remove {:label}`, addedAnnouncementTemplate = '{:label} was added', removedAnnouncementTemplate = '{:label} was removed' } = props;
1024
+ const { value: propValue = [], onChange: onChangeCallback, label, errorText, closeButtonAriaLabel = `Remove {:label}`, addedAnnouncementTemplate = '{:label} was added', removedAnnouncementTemplate = '{:label} was removed', width, ...inputProps } = props;
1018
1025
  const [text, setText] = React.useState('');
1019
1026
  const [touched, setTouched] = React.useState(false);
1020
1027
  const [value, setValue] = React.useState(propValue || []);
@@ -1045,10 +1052,10 @@ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1045
1052
  ]);
1046
1053
  React.useEffect(()=>{
1047
1054
  if (InputRef.current) {
1048
- InputRef.current.setCustomValidity(props.errorText || '');
1055
+ InputRef.current.setCustomValidity(errorText || '');
1049
1056
  }
1050
1057
  }, [
1051
- props.errorText
1058
+ errorText
1052
1059
  ]);
1053
1060
  /**
1054
1061
  * Update the chip values and notify changes.
@@ -1056,15 +1063,15 @@ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1056
1063
  */ const updateValue = (newValue)=>{
1057
1064
  const deduped = Array.from(new Set(newValue));
1058
1065
  setValue(deduped);
1059
- props.onChange?.(deduped);
1066
+ onChangeCallback?.(deduped);
1060
1067
  };
1061
1068
  /**
1062
1069
  * Marks the input as touched on focus.
1063
1070
  * @param e React focus event
1064
1071
  */ const handleFocus = (e)=>{
1065
1072
  setTouched(true);
1066
- if (props.onFocus) {
1067
- props.onFocus(e);
1073
+ if (inputProps.onFocus) {
1074
+ inputProps.onFocus(e);
1068
1075
  }
1069
1076
  };
1070
1077
  /**
@@ -1076,15 +1083,28 @@ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1076
1083
  /**
1077
1084
  * Adds a new chip on Enter key press.
1078
1085
  * @param e React keyboard event
1079
- */ const handleKeyUp = (e)=>{
1080
- if (e.key === 'Enter' && text.trim() !== '' && InputRef.current?.validity.valid) {
1081
- const newValue = [
1082
- ...value,
1083
- text.trim()
1084
- ];
1085
- updateValue(newValue);
1086
- setText('');
1087
- setAnnouncement(replacePlaceholder(addedAnnouncementTemplate, text.trim()));
1086
+ */ const handleKeyDown = (e)=>{
1087
+ if (e.key === 'Enter') {
1088
+ // Check validity against HTML5 constraints only (ignore custom validity from errorText)
1089
+ let isValid;
1090
+ if (InputRef.current) {
1091
+ InputRef.current.setCustomValidity('');
1092
+ isValid = InputRef.current.checkValidity();
1093
+ InputRef.current.setCustomValidity(errorText || '');
1094
+ }
1095
+ // Only prevent form submission if we have valid text to add as a chip
1096
+ if (text.trim() !== '' && isValid) {
1097
+ e.preventDefault();
1098
+ e.stopPropagation();
1099
+ const newValue = [
1100
+ ...value,
1101
+ text.trim()
1102
+ ];
1103
+ updateValue(newValue);
1104
+ setText('');
1105
+ setAnnouncement(replacePlaceholder(addedAnnouncementTemplate, text.trim()));
1106
+ }
1107
+ // Otherwise, allow form submission to proceed
1088
1108
  }
1089
1109
  };
1090
1110
  /**
@@ -1114,42 +1134,46 @@ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
1114
1134
  // Render the component
1115
1135
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
1116
1136
  children: [
1117
- /*#__PURE__*/ jsxRuntime.jsxs(Label$6, {
1118
- text: text,
1119
- touched: touched,
1120
- errorText: props.errorText,
1121
- required: props.required,
1122
- width: props.width,
1137
+ /*#__PURE__*/ jsxRuntime.jsxs(Container$8, {
1123
1138
  children: [
1124
- /*#__PURE__*/ jsxRuntime.jsx("input", {
1125
- ...props,
1126
- ref: InputRef,
1127
- value: text,
1128
- onChange: handleChange,
1129
- onFocus: handleFocus,
1130
- onKeyUp: handleKeyUp,
1131
- required: props.required && value.length === 0,
1132
- "aria-required": props.required,
1133
- "aria-invalid": !!props.errorText,
1134
- "aria-describedby": props.errorText ? errorId : undefined
1135
- }),
1136
- /*#__PURE__*/ jsxRuntime.jsx("div", {
1137
- children: value?.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(DragAndDrop, {
1138
- orientation: ORIENTATION.HORIZONTAL,
1139
- onDrop: onDrop,
1140
- children: value.map((chip)=>/*#__PURE__*/ jsxRuntime.jsx(Chip, {
1141
- label: chip,
1142
- onCloseClick: ()=>removeChip(chip),
1143
- closeButtonAriaLabel: replacePlaceholder(closeButtonAriaLabel, chip)
1144
- }, chip))
1145
- })
1146
- }),
1147
- /*#__PURE__*/ jsxRuntime.jsx("span", {
1148
- children: props.label
1139
+ /*#__PURE__*/ jsxRuntime.jsxs(Label$6, {
1140
+ text: text,
1141
+ touched: touched,
1142
+ errorText: errorText,
1143
+ required: inputProps.required,
1144
+ width: width,
1145
+ children: [
1146
+ /*#__PURE__*/ jsxRuntime.jsx("input", {
1147
+ ...inputProps,
1148
+ ref: InputRef,
1149
+ value: text,
1150
+ onChange: handleChange,
1151
+ onFocus: handleFocus,
1152
+ onKeyDown: handleKeyDown,
1153
+ required: inputProps.required && value.length === 0,
1154
+ "aria-required": inputProps.required,
1155
+ "aria-invalid": !!errorText,
1156
+ "aria-describedby": errorText ? errorId : undefined
1157
+ }),
1158
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
1159
+ children: value?.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(DragAndDrop, {
1160
+ orientation: ORIENTATION.HORIZONTAL,
1161
+ onDrop: onDrop,
1162
+ children: value.map((chip)=>/*#__PURE__*/ jsxRuntime.jsx(Chip, {
1163
+ label: chip,
1164
+ onCloseClick: ()=>removeChip(chip),
1165
+ closeButtonAriaLabel: replacePlaceholder(closeButtonAriaLabel, chip)
1166
+ }, chip))
1167
+ })
1168
+ }),
1169
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
1170
+ children: label
1171
+ })
1172
+ ]
1149
1173
  }),
1150
- props.errorText && /*#__PURE__*/ jsxRuntime.jsx(ErrorContainer$6, {
1174
+ errorText && /*#__PURE__*/ jsxRuntime.jsx(ErrorContainer$6, {
1151
1175
  id: errorId,
1152
- children: props.errorText
1176
+ children: errorText
1153
1177
  })
1154
1178
  ]
1155
1179
  }),
@@ -3560,6 +3584,7 @@ const DEFAULT_DURATION$1 = 5000;
3560
3584
  ]
3561
3585
  }),
3562
3586
  /*#__PURE__*/ jsxRuntime.jsx(CloseButton, {
3587
+ type: "button",
3563
3588
  onClick: this.closeClickHandler(id),
3564
3589
  "aria-label": closeButtonAriaLabel || 'Close notification',
3565
3590
  tabIndex: 0,