@elliemae/ds-button-v1 3.22.0-next.8 → 3.22.0-rc.1
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/cjs/DSButton.js.map +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/defaultProps.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/propTypes.js.map +1 -1
- package/dist/esm/DSButton.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/defaultProps.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/propTypes.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/DSButton.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSButton.tsx", "
|
|
3
|
+
"sources": ["../../src/DSButton.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable jest/valid-title */\nimport React, { useState, useMemo } from 'react';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { cx, useDeprecateComponent } from '@elliemae/ds-utilities';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { BUTTON_TYPE, BUTTON_SIZE, BUTTON_VARIANT } from './constants.js';\nimport { btnPropTypes } from './propTypes.js';\nimport { defaultProps } from './defaultProps.js';\n\nconst blockName = 'button';\n\nconst getContainer = (Element) =>\n aggregatedClasses(Element)(\n blockName,\n null,\n ({ iconOnly, variant }) => ({\n 'icon-only': iconOnly,\n [variant]: variant,\n }),\n {\n propsToRemoveFromFinalElement: ['cx'],\n },\n );\n\ninterface ButtonPropsT {\n [x: string]: unknown;\n disabled?: boolean;\n fluidWidth?: boolean;\n innerRef?: unknown;\n buttonType?: (typeof BUTTON_TYPE)[keyof typeof BUTTON_TYPE];\n size?: (typeof BUTTON_SIZE)[keyof typeof BUTTON_SIZE];\n variant?: (typeof BUTTON_VARIANT)[keyof typeof BUTTON_VARIANT];\n labelText?: string;\n icon?: JSX.Element;\n leftIcon?: JSX.Element;\n tabIndex?: number;\n intent?: 'success' | 'danger' | 'warning' | 'info';\n containerProps?: { [x: string]: unknown };\n className?: string;\n as?: string | JSX.Element;\n type?: 'button' | 'text';\n onBlur?: React.FocusEventHandler<HTMLElement>;\n onClick?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;\n onKeyPress?: React.KeyboardEventHandler<HTMLElement>;\n}\n\n// eslint-disable-next-line complexity\nconst DSButton = ({\n innerRef,\n disabled,\n buttonType,\n fluidWidth,\n size,\n labelText,\n icon,\n onBlur,\n onClick,\n onKeyPress,\n leftIcon,\n tabIndex,\n variant,\n intent,\n containerProps,\n className,\n as: Component,\n type,\n ...rest\n}: ButtonPropsT) => {\n useDeprecateComponent({ componentName: 'ds-button-v1', version: 'TBD Date: 2023 Q3' });\n\n const [pressed, setPressed] = useState(false);\n const Button = useMemo(() => getContainer(Component), [Component]);\n const intentBlockName = `${blockName}${intent ? `-${intent}` : ''}`;\n const { cssClassName: intentClassName } = convertPropToCssClassName(intentBlockName);\n return (\n <Button\n data-testid={(containerProps && containerProps['data-testid']) || 'button-wrapper'}\n {...rest}\n {...containerProps}\n aria-disabled={rest['aria-disabled'] !== undefined ? rest['aria-disabled'] : disabled}\n aria-label={rest['aria-label'] || labelText || 'button'}\n aria-pressed={pressed}\n className={cx(intentClassName, className)}\n classProps={{\n disabled,\n // DON'T CHANGE FOR defaultProps\n // using OR to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n buttonType: buttonType || BUTTON_TYPE.PRIMARY,\n // using or to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n size: size || BUTTON_SIZE.M,\n fluidWidth,\n iconOnly: !labelText && (icon || leftIcon),\n variant: disabled ? BUTTON_VARIANT.DISABLED : variant,\n }}\n disabled={disabled} // https://jira.elliemae.io/browse/PUI-1215\n innerRef={innerRef}\n onBlur={(e: React.FocusEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(false);\n if (onBlur) onBlur(e);\n }}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(true);\n if (onClick) onClick(e);\n }}\n onKeyPress={(e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n e.preventDefault();\n if (e.key === 'Enter') {\n setPressed(true);\n if (onClick) onClick(e);\n }\n if (onKeyPress) onKeyPress(e);\n }}\n tabIndex={tabIndex}\n type={type}\n >\n {leftIcon}\n {labelText && (\n <span\n className={`label-wrapper ${icon || leftIcon ? 'with-icon' : 'no-icon'}`}\n data-testid=\"button-label\"\n role=\"presentation\"\n >\n <span>{labelText}</span>\n </span>\n )}\n {icon}\n </Button>\n );\n};\n\nDSButton.defaultProps = defaultProps;\nDSButton.propTypes = btnPropTypes;\nDSButton.displayName = 'DSButton';\n\nconst DSButtonWithSchema = describe(DSButton);\nDSButtonWithSchema.propTypes = btnPropTypes;\n\nexport { DSButton, DSButtonWithSchema };\nexport default DSButton;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4EnB;AA1EJ,mBAAyC;AACzC,2BAA6D;AAC7D,0BAA0C;AAC1C,8BAAyB;AACzB,uBAAyD;AACzD,uBAA6B;AAC7B,0BAA6B;AAE7B,MAAM,YAAY;AAElB,MAAM,eAAe,CAAC,gBACpB,wCAAkB,OAAO;AAAA,EACvB;AAAA,EACA;AAAA,EACA,CAAC,EAAE,UAAU,QAAQ,OAAO;AAAA,IAC1B,aAAa;AAAA,IACb,CAAC,OAAO,GAAG;AAAA,EACb;AAAA,EACA;AAAA,IACE,+BAA+B,CAAC,IAAI;AAAA,EACtC;AACF;AAyBF,MAAM,WAAW,C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AAA,MACxB;AAAA,MACA,YAAY,CAAC,MAAwC;AACnD,YAAI;AAAU;AACd,UAAE,eAAe;AACjB,YAAI,EAAE,QAAQ,SAAS;AACrB,qBAAW,IAAI;AACf,cAAI;AAAS,oBAAQ,CAAC;AAAA,QACxB;AACA,YAAI;AAAY,qBAAW,CAAC;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,QACA,aACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,iBAAiB,QAAQ,WAAW,cAAc;AAAA,YAC7D,eAAY;AAAA,YACZ,MAAK;AAAA,YAEL,sDAAC,UAAM,qBAAU;AAAA;AAAA,QACnB;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/constants.tsx", "
|
|
3
|
+
"sources": ["../../src/constants.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export const BUTTON_TYPE = {\n PRIMARY: 'primary' as const,\n SECONDARY: 'secondary' as const,\n TEXT: 'text' as const,\n LINK: 'link' as const,\n};\n\nexport const buttonTypes = ['primary' as const, 'secondary' as const, 'text' as const, 'link' as const] as const;\n\nexport const BUTTON_SIZE = {\n S: 's' as const,\n M: 'm' as const,\n L: 'l' as const,\n};\n\nexport const BUTTON_INTENT = {\n DANGER: 'danger' as const,\n SUCCESS: 'success' as const,\n WARNING: 'warning' as const,\n INFO: 'info' as const,\n};\n\nexport const BUTTON_VARIANT = {\n DEFAULT: 'variant-default' as const,\n FOCUS: 'variant-focus' as const,\n ACTIVE: 'variant-active' as const,\n DISABLED: 'variant-disabled' as const,\n HOVER: 'variant-hover' as const,\n};\n\nexport const buttonVariants = [\n 'variant-default' as const,\n 'variant-focus' as const,\n 'variant-active' as const,\n 'variant-disabled' as const,\n 'variant-hover' as const,\n] as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,cAAc;AAAA,EACzB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,cAAc,CAAC,WAAoB,aAAsB,QAAiB,MAAe;AAE/F,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,gBAAgB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/defaultProps.tsx", "
|
|
3
|
+
"sources": ["../../src/defaultProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { BUTTON_VARIANT } from './constants.js';\n\nexport const defaultProps = {\n disabled: false,\n fluidWidth: false,\n labelText: '',\n icon: null,\n onBlur: () => null,\n onClick: () => null,\n onKeyPress: () => null,\n leftIcon: null,\n tabIndex: 0,\n variant: BUTTON_VARIANT.DEFAULT,\n containerProps: {},\n as: 'button',\n type: 'button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA+B;AAExB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ,MAAM;AAAA,EACd,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,gCAAe;AAAA,EACxB,gBAAgB,CAAC;AAAA,EACjB,IAAI;AAAA,EACJ,MAAM;AACR;",
|
|
6
6
|
"names": []
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export * from './DSButton.js';\nexport * from './constants.js';\nexport { default } from './DSButton.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,0BAAd;AACA,wBAAc,2BADd;AAEA,sBAAwB;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/propTypes.tsx", "
|
|
3
|
+
"sources": ["../../src/propTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable no-unused-vars */\n\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { buttonTypes, buttonVariants } from './constants.js';\n\nexport const btnPropTypes = {\n /**\n * Tab index\n */\n tabIndex: PropTypes.number.description('Tab index'),\n /**\n * Additional className\n */\n className: PropTypes.string.description('Additional className'),\n /**\n * aria disabled\n */\n 'aria-disabled': PropTypes.string.description('aria disabled'),\n /**\n * Html tag. default 'button'\n */\n as: PropTypes.string.description('Html tag').defaultValue('button'),\n /**\n * Whether the button is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the button is disabled or not'),\n /**\n * Make the content of the button fit the button container or not\n */\n fluidWidth: PropTypes.bool.description('Make the content of the button fit the button container or not'),\n /**\n * Displayable label inside the button\n */\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(\n 'Displayable label inside the button',\n ),\n /**\n * Put an icon inside the button\n */\n icon: PropTypes.element.description('Put an icon inside the button'),\n /**\n * Put an icon on the left side of the button\n */\n leftIcon: PropTypes.element.description('Put an icon on the left side of the button'),\n /**\n * ['primary', 'secondary', 'text', 'link']\n */\n buttonType: PropTypes.oneOf(buttonTypes).description('type of the button'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description('size of the button'),\n /**\n * submit or button\n */\n type: PropTypes.oneOf(['button', 'submit']).description('type of the button'),\n /**\n * [\n * 'variant-default',\n * 'variant-focus',\n * 'variant-active',\n * 'variant-disabled',\n * ]\n */\n variant: PropTypes.oneOf(buttonVariants).description('variant of the button'),\n /**\n * Refence\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /**\n * Onblur callback\n */\n onBlur: PropTypes.func.description('Allows a function that is triggered once the button is blur'),\n /**\n * Apply intent color: ['success', 'warning', 'danger', 'info']\n * Only valid with buttonType=\"text\"\n */\n intent: PropTypes.oneOf(['success', 'warning', 'danger', 'info']).description(\n 'Apply intent color. Only valid with buttonType=\"text\"',\n ),\n /**\n * additional props for the container\n */\n containerProps: PropTypes.object.description('additional props for the container'),\n /**\n * Allows a function that is triggered once the button is clicked\n */\n onClick: PropTypes.func.description('Allows a function that is triggered once the button is clicked'),\n /**\n * Allows a function that is triggered once the button is key pressed\n */\n onKeyPress: PropTypes.func.description('Allows a function that is triggered once the button is key pressed'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;AAC1B,uBAA6B;AAC7B,uBAA4C;AAErC,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,UAAU,kCAAU,OAAO,YAAY,WAAW;AAAA;AAAA;AAAA;AAAA,EAIlD,WAAW,kCAAU,OAAO,YAAY,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAI9D,iBAAiB,kCAAU,OAAO,YAAY,eAAe;AAAA;AAAA;AAAA;AAAA,EAI7D,IAAI,kCAAU,OAAO,YAAY,UAAU,EAAE,aAAa,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIlE,UAAU,kCAAU,KAAK,YAAY,uCAAuC;AAAA;AAAA;AAAA;AAAA,EAI5E,YAAY,kCAAU,KAAK,YAAY,gEAAgE;AAAA;AAAA;AAAA;AAAA,EAIvG,WAAW,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,OAAO,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM,kCAAU,QAAQ,YAAY,+BAA+B;AAAA;AAAA;AAAA;AAAA,EAInE,UAAU,kCAAU,QAAQ,YAAY,4CAA4C;AAAA;AAAA;AAAA;AAAA,EAIpF,YAAY,kCAAU,MAAM,4BAAW,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIzE,MAAM,kCAAU,MAAM,6BAAY,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIpE,MAAM,kCAAU,MAAM,CAAC,UAAU,QAAQ,CAAC,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5E,SAAS,kCAAU,MAAM,+BAAc,EAAE,YAAY,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAI5E,UAAU,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,QAAQ,kCAAU,KAAK,YAAY,6DAA6D;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhG,QAAQ,kCAAU,MAAM,CAAC,WAAW,WAAW,UAAU,MAAM,CAAC,EAAE;AAAA,IAChE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,gBAAgB,kCAAU,OAAO,YAAY,oCAAoC;AAAA;AAAA;AAAA;AAAA,EAIjF,SAAS,kCAAU,KAAK,YAAY,gEAAgE;AAAA;AAAA;AAAA;AAAA,EAIpG,YAAY,kCAAU,KAAK,YAAY,oEAAoE;AAC7G;",
|
|
6
6
|
"names": []
|
package/dist/esm/DSButton.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSButton.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable jest/valid-title */\nimport React, { useState, useMemo } from 'react';\nimport { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { cx, useDeprecateComponent } from '@elliemae/ds-utilities';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { BUTTON_TYPE, BUTTON_SIZE, BUTTON_VARIANT } from './constants.js';\nimport { btnPropTypes } from './propTypes.js';\nimport { defaultProps } from './defaultProps.js';\n\nconst blockName = 'button';\n\nconst getContainer = (Element) =>\n aggregatedClasses(Element)(\n blockName,\n null,\n ({ iconOnly, variant }) => ({\n 'icon-only': iconOnly,\n [variant]: variant,\n }),\n {\n propsToRemoveFromFinalElement: ['cx'],\n },\n );\n\ninterface ButtonPropsT {\n [x: string]: unknown;\n disabled?: boolean;\n fluidWidth?: boolean;\n innerRef?: unknown;\n buttonType?: (typeof BUTTON_TYPE)[keyof typeof BUTTON_TYPE];\n size?: (typeof BUTTON_SIZE)[keyof typeof BUTTON_SIZE];\n variant?: (typeof BUTTON_VARIANT)[keyof typeof BUTTON_VARIANT];\n labelText?: string;\n icon?: JSX.Element;\n leftIcon?: JSX.Element;\n tabIndex?: number;\n intent?: 'success' | 'danger' | 'warning' | 'info';\n containerProps?: { [x: string]: unknown };\n className?: string;\n as?: string | JSX.Element;\n type?: 'button' | 'text';\n onBlur?: React.FocusEventHandler<HTMLElement>;\n onClick?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;\n onKeyPress?: React.KeyboardEventHandler<HTMLElement>;\n}\n\n// eslint-disable-next-line complexity\nconst DSButton = ({\n innerRef,\n disabled,\n buttonType,\n fluidWidth,\n size,\n labelText,\n icon,\n onBlur,\n onClick,\n onKeyPress,\n leftIcon,\n tabIndex,\n variant,\n intent,\n containerProps,\n className,\n as: Component,\n type,\n ...rest\n}: ButtonPropsT) => {\n useDeprecateComponent({ componentName: 'ds-button-v1', version: 'TBD Date: 2023 Q3' });\n\n const [pressed, setPressed] = useState(false);\n const Button = useMemo(() => getContainer(Component), [Component]);\n const intentBlockName = `${blockName}${intent ? `-${intent}` : ''}`;\n const { cssClassName: intentClassName } = convertPropToCssClassName(intentBlockName);\n return (\n <Button\n data-testid={(containerProps && containerProps['data-testid']) || 'button-wrapper'}\n {...rest}\n {...containerProps}\n aria-disabled={rest['aria-disabled'] !== undefined ? rest['aria-disabled'] : disabled}\n aria-label={rest['aria-label'] || labelText || 'button'}\n aria-pressed={pressed}\n className={cx(intentClassName, className)}\n classProps={{\n disabled,\n // DON'T CHANGE FOR defaultProps\n // using OR to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n buttonType: buttonType || BUTTON_TYPE.PRIMARY,\n // using or to keep ButtonGroup behavior at packages/ds-basic/src/ButtonGroup/DSButtonGroup\n size: size || BUTTON_SIZE.M,\n fluidWidth,\n iconOnly: !labelText && (icon || leftIcon),\n variant: disabled ? BUTTON_VARIANT.DISABLED : variant,\n }}\n disabled={disabled} // https://jira.elliemae.io/browse/PUI-1215\n innerRef={innerRef}\n onBlur={(e: React.FocusEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(false);\n if (onBlur) onBlur(e);\n }}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n if (disabled) return;\n setPressed(true);\n if (onClick) onClick(e);\n }}\n onKeyPress={(e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n e.preventDefault();\n if (e.key === 'Enter') {\n setPressed(true);\n if (onClick) onClick(e);\n }\n if (onKeyPress) onKeyPress(e);\n }}\n tabIndex={tabIndex}\n type={type}\n >\n {leftIcon}\n {labelText && (\n <span\n className={`label-wrapper ${icon || leftIcon ? 'with-icon' : 'no-icon'}`}\n data-testid=\"button-label\"\n role=\"presentation\"\n >\n <span>{labelText}</span>\n </span>\n )}\n {icon}\n </Button>\n );\n};\n\nDSButton.defaultProps = defaultProps;\nDSButton.propTypes = btnPropTypes;\nDSButton.displayName = 'DSButton';\n\nconst DSButtonWithSchema = describe(DSButton);\nDSButtonWithSchema.propTypes = btnPropTypes;\n\nexport { DSButton, DSButtonWithSchema };\nexport default DSButton;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;AC4EnB,SAkDM,KAlDN;AA1EJ,SAAgB,UAAU,eAAe;AACzC,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,IAAI,6BAA6B;AAC1C,SAAS,gBAAgB;AACzB,SAAS,aAAa,aAAa,sBAAsB;AACzD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAE7B,MAAM,YAAY;AAElB,MAAM,eAAe,CAAC,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ACA;AAAA,MACA,QAAQ,CAAC,MAAqC;AAC5C,YAAI;AAAU;AACd,mBAAW,KAAK;AAChB,YAAI;AAAQ,iBAAO,CAAC;AAAA,MACtB;AAAA,MACA,SAAS,CAAC,MAAqC;AAC7C,YAAI;AAAU;AACd,mBAAW,IAAI;AACf,YAAI;AAAS,kBAAQ,CAAC;AAAA,MACxB;AAAA,MACA,YAAY,CAAC,MAAwC;AACnD,YAAI;AAAU;AACd,UAAE,eAAe;AACjB,YAAI,EAAE,QAAQ,SAAS;AACrB,qBAAW,IAAI;AACf,cAAI;AAAS,oBAAQ,CAAC;AAAA,QACxB;AACA,YAAI;AAAY,qBAAW,CAAC;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,QACA,aACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,iBAAiB,QAAQ,WAAW,cAAc;AAAA,YAC7D,eAAY;AAAA,YACZ,MAAK;AAAA,YAEL,8BAAC,UAAM,qBAAU;AAAA;AAAA,QACnB;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/constants.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const BUTTON_TYPE = {\n PRIMARY: 'primary' as const,\n SECONDARY: 'secondary' as const,\n TEXT: 'text' as const,\n LINK: 'link' as const,\n};\n\nexport const buttonTypes = ['primary' as const, 'secondary' as const, 'text' as const, 'link' as const] as const;\n\nexport const BUTTON_SIZE = {\n S: 's' as const,\n M: 'm' as const,\n L: 'l' as const,\n};\n\nexport const BUTTON_INTENT = {\n DANGER: 'danger' as const,\n SUCCESS: 'success' as const,\n WARNING: 'warning' as const,\n INFO: 'info' as const,\n};\n\nexport const BUTTON_VARIANT = {\n DEFAULT: 'variant-default' as const,\n FOCUS: 'variant-focus' as const,\n ACTIVE: 'variant-active' as const,\n DISABLED: 'variant-disabled' as const,\n HOVER: 'variant-hover' as const,\n};\n\nexport const buttonVariants = [\n 'variant-default' as const,\n 'variant-focus' as const,\n 'variant-active' as const,\n 'variant-disabled' as const,\n 'variant-hover' as const,\n] as const;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,cAAc;AAAA,EACzB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,cAAc,CAAC,WAAoB,aAAsB,QAAiB,MAAe;AAE/F,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,gBAAgB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { BUTTON_VARIANT } from './constants.js';\n\nexport const defaultProps = {\n disabled: false,\n fluidWidth: false,\n labelText: '',\n icon: null,\n onBlur: () => null,\n onClick: () => null,\n onKeyPress: () => null,\n leftIcon: null,\n tabIndex: 0,\n variant: BUTTON_VARIANT.DEFAULT,\n containerProps: {},\n as: 'button',\n type: 'button',\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sBAAsB;AAExB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ,MAAM;AAAA,EACd,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS,eAAe;AAAA,EACxB,gBAAgB,CAAC;AAAA,EACjB,IAAI;AAAA,EACJ,MAAM;AACR;",
|
|
6
6
|
"names": []
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSButton.js';\nexport * from './constants.js';\nexport { default } from './DSButton.js';\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,SAAS,WAAAA,gBAAe;",
|
|
6
6
|
"names": ["default"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\n\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { buttonTypes, buttonVariants } from './constants.js';\n\nexport const btnPropTypes = {\n /**\n * Tab index\n */\n tabIndex: PropTypes.number.description('Tab index'),\n /**\n * Additional className\n */\n className: PropTypes.string.description('Additional className'),\n /**\n * aria disabled\n */\n 'aria-disabled': PropTypes.string.description('aria disabled'),\n /**\n * Html tag. default 'button'\n */\n as: PropTypes.string.description('Html tag').defaultValue('button'),\n /**\n * Whether the button is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the button is disabled or not'),\n /**\n * Make the content of the button fit the button container or not\n */\n fluidWidth: PropTypes.bool.description('Make the content of the button fit the button container or not'),\n /**\n * Displayable label inside the button\n */\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(\n 'Displayable label inside the button',\n ),\n /**\n * Put an icon inside the button\n */\n icon: PropTypes.element.description('Put an icon inside the button'),\n /**\n * Put an icon on the left side of the button\n */\n leftIcon: PropTypes.element.description('Put an icon on the left side of the button'),\n /**\n * ['primary', 'secondary', 'text', 'link']\n */\n buttonType: PropTypes.oneOf(buttonTypes).description('type of the button'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description('size of the button'),\n /**\n * submit or button\n */\n type: PropTypes.oneOf(['button', 'submit']).description('type of the button'),\n /**\n * [\n * 'variant-default',\n * 'variant-focus',\n * 'variant-active',\n * 'variant-disabled',\n * ]\n */\n variant: PropTypes.oneOf(buttonVariants).description('variant of the button'),\n /**\n * Refence\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /**\n * Onblur callback\n */\n onBlur: PropTypes.func.description('Allows a function that is triggered once the button is blur'),\n /**\n * Apply intent color: ['success', 'warning', 'danger', 'info']\n * Only valid with buttonType=\"text\"\n */\n intent: PropTypes.oneOf(['success', 'warning', 'danger', 'info']).description(\n 'Apply intent color. Only valid with buttonType=\"text\"',\n ),\n /**\n * additional props for the container\n */\n containerProps: PropTypes.object.description('additional props for the container'),\n /**\n * Allows a function that is triggered once the button is clicked\n */\n onClick: PropTypes.func.description('Allows a function that is triggered once the button is clicked'),\n /**\n * Allows a function that is triggered once the button is key pressed\n */\n onKeyPress: PropTypes.func.description('Allows a function that is triggered once the button is key pressed'),\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,aAAa,sBAAsB;AAErC,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,UAAU,UAAU,OAAO,YAAY,WAAW;AAAA;AAAA;AAAA;AAAA,EAIlD,WAAW,UAAU,OAAO,YAAY,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAI9D,iBAAiB,UAAU,OAAO,YAAY,eAAe;AAAA;AAAA;AAAA;AAAA,EAI7D,IAAI,UAAU,OAAO,YAAY,UAAU,EAAE,aAAa,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIlE,UAAU,UAAU,KAAK,YAAY,uCAAuC;AAAA;AAAA;AAAA;AAAA,EAI5E,YAAY,UAAU,KAAK,YAAY,gEAAgE;AAAA;AAAA;AAAA;AAAA,EAIvG,WAAW,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,OAAO,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM,UAAU,QAAQ,YAAY,+BAA+B;AAAA;AAAA;AAAA;AAAA,EAInE,UAAU,UAAU,QAAQ,YAAY,4CAA4C;AAAA;AAAA;AAAA;AAAA,EAIpF,YAAY,UAAU,MAAM,WAAW,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIzE,MAAM,UAAU,MAAM,YAAY,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIpE,MAAM,UAAU,MAAM,CAAC,UAAU,QAAQ,CAAC,EAAE,YAAY,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5E,SAAS,UAAU,MAAM,cAAc,EAAE,YAAY,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAI5E,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,QAAQ,UAAU,KAAK,YAAY,6DAA6D;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhG,QAAQ,UAAU,MAAM,CAAC,WAAW,WAAW,UAAU,MAAM,CAAC,EAAE;AAAA,IAChE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,gBAAgB,UAAU,OAAO,YAAY,oCAAoC;AAAA;AAAA;AAAA;AAAA,EAIjF,SAAS,UAAU,KAAK,YAAY,gEAAgE;AAAA;AAAA;AAAA;AAAA,EAIpG,YAAY,UAAU,KAAK,YAAY,oEAAoE;AAC7G;",
|
|
6
6
|
"names": []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-button-v1",
|
|
3
|
-
"version": "3.22.0-
|
|
3
|
+
"version": "3.22.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Button V 1",
|
|
6
6
|
"files": [
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
"indent": 4
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@elliemae/ds-classnames": "3.22.0-
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-
|
|
57
|
-
"@elliemae/ds-
|
|
54
|
+
"@elliemae/ds-classnames": "3.22.0-rc.1",
|
|
55
|
+
"@elliemae/ds-props-helpers": "3.22.0-rc.1",
|
|
56
|
+
"@elliemae/ds-shared": "3.22.0-rc.1",
|
|
57
|
+
"@elliemae/ds-utilities": "3.22.0-rc.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@elliemae/pui-cli": "~9.0.0-next.
|
|
60
|
+
"@elliemae/pui-cli": "~9.0.0-next.22",
|
|
61
61
|
"@testing-library/jest-dom": "~5.16.5",
|
|
62
62
|
"@testing-library/react": "~12.1.3",
|
|
63
|
-
"@elliemae/ds-monorepo-devops": "3.22.0-
|
|
63
|
+
"@elliemae/ds-monorepo-devops": "3.22.0-rc.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "^17.0.2",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"typeSafety": false
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
|
-
"dev": "cross-env NODE_ENV=development node
|
|
74
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
75
75
|
"test": "pui-cli test --passWithNoTests",
|
|
76
|
-
"lint": "node
|
|
76
|
+
"lint": "node ../../../scripts/lint.mjs",
|
|
77
77
|
"eslint:fix": "exit 0 | echo",
|
|
78
78
|
"dts": "exit 0 | echo",
|
|
79
79
|
"dts:withdeps": "exit 0",
|
|
80
|
-
"build": "cross-env NODE_ENV=production node
|
|
80
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
81
81
|
"dev:build": "pnpm --filter {.}... build",
|
|
82
82
|
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
83
|
-
"checkDeps": "npm exec
|
|
83
|
+
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
84
84
|
}
|
|
85
85
|
}
|