@os-design/styles 1.0.44 → 1.0.46
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/package.json +13 -6
- package/src/@types/emotion.d.ts +7 -0
- package/src/ellipsisStyles/index.ts +9 -0
- package/src/enableScrollingStyles/index.ts +28 -0
- package/src/horizontalPaddingStyles/index.ts +19 -0
- package/src/index.ts +11 -0
- package/src/lineClampStyles/index.ts +11 -0
- package/src/resetButtonStyles/index.ts +10 -0
- package/src/resetFocusStyles/index.ts +9 -0
- package/src/resetUlStyles/index.ts +9 -0
- package/src/sizeStyles/index.ts +25 -0
- package/src/transitionStyles/index.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design/styles",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -14,7 +14,14 @@
|
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"src",
|
|
19
|
+
"!**/*.test.ts",
|
|
20
|
+
"!**/*.test.tsx",
|
|
21
|
+
"!**/__tests__",
|
|
22
|
+
"!**/*.stories.tsx",
|
|
23
|
+
"!**/*.stories.mdx",
|
|
24
|
+
"!**/*.example.tsx"
|
|
18
25
|
],
|
|
19
26
|
"sideEffects": false,
|
|
20
27
|
"scripts": {
|
|
@@ -29,18 +36,18 @@
|
|
|
29
36
|
"access": "public"
|
|
30
37
|
},
|
|
31
38
|
"dependencies": {
|
|
32
|
-
"@os-design/media": "^1.0.
|
|
33
|
-
"@os-design/theming": "^1.0.
|
|
39
|
+
"@os-design/media": "^1.0.20",
|
|
40
|
+
"@os-design/theming": "^1.0.44",
|
|
34
41
|
"facepaint": "^1.2.1"
|
|
35
42
|
},
|
|
36
43
|
"devDependencies": {
|
|
37
44
|
"@emotion/react": ">=11",
|
|
38
45
|
"@emotion/serialize": "*",
|
|
39
|
-
"@os-design/omit-emotion-props": "^1.0.
|
|
46
|
+
"@os-design/omit-emotion-props": "^1.0.13"
|
|
40
47
|
},
|
|
41
48
|
"peerDependencies": {
|
|
42
49
|
"@emotion/react": ">=11",
|
|
43
50
|
"@emotion/serialize": "*"
|
|
44
51
|
},
|
|
45
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e5d8409760608145d2c738aa5789d0465ae5416f"
|
|
46
53
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { SerializedStyles } from '@emotion/serialize';
|
|
3
|
+
|
|
4
|
+
const enableScrollingStyles = (
|
|
5
|
+
axis: 'x' | 'y' | 'both',
|
|
6
|
+
showScrollbar = true
|
|
7
|
+
): SerializedStyles => css`
|
|
8
|
+
${['x', 'both'].includes(axis) &&
|
|
9
|
+
css`
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
`};
|
|
12
|
+
|
|
13
|
+
${['y', 'both'].includes(axis) &&
|
|
14
|
+
css`
|
|
15
|
+
overflow-y: auto;
|
|
16
|
+
`};
|
|
17
|
+
|
|
18
|
+
${!showScrollbar &&
|
|
19
|
+
css`
|
|
20
|
+
::-webkit-scrollbar {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
`};
|
|
24
|
+
|
|
25
|
+
-webkit-overflow-scrolling: touch;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export default enableScrollingStyles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { m } from '@os-design/media';
|
|
2
|
+
import fp from 'facepaint';
|
|
3
|
+
|
|
4
|
+
type Side = 'left' | 'right' | 'both';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
7
|
+
const horizontalPaddingStyles =
|
|
8
|
+
(side: Side = 'both') =>
|
|
9
|
+
(p) =>
|
|
10
|
+
fp([m.min.sm])({
|
|
11
|
+
paddingLeft: ['left', 'both'].includes(side)
|
|
12
|
+
? p.theme.horizontalPadding.map((v) => `${v}em`)
|
|
13
|
+
: undefined,
|
|
14
|
+
paddingRight: ['right', 'both'].includes(side)
|
|
15
|
+
? p.theme.horizontalPadding.map((v) => `${v}em`)
|
|
16
|
+
: undefined,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default horizontalPaddingStyles;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as ellipsisStyles } from './ellipsisStyles';
|
|
2
|
+
export { default as enableScrollingStyles } from './enableScrollingStyles';
|
|
3
|
+
export { default as horizontalPaddingStyles } from './horizontalPaddingStyles';
|
|
4
|
+
export { default as lineClampStyles } from './lineClampStyles';
|
|
5
|
+
export { default as resetButtonStyles } from './resetButtonStyles';
|
|
6
|
+
export { default as resetFocusStyles } from './resetFocusStyles';
|
|
7
|
+
export { default as resetUlStyles } from './resetUlStyles';
|
|
8
|
+
export { default as sizeStyles } from './sizeStyles';
|
|
9
|
+
export { default as transitionStyles } from './transitionStyles';
|
|
10
|
+
|
|
11
|
+
export * from './sizeStyles';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { SerializedStyles } from '@emotion/serialize';
|
|
3
|
+
|
|
4
|
+
const lineClampStyles = (maxLines: number): SerializedStyles => css`
|
|
5
|
+
display: -webkit-box;
|
|
6
|
+
-webkit-line-clamp: ${maxLines};
|
|
7
|
+
-webkit-box-orient: vertical;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
export default lineClampStyles;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { SerializedStyles } from '@emotion/serialize';
|
|
3
|
+
|
|
4
|
+
export interface WithSize {
|
|
5
|
+
/**
|
|
6
|
+
* The size of the element.
|
|
7
|
+
* @default medium
|
|
8
|
+
*/
|
|
9
|
+
size?: 'small' | 'medium' | 'large' | string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
13
|
+
const sizeStyles = (p): SerializedStyles => {
|
|
14
|
+
const size = p.theme.sizes[p.size || 'medium'];
|
|
15
|
+
if (!size) {
|
|
16
|
+
return css`
|
|
17
|
+
font-size: ${p.size};
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
return css`
|
|
21
|
+
font-size: ${size}em;
|
|
22
|
+
`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default sizeStyles;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { SerializedStyles } from '@emotion/serialize';
|
|
3
|
+
|
|
4
|
+
const singleTransitionStyles = (property: string) => (p) =>
|
|
5
|
+
css`
|
|
6
|
+
transition: ${property} ${p.theme.transitionDelay}ms;
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
const multipleTransitionsStyles = (properties: string[]) => (p) =>
|
|
10
|
+
css`
|
|
11
|
+
transition: all ${p.theme.transitionDelay}ms;
|
|
12
|
+
transition-property: ${properties.join(', ')};
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
16
|
+
const transitionStyles =
|
|
17
|
+
(...props: string[]) =>
|
|
18
|
+
(p): SerializedStyles =>
|
|
19
|
+
props.length === 1
|
|
20
|
+
? singleTransitionStyles(props[0])(p)
|
|
21
|
+
: multipleTransitionsStyles(props)(p);
|
|
22
|
+
|
|
23
|
+
export default transitionStyles;
|