@atlaskit/ds-explorations 5.1.3 → 5.1.5
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 +13 -0
- package/dist/types/components/interaction-surface.partial.d.ts +1 -1
- package/dist/types/components/surface-provider.d.ts +1 -1
- package/dist/types-ts4.5/components/interaction-surface.partial.d.ts +1 -1
- package/dist/types-ts4.5/components/surface-provider.d.ts +1 -1
- package/package.json +5 -5
- package/scripts/capitalize.tsx +2 -0
- package/scripts/color-codegen-template.tsx +9 -11
- package/scripts/color-map-template.tsx +4 -1
- package/scripts/compose.tsx +4 -0
- package/scripts/dimension-codegen-template.tsx +1 -1
- package/scripts/interaction-codegen.tsx +7 -1
- package/scripts/is-accent.tsx +1 -0
- package/scripts/is-hovered.tsx +2 -0
- package/scripts/is-pressed.tsx +2 -0
- package/scripts/not.tsx +6 -0
- package/scripts/or.tsx +6 -0
- package/scripts/pick.tsx +4 -0
- package/scripts/token-to-style.tsx +20 -0
- package/scripts/types.tsx +16 -0
- package/scripts/utils.tsx +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/ds-explorations
|
|
2
2
|
|
|
3
|
+
## 5.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 5.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`22bf79dbdcdca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22bf79dbdcdca) -
|
|
14
|
+
Internal changes to remove unnecessary token fallbacks and imports from `@atlaskit/theme`
|
|
15
|
+
|
|
3
16
|
## 5.1.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -20,7 +20,7 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
20
20
|
* </Pressable>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId, }: InteractionSurfaceProps) => React.JSX.Element;
|
|
24
24
|
export default InteractionSurface;
|
|
25
25
|
/**
|
|
26
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
@@ -20,7 +20,7 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
20
20
|
* </Pressable>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId, }: InteractionSurfaceProps) => React.JSX.Element;
|
|
24
24
|
export default InteractionSurface;
|
|
25
25
|
/**
|
|
26
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ds-explorations",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"description": "DEPRECATED. Use @atlaskit/primitives. An experimental package for exploration and validation of spacing / typography foundations.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepare": "yarn ak-postbuild"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/tokens": "^
|
|
28
|
+
"@atlaskit/tokens": "^12.0.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
30
30
|
"@emotion/react": "^11.7.1"
|
|
31
31
|
},
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@af/formatting": "workspace:^",
|
|
37
|
-
"@atlaskit/ds-lib": "^
|
|
38
|
-
"@atlaskit/primitives": "^18.
|
|
39
|
-
"@atlaskit/textfield": "^8.
|
|
37
|
+
"@atlaskit/ds-lib": "^7.0.0",
|
|
38
|
+
"@atlaskit/primitives": "^18.1.0",
|
|
39
|
+
"@atlaskit/textfield": "^8.3.0",
|
|
40
40
|
"@atlassian/codegen": "^0.1.0",
|
|
41
41
|
"@testing-library/react": "^16.3.0",
|
|
42
42
|
"fs-extra": "^4.0.2",
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import format from '@af/formatting/sync';
|
|
2
2
|
import { light as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
tokenToStyle,
|
|
14
|
-
} from './utils';
|
|
4
|
+
import { capitalize } from './capitalize';
|
|
5
|
+
import { compose } from './compose';
|
|
6
|
+
import { isAccent } from './is-accent';
|
|
7
|
+
import { isHovered } from './is-hovered';
|
|
8
|
+
import { isPressed } from './is-pressed';
|
|
9
|
+
import { not } from './not';
|
|
10
|
+
import { pick } from './pick';
|
|
11
|
+
import { tokenToStyle } from './token-to-style';
|
|
12
|
+
import type { ShadowDefintion } from './types';
|
|
15
13
|
|
|
16
14
|
type Token = {
|
|
17
15
|
token: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import format from '@af/formatting/sync';
|
|
2
2
|
import { light as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
3
|
|
|
4
|
-
import { compose
|
|
4
|
+
import { compose } from './compose';
|
|
5
|
+
import { isAccent } from './is-accent';
|
|
6
|
+
import { not } from './not';
|
|
7
|
+
import { pick } from './pick';
|
|
5
8
|
|
|
6
9
|
type Token = {
|
|
7
10
|
token: string;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import format from '@af/formatting/sync';
|
|
2
2
|
import { light as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
3
|
|
|
4
|
-
import { capitalize
|
|
4
|
+
import { capitalize } from './capitalize';
|
|
5
|
+
import { compose } from './compose';
|
|
6
|
+
import { isAccent } from './is-accent';
|
|
7
|
+
import { isHovered } from './is-hovered';
|
|
8
|
+
import { isPressed } from './is-pressed';
|
|
9
|
+
import { or } from './or';
|
|
10
|
+
import { pick } from './pick';
|
|
5
11
|
|
|
6
12
|
type Token = {
|
|
7
13
|
token: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isAccent: (str: string) => boolean = (str: string): boolean => str.includes('accent');
|
package/scripts/not.tsx
ADDED
package/scripts/or.tsx
ADDED
package/scripts/pick.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ShadowDefintion } from './types';
|
|
4
|
+
|
|
5
|
+
const constructShadow = (shadowObject: ShadowDefintion) => {
|
|
6
|
+
return shadowObject
|
|
7
|
+
.map((shadow) => `${shadow.offset.x}px ${shadow.offset.y}px ${shadow.radius}px ${shadow.color}`)
|
|
8
|
+
.join(', ');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const tokenToStyle: (
|
|
12
|
+
prop: keyof CSSProperties,
|
|
13
|
+
token: string,
|
|
14
|
+
fallback: string | ShadowDefintion,
|
|
15
|
+
) => string = (prop: keyof CSSProperties, token: string, fallback: string | ShadowDefintion) => {
|
|
16
|
+
if (Array.isArray(fallback)) {
|
|
17
|
+
fallback = constructShadow(fallback);
|
|
18
|
+
}
|
|
19
|
+
return `css({\n\t${prop}: token('${token}', '${fallback}')\n})`;
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type BooleanCallback<T> = (args: T) => boolean;
|
|
2
|
+
|
|
3
|
+
export type Token = {
|
|
4
|
+
token: string;
|
|
5
|
+
fallback: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ShadowDefintion = Array<{
|
|
9
|
+
radius: number;
|
|
10
|
+
offset: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
color: string;
|
|
15
|
+
opacity: number;
|
|
16
|
+
}>;
|
package/scripts/utils.tsx
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export const tokenToStyle = (
|
|
4
|
-
prop: keyof CSSProperties,
|
|
5
|
-
token: string,
|
|
6
|
-
fallback: string | ShadowDefintion,
|
|
7
|
-
) => {
|
|
8
|
-
if (Array.isArray(fallback)) {
|
|
9
|
-
fallback = constructShadow(fallback);
|
|
10
|
-
}
|
|
11
|
-
return `css({\n\t${prop}: token('${token}', '${fallback}')\n})`;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type ShadowDefintion = Array<{
|
|
15
|
-
radius: number;
|
|
16
|
-
offset: {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
};
|
|
20
|
-
color: string;
|
|
21
|
-
opacity: number;
|
|
22
|
-
}>;
|
|
23
|
-
|
|
24
|
-
const constructShadow = (shadowObject: ShadowDefintion) => {
|
|
25
|
-
return shadowObject
|
|
26
|
-
.map((shadow) => `${shadow.offset.x}px ${shadow.offset.y}px ${shadow.radius}px ${shadow.color}`)
|
|
27
|
-
.join(', ');
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type BooleanCallback<T> = (args: T) => boolean;
|
|
31
|
-
|
|
32
|
-
export const compose =
|
|
33
|
-
(...fns: ((...any: any[]) => any)[]) =>
|
|
34
|
-
(x: any): any =>
|
|
35
|
-
fns.reduce((res, fn) => fn(res), x);
|
|
36
|
-
export const pick =
|
|
37
|
-
<T extends any>(key: keyof T) =>
|
|
38
|
-
(obj: T) =>
|
|
39
|
-
obj[key];
|
|
40
|
-
export const isAccent = (str: string): boolean => str.includes('accent');
|
|
41
|
-
export const isPressed = (str: string): boolean => str.includes('pressed');
|
|
42
|
-
export const isHovered = (str: string): boolean => str.includes('hovered');
|
|
43
|
-
export const not =
|
|
44
|
-
<T extends any>(cb: BooleanCallback<T>) =>
|
|
45
|
-
(val: T): boolean =>
|
|
46
|
-
!cb(val);
|
|
47
|
-
export const or =
|
|
48
|
-
<T extends any>(...fns: BooleanCallback<T>[]) =>
|
|
49
|
-
(val: T): boolean =>
|
|
50
|
-
fns.some((fn) => fn(val));
|
|
51
|
-
export const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);
|