@indico-data/design-system 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/button/types.d.ts +1 -25
- package/lib/index.d.ts +1 -25
- package/lib/index.esm.js +2 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +0 -6
- package/src/components/button/types.ts +1 -25
|
@@ -2,39 +2,15 @@ import { IconName } from '../../types';
|
|
|
2
2
|
export type ButtonVariants = 'solid' | 'outline' | 'link' | 'action' | 'destructive' | 'soft';
|
|
3
3
|
export type ButtonSizes = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
4
|
export type ButtonTypes = 'button' | 'submit' | 'reset';
|
|
5
|
-
export interface ButtonProps {
|
|
6
|
-
/**
|
|
7
|
-
* The class name to apply to the button
|
|
8
|
-
*/
|
|
9
|
-
className?: string;
|
|
5
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
6
|
/**
|
|
11
7
|
* The aria-label to apply to the button
|
|
12
8
|
*/
|
|
13
9
|
ariaLabel: string;
|
|
14
|
-
/**
|
|
15
|
-
* The children to apply to the button
|
|
16
|
-
*/
|
|
17
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
18
|
-
/**
|
|
19
|
-
* The function to call when the mouse enters the button
|
|
20
|
-
*/
|
|
21
|
-
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
22
10
|
/**
|
|
23
11
|
* The function to call when the mouse exits the button
|
|
24
12
|
*/
|
|
25
13
|
onMouseExit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
26
|
-
/**
|
|
27
|
-
* The function to call when the button loses focus
|
|
28
|
-
*/
|
|
29
|
-
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
30
|
-
/**
|
|
31
|
-
* The function to call when the button is clicked
|
|
32
|
-
*/
|
|
33
|
-
onClick?: (...args: any[]) => void;
|
|
34
|
-
/**
|
|
35
|
-
* The function to call when the button is pressed
|
|
36
|
-
*/
|
|
37
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
38
14
|
/**
|
|
39
15
|
* Determines the visual style and emphasis level of the button
|
|
40
16
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -260,39 +260,15 @@ type ChromaticColor = 'blue' | 'purple' | 'red' | 'yellow' | 'gray' | 'green' |
|
|
|
260
260
|
type ButtonVariants = 'solid' | 'outline' | 'link' | 'action' | 'destructive' | 'soft';
|
|
261
261
|
type ButtonSizes = 'xs' | 'sm' | 'md' | 'lg';
|
|
262
262
|
type ButtonTypes = 'button' | 'submit' | 'reset';
|
|
263
|
-
interface ButtonProps {
|
|
264
|
-
/**
|
|
265
|
-
* The class name to apply to the button
|
|
266
|
-
*/
|
|
267
|
-
className?: string;
|
|
263
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
268
264
|
/**
|
|
269
265
|
* The aria-label to apply to the button
|
|
270
266
|
*/
|
|
271
267
|
ariaLabel: string;
|
|
272
|
-
/**
|
|
273
|
-
* The children to apply to the button
|
|
274
|
-
*/
|
|
275
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
276
|
-
/**
|
|
277
|
-
* The function to call when the mouse enters the button
|
|
278
|
-
*/
|
|
279
|
-
onMouseEnter?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
280
268
|
/**
|
|
281
269
|
* The function to call when the mouse exits the button
|
|
282
270
|
*/
|
|
283
271
|
onMouseExit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
284
|
-
/**
|
|
285
|
-
* The function to call when the button loses focus
|
|
286
|
-
*/
|
|
287
|
-
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
288
|
-
/**
|
|
289
|
-
* The function to call when the button is clicked
|
|
290
|
-
*/
|
|
291
|
-
onClick?: (...args: any[]) => void;
|
|
292
|
-
/**
|
|
293
|
-
* The function to call when the button is pressed
|
|
294
|
-
*/
|
|
295
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
296
272
|
/**
|
|
297
273
|
* Determines the visual style and emphasis level of the button
|
|
298
274
|
*/
|
package/lib/index.esm.js
CHANGED
|
@@ -5042,7 +5042,7 @@ const Icon = (_a) => {
|
|
|
5042
5042
|
};
|
|
5043
5043
|
|
|
5044
5044
|
const Button$1 = forwardRef((props, ref) => {
|
|
5045
|
-
const { ariaLabel, children, isLoading, isDisabled, variant = 'solid', isPill, iconLeft, iconRight, onClick, type = 'button', size = 'md',
|
|
5045
|
+
const { ariaLabel, children, isLoading, isDisabled, variant = 'solid', isPill, iconLeft, iconRight, onClick, type = 'button', size = 'md', onMouseExit, className, href } = props, rest = __rest(props, ["ariaLabel", "children", "isLoading", "isDisabled", "variant", "isPill", "iconLeft", "iconRight", "onClick", "type", "size", "onMouseExit", "className", "href"]);
|
|
5046
5046
|
const buttonClasses = classNames('btn', {
|
|
5047
5047
|
[`btn--${variant}`]: variant,
|
|
5048
5048
|
[`btn--${size}`]: size,
|
|
@@ -5055,7 +5055,7 @@ const Button$1 = forwardRef((props, ref) => {
|
|
|
5055
5055
|
onClick(event);
|
|
5056
5056
|
}
|
|
5057
5057
|
};
|
|
5058
|
-
return (jsxs("button", Object.assign({ ref: ref, disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type,
|
|
5058
|
+
return (jsxs("button", Object.assign({ ref: ref, disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type, onMouseLeave: onMouseExit }, rest, { children: [isLoading && !iconRight && (jsx(Icon, { name: "indico-o", style: { animation: 'spin 1s linear infinite' }, className: children ? 'mr-2' : '', ariaLabel: "Loading...", size: size })), iconLeft && !isLoading && (jsx(Icon, { name: iconLeft, className: children ? 'mr-2' : '', ariaLabel: `${iconLeft} Icon`, size: size })), children, iconRight && !isLoading && (jsx(Icon, { name: iconRight, className: children ? 'ml-2' : '', ariaLabel: `${iconRight} Icon`, size: size })), isLoading && iconRight && (jsx(Icon, { name: "indico-o", style: { animation: 'spin 1s linear infinite' }, className: children ? 'ml-2' : '', ariaLabel: "Loading...", size: size }))] })));
|
|
5059
5059
|
});
|
|
5060
5060
|
|
|
5061
5061
|
var l;function r$1(e,t){return e[t]}function i(e=[],t,n=0){return [...e.slice(0,n),t,...e.slice(n)]}function s(e=[],t,n="id"){const o=e.slice(),a=r$1(t,n);return a?o.splice(o.findIndex((e=>r$1(e,n)===a)),1):o.splice(o.findIndex((e=>e===t)),1),o}function d(e){return e.map(((e,t)=>{const n=Object.assign(Object.assign({},e),{sortable:e.sortable||!!e.sortFunction||void 0});return e.id||(n.id=t+1),n}))}function c(e,t){return Math.ceil(e/t)}function g(e,t){return Math.min(e,t)}!function(e){e.ASC="asc",e.DESC="desc";}(l||(l={}));const u=()=>null;function p(e,t=[],n=[]){let o={},a=[...n];return t.length&&t.forEach((t=>{if(!t.when||"function"!=typeof t.when)throw new Error('"when" must be defined in the conditional style object and must be function');t.when(e)&&(o=t.style||{},t.classNames&&(a=[...a,...t.classNames]),"function"==typeof t.style&&(o=t.style(e)||{}));})),{conditionalStyle:o,classNames:a.join(" ")}}function b$1(e,t=[],n="id"){const o=r$1(e,n);return o?t.some((e=>r$1(e,n)===o)):t.some((t=>t===e))}function m(e,t){return t?e.findIndex((e=>h$1(e.id,t))):-1}function h$1(e,t){return e==t}function w$1(e,t){const n=!e.toggleOnSelectedRowsChange;switch(t.type){case"SELECT_ALL_ROWS":{const{keyField:n,rows:o,rowCount:a,mergeSelections:l}=t,r=!e.allSelected,i=!e.toggleOnSelectedRowsChange;if(l){const t=r?[...e.selectedRows,...o.filter((t=>!b$1(t,e.selectedRows,n)))]:e.selectedRows.filter((e=>!b$1(e,o,n)));return Object.assign(Object.assign({},e),{allSelected:r,selectedCount:t.length,selectedRows:t,toggleOnSelectedRowsChange:i})}return Object.assign(Object.assign({},e),{allSelected:r,selectedCount:r?a:0,selectedRows:r?o:[],toggleOnSelectedRowsChange:i})}case"SELECT_SINGLE_ROW":{const{keyField:o,row:a,isSelected:l,rowCount:r,singleSelect:d}=t;return d?l?Object.assign(Object.assign({},e),{selectedCount:0,allSelected:!1,selectedRows:[],toggleOnSelectedRowsChange:n}):Object.assign(Object.assign({},e),{selectedCount:1,allSelected:!1,selectedRows:[a],toggleOnSelectedRowsChange:n}):l?Object.assign(Object.assign({},e),{selectedCount:e.selectedRows.length>0?e.selectedRows.length-1:0,allSelected:!1,selectedRows:s(e.selectedRows,a,o),toggleOnSelectedRowsChange:n}):Object.assign(Object.assign({},e),{selectedCount:e.selectedRows.length+1,allSelected:e.selectedRows.length+1===r,selectedRows:i(e.selectedRows,a),toggleOnSelectedRowsChange:n})}case"SELECT_MULTIPLE_ROWS":{const{keyField:o,selectedRows:a,totalRows:l,mergeSelections:r}=t;if(r){const t=[...e.selectedRows,...a.filter((t=>!b$1(t,e.selectedRows,o)))];return Object.assign(Object.assign({},e),{selectedCount:t.length,allSelected:!1,selectedRows:t,toggleOnSelectedRowsChange:n})}return Object.assign(Object.assign({},e),{selectedCount:a.length,allSelected:a.length===l,selectedRows:a,toggleOnSelectedRowsChange:n})}case"CLEAR_SELECTED_ROWS":{const{selectedRowsFlag:n}=t;return Object.assign(Object.assign({},e),{allSelected:!1,selectedCount:0,selectedRows:[],selectedRowsFlag:n})}case"SORT_CHANGE":{const{sortDirection:o,selectedColumn:a,clearSelectedOnSort:l}=t;return Object.assign(Object.assign(Object.assign({},e),{selectedColumn:a,sortDirection:o,currentPage:1}),l&&{allSelected:!1,selectedCount:0,selectedRows:[],toggleOnSelectedRowsChange:n})}case"CHANGE_PAGE":{const{page:o,paginationServer:a,visibleOnly:l,persistSelectedOnPageChange:r}=t,i=a&&r,s=a&&!r||l;return Object.assign(Object.assign(Object.assign(Object.assign({},e),{currentPage:o}),i&&{allSelected:!1}),s&&{allSelected:!1,selectedCount:0,selectedRows:[],toggleOnSelectedRowsChange:n})}case"CHANGE_ROWS_PER_PAGE":{const{rowsPerPage:n,page:o}=t;return Object.assign(Object.assign({},e),{currentPage:o,rowsPerPage:n})}}}const f=css`
|