@zendeskgarden/react-buttons 8.69.2 → 8.69.4
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/index.cjs.js +45 -21
- package/dist/index.esm.js +46 -23
- package/dist/typings/elements/Anchor.d.ts +16 -16
- package/dist/typings/elements/Button.d.ts +23 -23
- package/dist/typings/elements/ButtonGroup.d.ts +14 -14
- package/dist/typings/elements/ChevronButton.d.ts +12 -12
- package/dist/typings/elements/IconButton.d.ts +12 -12
- package/dist/typings/elements/SplitButton.d.ts +11 -11
- package/dist/typings/elements/ToggleButton.d.ts +12 -12
- package/dist/typings/elements/ToggleIconButton.d.ts +12 -12
- package/dist/typings/elements/components/EndIcon.d.ts +15 -15
- package/dist/typings/elements/components/StartIcon.d.ts +15 -15
- package/dist/typings/index.d.ts +15 -16
- package/dist/typings/styled/StyledAnchor.d.ts +17 -17
- package/dist/typings/styled/StyledButton.d.ts +15 -15
- package/dist/typings/styled/StyledButtonGroup.d.ts +13 -13
- package/dist/typings/styled/StyledExternalIcon.d.ts +13 -13
- package/dist/typings/styled/StyledIcon.d.ts +17 -17
- package/dist/typings/styled/StyledIconButton.d.ts +12 -12
- package/dist/typings/styled/index.d.ts +12 -12
- package/dist/typings/types/index.d.ts +68 -68
- package/dist/typings/utils/useButtonGroupContext.d.ts +14 -14
- package/dist/typings/utils/useSplitButtonContext.d.ts +9 -9
- package/package.json +7 -6
package/dist/index.cjs.js
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var PropTypes = require('prop-types');
|
|
12
|
+
var mergeRefs = require('react-merge-refs');
|
|
12
13
|
var styled = require('styled-components');
|
|
13
14
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
14
15
|
var polished = require('polished');
|
|
15
|
-
var
|
|
16
|
+
var containerSelection = require('@zendeskgarden/container-selection');
|
|
17
|
+
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
16
18
|
|
|
17
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
20
|
|
|
@@ -36,6 +38,7 @@ function _interopNamespace(e) {
|
|
|
36
38
|
|
|
37
39
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
38
40
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
41
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
39
42
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
40
43
|
|
|
41
44
|
function _extends$2() {
|
|
@@ -58,7 +61,7 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
58
61
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
59
62
|
const StyledButtonGroup = styled__default.default.div.attrs({
|
|
60
63
|
'data-garden-id': COMPONENT_ID$5,
|
|
61
|
-
'data-garden-version': '8.69.
|
|
64
|
+
'data-garden-version': '8.69.4'
|
|
62
65
|
}).withConfig({
|
|
63
66
|
displayName: "StyledButtonGroup",
|
|
64
67
|
componentId: "sc-1fbpzef-0"
|
|
@@ -87,7 +90,7 @@ const StyledIcon = styled__default.default(_ref => {
|
|
|
87
90
|
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
88
91
|
}).attrs({
|
|
89
92
|
'data-garden-id': COMPONENT_ID$4,
|
|
90
|
-
'data-garden-version': '8.69.
|
|
93
|
+
'data-garden-version': '8.69.4'
|
|
91
94
|
}).withConfig({
|
|
92
95
|
displayName: "StyledIcon",
|
|
93
96
|
componentId: "sc-19meqgg-0"
|
|
@@ -225,7 +228,7 @@ const sizeStyles = props => {
|
|
|
225
228
|
};
|
|
226
229
|
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
227
230
|
'data-garden-id': COMPONENT_ID$3,
|
|
228
|
-
'data-garden-version': '8.69.
|
|
231
|
+
'data-garden-version': '8.69.4',
|
|
229
232
|
type: props.type || 'button'
|
|
230
233
|
})).withConfig({
|
|
231
234
|
displayName: "StyledButton",
|
|
@@ -238,7 +241,7 @@ StyledButton.defaultProps = {
|
|
|
238
241
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
239
242
|
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
240
243
|
'data-garden-id': COMPONENT_ID$2,
|
|
241
|
-
'data-garden-version': '8.69.
|
|
244
|
+
'data-garden-version': '8.69.4',
|
|
242
245
|
as: 'a',
|
|
243
246
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
244
247
|
isLink: true,
|
|
@@ -272,7 +275,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
272
275
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
273
276
|
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
274
277
|
'data-garden-id': COMPONENT_ID$1,
|
|
275
|
-
'data-garden-version': '8.69.
|
|
278
|
+
'data-garden-version': '8.69.4'
|
|
276
279
|
}).withConfig({
|
|
277
280
|
displayName: "StyledExternalIcon",
|
|
278
281
|
componentId: "sc-16oz07e-0"
|
|
@@ -299,7 +302,7 @@ const iconStyles = props => {
|
|
|
299
302
|
};
|
|
300
303
|
const StyledIconButton = styled__default.default(StyledButton).attrs({
|
|
301
304
|
'data-garden-id': COMPONENT_ID,
|
|
302
|
-
'data-garden-version': '8.69.
|
|
305
|
+
'data-garden-version': '8.69.4'
|
|
303
306
|
}).withConfig({
|
|
304
307
|
displayName: "StyledIconButton",
|
|
305
308
|
componentId: "sc-1t0ughp-0"
|
|
@@ -333,6 +336,7 @@ const EndIcon = EndIconComponent;
|
|
|
333
336
|
const ButtonComponent = React.forwardRef((props, ref) => {
|
|
334
337
|
const buttonGroupContext = useButtonGroupContext();
|
|
335
338
|
const splitButtonContext = useSplitButtonContext();
|
|
339
|
+
let computedRef = ref;
|
|
336
340
|
let computedProps = {
|
|
337
341
|
...props,
|
|
338
342
|
focusInset: props.focusInset || buttonGroupContext !== undefined || splitButtonContext
|
|
@@ -342,15 +346,15 @@ const ButtonComponent = React.forwardRef((props, ref) => {
|
|
|
342
346
|
throw new Error('"value" prop must be provided to Button when used within a ButtonGroup');
|
|
343
347
|
}
|
|
344
348
|
computedProps = buttonGroupContext.getButtonProps({
|
|
345
|
-
item: props.value,
|
|
346
|
-
focusRef: React__namespace.default.createRef(),
|
|
347
349
|
isSelected: props.value === buttonGroupContext.selectedItem,
|
|
348
350
|
...computedProps
|
|
349
351
|
});
|
|
352
|
+
computedRef = mergeRefs__default.default([
|
|
353
|
+
computedProps.ref, ref]);
|
|
350
354
|
}
|
|
351
|
-
return React__namespace.default.createElement(StyledButton, _extends$2({
|
|
352
|
-
ref:
|
|
353
|
-
}
|
|
355
|
+
return React__namespace.default.createElement(StyledButton, _extends$2({}, computedProps, {
|
|
356
|
+
ref: computedRef
|
|
357
|
+
}));
|
|
354
358
|
});
|
|
355
359
|
ButtonComponent.displayName = 'Button';
|
|
356
360
|
ButtonComponent.propTypes = {
|
|
@@ -413,22 +417,42 @@ const ButtonGroup = React.forwardRef((_ref, ref) => {
|
|
|
413
417
|
let {
|
|
414
418
|
children,
|
|
415
419
|
onSelect,
|
|
416
|
-
selectedItem:
|
|
420
|
+
selectedItem: controlledSelectedValue,
|
|
417
421
|
...otherProps
|
|
418
422
|
} = _ref;
|
|
419
423
|
const {
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
rtl
|
|
425
|
+
} = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
|
|
426
|
+
const [internalSelectedValue, setInternalSelectedValue] = React.useState();
|
|
427
|
+
const selectedValue = containerUtilities.getControlledValue(controlledSelectedValue, internalSelectedValue);
|
|
428
|
+
const values = React.useMemo(() => React.Children.toArray(children).reduce((buttons, child) => {
|
|
429
|
+
if ( React.isValidElement(child) && child.type !== 'string' && !child.props.disabled) {
|
|
430
|
+
buttons.push(child.props.value);
|
|
431
|
+
}
|
|
432
|
+
return buttons;
|
|
433
|
+
}, []), [children]);
|
|
434
|
+
const {
|
|
435
|
+
selectedValue: selectedItem,
|
|
436
|
+
getElementProps,
|
|
422
437
|
getGroupProps
|
|
423
|
-
} =
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
438
|
+
} = containerSelection.useSelection({
|
|
439
|
+
rtl,
|
|
440
|
+
values,
|
|
441
|
+
defaultSelectedValue: values[0],
|
|
442
|
+
selectedValue,
|
|
443
|
+
onSelect: React.useCallback(value => {
|
|
444
|
+
onSelect && onSelect(value);
|
|
445
|
+
setInternalSelectedValue(value);
|
|
446
|
+
}, [onSelect])
|
|
427
447
|
});
|
|
428
448
|
const contextValue = React.useMemo(() => ({
|
|
429
449
|
selectedItem,
|
|
430
|
-
getButtonProps
|
|
431
|
-
|
|
450
|
+
getButtonProps: props => getElementProps({
|
|
451
|
+
role: 'button',
|
|
452
|
+
selectedAriaKey: 'aria-pressed',
|
|
453
|
+
...props
|
|
454
|
+
})
|
|
455
|
+
}), [selectedItem, getElementProps]);
|
|
432
456
|
return React__namespace.default.createElement(ButtonGroupContext.Provider, {
|
|
433
457
|
value: contextValue
|
|
434
458
|
}, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
|
package/dist/index.esm.js
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import React__default, { Children, createContext, useContext, forwardRef, useMemo } from 'react';
|
|
9
|
+
import React__default, { Children, createContext, useContext, forwardRef, useState, useMemo, isValidElement, useCallback } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import
|
|
11
|
+
import mergeRefs from 'react-merge-refs';
|
|
12
|
+
import styled, { css, ThemeContext } from 'styled-components';
|
|
12
13
|
import { retrieveComponentStyles, DEFAULT_THEME, SELECTOR_FOCUS_VISIBLE, getColor, focusStyles, getFocusBoxShadow, useText } from '@zendeskgarden/react-theming';
|
|
13
14
|
import { rgba, math, em } from 'polished';
|
|
14
|
-
import {
|
|
15
|
+
import { useSelection } from '@zendeskgarden/container-selection';
|
|
16
|
+
import { getControlledValue } from '@zendeskgarden/container-utilities';
|
|
15
17
|
|
|
16
18
|
function _extends$2() {
|
|
17
19
|
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -33,7 +35,7 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
33
35
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
34
36
|
const StyledButtonGroup = styled.div.attrs({
|
|
35
37
|
'data-garden-id': COMPONENT_ID$5,
|
|
36
|
-
'data-garden-version': '8.69.
|
|
38
|
+
'data-garden-version': '8.69.4'
|
|
37
39
|
}).withConfig({
|
|
38
40
|
displayName: "StyledButtonGroup",
|
|
39
41
|
componentId: "sc-1fbpzef-0"
|
|
@@ -62,7 +64,7 @@ const StyledIcon = styled(_ref => {
|
|
|
62
64
|
return React__default.cloneElement(Children.only(children), props);
|
|
63
65
|
}).attrs({
|
|
64
66
|
'data-garden-id': COMPONENT_ID$4,
|
|
65
|
-
'data-garden-version': '8.69.
|
|
67
|
+
'data-garden-version': '8.69.4'
|
|
66
68
|
}).withConfig({
|
|
67
69
|
displayName: "StyledIcon",
|
|
68
70
|
componentId: "sc-19meqgg-0"
|
|
@@ -200,7 +202,7 @@ const sizeStyles = props => {
|
|
|
200
202
|
};
|
|
201
203
|
const StyledButton = styled.button.attrs(props => ({
|
|
202
204
|
'data-garden-id': COMPONENT_ID$3,
|
|
203
|
-
'data-garden-version': '8.69.
|
|
205
|
+
'data-garden-version': '8.69.4',
|
|
204
206
|
type: props.type || 'button'
|
|
205
207
|
})).withConfig({
|
|
206
208
|
displayName: "StyledButton",
|
|
@@ -213,7 +215,7 @@ StyledButton.defaultProps = {
|
|
|
213
215
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
214
216
|
const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
215
217
|
'data-garden-id': COMPONENT_ID$2,
|
|
216
|
-
'data-garden-version': '8.69.
|
|
218
|
+
'data-garden-version': '8.69.4',
|
|
217
219
|
as: 'a',
|
|
218
220
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
219
221
|
isLink: true,
|
|
@@ -247,7 +249,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
247
249
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
248
250
|
const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
|
|
249
251
|
'data-garden-id': COMPONENT_ID$1,
|
|
250
|
-
'data-garden-version': '8.69.
|
|
252
|
+
'data-garden-version': '8.69.4'
|
|
251
253
|
}).withConfig({
|
|
252
254
|
displayName: "StyledExternalIcon",
|
|
253
255
|
componentId: "sc-16oz07e-0"
|
|
@@ -274,7 +276,7 @@ const iconStyles = props => {
|
|
|
274
276
|
};
|
|
275
277
|
const StyledIconButton = styled(StyledButton).attrs({
|
|
276
278
|
'data-garden-id': COMPONENT_ID,
|
|
277
|
-
'data-garden-version': '8.69.
|
|
279
|
+
'data-garden-version': '8.69.4'
|
|
278
280
|
}).withConfig({
|
|
279
281
|
displayName: "StyledIconButton",
|
|
280
282
|
componentId: "sc-1t0ughp-0"
|
|
@@ -308,6 +310,7 @@ const EndIcon = EndIconComponent;
|
|
|
308
310
|
const ButtonComponent = forwardRef((props, ref) => {
|
|
309
311
|
const buttonGroupContext = useButtonGroupContext();
|
|
310
312
|
const splitButtonContext = useSplitButtonContext();
|
|
313
|
+
let computedRef = ref;
|
|
311
314
|
let computedProps = {
|
|
312
315
|
...props,
|
|
313
316
|
focusInset: props.focusInset || buttonGroupContext !== undefined || splitButtonContext
|
|
@@ -317,15 +320,15 @@ const ButtonComponent = forwardRef((props, ref) => {
|
|
|
317
320
|
throw new Error('"value" prop must be provided to Button when used within a ButtonGroup');
|
|
318
321
|
}
|
|
319
322
|
computedProps = buttonGroupContext.getButtonProps({
|
|
320
|
-
item: props.value,
|
|
321
|
-
focusRef: React__default.createRef(),
|
|
322
323
|
isSelected: props.value === buttonGroupContext.selectedItem,
|
|
323
324
|
...computedProps
|
|
324
325
|
});
|
|
326
|
+
computedRef = mergeRefs([
|
|
327
|
+
computedProps.ref, ref]);
|
|
325
328
|
}
|
|
326
|
-
return React__default.createElement(StyledButton, _extends$2({
|
|
327
|
-
ref:
|
|
328
|
-
}
|
|
329
|
+
return React__default.createElement(StyledButton, _extends$2({}, computedProps, {
|
|
330
|
+
ref: computedRef
|
|
331
|
+
}));
|
|
329
332
|
});
|
|
330
333
|
ButtonComponent.displayName = 'Button';
|
|
331
334
|
ButtonComponent.propTypes = {
|
|
@@ -388,22 +391,42 @@ const ButtonGroup = forwardRef((_ref, ref) => {
|
|
|
388
391
|
let {
|
|
389
392
|
children,
|
|
390
393
|
onSelect,
|
|
391
|
-
selectedItem:
|
|
394
|
+
selectedItem: controlledSelectedValue,
|
|
392
395
|
...otherProps
|
|
393
396
|
} = _ref;
|
|
394
397
|
const {
|
|
395
|
-
|
|
396
|
-
|
|
398
|
+
rtl
|
|
399
|
+
} = useContext(ThemeContext) || DEFAULT_THEME;
|
|
400
|
+
const [internalSelectedValue, setInternalSelectedValue] = useState();
|
|
401
|
+
const selectedValue = getControlledValue(controlledSelectedValue, internalSelectedValue);
|
|
402
|
+
const values = useMemo(() => Children.toArray(children).reduce((buttons, child) => {
|
|
403
|
+
if ( isValidElement(child) && child.type !== 'string' && !child.props.disabled) {
|
|
404
|
+
buttons.push(child.props.value);
|
|
405
|
+
}
|
|
406
|
+
return buttons;
|
|
407
|
+
}, []), [children]);
|
|
408
|
+
const {
|
|
409
|
+
selectedValue: selectedItem,
|
|
410
|
+
getElementProps,
|
|
397
411
|
getGroupProps
|
|
398
|
-
} =
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
412
|
+
} = useSelection({
|
|
413
|
+
rtl,
|
|
414
|
+
values,
|
|
415
|
+
defaultSelectedValue: values[0],
|
|
416
|
+
selectedValue,
|
|
417
|
+
onSelect: useCallback(value => {
|
|
418
|
+
onSelect && onSelect(value);
|
|
419
|
+
setInternalSelectedValue(value);
|
|
420
|
+
}, [onSelect])
|
|
402
421
|
});
|
|
403
422
|
const contextValue = useMemo(() => ({
|
|
404
423
|
selectedItem,
|
|
405
|
-
getButtonProps
|
|
406
|
-
|
|
424
|
+
getButtonProps: props => getElementProps({
|
|
425
|
+
role: 'button',
|
|
426
|
+
selectedAriaKey: 'aria-pressed',
|
|
427
|
+
...props
|
|
428
|
+
})
|
|
429
|
+
}), [selectedItem, getElementProps]);
|
|
407
430
|
return React__default.createElement(ButtonGroupContext.Provider, {
|
|
408
431
|
value: contextValue
|
|
409
432
|
}, React__default.createElement(StyledButtonGroup, _extends$2({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IAnchorProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* 1. role='img' on `svg` is valid WAI-ARIA usage in this context.
|
|
11
|
-
* https://dequeuniversity.com/rules/axe/4.2/svg-img-alt
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @extends AnchorHTMLAttributes<HTMLAnchorElement>
|
|
15
|
-
*/
|
|
16
|
-
export declare const Anchor: React.ForwardRefExoticComponent<IAnchorProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IAnchorProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* 1. role='img' on `svg` is valid WAI-ARIA usage in this context.
|
|
11
|
+
* https://dequeuniversity.com/rules/axe/4.2/svg-img-alt
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @extends AnchorHTMLAttributes<HTMLAnchorElement>
|
|
15
|
+
*/
|
|
16
|
+
export declare const Anchor: React.ForwardRefExoticComponent<IAnchorProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React, { SVGAttributes } from 'react';
|
|
8
|
-
import { IButtonProps } from '../types';
|
|
9
|
-
import { StartIcon } from './components/StartIcon';
|
|
10
|
-
import { EndIcon } from './components/EndIcon';
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated use IButtonStartIconProps or IButtonEndIconProps instead
|
|
13
|
-
*/
|
|
14
|
-
export interface IIconProps extends SVGAttributes<SVGSVGElement> {
|
|
15
|
-
isRotated?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
19
|
-
*/
|
|
20
|
-
export declare const Button: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>> & {
|
|
21
|
-
EndIcon: typeof EndIcon;
|
|
22
|
-
StartIcon: typeof StartIcon;
|
|
23
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React, { SVGAttributes } from 'react';
|
|
8
|
+
import { IButtonProps } from '../types';
|
|
9
|
+
import { StartIcon } from './components/StartIcon';
|
|
10
|
+
import { EndIcon } from './components/EndIcon';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use IButtonStartIconProps or IButtonEndIconProps instead
|
|
13
|
+
*/
|
|
14
|
+
export interface IIconProps extends SVGAttributes<SVGSVGElement> {
|
|
15
|
+
isRotated?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
19
|
+
*/
|
|
20
|
+
export declare const Button: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>> & {
|
|
21
|
+
EndIcon: typeof EndIcon;
|
|
22
|
+
StartIcon: typeof StartIcon;
|
|
23
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IButtonGroupProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated this legacy component will be removed in a future release
|
|
11
|
-
*
|
|
12
|
-
* @extends HTMLAttributes<HTMLDivElement>
|
|
13
|
-
*/
|
|
14
|
-
export declare const ButtonGroup: React.ForwardRefExoticComponent<IButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IButtonGroupProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated this legacy component will be removed in a future release
|
|
11
|
+
*
|
|
12
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
13
|
+
*/
|
|
14
|
+
export declare const ButtonGroup: React.ForwardRefExoticComponent<IButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IIconButtonProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const ChevronButton: React.ForwardRefExoticComponent<IIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IIconButtonProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const ChevronButton: React.ForwardRefExoticComponent<IIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IIconButtonProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const IconButton: React.ForwardRefExoticComponent<IIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IIconButtonProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
/**
|
|
9
|
-
* @extends HTMLAttributes<HTMLDivElement>
|
|
10
|
-
*/
|
|
11
|
-
export declare const SplitButton: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
10
|
+
*/
|
|
11
|
+
export declare const SplitButton: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IToggleButtonProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const ToggleButton: React.ForwardRefExoticComponent<IToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IToggleButtonProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const ToggleButton: React.ForwardRefExoticComponent<IToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IToggleIconButtonProps } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const ToggleIconButton: React.ForwardRefExoticComponent<IToggleIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IToggleIconButtonProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const ToggleIconButton: React.ForwardRefExoticComponent<IToggleIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IButtonIconProps } from '../../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends SVGAttributes<SVGElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const EndIcon: {
|
|
13
|
-
(props: IButtonIconProps): React.JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IButtonIconProps } from '../../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends SVGAttributes<SVGElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const EndIcon: {
|
|
13
|
+
(props: IButtonIconProps): React.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { IButtonIconProps } from '../../types';
|
|
9
|
-
/**
|
|
10
|
-
* @extends SVGAttributes<SVGElement>
|
|
11
|
-
*/
|
|
12
|
-
export declare const StartIcon: {
|
|
13
|
-
(props: IButtonIconProps): React.JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IButtonIconProps } from '../../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends SVGAttributes<SVGElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const StartIcon: {
|
|
13
|
+
(props: IButtonIconProps): React.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
export { Button } from './elements/Button';
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export type { IButtonProps, IButtonIconProps as IButtonEndIconProps, IButtonIconProps as IButtonStartIconProps, IAnchorProps, IIconButtonProps, IIconButtonProps as IChevronButtonProps, IToggleButtonProps, IToggleIconButtonProps, IButtonGroupProps } from './types';
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { Button, type IIconProps } from './elements/Button';
|
|
8
|
+
export { Anchor } from './elements/Anchor';
|
|
9
|
+
export { ButtonGroup } from './elements/ButtonGroup';
|
|
10
|
+
export { ChevronButton } from './elements/ChevronButton';
|
|
11
|
+
export { IconButton } from './elements/IconButton';
|
|
12
|
+
export { SplitButton } from './elements/SplitButton';
|
|
13
|
+
export { ToggleButton } from './elements/ToggleButton';
|
|
14
|
+
export { ToggleIconButton } from './elements/ToggleIconButton';
|
|
15
|
+
export type { IButtonProps, IButtonIconProps as IButtonEndIconProps, IButtonIconProps as IButtonStartIconProps, IAnchorProps, IIconButtonProps, IIconButtonProps as IChevronButtonProps, IToggleButtonProps, IToggleIconButtonProps, IButtonGroupProps } from './types';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Accepts all `<a>` props
|
|
9
|
-
*/
|
|
10
|
-
export declare const StyledAnchor: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, import("..").IButtonProps & {
|
|
11
|
-
'data-garden-id': string;
|
|
12
|
-
'data-garden-version': string;
|
|
13
|
-
as: string;
|
|
14
|
-
dir: "rtl" | undefined;
|
|
15
|
-
isLink: boolean;
|
|
16
|
-
type: undefined;
|
|
17
|
-
}, "type" | "dir" | "data-garden-id" | "data-garden-version" | "as" | "isLink">;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Accepts all `<a>` props
|
|
9
|
+
*/
|
|
10
|
+
export declare const StyledAnchor: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, import("..").IButtonProps & {
|
|
11
|
+
'data-garden-id': string;
|
|
12
|
+
'data-garden-version': string;
|
|
13
|
+
as: string;
|
|
14
|
+
dir: "rtl" | undefined;
|
|
15
|
+
isLink: boolean;
|
|
16
|
+
type: undefined;
|
|
17
|
+
}, "type" | "dir" | "data-garden-id" | "data-garden-version" | "as" | "isLink">;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import { DefaultTheme, ThemeProps } from 'styled-components';
|
|
8
|
-
import { IButtonProps } from '../types';
|
|
9
|
-
export declare const getHeight: (props: IButtonProps & ThemeProps<DefaultTheme>) => string;
|
|
10
|
-
/**
|
|
11
|
-
* 1. FF <input type="submit"> fix
|
|
12
|
-
* 2. <a> element reset
|
|
13
|
-
* 3. Shifting :focus-visible from LVHFA order to preserve `text-decoration` on hover
|
|
14
|
-
*/
|
|
15
|
-
export declare const StyledButton: import("styled-components").StyledComponent<"button", DefaultTheme, IButtonProps, never>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { DefaultTheme, ThemeProps } from 'styled-components';
|
|
8
|
+
import { IButtonProps } from '../types';
|
|
9
|
+
export declare const getHeight: (props: IButtonProps & ThemeProps<DefaultTheme>) => string;
|
|
10
|
+
/**
|
|
11
|
+
* 1. FF <input type="submit"> fix
|
|
12
|
+
* 2. <a> element reset
|
|
13
|
+
* 3. Shifting :focus-visible from LVHFA order to preserve `text-decoration` on hover
|
|
14
|
+
*/
|
|
15
|
+
export declare const StyledButton: import("styled-components").StyledComponent<"button", DefaultTheme, IButtonProps, never>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Accepts all `<div>` props
|
|
9
|
-
*/
|
|
10
|
-
export declare const StyledButtonGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
11
|
-
'data-garden-id': string;
|
|
12
|
-
'data-garden-version': string;
|
|
13
|
-
}, "data-garden-id" | "data-garden-version">;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Accepts all `<div>` props
|
|
9
|
+
*/
|
|
10
|
+
export declare const StyledButtonGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
11
|
+
'data-garden-id': string;
|
|
12
|
+
'data-garden-version': string;
|
|
13
|
+
}, "data-garden-id" | "data-garden-version">;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Accepts all `<svg>` props
|
|
9
|
-
*/
|
|
10
|
-
export declare const StyledExternalIcon: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object & {
|
|
11
|
-
'data-garden-id': string;
|
|
12
|
-
'data-garden-version': string;
|
|
13
|
-
}, string | number | symbol>;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Accepts all `<svg>` props
|
|
9
|
+
*/
|
|
10
|
+
export declare const StyledExternalIcon: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object & {
|
|
11
|
+
'data-garden-id': string;
|
|
12
|
+
'data-garden-version': string;
|
|
13
|
+
}, string | number | symbol>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
interface IStyledIconProps {
|
|
10
|
-
isRotated: boolean;
|
|
11
|
-
position?: 'start' | 'end';
|
|
12
|
-
}
|
|
13
|
-
export declare const StyledIcon: import("styled-components").StyledComponent<({ children, isRotated, theme, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>, DefaultTheme, {
|
|
14
|
-
'data-garden-id': string;
|
|
15
|
-
'data-garden-version': string;
|
|
16
|
-
} & IStyledIconProps, "data-garden-id" | "data-garden-version">;
|
|
17
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
interface IStyledIconProps {
|
|
10
|
+
isRotated: boolean;
|
|
11
|
+
position?: 'start' | 'end';
|
|
12
|
+
}
|
|
13
|
+
export declare const StyledIcon: import("styled-components").StyledComponent<({ children, isRotated, theme, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>, DefaultTheme, {
|
|
14
|
+
'data-garden-id': string;
|
|
15
|
+
'data-garden-version': string;
|
|
16
|
+
} & IStyledIconProps, "data-garden-id" | "data-garden-version">;
|
|
17
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
import { IButtonProps } from '../types';
|
|
9
|
-
export declare const StyledIconButton: import("styled-components").StyledComponent<"button", DefaultTheme, {
|
|
10
|
-
'data-garden-id': string;
|
|
11
|
-
'data-garden-version': string;
|
|
12
|
-
} & IButtonProps, "data-garden-id" | "data-garden-version">;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
import { IButtonProps } from '../types';
|
|
9
|
+
export declare const StyledIconButton: import("styled-components").StyledComponent<"button", DefaultTheme, {
|
|
10
|
+
'data-garden-id': string;
|
|
11
|
+
'data-garden-version': string;
|
|
12
|
+
} & IButtonProps, "data-garden-id" | "data-garden-version">;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
export * from './StyledAnchor';
|
|
8
|
-
export * from './StyledButton';
|
|
9
|
-
export * from './StyledButtonGroup';
|
|
10
|
-
export * from './StyledExternalIcon';
|
|
11
|
-
export * from './StyledIcon';
|
|
12
|
-
export * from './StyledIconButton';
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
export * from './StyledAnchor';
|
|
8
|
+
export * from './StyledButton';
|
|
9
|
+
export * from './StyledButtonGroup';
|
|
10
|
+
export * from './StyledExternalIcon';
|
|
11
|
+
export * from './StyledIcon';
|
|
12
|
+
export * from './StyledIconButton';
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
import { AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, SVGAttributes } from 'react';
|
|
8
|
-
export declare const SIZE: readonly ["small", "medium", "large"];
|
|
9
|
-
export interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
-
/** Applies danger styling */
|
|
11
|
-
isDanger?: boolean;
|
|
12
|
-
/** Specifies the button size */
|
|
13
|
-
size?: (typeof SIZE)[number];
|
|
14
|
-
/** Stretches the button fill to its container width */
|
|
15
|
-
isStretched?: boolean;
|
|
16
|
-
/** Applies neutral button styling */
|
|
17
|
-
isNeutral?: boolean;
|
|
18
|
-
/** Applies primary button styling */
|
|
19
|
-
isPrimary?: boolean;
|
|
20
|
-
/** Applies basic button styling */
|
|
21
|
-
isBasic?: boolean;
|
|
22
|
-
/** Applies link (anchor) button styling */
|
|
23
|
-
isLink?: boolean;
|
|
24
|
-
/** Applies pill button styling */
|
|
25
|
-
isPill?: boolean;
|
|
26
|
-
/** Applies inset `box-shadow` styling on focus */
|
|
27
|
-
focusInset?: boolean;
|
|
28
|
-
/** @ignore prop used by `ButtonGroup` */
|
|
29
|
-
isSelected?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface IToggleButtonProps extends IButtonProps {
|
|
32
|
-
/**
|
|
33
|
-
* Determines if the button is pressed. Use "mixed" to indicate that
|
|
34
|
-
* the toggle controls other elements which do not share the same value.
|
|
35
|
-
*/
|
|
36
|
-
isPressed?: boolean | 'mixed';
|
|
37
|
-
}
|
|
38
|
-
export interface IIconButtonProps extends Omit<IButtonProps, 'isStretched' | 'isLink'> {
|
|
39
|
-
/** Rotates icon 180 degrees */
|
|
40
|
-
isRotated?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface IToggleIconButtonProps extends IIconButtonProps, Pick<IToggleButtonProps, 'isPressed'> {
|
|
43
|
-
}
|
|
44
|
-
export interface IButtonIconProps extends Pick<IIconButtonProps, 'isRotated'>, SVGAttributes<SVGElement> {
|
|
45
|
-
}
|
|
46
|
-
export interface IAnchorProps extends Pick<IButtonProps, 'isDanger'>, AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
47
|
-
/**
|
|
48
|
-
* Attaches `target="_blank"` and `rel="noopener noreferrer"` to an anchor that
|
|
49
|
-
* navigates to an external resource. This ensures that the anchor is a
|
|
50
|
-
* safe [cross-origin destination link](https://web.dev/external-anchors-use-rel-noopener/).
|
|
51
|
-
**/
|
|
52
|
-
isExternal?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Allows a customized/translated text label to be passed to the external link icon,
|
|
55
|
-
* making that icon accessible to assistive technology
|
|
56
|
-
**/
|
|
57
|
-
externalIconLabel?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface IButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
60
|
-
/** Defines the currently selected button in the group */
|
|
61
|
-
selectedItem?: any;
|
|
62
|
-
/**
|
|
63
|
-
* Handles button selection
|
|
64
|
-
*
|
|
65
|
-
* @param {any} item The selected item
|
|
66
|
-
*/
|
|
67
|
-
onSelect?: (item: any) => void;
|
|
68
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, SVGAttributes } from 'react';
|
|
8
|
+
export declare const SIZE: readonly ["small", "medium", "large"];
|
|
9
|
+
export interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
/** Applies danger styling */
|
|
11
|
+
isDanger?: boolean;
|
|
12
|
+
/** Specifies the button size */
|
|
13
|
+
size?: (typeof SIZE)[number];
|
|
14
|
+
/** Stretches the button fill to its container width */
|
|
15
|
+
isStretched?: boolean;
|
|
16
|
+
/** Applies neutral button styling */
|
|
17
|
+
isNeutral?: boolean;
|
|
18
|
+
/** Applies primary button styling */
|
|
19
|
+
isPrimary?: boolean;
|
|
20
|
+
/** Applies basic button styling */
|
|
21
|
+
isBasic?: boolean;
|
|
22
|
+
/** Applies link (anchor) button styling */
|
|
23
|
+
isLink?: boolean;
|
|
24
|
+
/** Applies pill button styling */
|
|
25
|
+
isPill?: boolean;
|
|
26
|
+
/** Applies inset `box-shadow` styling on focus */
|
|
27
|
+
focusInset?: boolean;
|
|
28
|
+
/** @ignore prop used by `ButtonGroup` */
|
|
29
|
+
isSelected?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface IToggleButtonProps extends IButtonProps {
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the button is pressed. Use "mixed" to indicate that
|
|
34
|
+
* the toggle controls other elements which do not share the same value.
|
|
35
|
+
*/
|
|
36
|
+
isPressed?: boolean | 'mixed';
|
|
37
|
+
}
|
|
38
|
+
export interface IIconButtonProps extends Omit<IButtonProps, 'isStretched' | 'isLink'> {
|
|
39
|
+
/** Rotates icon 180 degrees */
|
|
40
|
+
isRotated?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface IToggleIconButtonProps extends IIconButtonProps, Pick<IToggleButtonProps, 'isPressed'> {
|
|
43
|
+
}
|
|
44
|
+
export interface IButtonIconProps extends Pick<IIconButtonProps, 'isRotated'>, SVGAttributes<SVGElement> {
|
|
45
|
+
}
|
|
46
|
+
export interface IAnchorProps extends Pick<IButtonProps, 'isDanger'>, AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
47
|
+
/**
|
|
48
|
+
* Attaches `target="_blank"` and `rel="noopener noreferrer"` to an anchor that
|
|
49
|
+
* navigates to an external resource. This ensures that the anchor is a
|
|
50
|
+
* safe [cross-origin destination link](https://web.dev/external-anchors-use-rel-noopener/).
|
|
51
|
+
**/
|
|
52
|
+
isExternal?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Allows a customized/translated text label to be passed to the external link icon,
|
|
55
|
+
* making that icon accessible to assistive technology
|
|
56
|
+
**/
|
|
57
|
+
externalIconLabel?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface IButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
60
|
+
/** Defines the currently selected button in the group */
|
|
61
|
+
selectedItem?: any;
|
|
62
|
+
/**
|
|
63
|
+
* Handles button selection
|
|
64
|
+
*
|
|
65
|
+
* @param {any} item The selected item
|
|
66
|
+
*/
|
|
67
|
+
onSelect?: (item: any) => void;
|
|
68
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
/// <reference types="react" />
|
|
8
|
-
interface IButtonGroupContext {
|
|
9
|
-
selectedItem: any;
|
|
10
|
-
getButtonProps: (props: any) => any;
|
|
11
|
-
}
|
|
12
|
-
export declare const ButtonGroupContext: import("react").Context<IButtonGroupContext | undefined>;
|
|
13
|
-
export declare const useButtonGroupContext: () => IButtonGroupContext | undefined;
|
|
14
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
interface IButtonGroupContext {
|
|
9
|
+
selectedItem: any;
|
|
10
|
+
getButtonProps: (props: any) => any;
|
|
11
|
+
}
|
|
12
|
+
export declare const ButtonGroupContext: import("react").Context<IButtonGroupContext | undefined>;
|
|
13
|
+
export declare const useButtonGroupContext: () => IButtonGroupContext | undefined;
|
|
14
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
/// <reference types="react" />
|
|
8
|
-
export declare const SplitButtonContext: import("react").Context<boolean | undefined>;
|
|
9
|
-
export declare const useSplitButtonContext: () => boolean | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export declare const SplitButtonContext: import("react").Context<boolean | undefined>;
|
|
9
|
+
export declare const useSplitButtonContext: () => boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-buttons",
|
|
3
|
-
"version": "8.69.
|
|
3
|
+
"version": "8.69.4",
|
|
4
4
|
"description": "Components relating to buttons in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-
|
|
25
|
-
"@zendeskgarden/container-
|
|
24
|
+
"@zendeskgarden/container-selection": "^3.0.0",
|
|
25
|
+
"@zendeskgarden/container-utilities": "^1.0.6",
|
|
26
26
|
"polished": "^4.0.0",
|
|
27
|
-
"prop-types": "^15.5.7"
|
|
27
|
+
"prop-types": "^15.5.7",
|
|
28
|
+
"react-merge-refs": "^1.1.0"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
31
|
"@zendeskgarden/react-theming": "^8.67.0",
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@zendeskgarden/react-theming": "^8.69.
|
|
37
|
+
"@zendeskgarden/react-theming": "^8.69.4",
|
|
37
38
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
38
39
|
},
|
|
39
40
|
"keywords": [
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"access": "public"
|
|
47
48
|
},
|
|
48
49
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4911fa867a3c7e72f0c78dcea8748893c3070c17"
|
|
50
51
|
}
|