@atlaskit/forge-react-types 0.37.14 → 0.39.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/CHANGELOG.md +25 -0
- package/dist/cjs/components/__generated__/BoxProps.codegen.js +2 -2
- package/dist/cjs/components/__generated__/PressableProps.codegen.js +183 -1
- package/dist/cjs/components/charts/BarChartProps.js +1 -5
- package/dist/cjs/components/charts/DonutChartProps.js +5 -0
- package/dist/cjs/components/charts/LineChartProps.js +1 -5
- package/dist/cjs/components/charts/PieChartProps.js +1 -5
- package/dist/es2019/components/__generated__/BoxProps.codegen.js +2 -2
- package/dist/es2019/components/__generated__/PressableProps.codegen.js +182 -0
- package/dist/es2019/components/charts/BarChartProps.js +0 -1
- package/dist/es2019/components/charts/DonutChartProps.js +1 -0
- package/dist/es2019/components/charts/LineChartProps.js +0 -1
- package/dist/es2019/components/charts/PieChartProps.js +0 -1
- package/dist/esm/components/__generated__/BoxProps.codegen.js +2 -2
- package/dist/esm/components/__generated__/PressableProps.codegen.js +182 -0
- package/dist/esm/components/charts/BarChartProps.js +0 -1
- package/dist/esm/components/charts/DonutChartProps.js +1 -0
- package/dist/esm/components/charts/LineChartProps.js +0 -1
- package/dist/esm/components/charts/PieChartProps.js +0 -1
- package/dist/types/components/__generated__/BoxProps.codegen.d.ts +3 -3
- package/dist/types/components/charts/BarChartProps.d.ts +0 -10
- package/dist/types/components/charts/DonutChartProps.d.ts +15 -0
- package/dist/types/components/charts/LineChartProps.d.ts +0 -7
- package/dist/types/components/charts/PieChartProps.d.ts +0 -14
- package/dist/types/components/charts/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/__generated__/BoxProps.codegen.d.ts +3 -3
- package/dist/types-ts4.5/components/charts/BarChartProps.d.ts +0 -10
- package/dist/types-ts4.5/components/charts/DonutChartProps.d.ts +15 -0
- package/dist/types-ts4.5/components/charts/LineChartProps.d.ts +0 -7
- package/dist/types-ts4.5/components/charts/PieChartProps.d.ts +0 -14
- package/dist/types-ts4.5/components/charts/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/codegen/codeGenerator.ts +12 -3
- package/src/components/__generated__/BoxProps.codegen.tsx +3 -3
- package/src/components/__generated__/PressableProps.codegen.tsx +238 -63
- package/src/components/charts/BarChartProps.tsx +0 -11
- package/src/components/charts/DonutChartProps.tsx +17 -0
- package/src/components/charts/LineChartProps.tsx +0 -8
- package/src/components/charts/PieChartProps.tsx +0 -15
- package/src/components/charts/index.ts +1 -1
- package/src/index.ts +2 -2
- package/dist/cjs/components/charts/SingleValueChartProps.js +0 -1
- package/dist/es2019/components/charts/SingleValueChartProps.js +0 -0
- package/dist/esm/components/charts/SingleValueChartProps.js +0 -0
- package/dist/types/components/charts/SingleValueChartProps.d.ts +0 -33
- package/dist/types-ts4.5/components/charts/SingleValueChartProps.d.ts +0 -33
- package/src/components/charts/SingleValueChartProps.tsx +0 -34
|
@@ -3,80 +3,255 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extract component prop types from UIKit 2 components - PressableProps
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::515984e69408f30f333241c0b51ceb31>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/forge-react-types codegen
|
|
8
|
-
* @codegenDependency ../../../../forge-ui/src/components/UIKit/pressable/__generated__/index.partial.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../../../forge-ui/src/components/UIKit/pressable/__generated__/index.partial.tsx <<SignedSource::a7f457ec091071415e904b705d62f605>>
|
|
9
9
|
*/
|
|
10
|
-
/* eslint @
|
|
10
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Pressable as PlatformPressable } from '@atlaskit/primitives';
|
|
14
14
|
|
|
15
|
-
type
|
|
16
|
-
|
|
15
|
+
import type { CSSProperties } from '@emotion/serialize';
|
|
16
|
+
import type * as CSS from 'csstype';
|
|
17
|
+
import type { MediaQuery } from '@atlaskit/primitives';
|
|
18
|
+
import { tokensMap } from '@atlaskit/primitives';
|
|
19
|
+
type TokensMap = typeof tokensMap;
|
|
20
|
+
type TokensMapPropKey = keyof TokensMap;
|
|
21
|
+
type TokenizedProps = {
|
|
22
|
+
[K in TokensMapPropKey]?: keyof TokensMap[K];
|
|
23
|
+
};
|
|
24
|
+
type RawCSSValue = string & {};
|
|
25
|
+
type RelaxedTokenizedProps = {
|
|
26
|
+
[K in TokensMapPropKey]?: keyof TokensMap[K] | RawCSSValue;
|
|
27
|
+
};
|
|
28
|
+
type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)';
|
|
29
|
+
type StandardCSSProps = Omit<CSSProperties, TokensMapPropKey>;
|
|
30
|
+
type RestrictedPropsSpec = RelaxedTokenizedProps & StandardCSSProps;
|
|
31
|
+
type SafeCSSObject<SupportedPropKeys extends keyof CSSProperties = keyof CSSProperties, RawCSSPropKeys extends SupportedPropKeys = SupportedPropKeys, RestrictedProps extends RestrictedPropsSpec = RestrictedPropsSpec> = {
|
|
32
|
+
[MQ in AllMedia]?: Omit<SafeCSSObject<SupportedPropKeys, RawCSSPropKeys, RestrictedPropsSpec>, AllMedia>;
|
|
33
|
+
} & {
|
|
34
|
+
[Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject<SupportedPropKeys, RawCSSPropKeys, RestrictedPropsSpec>, CSS.Pseudos | AllMedia>;
|
|
35
|
+
} & Pick<TokenizedProps, Exclude<Extract<SupportedPropKeys, TokensMapPropKey>, RawCSSPropKeys | keyof RestrictedProps>> & Pick<StandardCSSProps, Exclude<Extract<SupportedPropKeys, keyof StandardCSSProps>, RawCSSPropKeys | keyof RestrictedProps>> & // force standard css prop values for allowCSS: true
|
|
36
|
+
Pick<CSSProperties, Extract<RawCSSPropKeys, keyof CSSProperties>> & RestrictedProps;
|
|
37
|
+
type XCSSValidatorParam = {
|
|
38
|
+
[key in keyof CSSProperties]: true | {
|
|
39
|
+
supportedValues: Array<RestrictedPropsSpec[key]>;
|
|
40
|
+
} | {
|
|
41
|
+
allowCSS: true;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
17
44
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
|
|
27
|
-
*/
|
|
28
|
-
onClick?: _PlatformPressableProps['onClick'];
|
|
29
|
-
/**
|
|
30
|
-
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
31
|
-
*
|
|
32
|
-
* @see paddingBlock
|
|
33
|
-
* @see paddingInline
|
|
34
|
-
*/
|
|
35
|
-
padding?: _PlatformPressableProps['padding'];
|
|
36
|
-
/**
|
|
37
|
-
* Tokens representing CSS shorthand `paddingBlock`.
|
|
38
|
-
*
|
|
39
|
-
* @see paddingBlockStart
|
|
40
|
-
* @see paddingBlockEnd
|
|
41
|
-
*/
|
|
42
|
-
paddingBlock?: _PlatformPressableProps['paddingBlock'];
|
|
43
|
-
/**
|
|
44
|
-
* Tokens representing CSS `paddingBlockEnd`.
|
|
45
|
-
*/
|
|
46
|
-
paddingBlockEnd?: _PlatformPressableProps['paddingBlockEnd'];
|
|
47
|
-
/**
|
|
48
|
-
* Tokens representing CSS `paddingBlockStart`.
|
|
49
|
-
*/
|
|
50
|
-
paddingBlockStart?: _PlatformPressableProps['paddingBlockStart'];
|
|
51
|
-
/**
|
|
52
|
-
* Tokens representing CSS shorthand `paddingInline`.
|
|
53
|
-
*
|
|
54
|
-
* @see paddingInlineStart
|
|
55
|
-
* @see paddingInlineEnd
|
|
56
|
-
*/
|
|
57
|
-
paddingInline?: _PlatformPressableProps['paddingInline'];
|
|
58
|
-
/**
|
|
59
|
-
* Tokens representing CSS `paddingInlineEnd`.
|
|
60
|
-
*/
|
|
61
|
-
paddingInlineEnd?: _PlatformPressableProps['paddingInlineEnd'];
|
|
62
|
-
/**
|
|
63
|
-
* Tokens representing CSS `paddingInlineStart`.
|
|
64
|
-
*/
|
|
65
|
-
paddingInlineStart?: _PlatformPressableProps['paddingInlineStart'];
|
|
66
|
-
/**
|
|
67
|
-
* A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
|
|
45
|
+
*
|
|
46
|
+
* @param supportedXCSSProps - the list of css props to be supported for the intended component.
|
|
47
|
+
* If not provided, all the props will be supported. The props could be either standard css props
|
|
48
|
+
* or design token based props. If the prop is a design token based prop, the value of the prop
|
|
49
|
+
* will be validated against the design tokens map to ensure the value is a valid design token string.
|
|
50
|
+
* @returns a function that takes a style object and returns a style object with only the supported props
|
|
51
|
+
* as specified in the supportedXCSSProps list. The props that are not supported will be removed from the
|
|
52
|
+
* returned style object and a warning will be logged in the console.
|
|
68
53
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
declare const makeXCSSValidator: <U extends XCSSValidatorParam>(supportedXCSSProps: U) => (styleObj: SafeCSSObject<keyof CSSProperties, keyof CSSProperties, RestrictedPropsSpec> | SafeCSSObject<Extract<keyof U, keyof CSSProperties>, Extract<{ [K in Extract<keyof U, keyof CSSProperties>]: U[K] extends {
|
|
55
|
+
allowCSS: true;
|
|
56
|
+
} ? K : never; }[Extract<keyof U, keyof CSSProperties>], Extract<keyof U, keyof CSSProperties>>, { [K_2 in Extract<{ [K_1 in Extract<keyof U, keyof CSSProperties>]: U[K_1] extends {
|
|
57
|
+
supportedValues: RestrictedPropsSpec[K_1][];
|
|
58
|
+
} ? K_1 : never; }[Extract<keyof U, keyof CSSProperties>], Extract<keyof U, keyof CSSProperties>>]?: (U[K_2] extends {
|
|
59
|
+
supportedValues: infer V;
|
|
60
|
+
} ? Exclude<V[keyof V], number | Function> : never) | undefined; }>) => SafeCSSObject<Extract<keyof U, keyof CSSProperties>, Extract<{ [K in Extract<keyof U, keyof CSSProperties>]: U[K] extends {
|
|
61
|
+
allowCSS: true;
|
|
62
|
+
} ? K : never; }[Extract<keyof U, keyof CSSProperties>], Extract<keyof U, keyof CSSProperties>>, { [K_2 in Extract<{ [K_1 in Extract<keyof U, keyof CSSProperties>]: U[K_1] extends {
|
|
63
|
+
supportedValues: RestrictedPropsSpec[K_1][];
|
|
64
|
+
} ? K_1 : never; }[Extract<keyof U, keyof CSSProperties>], Extract<keyof U, keyof CSSProperties>>]?: (U[K_2] extends {
|
|
65
|
+
supportedValues: infer V;
|
|
66
|
+
} ? Exclude<V[keyof V], number | Function> : never) | undefined; }>;
|
|
67
|
+
export { makeXCSSValidator };
|
|
68
|
+
export type { SafeCSSObject };
|
|
69
|
+
|
|
70
|
+
const xcssValidator = makeXCSSValidator({
|
|
71
|
+
// color related props
|
|
72
|
+
color: true,
|
|
73
|
+
boxShadow: true,
|
|
74
|
+
opacity: true,
|
|
75
|
+
backgroundColor: true,
|
|
76
|
+
borderColor: true,
|
|
77
|
+
borderBlockColor: true,
|
|
78
|
+
borderBlockEndColor: true,
|
|
79
|
+
borderBlockStartColor: true,
|
|
80
|
+
borderBottomColor: true,
|
|
81
|
+
borderInlineColor: true,
|
|
82
|
+
borderInlineEndColor: true,
|
|
83
|
+
borderInlineStartColor: true,
|
|
84
|
+
borderLeftColor: true,
|
|
85
|
+
borderRightColor: true,
|
|
86
|
+
borderTopColor: true,
|
|
87
|
+
|
|
88
|
+
overflow: {
|
|
89
|
+
supportedValues: ['hidden', 'visible', 'scroll', 'auto'],
|
|
90
|
+
},
|
|
71
91
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
overflowX: {
|
|
93
|
+
supportedValues: ['hidden', 'visible', 'scroll', 'auto'],
|
|
94
|
+
},
|
|
95
|
+
overflowY: {
|
|
96
|
+
supportedValues: ['hidden', 'visible', 'scroll', 'auto'],
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// layout and space related props
|
|
100
|
+
display: {
|
|
101
|
+
supportedValues: ['block', 'inline-block', 'inline', 'none'],
|
|
102
|
+
},
|
|
103
|
+
flexGrow: {
|
|
104
|
+
allowCSS: true,
|
|
105
|
+
},
|
|
106
|
+
width: {
|
|
107
|
+
allowCSS: true,
|
|
108
|
+
},
|
|
109
|
+
height: {
|
|
110
|
+
allowCSS: true,
|
|
111
|
+
},
|
|
112
|
+
minWidth: {
|
|
113
|
+
allowCSS: true,
|
|
114
|
+
},
|
|
115
|
+
maxWidth: {
|
|
116
|
+
allowCSS: true,
|
|
117
|
+
},
|
|
118
|
+
minHeight: {
|
|
119
|
+
allowCSS: true,
|
|
120
|
+
},
|
|
121
|
+
maxHeight: {
|
|
122
|
+
allowCSS: true,
|
|
123
|
+
},
|
|
124
|
+
margin: true,
|
|
125
|
+
marginBlock: true,
|
|
126
|
+
marginBlockEnd: true,
|
|
127
|
+
marginBlockStart: true,
|
|
128
|
+
marginBottom: true,
|
|
129
|
+
marginInline: true,
|
|
130
|
+
marginInlineEnd: true,
|
|
131
|
+
marginInlineStart: true,
|
|
132
|
+
marginLeft: true,
|
|
133
|
+
marginRight: true,
|
|
134
|
+
marginTop: true,
|
|
135
|
+
padding: true,
|
|
136
|
+
paddingBlock: true,
|
|
137
|
+
paddingBlockEnd: true,
|
|
138
|
+
paddingBlockStart: true,
|
|
139
|
+
paddingBottom: true,
|
|
140
|
+
paddingInline: true,
|
|
141
|
+
paddingInlineEnd: true,
|
|
142
|
+
paddingInlineStart: true,
|
|
143
|
+
paddingLeft: true,
|
|
144
|
+
paddingRight: true,
|
|
145
|
+
paddingTop: true,
|
|
146
|
+
|
|
147
|
+
// other box related props
|
|
148
|
+
borderRadius: { supportedValues: ['border.radius'] },
|
|
149
|
+
borderBottomLeftRadius: { supportedValues: ['border.radius'] },
|
|
150
|
+
borderBottomRightRadius: { supportedValues: ['border.radius'] },
|
|
151
|
+
borderTopLeftRadius: { supportedValues: ['border.radius'] },
|
|
152
|
+
borderTopRightRadius: { supportedValues: ['border.radius'] },
|
|
153
|
+
borderEndEndRadius: { supportedValues: ['border.radius'] },
|
|
154
|
+
borderEndStartRadius: { supportedValues: ['border.radius'] },
|
|
155
|
+
borderStartEndRadius: { supportedValues: ['border.radius'] },
|
|
156
|
+
borderStartStartRadius: { supportedValues: ['border.radius'] },
|
|
157
|
+
borderWidth: { supportedValues: ['border.width'] },
|
|
158
|
+
borderBlockWidth: { supportedValues: ['border.width'] },
|
|
159
|
+
borderBlockEndWidth: { supportedValues: ['border.width'] },
|
|
160
|
+
borderBlockStartWidth: { supportedValues: ['border.width'] },
|
|
161
|
+
borderBottomWidth: { supportedValues: ['border.width'] },
|
|
162
|
+
borderInlineWidth: { supportedValues: ['border.width'] },
|
|
163
|
+
borderInlineEndWidth: { supportedValues: ['border.width'] },
|
|
164
|
+
borderInlineStartWidth: { supportedValues: ['border.width'] },
|
|
165
|
+
borderLeftWidth: { supportedValues: ['border.width'] },
|
|
166
|
+
borderRightWidth: { supportedValues: ['border.width'] },
|
|
167
|
+
borderTopWidth: { supportedValues: ['border.width'] },
|
|
168
|
+
|
|
169
|
+
// other props not in tokens based props
|
|
170
|
+
borderTopStyle: {
|
|
171
|
+
supportedValues: ['dotted', 'dashed', 'solid', 'none', 'hidden'],
|
|
172
|
+
},
|
|
173
|
+
borderBottomStyle: {
|
|
174
|
+
supportedValues: ['dotted', 'dashed', 'solid', 'none', 'hidden'],
|
|
175
|
+
},
|
|
176
|
+
borderRightStyle: {
|
|
177
|
+
supportedValues: ['dotted', 'dashed', 'solid', 'none', 'hidden'],
|
|
178
|
+
},
|
|
179
|
+
borderLeftStyle: {
|
|
180
|
+
supportedValues: ['dotted', 'dashed', 'solid', 'none', 'hidden'],
|
|
181
|
+
},
|
|
182
|
+
borderStyle: {
|
|
183
|
+
supportedValues: ['dotted', 'dashed', 'solid', 'none', 'hidden'],
|
|
184
|
+
},
|
|
185
|
+
position: {
|
|
186
|
+
supportedValues: ['relative', 'static'],
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
type XCSSProp = ReturnType<typeof xcssValidator>;
|
|
190
|
+
|
|
191
|
+
type PlatformPressableProps = React.ComponentProps<typeof PlatformPressable>;
|
|
192
|
+
|
|
193
|
+
export type PressableProps = Pick<PlatformPressableProps, 'children' | 'ref' | 'testId'> & {
|
|
194
|
+
/**
|
|
195
|
+
* Token representing background color with a built-in fallback value.
|
|
196
|
+
*/
|
|
197
|
+
backgroundColor?: PlatformPressableProps['backgroundColor'],
|
|
198
|
+
/**
|
|
199
|
+
* Whether the button is disabled.
|
|
200
|
+
*/
|
|
201
|
+
isDisabled?: PlatformPressableProps['isDisabled'],
|
|
202
|
+
/**
|
|
203
|
+
* Handler called on click.
|
|
204
|
+
*/
|
|
205
|
+
onClick?: () => void,
|
|
206
|
+
/**
|
|
207
|
+
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
208
|
+
*
|
|
209
|
+
* @see paddingBlock
|
|
210
|
+
* @see paddingInline
|
|
211
|
+
*/
|
|
212
|
+
padding?: PlatformPressableProps['padding'],
|
|
213
|
+
/**
|
|
214
|
+
* Tokens representing CSS shorthand `paddingBlock`.
|
|
215
|
+
*
|
|
216
|
+
* @see paddingBlockStart
|
|
217
|
+
* @see paddingBlockEnd
|
|
218
|
+
*/
|
|
219
|
+
paddingBlock?: PlatformPressableProps['paddingBlock'],
|
|
220
|
+
/**
|
|
221
|
+
* Tokens representing CSS `paddingBlockEnd`.
|
|
222
|
+
*/
|
|
223
|
+
paddingBlockEnd?: PlatformPressableProps['paddingBlockEnd'],
|
|
224
|
+
/**
|
|
225
|
+
* Tokens representing CSS `paddingBlockStart`.
|
|
226
|
+
*/
|
|
227
|
+
paddingBlockStart?: PlatformPressableProps['paddingBlockStart'],
|
|
228
|
+
/**
|
|
229
|
+
* Tokens representing CSS shorthand `paddingInline`.
|
|
230
|
+
*
|
|
231
|
+
* @see paddingInlineStart
|
|
232
|
+
* @see paddingInlineEnd
|
|
233
|
+
*/
|
|
234
|
+
paddingInline?: PlatformPressableProps['paddingInline'],
|
|
235
|
+
/**
|
|
236
|
+
* Tokens representing CSS `paddingInlineEnd`.
|
|
237
|
+
*/
|
|
238
|
+
paddingInlineEnd?: PlatformPressableProps['paddingInlineEnd'],
|
|
239
|
+
/**
|
|
240
|
+
* Tokens representing CSS `paddingInlineStart`.
|
|
241
|
+
*/
|
|
242
|
+
paddingInlineStart?: PlatformPressableProps['paddingInlineStart'],
|
|
243
|
+
/**
|
|
244
|
+
* Apply a subset of permitted styles, powered by Atlassian Design System tokens.
|
|
245
|
+
* For a list of supported style properties on this component, see [here](https://developer.atlassian.com/platform/forge/ui-kit/components/xcss).
|
|
246
|
+
*
|
|
247
|
+
* @type XCSSProp
|
|
248
|
+
*/
|
|
249
|
+
xcss?: XCSSProp;
|
|
250
|
+
}
|
|
76
251
|
|
|
77
252
|
/**
|
|
78
253
|
* A pressable is a primitive for building custom buttons.
|
|
79
|
-
*
|
|
80
|
-
* @
|
|
254
|
+
*
|
|
255
|
+
* @see [Pressable](https://developer.atlassian.com/platform/forge/ui-kit/components/pressable/) in UI Kit documentation for more information
|
|
81
256
|
*/
|
|
82
257
|
export type TPressable<T> = (props: PressableProps) => T;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ChartColorTokens } from '../../types';
|
|
2
|
-
|
|
3
1
|
export type BarChartProps = {
|
|
4
2
|
/**
|
|
5
3
|
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
@@ -15,10 +13,6 @@ export type BarChartProps = {
|
|
|
15
13
|
* 2. An [array of objects](https://developer.atlassian.com/platform/forge/ui-kit/components/bar-chart/#2--array-of-objects).
|
|
16
14
|
*/
|
|
17
15
|
data: unknown[];
|
|
18
|
-
/**
|
|
19
|
-
* Boolean to display the chart border. Defaults to `false`.
|
|
20
|
-
*/
|
|
21
|
-
showBorder?: boolean;
|
|
22
16
|
/**
|
|
23
17
|
* Accessor to define the x-axis values. This can be a numerical or string index.
|
|
24
18
|
* For more information on all accessors, see [Data](https://developer.atlassian.com/platform/forge/ui-kit/components/bar-chart/#data).
|
|
@@ -40,11 +34,6 @@ export type BarChartProps = {
|
|
|
40
34
|
* A string value that represents the subtitle of the chart. This appears below the title.
|
|
41
35
|
*/
|
|
42
36
|
subtitle?: string;
|
|
43
|
-
/**
|
|
44
|
-
* An array of [chart color tokens](https://atlassian.design/components/tokens/all-tokens#color-chart).
|
|
45
|
-
* This is utilized to render each bar with the specified colors, based on the color grouping given by colorAccessor.
|
|
46
|
-
*/
|
|
47
|
-
colors?: ChartColorTokens[];
|
|
48
37
|
};
|
|
49
38
|
|
|
50
39
|
type StackChartProps = BarChartProps & {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PieChartProps } from './PieChartProps';
|
|
2
|
+
|
|
3
|
+
export type DonutChartProps = PieChartProps & {
|
|
4
|
+
/**
|
|
5
|
+
* The radius of the inner circle of the donut chart in pixels. If this is not specified, the radius is responsive.
|
|
6
|
+
*/
|
|
7
|
+
innerRadius?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The radius of the outer circle of the donut chart in pixels. If this is not specified, the radius is responsive.
|
|
10
|
+
*/
|
|
11
|
+
outerRadius?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A visual representation of data proportions in a donut format.
|
|
16
|
+
*/
|
|
17
|
+
export type TDonutChart<T> = (props: DonutChartProps) => T;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ChartColorTokens } from '../../types';
|
|
2
|
-
|
|
3
1
|
export type LineChartProps = {
|
|
4
2
|
/**
|
|
5
3
|
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
@@ -15,7 +13,6 @@ export type LineChartProps = {
|
|
|
15
13
|
* 2. An [array of objects](https://developer.atlassian.com/platform/forge/ui-kit/components/line-chart/#2--array-of-objects).
|
|
16
14
|
*/
|
|
17
15
|
data: unknown[];
|
|
18
|
-
showBorder?: boolean;
|
|
19
16
|
/**
|
|
20
17
|
* Accessor to define the x-axis values. This can be a numerical or string index.
|
|
21
18
|
* For more information on all accessors, see [Data](https://developer.atlassian.com/platform/forge/ui-kit/components/line-chart/#data).
|
|
@@ -37,11 +34,6 @@ export type LineChartProps = {
|
|
|
37
34
|
* A string value that represents the subtitle of the chart. This appears below the title.
|
|
38
35
|
*/
|
|
39
36
|
subtitle?: string;
|
|
40
|
-
/**
|
|
41
|
-
* An array of [chart color tokens](https://atlassian.design/components/tokens/all-tokens#color-chart).
|
|
42
|
-
* This is utilized to render each line with the specified colors, based on the color grouping given by colorAccessor.
|
|
43
|
-
*/
|
|
44
|
-
colors?: ChartColorTokens[];
|
|
45
37
|
};
|
|
46
38
|
|
|
47
39
|
/**
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ChartColorTokens } from '../../types';
|
|
2
|
-
|
|
3
1
|
export type PieChartProps = {
|
|
4
2
|
/**
|
|
5
3
|
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
@@ -15,10 +13,6 @@ export type PieChartProps = {
|
|
|
15
13
|
* 2. [Array of objects](https://developer.atlassian.com/platform/forge/ui-kit/components/pie-chart/#2--array-of-objects).
|
|
16
14
|
*/
|
|
17
15
|
data: unknown[];
|
|
18
|
-
/**
|
|
19
|
-
* Boolean to display the chart border. Defaults to `false`.
|
|
20
|
-
*/
|
|
21
|
-
showBorder?: boolean;
|
|
22
16
|
/**
|
|
23
17
|
* Accessor to define the color grouping. This can be a numerical or string index.
|
|
24
18
|
* For more information on all accessors, see [Data](https://developer.atlassian.com/platform/forge/ui-kit/components/pie-chart/#data).
|
|
@@ -40,19 +34,10 @@ export type PieChartProps = {
|
|
|
40
34
|
* A string value that represents the subtitle of the chart. This appears below the title.
|
|
41
35
|
*/
|
|
42
36
|
subtitle?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Boolean to render the pie as the donut variation. Defaults to `false`.
|
|
45
|
-
*/
|
|
46
|
-
isDonut?: boolean;
|
|
47
37
|
/**
|
|
48
38
|
* Boolean to display labels on top of each slice. Defaults to `false`.
|
|
49
39
|
*/
|
|
50
40
|
showMarkLabels?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* An array of [chart color tokens](https://atlassian.design/components/tokens/all-tokens#color-chart).
|
|
53
|
-
* This is utilized to render each slice with the specified colors, based on the color grouping given by colorAccessor.
|
|
54
|
-
*/
|
|
55
|
-
colors?: ChartColorTokens[];
|
|
56
41
|
};
|
|
57
42
|
|
|
58
43
|
/**
|
|
@@ -10,5 +10,5 @@ export type {
|
|
|
10
10
|
} from './BarChartProps';
|
|
11
11
|
|
|
12
12
|
export type { LineChartProps, TLineChart } from './LineChartProps';
|
|
13
|
-
export type { SingleValueChartProps, TSingleValueChart } from './SingleValueChartProps';
|
|
14
13
|
export type { PieChartProps, TPieChart } from './PieChartProps';
|
|
14
|
+
export type { DonutChartProps, TDonutChart } from './DonutChartProps';
|
package/src/index.ts
CHANGED
|
@@ -131,14 +131,14 @@ export type {
|
|
|
131
131
|
HorizontalStackBarChartProps,
|
|
132
132
|
HorizontalBarChartProps,
|
|
133
133
|
LineChartProps,
|
|
134
|
-
|
|
134
|
+
DonutChartProps,
|
|
135
135
|
PieChartProps,
|
|
136
136
|
TBarChart,
|
|
137
137
|
TStackBarChart,
|
|
138
138
|
THorizontalStackBarChart,
|
|
139
139
|
THorizontalBarChart,
|
|
140
140
|
TLineChart,
|
|
141
|
-
|
|
141
|
+
TDonutChart,
|
|
142
142
|
TPieChart,
|
|
143
143
|
} from './components/charts';
|
|
144
144
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type SingleValueChartProps = {
|
|
2
|
-
/**
|
|
3
|
-
* Data can be one of two formats:
|
|
4
|
-
* 1. A **number** - The value that is displayed, abbreviated at the thousand, millions, trillions and billions.
|
|
5
|
-
* 2. An **array of numbers**: The first number in the array is used as the display value, the second number in the array is used to calculate the increase/decrease percentage relative to the first number.
|
|
6
|
-
*/
|
|
7
|
-
data: number | number[];
|
|
8
|
-
/**
|
|
9
|
-
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
10
|
-
*/
|
|
11
|
-
width?: number;
|
|
12
|
-
/**
|
|
13
|
-
* The static height of the chart in pixels. Defaults to `120`.
|
|
14
|
-
*/
|
|
15
|
-
height?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Boolean to display the chart border. Defaults to `false`.
|
|
18
|
-
*/
|
|
19
|
-
showBorder?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* A string value that represents the title of the chart.
|
|
22
|
-
*/
|
|
23
|
-
title?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A string value that represents the subtitle of the chart. This appears below the metric value.
|
|
26
|
-
*/
|
|
27
|
-
subtitle?: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* A visualization representation of information with a single value as its metrics.
|
|
31
|
-
* The metric can be displayed with a increase/decrease indicator to display trends or changes over time.
|
|
32
|
-
*/
|
|
33
|
-
export type TSingleValueChart<T> = (props: SingleValueChartProps) => T;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type SingleValueChartProps = {
|
|
2
|
-
/**
|
|
3
|
-
* Data can be one of two formats:
|
|
4
|
-
* 1. A **number** - The value that is displayed, abbreviated at the thousand, millions, trillions and billions.
|
|
5
|
-
* 2. An **array of numbers**: The first number in the array is used as the display value, the second number in the array is used to calculate the increase/decrease percentage relative to the first number.
|
|
6
|
-
*/
|
|
7
|
-
data: number | number[];
|
|
8
|
-
/**
|
|
9
|
-
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
10
|
-
*/
|
|
11
|
-
width?: number;
|
|
12
|
-
/**
|
|
13
|
-
* The static height of the chart in pixels. Defaults to `120`.
|
|
14
|
-
*/
|
|
15
|
-
height?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Boolean to display the chart border. Defaults to `false`.
|
|
18
|
-
*/
|
|
19
|
-
showBorder?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* A string value that represents the title of the chart.
|
|
22
|
-
*/
|
|
23
|
-
title?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A string value that represents the subtitle of the chart. This appears below the metric value.
|
|
26
|
-
*/
|
|
27
|
-
subtitle?: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* A visualization representation of information with a single value as its metrics.
|
|
31
|
-
* The metric can be displayed with a increase/decrease indicator to display trends or changes over time.
|
|
32
|
-
*/
|
|
33
|
-
export type TSingleValueChart<T> = (props: SingleValueChartProps) => T;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type SingleValueChartProps = {
|
|
2
|
-
/**
|
|
3
|
-
* Data can be one of two formats:
|
|
4
|
-
* 1. A **number** - The value that is displayed, abbreviated at the thousand, millions, trillions and billions.
|
|
5
|
-
* 2. An **array of numbers**: The first number in the array is used as the display value, the second number in the array is used to calculate the increase/decrease percentage relative to the first number.
|
|
6
|
-
*/
|
|
7
|
-
data: number | number[];
|
|
8
|
-
/**
|
|
9
|
-
* The static width of the chart in pixels. If this is not specified, the width is responsive.
|
|
10
|
-
*/
|
|
11
|
-
width?: number;
|
|
12
|
-
/**
|
|
13
|
-
* The static height of the chart in pixels. Defaults to `120`.
|
|
14
|
-
*/
|
|
15
|
-
height?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Boolean to display the chart border. Defaults to `false`.
|
|
18
|
-
*/
|
|
19
|
-
showBorder?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* A string value that represents the title of the chart.
|
|
22
|
-
*/
|
|
23
|
-
title?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A string value that represents the subtitle of the chart. This appears below the metric value.
|
|
26
|
-
*/
|
|
27
|
-
subtitle?: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A visualization representation of information with a single value as its metrics.
|
|
32
|
-
* The metric can be displayed with a increase/decrease indicator to display trends or changes over time.
|
|
33
|
-
*/
|
|
34
|
-
export type TSingleValueChart<T> = (props: SingleValueChartProps) => T;
|