@lumx/react 2.2.19 → 2.2.20-alpha.xss.datatable
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/esm/_internal/ButtonRoot.js.map +1 -1
- package/esm/_internal/Checkbox2.js +3 -1
- package/esm/_internal/Checkbox2.js.map +1 -1
- package/package.json +4 -4
- package/src/components/button/Button.stories.tsx +1 -0
- package/src/components/button/ButtonRoot.tsx +4 -4
- package/src/components/checkbox/Checkbox.tsx +2 -1
- package/src/components/checkbox/__snapshots__/Checkbox.test.tsx.snap +4 -0
- package/types.d.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonRoot.js","sources":["../../../src/components/button/ButtonRoot.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, RefObject } from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorPalette, Emphasis, Size, Theme } from '@lumx/react';\nimport { CSS_PREFIX } from '@lumx/react/constants';\nimport { Comp, GenericProps, handleBasicClasses } from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\ntype HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;\n\n/**\n * Button size definition.\n */\nexport type ButtonSize = Extract<Size, 's' | 'm'>;\n\nexport interface BaseButtonProps extends GenericProps {\n /** ARIA button label. */\n ['aria-label']?: string;\n /** Color variant. */\n color?: Color;\n /** Emphasis variant. */\n emphasis?: Emphasis;\n /** Whether or not the button has a background color in low emphasis. */\n hasBackground?: boolean;\n /** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */\n href?: string;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Native button name property. */\n name?: string;\n /** Size variant. */\n size?: ButtonSize;\n /** Native anchor target property. */\n target?: '_self' | '_blank' | '_parent' | '_top';\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native button type. */\n type?: HTMLButtonProps['type'];\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n}\n\nexport interface ButtonRootProps extends BaseButtonProps {\n variant: 'button' | 'icon';\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonRoot';\n\nexport const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;\nexport const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;\n\n/**\n * Render a button wrapper with the ButtonRoot inside.\n *\n * @param props Component props.\n * @return React element.\n */\nconst renderButtonWrapper: React.FC<ButtonRootProps> = (props) => {\n const { color, emphasis, variant, fullWidth } = props;\n\n const adaptedColor =\n emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);\n\n const wrapperClassName = classNames(\n handleBasicClasses({\n color: adaptedColor,\n prefix: BUTTON_WRAPPER_CLASSNAME,\n variant,\n fullWidth,\n }),\n );\n const buttonProps = { ...props, hasBackground: false };\n\n return (\n <div className={wrapperClassName}>\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <ButtonRoot {...buttonProps} />\n </div>\n );\n};\n\n/**\n * ButtonRoot component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonRoot: Comp<ButtonRootProps, HTMLButtonElement | HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n children,\n className,\n color,\n disabled,\n emphasis,\n hasBackground,\n href,\n isDisabled = disabled,\n isSelected,\n isActive,\n isFocused,\n isHovered,\n linkAs,\n name,\n size,\n target,\n theme,\n variant,\n type = 'button',\n fullWidth,\n ...forwardedProps\n } = props;\n\n const adaptedColor =\n color ||\n (emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light) ||\n (emphasis === Emphasis.high && ColorPalette.primary) ||\n ColorPalette.dark;\n\n if (hasBackground) {\n return renderButtonWrapper({ ...props, ref, variant, color: adaptedColor });\n }\n\n const buttonClassName = classNames(\n className,\n handleBasicClasses({\n color: adaptedColor,\n emphasis,\n isSelected,\n isDisabled,\n isActive,\n isFocused,\n isHovered,\n prefix: BUTTON_CLASSNAME,\n size,\n theme: emphasis === Emphasis.high && theme,\n variant,\n fullWidth,\n }),\n );\n\n /**\n * If the linkAs prop is used, we use the linkAs component instead of a <button>.\n * If there is an href attribute, we display an <a> instead of a <button>.\n *\n * However, in any case, if the component is disabled, we returned a <button> since disabled is not compatible with <a>.\n */\n if ((linkAs || !isEmpty(props.href)) && !isDisabled) {\n return renderLink(\n {\n linkAs,\n ...forwardedProps,\n 'aria-label': ariaLabel,\n href,\n target,\n className: buttonClassName,\n ref: ref as RefObject<HTMLAnchorElement>,\n },\n children,\n );\n }\n return (\n <button\n {...forwardedProps}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n aria-label={ariaLabel}\n ref={ref as RefObject<HTMLButtonElement>}\n className={buttonClassName}\n name={name}\n type={\n // eslint-disable-next-line react/button-has-type\n type\n }\n >\n {children}\n </button>\n );\n});\nButtonRoot.displayName = COMPONENT_NAME;\nButtonRoot.defaultProps = {};\n"],"names":["COMPONENT_NAME","BUTTON_WRAPPER_CLASSNAME","CSS_PREFIX","BUTTON_CLASSNAME","renderButtonWrapper","props","color","emphasis","variant","fullWidth","adaptedColor","Emphasis","low","ColorPalette","light","dark","wrapperClassName","classNames","handleBasicClasses","prefix","buttonProps","hasBackground","ButtonRoot","forwardRef","ref","ariaLabel","children","className","disabled","href","isDisabled","isSelected","isActive","isFocused","isHovered","linkAs","name","size","target","theme","type","forwardedProps","high","Theme","primary","buttonClassName","isEmpty","renderLink","displayName","defaultProps"],"mappings":";;;;;;;AAmDA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEO,IAAMC,wBAAwB,aAAMC,UAAN,oBAA9B;AACA,IAAMC,gBAAgB,aAAMD,UAAN,YAAtB;AAEP;;;;;;;AAMA,IAAME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AAS,EAAEqB,eANf;AAOI,IAAA,IAAI,EAAET,IAPV;AAQI,IAAA,IAAI;AAEAI,IAAAA;AAVR,MAaKd,QAbL,CADJ;AAiBH,CA3FiG;AA4FlGJ,UAAU,CAAC0B,WAAX,GAAyBhD,cAAzB;AACAsB,UAAU,CAAC2B,YAAX,GAA0B,EAA1B;;;;"}
|
|
1
|
+
{"version":3,"file":"ButtonRoot.js","sources":["../../../src/components/button/ButtonRoot.tsx"],"sourcesContent":["import React, { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, RefObject } from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorPalette, Emphasis, Size, Theme } from '@lumx/react';\nimport { CSS_PREFIX } from '@lumx/react/constants';\nimport { Comp, GenericProps, handleBasicClasses } from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\ntype HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;\n\n/**\n * Button size definition.\n */\nexport type ButtonSize = Extract<Size, 's' | 'm'>;\n\nexport interface BaseButtonProps\n extends GenericProps,\n Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'> {\n /** Color variant. */\n color?: Color;\n /** Emphasis variant. */\n emphasis?: Emphasis;\n /** Whether or not the button has a background color in low emphasis. */\n hasBackground?: boolean;\n /** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */\n href?: string;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Native button name property. */\n name?: string;\n /** Size variant. */\n size?: ButtonSize;\n /** Native anchor target property. */\n target?: '_self' | '_blank' | '_parent' | '_top';\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native button type. */\n type?: HTMLButtonProps['type'];\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n}\n\nexport interface ButtonRootProps extends BaseButtonProps {\n variant: 'button' | 'icon';\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonRoot';\n\nexport const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;\nexport const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;\n\n/**\n * Render a button wrapper with the ButtonRoot inside.\n *\n * @param props Component props.\n * @return React element.\n */\nconst renderButtonWrapper: React.FC<ButtonRootProps> = (props) => {\n const { color, emphasis, variant, fullWidth } = props;\n\n const adaptedColor =\n emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);\n\n const wrapperClassName = classNames(\n handleBasicClasses({\n color: adaptedColor,\n prefix: BUTTON_WRAPPER_CLASSNAME,\n variant,\n fullWidth,\n }),\n );\n const buttonProps = { ...props, hasBackground: false };\n\n return (\n <div className={wrapperClassName}>\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <ButtonRoot {...buttonProps} />\n </div>\n );\n};\n\n/**\n * ButtonRoot component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonRoot: Comp<ButtonRootProps, HTMLButtonElement | HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n children,\n className,\n color,\n disabled,\n emphasis,\n hasBackground,\n href,\n isDisabled = disabled,\n isSelected,\n isActive,\n isFocused,\n isHovered,\n linkAs,\n name,\n size,\n target,\n theme,\n variant,\n type = 'button',\n fullWidth,\n ...forwardedProps\n } = props;\n\n const adaptedColor =\n color ||\n (emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light) ||\n (emphasis === Emphasis.high && ColorPalette.primary) ||\n ColorPalette.dark;\n\n if (hasBackground) {\n return renderButtonWrapper({ ...props, ref, variant, color: adaptedColor });\n }\n\n const buttonClassName = classNames(\n className,\n handleBasicClasses({\n color: adaptedColor,\n emphasis,\n isSelected,\n isDisabled,\n isActive,\n isFocused,\n isHovered,\n prefix: BUTTON_CLASSNAME,\n size,\n theme: emphasis === Emphasis.high && theme,\n variant,\n fullWidth,\n }),\n );\n\n /**\n * If the linkAs prop is used, we use the linkAs component instead of a <button>.\n * If there is an href attribute, we display an <a> instead of a <button>.\n *\n * However, in any case, if the component is disabled, we returned a <button> since disabled is not compatible with <a>.\n */\n if ((linkAs || !isEmpty(props.href)) && !isDisabled) {\n return renderLink(\n {\n linkAs,\n ...forwardedProps,\n 'aria-label': ariaLabel,\n href,\n target,\n className: buttonClassName,\n ref: ref as RefObject<HTMLAnchorElement>,\n },\n children,\n );\n }\n return (\n <button\n {...forwardedProps}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n aria-label={ariaLabel}\n ref={ref as RefObject<HTMLButtonElement>}\n className={buttonClassName}\n name={name}\n type={\n // eslint-disable-next-line react/button-has-type\n type\n }\n >\n {children}\n </button>\n );\n});\nButtonRoot.displayName = COMPONENT_NAME;\nButtonRoot.defaultProps = {};\n"],"names":["COMPONENT_NAME","BUTTON_WRAPPER_CLASSNAME","CSS_PREFIX","BUTTON_CLASSNAME","renderButtonWrapper","props","color","emphasis","variant","fullWidth","adaptedColor","Emphasis","low","ColorPalette","light","dark","wrapperClassName","classNames","handleBasicClasses","prefix","buttonProps","hasBackground","ButtonRoot","forwardRef","ref","ariaLabel","children","className","disabled","href","isDisabled","isSelected","isActive","isFocused","isHovered","linkAs","name","size","target","theme","type","forwardedProps","high","Theme","primary","buttonClassName","isEmpty","renderLink","displayName","defaultProps"],"mappings":";;;;;;;AAmDA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEO,IAAMC,wBAAwB,aAAMC,UAAN,oBAA9B;AACA,IAAMC,gBAAgB,aAAMD,UAAN,YAAtB;AAEP;;;;;;;AAMA,IAAME,mBAA8C,GAAG,SAAjDA,mBAAiD,CAACC,KAAD,EAAW;AAAA,MACtDC,KADsD,GACdD,KADc,CACtDC,KADsD;AAAA,MAC/CC,QAD+C,GACdF,KADc,CAC/CE,QAD+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AAC0B,WAAX,GAAyBhD,cAAzB;AACAsB,UAAU,CAAC2B,YAAX,GAA0B,EAA1B;;;;"}
|
|
@@ -86,7 +86,8 @@ var Checkbox = forwardRef(function (props, ref) {
|
|
|
86
86
|
name: name,
|
|
87
87
|
value: value,
|
|
88
88
|
checked: isChecked,
|
|
89
|
-
onChange: handleChange
|
|
89
|
+
onChange: handleChange,
|
|
90
|
+
"aria-describedby": helper ? "".concat(inputId, "-helper") : undefined
|
|
90
91
|
}, inputProps)), React.createElement("div", {
|
|
91
92
|
className: "".concat(CLASSNAME, "__input-placeholder")
|
|
92
93
|
}, React.createElement("div", {
|
|
@@ -102,6 +103,7 @@ var Checkbox = forwardRef(function (props, ref) {
|
|
|
102
103
|
className: "".concat(CLASSNAME, "__label"),
|
|
103
104
|
theme: theme
|
|
104
105
|
}, label), helper && React.createElement(InputHelper, {
|
|
106
|
+
id: "".concat(inputId, "-helper"),
|
|
105
107
|
className: "".concat(CLASSNAME, "__helper"),
|
|
106
108
|
theme: theme
|
|
107
109
|
}, helper)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox2.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\nimport { uid } from 'uid';\n\nimport { mdiCheck } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Native input ref. */\n inputRef?: React.Ref<HTMLInputElement>;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {\n theme: Theme.light,\n};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n checked,\n className,\n disabled,\n helper,\n id,\n inputRef,\n isChecked = checked,\n isDisabled = disabled,\n label,\n name,\n onChange,\n theme,\n value,\n inputProps = {},\n ...forwardedProps\n } = props;\n const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n ref={inputRef}\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n tabIndex={isDisabled ? -1 : 0}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Checkbox","forwardRef","props","ref","checked","className","disabled","helper","id","inputRef","isChecked","isDisabled","label","name","onChange","value","inputProps","forwardedProps","inputId","useMemo","toLowerCase","uid","handleChange","event","classNames","handleBasicClasses","isUnchecked","prefix","mdiCheck","displayName","defaultProps"],"mappings":";;;;;;;;;AAUA;;;;AA4BA;;;AAGA,IAAMA,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAqC,GAAG;AAC1CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD6B,CAA9C;AAIA;;;;;;;;IAOaC,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEhFC,OAFgF,GAiBhFF,KAjBgF,CAEhFE,OAFgF;AAAA,MAGhFC,SAHgF,GAiBhFH,KAjBgF,CAGhFG,SAHgF;AAAA,MAIhFC,QAJgF,GAiBhFJ,KAjBgF,CAIhFI,QAJgF;AAAA,MAKhFC,MALgF,GAiBhFL,KAjBgF,CAKhFK,MALgF;AAAA,MAMhFC,EANgF,GAiBhFN,KAjBgF,CAMhFM,EANgF;AAAA,MAOhFC,QAPgF,GAiBhFP,KAjBgF,CAOhFO,QAPgF;AAAA,yBAiBhFP,KAjBgF,CAQhFQ,SARgF;AAAA,MAQhFA,SARgF,iCAQpEN,OARoE;AAAA,0BAiBhFF,KAjBgF,CAShFS,UATgF;AAAA,MAShFA,UATgF,kCASnEL,QATmE;AAAA,MAUhFM,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,IAAA,QAAQ,EAAEiB,UAAU,GAAG,CAAC,CAAJ,GAAQ,CALhC;AAMI,IAAA,IAAI,EAAEE,IANV;AAOI,IAAA,KAAK,EAAEE,KAPX;AAQI,IAAA,OAAO,EAAEL,SARb;AASI,IAAA,QAAQ,EAAEY;
|
|
1
|
+
{"version":3,"file":"Checkbox2.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\nimport { uid } from 'uid';\n\nimport { mdiCheck } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Native input ref. */\n inputRef?: React.Ref<HTMLInputElement>;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {\n theme: Theme.light,\n};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n checked,\n className,\n disabled,\n helper,\n id,\n inputRef,\n isChecked = checked,\n isDisabled = disabled,\n label,\n name,\n onChange,\n theme,\n value,\n inputProps = {},\n ...forwardedProps\n } = props;\n const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n ref={inputRef}\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n tabIndex={isDisabled ? -1 : 0}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n aria-describedby={helper ? `${inputId}-helper` : undefined}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper id={`${inputId}-helper`} className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Checkbox","forwardRef","props","ref","checked","className","disabled","helper","id","inputRef","isChecked","isDisabled","label","name","onChange","value","inputProps","forwardedProps","inputId","useMemo","toLowerCase","uid","handleChange","event","classNames","handleBasicClasses","isUnchecked","prefix","undefined","mdiCheck","displayName","defaultProps"],"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AZ,IADJ,CAHJ,CAfJ,CAdJ,EAsCI;AAAK,IAAA,SAAS,YAAKnC,SAAL;AAAd,KACKkB,KAAK,IACF,oBAAC,UAAD;AAAY,IAAA,OAAO,EAAEM,OAArB;AAA8B,IAAA,SAAS,YAAKxB,SAAL,YAAvC;AAAgE,IAAA,KAAK,EAAEG;AAAvE,KACKe,KADL,CAFR,EAMKL,MAAM,IACH,oBAAC,WAAD;AAAa,IAAA,EAAE,YAAKW,OAAL,YAAf;AAAsC,IAAA,SAAS,YAAKxB,SAAL,aAA/C;AAAyE,IAAA,KAAK,EAAEG;AAAhF,KACKU,MADL,CAPR,CAtCJ,CADJ;AAqDH,CA/EsE;AAgFvEP,QAAQ,CAAC8B,WAAT,GAAuBrC,cAAvB;AACAO,QAAQ,CAACK,SAAT,GAAqBX,SAArB;AACAM,QAAQ,CAAC+B,YAAT,GAAwBnC,aAAxB;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.2.
|
|
11
|
-
"@lumx/icons": "^2.2.
|
|
10
|
+
"@lumx/core": "^2.2.20-alpha.xss.datatable",
|
|
11
|
+
"@lumx/icons": "^2.2.20-alpha.xss.datatable",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -120,6 +120,6 @@
|
|
|
120
120
|
"build:storybook": "cd storybook && ./build"
|
|
121
121
|
},
|
|
122
122
|
"sideEffects": false,
|
|
123
|
-
"version": "2.2.
|
|
124
|
-
"gitHead": "
|
|
123
|
+
"version": "2.2.20-alpha.xss.datatable",
|
|
124
|
+
"gitHead": "f3e5a90ee87b5f78417bff7015fa43852205a69d"
|
|
125
125
|
}
|
|
@@ -13,6 +13,7 @@ const DEFAULT_PROPS = Button.defaultProps as any;
|
|
|
13
13
|
export const SimpleButton = ({ theme }: any) => {
|
|
14
14
|
return (
|
|
15
15
|
<Button
|
|
16
|
+
aria-pressed={boolean('isSelected', Boolean(DEFAULT_PROPS.isSelected))}
|
|
16
17
|
emphasis={emphasis('Emphasis', DEFAULT_PROPS.emphasis)}
|
|
17
18
|
theme={theme}
|
|
18
19
|
rightIcon={select('Right icon', { none: undefined, mdiSend }, undefined)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, RefObject } from 'react';
|
|
1
|
+
import React, { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
|
|
@@ -16,9 +16,9 @@ type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
16
16
|
*/
|
|
17
17
|
export type ButtonSize = Extract<Size, 's' | 'm'>;
|
|
18
18
|
|
|
19
|
-
export interface BaseButtonProps
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export interface BaseButtonProps
|
|
20
|
+
extends GenericProps,
|
|
21
|
+
Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'> {
|
|
22
22
|
/** Color variant. */
|
|
23
23
|
color?: Color;
|
|
24
24
|
/** Emphasis variant. */
|
|
@@ -112,6 +112,7 @@ export const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props,
|
|
|
112
112
|
value={value}
|
|
113
113
|
checked={isChecked}
|
|
114
114
|
onChange={handleChange}
|
|
115
|
+
aria-describedby={helper ? `${inputId}-helper` : undefined}
|
|
115
116
|
{...inputProps}
|
|
116
117
|
/>
|
|
117
118
|
|
|
@@ -131,7 +132,7 @@ export const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props,
|
|
|
131
132
|
</InputLabel>
|
|
132
133
|
)}
|
|
133
134
|
{helper && (
|
|
134
|
-
<InputHelper className={`${CLASSNAME}__helper`} theme={theme}>
|
|
135
|
+
<InputHelper id={`${inputId}-helper`} className={`${CLASSNAME}__helper`} theme={theme}>
|
|
135
136
|
{helper}
|
|
136
137
|
</InputHelper>
|
|
137
138
|
)}
|
|
@@ -8,6 +8,7 @@ exports[`<Checkbox> Props should use the given props 1`] = `
|
|
|
8
8
|
className="lumx-checkbox__input-wrapper"
|
|
9
9
|
>
|
|
10
10
|
<input
|
|
11
|
+
aria-describedby="fixedId-helper"
|
|
11
12
|
className="lumx-checkbox__input-native"
|
|
12
13
|
id="fixedId"
|
|
13
14
|
onChange={[Function]}
|
|
@@ -41,6 +42,7 @@ exports[`<Checkbox> Props should use the given props 1`] = `
|
|
|
41
42
|
</InputLabel>
|
|
42
43
|
<InputHelper
|
|
43
44
|
className="lumx-checkbox__helper"
|
|
45
|
+
id="fixedId-helper"
|
|
44
46
|
kind="info"
|
|
45
47
|
theme="light"
|
|
46
48
|
>
|
|
@@ -58,6 +60,7 @@ exports[`<Checkbox> Props should use the given props while passing custom props
|
|
|
58
60
|
className="lumx-checkbox__input-wrapper"
|
|
59
61
|
>
|
|
60
62
|
<input
|
|
63
|
+
aria-describedby="fixedId-helper"
|
|
61
64
|
aria-labelledby="labelledby-id"
|
|
62
65
|
className="lumx-checkbox__input-native"
|
|
63
66
|
id="fixedId"
|
|
@@ -92,6 +95,7 @@ exports[`<Checkbox> Props should use the given props while passing custom props
|
|
|
92
95
|
</InputLabel>
|
|
93
96
|
<InputHelper
|
|
94
97
|
className="lumx-checkbox__helper"
|
|
98
|
+
id="fixedId-helper"
|
|
95
99
|
kind="info"
|
|
96
100
|
theme="light"
|
|
97
101
|
>
|
package/types.d.ts
CHANGED
|
@@ -476,9 +476,7 @@ export declare type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTM
|
|
|
476
476
|
* Button size definition.
|
|
477
477
|
*/
|
|
478
478
|
export declare type ButtonSize = Extract<Size, "s" | "m">;
|
|
479
|
-
export interface BaseButtonProps extends GenericProps {
|
|
480
|
-
/** ARIA button label. */
|
|
481
|
-
["aria-label"]?: string;
|
|
479
|
+
export interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, "aria-expanded" | "aria-haspopup" | "aria-pressed" | "aria-label"> {
|
|
482
480
|
/** Color variant. */
|
|
483
481
|
color?: Color;
|
|
484
482
|
/** Emphasis variant. */
|