@m4l/components 9.1.70 → 9.1.71
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/components/Image/Image.js +8 -5
- package/components/Image/constant.d.ts +4 -0
- package/components/Image/constant.js +4 -0
- package/components/Image/image.styles.js +1 -1
- package/components/Image/slots/ImageEnum.d.ts +1 -1
- package/components/Image/slots/ImageEnum.js +1 -1
- package/components/Image/slots/ImageSlots.js +2 -2
- package/components/Image/types.d.ts +1 -0
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/MenuItem.styles.js +13 -0
- package/components/mui_extended/Select/Select.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +93 -96
- package/components/mui_extended/Select/Select.styles.js +94 -230
- package/components/mui_extended/Select/constants.d.ts +23 -0
- package/components/mui_extended/Select/constants.js +11 -1
- package/components/mui_extended/Select/dictionary.d.ts +4 -2
- package/components/mui_extended/Select/dictionary.js +7 -0
- package/components/mui_extended/Select/slots/SelectEnum.d.ts +12 -7
- package/components/mui_extended/Select/slots/SelectEnum.js +14 -7
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +15 -9
- package/components/mui_extended/Select/slots/SelectSlots.js +31 -20
- package/components/mui_extended/Select/slots/index.js +1 -0
- package/components/mui_extended/Select/types.d.ts +41 -29
- package/components/mui_extended/TextField/TextField.js +1 -1
- package/package.json +1 -1
- /package/components/mui_extended/Select/{Select.test.d.ts → test/Select.test.d.ts} +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
3
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
4
|
+
import clsx from "clsx";
|
|
4
5
|
import { L as LazyLoadComponent } from "./subcomponents/LazyLoadComponent/index.js";
|
|
5
6
|
import { D as DivContainerSkeletonStyled, I as ImgSkeleton, a as ImgStyled } from "./slots/ImageSlots.js";
|
|
6
7
|
import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
|
|
7
|
-
import { s as svgDataUriSkeleton, I as IMAGE_KEY_COMPONENT } from "./constant.js";
|
|
8
|
+
import { s as svgDataUriSkeleton, I as IMAGE_KEY_COMPONENT, a as IMAGE_CLASSES } from "./constant.js";
|
|
8
9
|
import { I as ImageSlots } from "./slots/ImageEnum.js";
|
|
9
10
|
function Image(props) {
|
|
10
11
|
const {
|
|
11
12
|
enableIntersectionObserver = true,
|
|
12
13
|
threshold = 100,
|
|
13
14
|
dataTestId,
|
|
15
|
+
className,
|
|
14
16
|
...others
|
|
15
17
|
} = props;
|
|
16
18
|
const isSkeleton = useModuleSkeleton();
|
|
@@ -35,13 +37,14 @@ function Image(props) {
|
|
|
35
37
|
ImgStyled,
|
|
36
38
|
{
|
|
37
39
|
ownerState: { ...ownerState },
|
|
38
|
-
...getPropDataTestId(IMAGE_KEY_COMPONENT, ImageSlots.
|
|
39
|
-
...others
|
|
40
|
+
...getPropDataTestId(IMAGE_KEY_COMPONENT, ImageSlots.root, dataTestId),
|
|
41
|
+
...others,
|
|
42
|
+
className: clsx(IMAGE_CLASSES.root, className)
|
|
40
43
|
}
|
|
41
44
|
) })
|
|
42
45
|
}
|
|
43
46
|
);
|
|
44
|
-
}, [dataTestId, enableIntersectionObserver, others, ownerState, threshold]);
|
|
47
|
+
}, [dataTestId, enableIntersectionObserver, others, ownerState, threshold, className]);
|
|
45
48
|
return lazyLoadComponent;
|
|
46
49
|
}
|
|
47
50
|
export {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare const IMAGE_KEY_COMPONENT = "M4LImage";
|
|
2
2
|
export declare const svgDataUriSkeleton = "data:image/svg+xml,%3Csvg width='36' height='37' viewBox='0 0 36 37' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Union'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M25.0001 14.7416C24.26 15.2361 23.39 15.5 22.5 15.5C21.3065 15.5 20.1619 15.0259 19.318 14.182C18.4741 13.3381 18 12.1935 18 11C18 10.11 18.2639 9.23996 18.7584 8.49994C19.2529 7.75992 19.9557 7.18314 20.7779 6.84254C21.6002 6.50195 22.505 6.41283 23.3779 6.58647C24.2508 6.7601 25.0526 7.18868 25.682 7.81802C26.3113 8.44736 26.7399 9.24918 26.9135 10.1221C27.0872 10.995 26.9981 11.8998 26.6575 12.7221C26.3169 13.5443 25.7401 14.2471 25.0001 14.7416ZM23.3334 9.7528C23.0867 9.58798 22.7967 9.5 22.5 9.5C22.1022 9.5 21.7206 9.65804 21.4393 9.93934C21.158 10.2206 21 10.6022 21 11C21 11.2967 21.088 11.5867 21.2528 11.8334C21.4176 12.08 21.6519 12.2723 21.926 12.3858C22.2001 12.4994 22.5017 12.5291 22.7926 12.4712C23.0836 12.4133 23.3509 12.2704 23.5607 12.0607C23.7704 11.8509 23.9133 11.5836 23.9712 11.2926C24.0291 11.0017 23.9994 10.7001 23.8858 10.426C23.7723 10.1519 23.58 9.91762 23.3334 9.7528Z' fill='%23091E42' fill-opacity='0.08'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M3 0.5H33C33.7957 0.5 34.5587 0.81607 35.1213 1.37868C35.6839 1.94129 36 2.70435 36 3.5V33.5C36 34.2957 35.6839 35.0587 35.1213 35.6213C34.5587 36.1839 33.7957 36.5 33 36.5H3C2.20435 36.5 1.44129 36.1839 0.87868 35.6213C0.31607 35.0587 0 34.2957 0 33.5V3.5C0 2.70435 0.31607 1.94129 0.87868 1.37868C1.44129 0.81607 2.20435 0.5 3 0.5ZM3 24.5V33.5H33V30.5L25.5 23L23.115 25.385C22.5529 25.9438 21.7926 26.2574 21 26.2574C20.2074 26.2574 19.4471 25.9438 18.885 25.385L10.5 17L3 24.5ZM27.615 20.87L33 26.255V3.5H3V20.255L8.385 14.87C8.94709 14.3112 9.70744 13.9976 10.5 13.9976C11.2926 13.9976 12.0529 14.3112 12.615 14.87L21 23.255L23.385 20.87C23.9471 20.3112 24.7074 19.9976 25.5 19.9976C26.2926 19.9976 27.0529 20.3112 27.615 20.87Z' fill='%23091E42' fill-opacity='0.08'/%3E%3C/g%3E%3C/svg%3E%0A";
|
|
3
|
+
/**
|
|
4
|
+
* Clases de los slots del componente Image
|
|
5
|
+
*/
|
|
6
|
+
export declare const IMAGE_CLASSES: Record<string, string>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { I as ImageSlots } from "./slots/ImageEnum.js";
|
|
1
3
|
const IMAGE_KEY_COMPONENT = "M4LImage";
|
|
2
4
|
const svgDataUriSkeleton = `data:image/svg+xml,%3Csvg width='36' height='37' viewBox='0 0 36 37' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Union'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M25.0001 14.7416C24.26 15.2361 23.39 15.5 22.5 15.5C21.3065 15.5 20.1619 15.0259 19.318 14.182C18.4741 13.3381 18 12.1935 18 11C18 10.11 18.2639 9.23996 18.7584 8.49994C19.2529 7.75992 19.9557 7.18314 20.7779 6.84254C21.6002 6.50195 22.505 6.41283 23.3779 6.58647C24.2508 6.7601 25.0526 7.18868 25.682 7.81802C26.3113 8.44736 26.7399 9.24918 26.9135 10.1221C27.0872 10.995 26.9981 11.8998 26.6575 12.7221C26.3169 13.5443 25.7401 14.2471 25.0001 14.7416ZM23.3334 9.7528C23.0867 9.58798 22.7967 9.5 22.5 9.5C22.1022 9.5 21.7206 9.65804 21.4393 9.93934C21.158 10.2206 21 10.6022 21 11C21 11.2967 21.088 11.5867 21.2528 11.8334C21.4176 12.08 21.6519 12.2723 21.926 12.3858C22.2001 12.4994 22.5017 12.5291 22.7926 12.4712C23.0836 12.4133 23.3509 12.2704 23.5607 12.0607C23.7704 11.8509 23.9133 11.5836 23.9712 11.2926C24.0291 11.0017 23.9994 10.7001 23.8858 10.426C23.7723 10.1519 23.58 9.91762 23.3334 9.7528Z' fill='%23091E42' fill-opacity='0.08'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M3 0.5H33C33.7957 0.5 34.5587 0.81607 35.1213 1.37868C35.6839 1.94129 36 2.70435 36 3.5V33.5C36 34.2957 35.6839 35.0587 35.1213 35.6213C34.5587 36.1839 33.7957 36.5 33 36.5H3C2.20435 36.5 1.44129 36.1839 0.87868 35.6213C0.31607 35.0587 0 34.2957 0 33.5V3.5C0 2.70435 0.31607 1.94129 0.87868 1.37868C1.44129 0.81607 2.20435 0.5 3 0.5ZM3 24.5V33.5H33V30.5L25.5 23L23.115 25.385C22.5529 25.9438 21.7926 26.2574 21 26.2574C20.2074 26.2574 19.4471 25.9438 18.885 25.385L10.5 17L3 24.5ZM27.615 20.87L33 26.255V3.5H3V20.255L8.385 14.87C8.94709 14.3112 9.70744 13.9976 10.5 13.9976C11.2926 13.9976 12.0529 14.3112 12.615 14.87L21 23.255L23.385 20.87C23.9471 20.3112 24.7074 19.9976 25.5 19.9976C26.2926 19.9976 27.0529 20.3112 27.615 20.87Z' fill='%23091E42' fill-opacity='0.08'/%3E%3C/g%3E%3C/svg%3E%0A`;
|
|
5
|
+
const IMAGE_CLASSES = getComponentClasses(IMAGE_KEY_COMPONENT, ImageSlots);
|
|
3
6
|
export {
|
|
4
7
|
IMAGE_KEY_COMPONENT as I,
|
|
8
|
+
IMAGE_CLASSES as a,
|
|
5
9
|
svgDataUriSkeleton as s
|
|
6
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var ImageSlots = /* @__PURE__ */ ((ImageSlots2) => {
|
|
2
|
-
ImageSlots2["
|
|
2
|
+
ImageSlots2["root"] = "root";
|
|
3
3
|
ImageSlots2["intersectComponent"] = "intersectComponent";
|
|
4
4
|
ImageSlots2["scrollIntersectRoot"] = "scrollIntersectRoot";
|
|
5
5
|
ImageSlots2["skeletonComponent"] = "skeletonComponent";
|
|
@@ -5,8 +5,8 @@ import { i as imageStyles } from "../image.styles.js";
|
|
|
5
5
|
import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
|
|
6
6
|
const ImgStyled = styled("img", {
|
|
7
7
|
name: IMAGE_KEY_COMPONENT,
|
|
8
|
-
slot: ImageSlots.
|
|
9
|
-
})(imageStyles?.
|
|
8
|
+
slot: ImageSlots.root
|
|
9
|
+
})(imageStyles?.root);
|
|
10
10
|
const ImgSkeleton = styled("img", {
|
|
11
11
|
name: IMAGE_KEY_COMPONENT,
|
|
12
12
|
slot: ImageSlots.imgSkeleton
|
|
@@ -29,6 +29,7 @@ export interface ImageProps extends Omit<IntersectComponentProps, 'setIsVisible'
|
|
|
29
29
|
alt?: string;
|
|
30
30
|
threshold?: number;
|
|
31
31
|
enableIntersectionObserver?: boolean;
|
|
32
|
+
className?: string;
|
|
32
33
|
dataTestId?: string;
|
|
33
34
|
}
|
|
34
35
|
export type ImageSlotsType = keyof typeof ImageSlots;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const RHFPeriodRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
2
2
|
export declare const PeriodRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
3
3
|
export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/TextField/types').TextFieldProps, "ref"> & import('react').RefAttributes<HTMLDivElement>, "children" | "value" | "title" | "component" | "size" | "name" | "error" | "select" | "rows" | "id" | "type" | "hidden" | "content" | "style" | "disabled" | "variant" | "margin" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | keyof import('react').RefAttributes<HTMLDivElement> | "autoComplete" | "placeholder" | "required" | "dataTestId" | "maxRows" | "fullWidth" | "focused" | "hiddenLabel" | "InputProps" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "inputProps" | "inputRef" | "multiline" | "minRows" | "SelectProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
4
|
-
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Select').SelectProps
|
|
4
|
+
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Select').SelectProps<any>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "children" | "value" | "onClose" | "title" | "size" | "name" | "error" | "input" | "options" | "rows" | "id" | "type" | "components" | "hidden" | "content" | "style" | "open" | "multiple" | "disabled" | "variant" | "margin" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "componentsProps" | "onOpen" | "slotProps" | "slots" | "label" | keyof import('react').RefAttributes<HTMLDivElement> | "autoComplete" | "placeholder" | "readOnly" | "required" | "dataTestId" | "maxRows" | "fullWidth" | "inputProps" | "inputRef" | "multiline" | "minRows" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "renderSuffix" | "startAdornment" | "disableUnderline" | "autoWidth" | "defaultOpen" | "displayEmpty" | "IconComponent" | "labelId" | "MenuProps" | "native" | "renderValue" | "SelectDisplayProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
@@ -108,6 +108,19 @@ const menuItemStyles = {
|
|
|
108
108
|
backgroundColor: theme.vars.palette.text.disabled
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
+
"& .M4LImage-root": {
|
|
112
|
+
...getHeightSizeStyles(
|
|
113
|
+
theme.generalSettings.isMobile,
|
|
114
|
+
ownerState.size || "medium",
|
|
115
|
+
"base",
|
|
116
|
+
(val) => {
|
|
117
|
+
return {
|
|
118
|
+
height: val,
|
|
119
|
+
width: val
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
},
|
|
111
124
|
...getHeightSizeStyles(
|
|
112
125
|
theme.generalSettings.isMobile,
|
|
113
126
|
ownerState.size || "medium",
|
|
@@ -8,4 +8,4 @@ import { SelectProps } from './types';
|
|
|
8
8
|
* @updatedAt 2025-01-03 11:42:15 - automatic
|
|
9
9
|
* @updatedUser Andrés Quintero - automatic
|
|
10
10
|
*/
|
|
11
|
-
export declare const Select: (
|
|
11
|
+
export declare const Select: import('react').ForwardRefExoticComponent<Omit<SelectProps<any>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -2,12 +2,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEnvironment, useModuleSkeleton, useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
3
3
|
import { useTheme } from "@mui/material";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { useState, useMemo } from "react";
|
|
6
|
-
import { a as
|
|
7
|
-
import { I as
|
|
8
|
-
import { S as
|
|
5
|
+
import { forwardRef, useState, useMemo } from "react";
|
|
6
|
+
import { A as ArrowDownStyled, S as SkeletonSelectStyled, a as SelectRootStyled, M as MenuItemListStyled, b as MenuItemNoOptionStyled, c as AdormentStyled, L as LabelPlaceholerStyled, R as RenderValueContainerStyled, d as RenderValueTypography } from "./slots/SelectSlots.js";
|
|
7
|
+
import { S as SELECT_CLASSES, a as SELECT_KEY_COMPONENT, I as ICON_ARROW_DOWN } from "./constants.js";
|
|
8
|
+
import { S as SELECT_DICTIONARY } from "./dictionary.js";
|
|
9
|
+
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
9
10
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
|
-
|
|
11
|
+
import { S as SelectSlots } from "./slots/SelectEnum.js";
|
|
12
|
+
const Select = forwardRef((props, ref) => {
|
|
11
13
|
const {
|
|
12
14
|
value,
|
|
13
15
|
options = [],
|
|
@@ -15,141 +17,136 @@ const Select = (props) => {
|
|
|
15
17
|
size = "medium",
|
|
16
18
|
disabled = false,
|
|
17
19
|
error = false,
|
|
18
|
-
color = "default",
|
|
19
20
|
variant = "outlined",
|
|
20
|
-
placeholder
|
|
21
|
-
className
|
|
21
|
+
placeholder,
|
|
22
|
+
className,
|
|
23
|
+
dataTestId,
|
|
24
|
+
...otherProps
|
|
22
25
|
} = props;
|
|
23
26
|
const { currentSize } = useComponentSize(size);
|
|
24
27
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
25
28
|
const isSkeleton = useModuleSkeleton();
|
|
26
29
|
const { getLabel } = useModuleDictionary();
|
|
27
|
-
const theme = useTheme();
|
|
28
30
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
29
|
-
const [selectedValue, setSelectedValue] = useState(value
|
|
31
|
+
const [selectedValue, setSelectedValue] = useState(value ?? "");
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
const theme = useTheme();
|
|
30
34
|
const paletteColor = getPropertyByString(
|
|
31
35
|
theme.vars.palette,
|
|
32
|
-
disabled ? "default" : error ? "error" :
|
|
36
|
+
disabled ? "default" : error ? "error" : "primary",
|
|
33
37
|
theme.vars.palette.default
|
|
34
38
|
);
|
|
35
|
-
const ownerState = {
|
|
39
|
+
const ownerState = useMemo(() => ({
|
|
36
40
|
size: adjustedSize,
|
|
37
41
|
disabled,
|
|
38
42
|
error,
|
|
39
43
|
variant,
|
|
40
|
-
paletteColor
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const optionsMap = useMemo(
|
|
44
|
-
() => new Map(options.map((opt) => [opt.id.toString(), opt])),
|
|
45
|
-
[options]
|
|
46
|
-
);
|
|
47
|
-
const handleChange = (event) => {
|
|
44
|
+
paletteColor
|
|
45
|
+
}), [adjustedSize, disabled, error, variant, paletteColor]);
|
|
46
|
+
const handleLocalChange = (event) => {
|
|
48
47
|
const newValue = event.target.value;
|
|
49
48
|
setSelectedValue(newValue);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
setOpen(false);
|
|
50
|
+
const selectedOption = options.find((option) => option.id === newValue);
|
|
51
|
+
if (selectedOption && onChange) {
|
|
52
|
+
onChange(selectedOption);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
const arrowDropDownIcon = `${host_static_assets}/${environment_assets}/${ICON_ARROW_DOWN}`;
|
|
56
|
+
const ArrowIcon = useMemo(() => {
|
|
57
|
+
return () => /* @__PURE__ */ jsx(
|
|
58
|
+
ArrowDownStyled,
|
|
59
|
+
{
|
|
60
|
+
ownerState: { ...ownerState },
|
|
61
|
+
icon: arrowDropDownIcon,
|
|
62
|
+
disabled,
|
|
63
|
+
size: adjustedSize,
|
|
64
|
+
onClick: () => {
|
|
65
|
+
!disabled && setOpen(!open);
|
|
66
|
+
},
|
|
67
|
+
rotationAngle: open ? 180 : 0
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}, [ownerState, arrowDropDownIcon, disabled, adjustedSize, open]);
|
|
71
|
+
const RenderIcon = (icon) => {
|
|
72
|
+
if (!icon) {
|
|
73
|
+
return null;
|
|
64
74
|
}
|
|
65
|
-
|
|
75
|
+
if (typeof icon !== "string") {
|
|
76
|
+
return icon;
|
|
77
|
+
} else {
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
AdormentStyled,
|
|
80
|
+
{
|
|
81
|
+
ownerState: {},
|
|
82
|
+
src: icon,
|
|
83
|
+
size: adjustedSize,
|
|
84
|
+
className: SELECT_CLASSES.renderValueStartAdorment,
|
|
85
|
+
disabled
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const renderValue = (selected) => {
|
|
91
|
+
if (!Boolean(selected)) {
|
|
92
|
+
return /* @__PURE__ */ jsx(LabelPlaceholerStyled, { variant: "body", color: "text.disabled", ownerState: {}, children: placeholder });
|
|
93
|
+
}
|
|
94
|
+
const selectedOption = options.find((option) => option.id === selected);
|
|
95
|
+
return selectedOption ? /* @__PURE__ */ jsxs(RenderValueContainerStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.renderValueContainer, children: [
|
|
96
|
+
selectedOption.startAdornment && RenderIcon(selectedOption.startAdornment),
|
|
97
|
+
/* @__PURE__ */ jsx(RenderValueTypography, { variant: "body", color: "text.primary", ownerState: {}, size: adjustedSize, className: SELECT_CLASSES.renderValueTypography, children: selectedOption.label })
|
|
98
|
+
] }) : "";
|
|
99
|
+
};
|
|
66
100
|
if (isSkeleton) {
|
|
67
|
-
return /* @__PURE__ */ jsx(SkeletonSelectStyled, { ownerState: { ...ownerState } });
|
|
101
|
+
return /* @__PURE__ */ jsx(SkeletonSelectStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.skeletonSelect });
|
|
68
102
|
}
|
|
69
|
-
const classSelect = getComponentSlotRoot("M4LSelectClass");
|
|
70
103
|
return /* @__PURE__ */ jsx(
|
|
71
104
|
SelectRootStyled,
|
|
72
105
|
{
|
|
73
|
-
|
|
106
|
+
...otherProps,
|
|
107
|
+
...getPropDataTestId(SELECT_KEY_COMPONENT, SelectSlots.root, dataTestId),
|
|
108
|
+
ref,
|
|
109
|
+
className: clsx(SELECT_CLASSES.root, SELECT_CLASSES[variant], className),
|
|
74
110
|
ownerState: { ...ownerState },
|
|
111
|
+
IconComponent: ArrowIcon,
|
|
75
112
|
value: selectedValue,
|
|
76
|
-
onChange:
|
|
77
|
-
IconComponent: arrowIcon,
|
|
113
|
+
onChange: handleLocalChange,
|
|
78
114
|
fullWidth: true,
|
|
79
115
|
disabled,
|
|
80
116
|
error,
|
|
81
|
-
renderValue: (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
selectedOption?.startAdornment && /* @__PURE__ */ jsx(Icon, { size, src: selectedOption.startAdornment }),
|
|
88
|
-
/* @__PURE__ */ jsx(LabelOptionStyled, { size, ownerState: { ...ownerState }, children: selectedOption?.label || placeholder })
|
|
89
|
-
] });
|
|
90
|
-
},
|
|
91
|
-
MenuProps: {
|
|
92
|
-
disableAutoFocusItem: true,
|
|
93
|
-
MenuListProps: {
|
|
94
|
-
onMouseMove: (event) => {
|
|
95
|
-
event.stopPropagation();
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* Handles the key down event for the menu.
|
|
100
|
-
* @param {React.KeyboardEvent} event - The key down event.
|
|
101
|
-
* @author SebastianM - automatic
|
|
102
|
-
* @createdAt 2024-12-23 10:47:53 - automatic
|
|
103
|
-
* @updatedAt 2025-01-03 11:42:15 - automatic
|
|
104
|
-
* @updatedUser Andrés Quintero - automatic
|
|
105
|
-
*/
|
|
106
|
-
onKeyDown: (event) => {
|
|
107
|
-
const char = event.key.toLowerCase();
|
|
108
|
-
const matchingOption = options.find(
|
|
109
|
-
(option) => option.label.toLowerCase().startsWith(char)
|
|
110
|
-
);
|
|
111
|
-
if (matchingOption) {
|
|
112
|
-
const element = document.querySelector(
|
|
113
|
-
`[data-value='${matchingOption.id}']`
|
|
114
|
-
);
|
|
115
|
-
element?.scrollIntoView({ block: "nearest" });
|
|
116
|
-
setSelectedValue(matchingOption.id.toString());
|
|
117
|
-
const selectedOption = optionsMap.get(matchingOption.id.toString());
|
|
118
|
-
if (selectedOption) {
|
|
119
|
-
onChange?.(selectedOption);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
117
|
+
renderValue: (val) => renderValue(val),
|
|
118
|
+
size: adjustedSize,
|
|
119
|
+
open,
|
|
120
|
+
displayEmpty: true,
|
|
121
|
+
onClick: () => {
|
|
122
|
+
!disabled && setOpen(!open);
|
|
123
123
|
},
|
|
124
124
|
children: options.length > 0 ? options.map((option) => /* @__PURE__ */ jsx(
|
|
125
|
-
|
|
125
|
+
MenuItemListStyled,
|
|
126
126
|
{
|
|
127
|
+
className: SELECT_CLASSES.menuItemList,
|
|
127
128
|
ownerState: { ...ownerState },
|
|
128
|
-
size,
|
|
129
|
-
value: option.id
|
|
129
|
+
size: adjustedSize,
|
|
130
|
+
value: String(option.id),
|
|
130
131
|
disabled,
|
|
131
132
|
label: option.label,
|
|
132
|
-
selected:
|
|
133
|
-
|
|
134
|
-
selectedValue
|
|
135
|
-
),
|
|
136
|
-
startIcon: option.startAdornment,
|
|
137
|
-
endIcon: option.endAdornment,
|
|
138
|
-
"data-value": option.id
|
|
133
|
+
selected: selectedValue === option.id,
|
|
134
|
+
startIcon: RenderIcon(option.startAdornment)
|
|
139
135
|
},
|
|
140
|
-
option.id
|
|
136
|
+
String(option.id)
|
|
141
137
|
)) : /* @__PURE__ */ jsx(
|
|
142
|
-
|
|
138
|
+
MenuItemNoOptionStyled,
|
|
143
139
|
{
|
|
144
140
|
ownerState: { ...ownerState },
|
|
145
|
-
|
|
146
|
-
size,
|
|
147
|
-
label: getLabel(
|
|
141
|
+
className: SELECT_CLASSES.menuItemNoOptions,
|
|
142
|
+
size: adjustedSize,
|
|
143
|
+
label: getLabel(SELECT_DICTIONARY.noOptions),
|
|
144
|
+
disabled: true
|
|
148
145
|
}
|
|
149
146
|
)
|
|
150
147
|
}
|
|
151
148
|
);
|
|
152
|
-
};
|
|
149
|
+
});
|
|
153
150
|
export {
|
|
154
151
|
Select as S
|
|
155
152
|
};
|