@sebgroup/green-react 1.3.1 → 1.5.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/index.js CHANGED
@@ -2092,7 +2092,8 @@ const IconButton = _a => {
2092
2092
  const ButtonGroup = ({
2093
2093
  children,
2094
2094
  selectedIndex,
2095
- variant
2095
+ variant,
2096
+ id
2096
2097
  }) => {
2097
2098
  const [selected, setSelected] = useState(selectedIndex);
2098
2099
  const [buttons, setButtons] = useState([]);
@@ -2112,9 +2113,12 @@ const ButtonGroup = ({
2112
2113
  });
2113
2114
  setButtons(buttonProps);
2114
2115
  }, [children, selected, variant]);
2115
- return jsx(Group, {
2116
+ return jsx(Group, Object.assign({
2117
+ "data-label": "button-group",
2118
+ id: id
2119
+ }, {
2116
2120
  children: buttons.map(props => jsx(Button, Object.assign({}, props), props.key))
2117
- });
2121
+ }));
2118
2122
  };
2119
2123
 
2120
2124
  /* eslint-disable-next-line */
@@ -2298,6 +2302,7 @@ const FormItems = ({
2298
2302
  };
2299
2303
 
2300
2304
  function Group({
2305
+ id,
2301
2306
  children,
2302
2307
  error,
2303
2308
  groupBorder = false
@@ -2305,7 +2310,8 @@ function Group({
2305
2310
  const groupClassName = `group ${groupBorder ? 'group-border' : ''} ${error ? 'is-invalid' : ''}`;
2306
2311
  const errorMessage = error ? error.message || error : '';
2307
2312
  return jsxs("div", Object.assign({
2308
- className: "form-group"
2313
+ className: "form-group",
2314
+ id: id
2309
2315
  }, {
2310
2316
  children: [jsx("div", Object.assign({
2311
2317
  className: groupClassName
@@ -3086,6 +3092,20 @@ const OptionGroup = ({
3086
3092
  }));
3087
3093
  };
3088
3094
 
3095
+ const InputWrapper = ({
3096
+ children,
3097
+ unitLabel
3098
+ }) => jsx(Fragment, {
3099
+ children: unitLabel ? jsxs("div", Object.assign({
3100
+ className: "group group-border"
3101
+ }, {
3102
+ children: [children, jsx("span", Object.assign({
3103
+ className: "form-text"
3104
+ }, {
3105
+ children: unitLabel
3106
+ }))]
3107
+ })) : children
3108
+ });
3089
3109
  function Slider({
3090
3110
  name = `${randomId()}-slider`,
3091
3111
  defaultValue,
@@ -3096,6 +3116,7 @@ function Slider({
3096
3116
  instruction,
3097
3117
  errorMessage,
3098
3118
  hasTextbox = false,
3119
+ unitLabel,
3099
3120
  disabled = false,
3100
3121
  onChange
3101
3122
  }) {
@@ -3128,10 +3149,10 @@ function Slider({
3128
3149
  })), instruction && jsx("p", {
3129
3150
  children: instruction
3130
3151
  })]
3131
- }), hasTextbox && jsxs("div", Object.assign({
3132
- className: "form-group"
3152
+ }), hasTextbox && jsx(InputWrapper, Object.assign({
3153
+ unitLabel: unitLabel
3133
3154
  }, {
3134
- children: [jsx("input", {
3155
+ children: jsx("input", {
3135
3156
  type: "number",
3136
3157
  value: sliderValue,
3137
3158
  id: `${name}-textbox`,
@@ -3139,9 +3160,7 @@ function Slider({
3139
3160
  className: errorMessage ? 'is-invalid' : '',
3140
3161
  disabled: disabled,
3141
3162
  onChange: handleChange
3142
- }), jsx("span", {
3143
- className: "form-info"
3144
- })]
3163
+ })
3145
3164
  }))]
3146
3165
  })), jsx("input", {
3147
3166
  type: "range",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "peerDependencies": {
5
5
  "react": "^17 || ^18",
6
6
  "react-dom": "^17 || ^18"
7
7
  },
8
8
  "dependencies": {
9
- "@sebgroup/chlorophyll": "^1.6.0",
10
- "@sebgroup/extract": "^1.3.0",
9
+ "@sebgroup/chlorophyll": "^1.8.0",
10
+ "@sebgroup/extract": "^1.3.1",
11
11
  "classnames": "^2.3.2"
12
12
  },
13
13
  "description": "React components built on top of @sebgroup/chlorophyll.",
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { AccordionItemInterface } from './accordion-item';
2
3
  export interface AccordionInterface {
3
4
  items: AccordionItemInterface[];
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { DatepickerOptions } from '@sebgroup/extract';
2
3
  export declare const Datepicker: (options?: DatepickerOptions) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DropdownArgs, OnChange } from '@sebgroup/extract';
2
3
  export interface DropdownProps extends DropdownArgs {
3
4
  onChange?: OnChange;
@@ -5,6 +5,7 @@ interface ButtonGroupProps {
5
5
  children: ReactElement<ButtonProps> | ReactElement<ButtonProps>[];
6
6
  selectedIndex?: number;
7
7
  variant?: ButtonVariant;
8
+ id?: string;
8
9
  }
9
- export declare const ButtonGroup: ({ children, selectedIndex, variant, }: ButtonGroupProps) => JSX.Element;
10
+ export declare const ButtonGroup: ({ children, selectedIndex, variant, id, }: ButtonGroupProps) => JSX.Element;
10
11
  export default ButtonGroup;
@@ -4,6 +4,7 @@ export interface GroupProps {
4
4
  error?: Error | string;
5
5
  groupBorder?: boolean;
6
6
  invalid?: boolean;
7
+ id?: string;
7
8
  }
8
- export declare function Group({ children, error, groupBorder }: GroupProps): JSX.Element;
9
+ export declare function Group({ id, children, error, groupBorder, }: GroupProps): JSX.Element;
9
10
  export default Group;
@@ -7,4 +7,4 @@ export declare const TextInput: ({ label, info, testId, onChange, onChangeInput,
7
7
  export declare const EmailInput: ({ label, info, onChange, onChangeInput, validator, testId, ...props }: TextInputProps) => JSX.Element;
8
8
  export declare const NumberInput: ({ label, info, onChange, onChangeInput, validator, expandableInfo, expandableInfoButtonLabel, testId, ...props }: NumberInputProps) => JSX.Element;
9
9
  export declare const Checkbox: ({ label, onChange, validator, testId, ...props }: CheckboxProps) => JSX.Element;
10
- export declare const RadioButton: React.ForwardRefExoticComponent<Pick<RadioButtonProps, "label" | "testId" | "onChange" | "validator" | "type" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLInputElement>>;
10
+ export declare const RadioButton: React.ForwardRefExoticComponent<Omit<RadioButtonProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const BankId: ({ fill, focusable, title, ...props }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const Check: ({ focusable, title }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const ChevronDown: ({ focusable, title }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const InfoCircle: ({ focusable, title, ...props }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const SquareExclamation: ({ focusable, title, ...props }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const SquareInfo: ({ focusable, title, ...props }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IconProps } from '../../types/props';
2
3
  export declare const Times: ({ focusable, title }: IconProps) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SliderProps } from '../../types';
2
- export declare function Slider({ name, defaultValue, min, max, step, label, instruction, errorMessage, hasTextbox, disabled, onChange, }: SliderProps): JSX.Element;
3
+ export declare function Slider({ name, defaultValue, min, max, step, label, instruction, errorMessage, hasTextbox, unitLabel, disabled, onChange, }: SliderProps): JSX.Element;
3
4
  export default Slider;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { StepperArgs } from './hook';
2
3
  import { IValidator } from "@sebgroup/extract";
3
4
  export interface StepperProps extends StepperArgs {
@@ -23,6 +23,7 @@ export interface SliderProps {
23
23
  instruction?: string;
24
24
  errorMessage?: string;
25
25
  hasTextbox?: boolean;
26
+ unitLabel?: string;
26
27
  disabled?: boolean;
27
28
  onChange?: (value: number) => void;
28
29
  }