@atlaskit/ds-explorations 5.1.4 → 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/ds-explorations
2
2
 
3
+ ## 5.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 5.1.4
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "5.1.4",
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": "^11.4.0",
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": "^6.0.0",
37
+ "@atlaskit/ds-lib": "^7.0.0",
38
38
  "@atlaskit/primitives": "^18.1.0",
39
- "@atlaskit/textfield": "^8.2.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",
@@ -0,0 +1,2 @@
1
+ export const capitalize: (str: string) => string = (str: string): string =>
2
+ str.charAt(0).toUpperCase() + str.slice(1);
@@ -8,8 +8,9 @@ import { createColorMapTemplate } from './color-map-template';
8
8
  import { createInteractionStylesFromTemplate } from './interaction-codegen';
9
9
 
10
10
  const colorMapOutputFolder = join(__dirname, '../', 'src', 'internal');
11
- const colorTokensDependencyPath =
12
- require.resolve('../../tokens/src/artifacts/tokens-raw/atlassian-light');
11
+ const colorTokensDependencyPath = require.resolve(
12
+ '../../tokens/src/artifacts/tokens-raw/atlassian-light',
13
+ );
13
14
 
14
15
  writeFile(
15
16
  join(colorMapOutputFolder, 'color-map.tsx'),
@@ -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
- capitalize,
6
- compose,
7
- isAccent,
8
- isHovered,
9
- isPressed,
10
- not,
11
- pick,
12
- type ShadowDefintion,
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, isAccent, not, pick } from './utils';
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;
@@ -0,0 +1,4 @@
1
+ export const compose: (...fns: ((...any: any[]) => any)[]) => (x: any) => any =
2
+ (...fns: ((...any: any[]) => any)[]) =>
3
+ (x: any): any =>
4
+ fns.reduce((res, fn) => fn(res), x);
@@ -1,6 +1,6 @@
1
1
  import format from '@af/formatting/sync';
2
2
 
3
- import { capitalize } from './utils';
3
+ import { capitalize } from './capitalize';
4
4
 
5
5
  const dimensionProperties = {
6
6
  width: {
@@ -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, compose, isAccent, isHovered, isPressed, or, pick } 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 { 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');
@@ -0,0 +1,2 @@
1
+ export const isHovered: (str: string) => boolean = (str: string): boolean =>
2
+ str.includes('hovered');
@@ -0,0 +1,2 @@
1
+ export const isPressed: (str: string) => boolean = (str: string): boolean =>
2
+ str.includes('pressed');
@@ -0,0 +1,6 @@
1
+ import type { BooleanCallback } from './types';
2
+
3
+ export const not: <T extends any>(cb: BooleanCallback<T>) => (val: T) => boolean =
4
+ <T extends any>(cb: BooleanCallback<T>) =>
5
+ (val: T): boolean =>
6
+ !cb(val);
package/scripts/or.tsx ADDED
@@ -0,0 +1,6 @@
1
+ import type { BooleanCallback } from './types';
2
+
3
+ export const or: <T extends any>(...fns: BooleanCallback<T>[]) => (val: T) => boolean =
4
+ <T extends any>(...fns: BooleanCallback<T>[]) =>
5
+ (val: T): boolean =>
6
+ fns.some((fn) => fn(val));
@@ -0,0 +1,4 @@
1
+ export const pick: <T extends any>(key: keyof T) => (obj: T) => T[keyof T] =
2
+ <T extends any>(key: keyof T) =>
3
+ (obj: T) =>
4
+ obj[key];
@@ -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,54 +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
- ) => string = (prop: keyof CSSProperties, token: string, fallback: string | ShadowDefintion) => {
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: (...fns: ((...any: any[]) => any)[]) => (x: any) => any =
33
- (...fns: ((...any: any[]) => any)[]) =>
34
- (x: any): any =>
35
- fns.reduce((res, fn) => fn(res), x);
36
- export const pick: <T extends any>(key: keyof T) => (obj: T) => T[keyof T] =
37
- <T extends any>(key: keyof T) =>
38
- (obj: T) =>
39
- obj[key];
40
- export const isAccent: (str: string) => boolean = (str: string): boolean => str.includes('accent');
41
- export const isPressed: (str: string) => boolean = (str: string): boolean =>
42
- str.includes('pressed');
43
- export const isHovered: (str: string) => boolean = (str: string): boolean =>
44
- str.includes('hovered');
45
- export const not: <T extends any>(cb: BooleanCallback<T>) => (val: T) => boolean =
46
- <T extends any>(cb: BooleanCallback<T>) =>
47
- (val: T): boolean =>
48
- !cb(val);
49
- export const or: <T extends any>(...fns: BooleanCallback<T>[]) => (val: T) => boolean =
50
- <T extends any>(...fns: BooleanCallback<T>[]) =>
51
- (val: T): boolean =>
52
- fns.some((fn) => fn(val));
53
- export const capitalize: (str: string) => string = (str: string): string =>
54
- str.charAt(0).toUpperCase() + str.slice(1);