@openedx/paragon 22.11.0 → 22.11.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/IconButton/index.d.ts +3 -0
- package/dist/IconButton/index.js +4 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/utils/propTypes/utils.js +1 -1
- package/package.json +1 -1
- package/src/Collapsible/README.md +2 -2
- package/src/DataTable/README.md +2 -2
- package/src/Dropdown/README.md +1 -1
- package/src/Dropzone/README.md +1 -1
- package/src/Form/form-control.mdx +4 -6
- package/src/IconButton/index.tsx +5 -0
- package/src/InputSelect/README.md +2 -3
- package/src/InputText/README.md +4 -6
- package/src/ListBox/README.md +1 -1
- package/src/Modal/standard-modal.mdx +1 -1
- package/src/TextArea/README.md +2 -3
- package/src/utils/propTypes/utils.js +1 -1
|
@@ -33,6 +33,8 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
33
33
|
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';
|
|
34
34
|
/** size of button to render */
|
|
35
35
|
size?: 'sm' | 'md' | 'inline';
|
|
36
|
+
/** Used with `IconButtonToggle` */
|
|
37
|
+
value?: string;
|
|
36
38
|
/** no children */
|
|
37
39
|
children?: never;
|
|
38
40
|
}
|
|
@@ -64,6 +66,7 @@ declare namespace IconButtonWithTooltip {
|
|
|
64
66
|
} | undefined;
|
|
65
67
|
variant?: "primary" | "success" | "warning" | "secondary" | "danger" | "dark" | "light" | "black" | "brand" | undefined;
|
|
66
68
|
size?: "sm" | "md" | "inline" | undefined;
|
|
69
|
+
value?: string | undefined;
|
|
67
70
|
children?: undefined;
|
|
68
71
|
defaultChecked?: boolean | undefined;
|
|
69
72
|
defaultValue?: string | number | readonly string[] | undefined;
|
package/dist/IconButton/index.js
CHANGED
|
@@ -57,6 +57,7 @@ IconButton.defaultProps = {
|
|
|
57
57
|
size: 'md',
|
|
58
58
|
onClick: () => {},
|
|
59
59
|
isActive: false,
|
|
60
|
+
value: undefined,
|
|
60
61
|
children: undefined
|
|
61
62
|
};
|
|
62
63
|
IconButton.propTypes = {
|
|
@@ -91,7 +92,9 @@ IconButton.propTypes = {
|
|
|
91
92
|
/** size of button to render */
|
|
92
93
|
size: PropTypes.oneOf(['sm', 'md', 'inline']),
|
|
93
94
|
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
94
|
-
isActive: PropTypes.bool
|
|
95
|
+
isActive: PropTypes.bool,
|
|
96
|
+
/** Used with <IconButtonToggle> */
|
|
97
|
+
value: PropTypes.string
|
|
95
98
|
};
|
|
96
99
|
/**
|
|
97
100
|
* An icon button wrapped in overlaytrigger to display a tooltip.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","type","defaultProps","undefined","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","placement","overlay","id","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { type Placement } from 'react-bootstrap/Overlay';\n\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: typeof Icon | typeof FontAwesomeIcon,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAmChC,MAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAA2B,CAAAC,IAAA,EAc3DC,GAAG,KAAK;EAAA,IAdoD;IAC7DC,SAAS;IACTC,GAAG;IACHC,YAAY;IACZC,IAAI;IACJC,GAAG;IACHC,cAAc;IACdC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IAAE;IACV,GAAGC;EACL,CAAC,GAAAd,IAAA;EACC,MAAMe,MAAM,GAAGX,YAAY,GAAG,UAAU,GAAG,EAAE;EAC7C,MAAMY,WAAW,GAAGJ,QAAQ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,eACLrD,KAAA,CAAAgC,aAAA,CAAC3B,OAAO;MACNiD,EAAE,EAAG,sBAAqBL,gBAAiB,EAAE;MAC7C/B,OAAO,EAAEK,MAAM,GAAG,OAAO,GAAGY;IAAU,GAErCe,cACM;EACT,gBAEFlD,KAAA,CAAAgC,aAAA,CAAC1B,UAAU;IAAA,GAAK6C;EAAK,CAAG,CACV,CAAC;AAErB;AAEAJ,qBAAqB,CAACb,YAAY,GAAG;EACnC,GAAG5B,UAAU,CAAC4B,YAAY;EAC1Be,gBAAgB,EAAE;AACpB,CAAC;AAEDF,qBAAqB,CAACX,SAAS,GAAG;EAChC;EACAa,gBAAgB,EAAEhD,SAAS,CAACoC,MAAM;EAClC;EACAa,cAAc,EAAEjD,SAAS,CAACsD,IAAI,CAAChB,UAAU;EACzC;EACArB,OAAO,EAAEjB,SAAS,CAAC6C,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAlC,YAAY,EAAEX,SAAS,CAACuC;AAC1B,CAAC;AAEAlC,UAAU,CAASyC,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAezC,UAAU;AAGzB,SAASyC,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","type","defaultProps","undefined","value","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","placement","overlay","id","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { type Placement } from 'react-bootstrap/Overlay';\n\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: typeof Icon | typeof FontAwesomeIcon,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** Used with `IconButtonToggle` */\n value?: string;\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n value: undefined,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n /** Used with <IconButtonToggle> */\n value: PropTypes.string,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SAASC,cAAc,QA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AU,CAAS0C,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAe1C,UAAU;AAGzB,SAAS0C,qBAAqB","ignoreList":[]}
|
|
@@ -36,7 +36,7 @@ export const isEveryPropDefined = (props, otherPropNames) => otherPropNames
|
|
|
36
36
|
* Returns a PropType entry with the given propType that is required if otherPropName
|
|
37
37
|
* is truthy.
|
|
38
38
|
* @param {func} propType - target PropType
|
|
39
|
-
* @param {string} otherPropName - string name for prop that, if true, marks the
|
|
39
|
+
* @param {string | string[]} otherPropName - string name for prop that, if true, marks the
|
|
40
40
|
* associated prop as required
|
|
41
41
|
* @return {func} - PropType based on propType that is required if otherPropName is
|
|
42
42
|
* set to true.
|
package/package.json
CHANGED
|
@@ -185,13 +185,13 @@ See the developer console for logging.
|
|
|
185
185
|
### Controlled usage
|
|
186
186
|
|
|
187
187
|
```jsx live
|
|
188
|
-
|
|
188
|
+
() => {
|
|
189
189
|
const [collapseIsOpen, setCollapseOpen] = React.useState(true);
|
|
190
190
|
|
|
191
191
|
return (
|
|
192
192
|
<Collapsible.Advanced
|
|
193
193
|
open={collapseIsOpen}
|
|
194
|
-
onToggle={isOpen => setCollapseOpen(
|
|
194
|
+
onToggle={isOpen => setCollapseOpen(isOpen)}
|
|
195
195
|
className="collapsible-card"
|
|
196
196
|
>
|
|
197
197
|
<Collapsible.Trigger className="collapsible-trigger">
|
package/src/DataTable/README.md
CHANGED
|
@@ -253,7 +253,7 @@ To enable proper selection behavior with backend pagination (i.e., when ``isSele
|
|
|
253
253
|
</Component>
|
|
254
254
|
);
|
|
255
255
|
|
|
256
|
-
const ClearAction = ({ as: Component, tableInstance
|
|
256
|
+
const ClearAction = ({ as: Component, tableInstance }) => (
|
|
257
257
|
<Component
|
|
258
258
|
variant="danger"
|
|
259
259
|
onClick={() => {
|
|
@@ -845,7 +845,7 @@ a responsive grid of cards.
|
|
|
845
845
|
</Component>
|
|
846
846
|
);
|
|
847
847
|
|
|
848
|
-
const ClearAction = ({ as: Component, tableInstance
|
|
848
|
+
const ClearAction = ({ as: Component, tableInstance }) => (
|
|
849
849
|
<Component
|
|
850
850
|
variant="danger"
|
|
851
851
|
onClick={() => {
|
package/src/Dropdown/README.md
CHANGED
|
@@ -145,7 +145,7 @@ You can use `Dropdown.Toggle` with [IconButton](/components/iconbutton) componen
|
|
|
145
145
|
```jsx live
|
|
146
146
|
<Dropdown.Deprecated>
|
|
147
147
|
<Dropdown.Deprecated.Button>
|
|
148
|
-
<Icon className="fa fa-user pr-3"
|
|
148
|
+
<Icon className="fa fa-user pr-3" />
|
|
149
149
|
Search Engines
|
|
150
150
|
</Dropdown.Deprecated.Button>
|
|
151
151
|
<Dropdown.Deprecated.Menu>
|
package/src/Dropzone/README.md
CHANGED
|
@@ -240,7 +240,7 @@ This example validates that only `400x479` images can be uploaded.
|
|
|
240
240
|
async function imageDimensionValidator(file) {
|
|
241
241
|
const image = new window.Image();
|
|
242
242
|
try {
|
|
243
|
-
url = URL.createObjectURL(file);
|
|
243
|
+
const url = URL.createObjectURL(file);
|
|
244
244
|
image.src = url;
|
|
245
245
|
await image.decode();
|
|
246
246
|
if (image.width !== 400 || image.height !== 479) {
|
|
@@ -49,7 +49,9 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
|
49
49
|
() => {
|
|
50
50
|
{/* start example state */}
|
|
51
51
|
const [type, setType] = useState('default');
|
|
52
|
+
const [value, setValue] = useState('');
|
|
52
53
|
{/* end example state */}
|
|
54
|
+
const handleChange = (e) => setValue(e.target.value);
|
|
53
55
|
|
|
54
56
|
const inputs = {
|
|
55
57
|
default: (
|
|
@@ -144,8 +146,6 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
|
144
146
|
</Form.Group>
|
|
145
147
|
</>),
|
|
146
148
|
};
|
|
147
|
-
const [value, setValue] = useState('');
|
|
148
|
-
const handleChange = (e) => setValue(e.target.value);
|
|
149
149
|
return (
|
|
150
150
|
<>
|
|
151
151
|
{/* start example form block */}
|
|
@@ -172,7 +172,9 @@ See [react-imask](https://imask.js.org) for documentation on available props.
|
|
|
172
172
|
() => {
|
|
173
173
|
{/* start example state */}
|
|
174
174
|
const [maskType, setMaskType] = useState('phone');
|
|
175
|
+
const [value, setValue] = useState('');
|
|
175
176
|
{/* end example state */}
|
|
177
|
+
const handleChange = (e) => setValue(e.target.value);
|
|
176
178
|
|
|
177
179
|
const inputsWithMask = {
|
|
178
180
|
phone: (
|
|
@@ -255,10 +257,6 @@ See [react-imask](https://imask.js.org) for documentation on available props.
|
|
|
255
257
|
),
|
|
256
258
|
};
|
|
257
259
|
|
|
258
|
-
const [value, setValue] = useState('');
|
|
259
|
-
|
|
260
|
-
const handleChange = (e) => setValue(e.target.value);
|
|
261
|
-
|
|
262
260
|
return (
|
|
263
261
|
<>
|
|
264
262
|
{/* start example form block */}
|
package/src/IconButton/index.tsx
CHANGED
|
@@ -36,6 +36,8 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
36
36
|
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';
|
|
37
37
|
/** size of button to render */
|
|
38
38
|
size?: 'sm' | 'md' | 'inline';
|
|
39
|
+
/** Used with `IconButtonToggle` */
|
|
40
|
+
value?: string;
|
|
39
41
|
/** no children */
|
|
40
42
|
children?: never;
|
|
41
43
|
}
|
|
@@ -104,6 +106,7 @@ IconButton.defaultProps = {
|
|
|
104
106
|
size: 'md',
|
|
105
107
|
onClick: () => {},
|
|
106
108
|
isActive: false,
|
|
109
|
+
value: undefined,
|
|
107
110
|
children: undefined,
|
|
108
111
|
};
|
|
109
112
|
|
|
@@ -140,6 +143,8 @@ IconButton.propTypes = {
|
|
|
140
143
|
size: PropTypes.oneOf(['sm', 'md', 'inline']),
|
|
141
144
|
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
142
145
|
isActive: PropTypes.bool,
|
|
146
|
+
/** Used with <IconButtonToggle> */
|
|
147
|
+
value: PropTypes.string,
|
|
143
148
|
};
|
|
144
149
|
|
|
145
150
|
interface PropsWithTooltip extends Props {
|
|
@@ -90,14 +90,13 @@ notes: |
|
|
|
90
90
|
label="Favorite Color"
|
|
91
91
|
options={['', 'red', 'orange', 'yellow', 'green', 'blue', 'purple']}
|
|
92
92
|
validator={value => {
|
|
93
|
-
let feedback = { isValid: true };
|
|
94
93
|
if (!value) {
|
|
95
|
-
|
|
94
|
+
return {
|
|
96
95
|
isValid: false,
|
|
97
96
|
validationMessage: 'Please make a selection.',
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
|
-
return
|
|
99
|
+
return { isValid: true };
|
|
101
100
|
}}
|
|
102
101
|
/>
|
|
103
102
|
```
|
package/src/InputText/README.md
CHANGED
|
@@ -33,14 +33,13 @@ notes: |
|
|
|
33
33
|
label="Username"
|
|
34
34
|
description="The unique name that identifies you throughout the site."
|
|
35
35
|
validator={value => {
|
|
36
|
-
let feedback = { isValid: true };
|
|
37
36
|
if (value.length < 3) {
|
|
38
|
-
|
|
37
|
+
return {
|
|
39
38
|
isValid: false,
|
|
40
39
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
|
-
return
|
|
42
|
+
return { isValid: true };
|
|
44
43
|
}}
|
|
45
44
|
/>
|
|
46
45
|
```
|
|
@@ -53,15 +52,14 @@ notes: |
|
|
|
53
52
|
label="Username"
|
|
54
53
|
description="The unique name that identifies you throughout the site."
|
|
55
54
|
validator={value => {
|
|
56
|
-
let feedback = { isValid: true };
|
|
57
55
|
if (value.length < 3) {
|
|
58
|
-
|
|
56
|
+
return {
|
|
59
57
|
isValid: false,
|
|
60
58
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
61
59
|
dangerIconDescription: 'Error',
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
return
|
|
62
|
+
return { isValid: true };
|
|
65
63
|
}}
|
|
66
64
|
themes={['danger']}
|
|
67
65
|
/>
|
package/src/ListBox/README.md
CHANGED
|
@@ -31,7 +31,7 @@ The standard `ModalDialog` composition. `StandardModal` passes all of its props
|
|
|
31
31
|
footerNode={(
|
|
32
32
|
<ActionRow>
|
|
33
33
|
<p className="small">
|
|
34
|
-
<Hyperlink
|
|
34
|
+
<Hyperlink destination="#">Get help</Hyperlink>
|
|
35
35
|
</p>
|
|
36
36
|
<ActionRow.Spacer />
|
|
37
37
|
<Button variant="tertiary" onClick={close}>Cancel</Button>
|
package/src/TextArea/README.md
CHANGED
|
@@ -40,14 +40,13 @@ notes: |
|
|
|
40
40
|
label="Username"
|
|
41
41
|
description="The unique name that identifies you throughout the site."
|
|
42
42
|
validator={value => {
|
|
43
|
-
let feedback = { isValid: true };
|
|
44
43
|
if (value.length < 3) {
|
|
45
|
-
|
|
44
|
+
return {
|
|
46
45
|
isValid: false,
|
|
47
46
|
validationMessage: 'Username must be at least 3 characters in length.',
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
return
|
|
49
|
+
return { isValid: true };
|
|
51
50
|
}}
|
|
52
51
|
/>
|
|
53
52
|
```
|
|
@@ -36,7 +36,7 @@ export const isEveryPropDefined = (props, otherPropNames) => otherPropNames
|
|
|
36
36
|
* Returns a PropType entry with the given propType that is required if otherPropName
|
|
37
37
|
* is truthy.
|
|
38
38
|
* @param {func} propType - target PropType
|
|
39
|
-
* @param {string} otherPropName - string name for prop that, if true, marks the
|
|
39
|
+
* @param {string | string[]} otherPropName - string name for prop that, if true, marks the
|
|
40
40
|
* associated prop as required
|
|
41
41
|
* @return {func} - PropType based on propType that is required if otherPropName is
|
|
42
42
|
* set to true.
|