@mirohq/design-system-types 0.2.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 +29 -0
- package/index.js +2 -0
- package/package.json +21 -0
- package/src/global.d.ts +1 -0
- package/src/index.d.ts +3 -0
- package/src/react.d.ts +18 -0
- package/src/scales.d.ts +23 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @mirohq-internal/design-system-types
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 815d405: Including global types
|
|
8
|
+
- 815d405: Including react types into the package:
|
|
9
|
+
|
|
10
|
+
- InferHTMLElement
|
|
11
|
+
- OnlyHTMLAttributes
|
|
12
|
+
|
|
13
|
+
## 0.1.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- a7bea72: Use Rollup with esbuild to build the packages
|
|
18
|
+
|
|
19
|
+
## 0.1.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 51cfb2f: Publish treeshakable packages 🌳📦👌
|
|
24
|
+
|
|
25
|
+
## 0.1.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- 7b56625: First release of the new packages extracted from the old DS packages strategy
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mirohq/design-system-types",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "Miro",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./index.js",
|
|
10
|
+
"import": "./index.js",
|
|
11
|
+
"types": "./dist/types.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "echo",
|
|
19
|
+
"clean": "echo"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Nullable<T> = T | null | undefined
|
package/src/index.d.ts
ADDED
package/src/react.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HTMLProps, ComponentProps, ElementType } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Automatically infers the type of the HTML element based on the component props
|
|
5
|
+
*
|
|
6
|
+
* const Button = (props: ComponentProps<'button'>) => <button />
|
|
7
|
+
* type Element = InferHTMLElement<typeof Button> // HTMLButtonElement
|
|
8
|
+
*/
|
|
9
|
+
export type InferHTMLElement<T extends ElementType> =
|
|
10
|
+
ComponentProps<T> extends HTMLProps<infer E> ? E : never
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Pick all the native HTML attributes from a type
|
|
14
|
+
*/
|
|
15
|
+
export type OnlyHTMLAttributes<T extends ElementType> = Pick<
|
|
16
|
+
ComponentProps<T>,
|
|
17
|
+
keyof HTMLProps<InferHTMLElement<T>>
|
|
18
|
+
>
|
package/src/scales.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DS core scales
|
|
3
|
+
*/
|
|
4
|
+
export type Scales =
|
|
5
|
+
| 'xxx-small'
|
|
6
|
+
| 'xx-small'
|
|
7
|
+
| 'x-small'
|
|
8
|
+
| 'small'
|
|
9
|
+
| 'medium'
|
|
10
|
+
| 'large'
|
|
11
|
+
| 'x-large'
|
|
12
|
+
| 'xx-large'
|
|
13
|
+
| 'xxx-large'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Filter out all non-scale options from a type
|
|
17
|
+
*/
|
|
18
|
+
export type ScaleProp<T> = Extract<
|
|
19
|
+
{
|
|
20
|
+
[K in keyof T]: T[K] extends string ? T[K] : ScaleProp<T[K]>
|
|
21
|
+
},
|
|
22
|
+
Scales | object | undefined
|
|
23
|
+
>
|