@datalayer/primer-addons 1.0.2 → 1.0.3
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/lib/components/box/Box.d.ts +7 -0
- package/lib/components/box/Box.js +10 -0
- package/lib/components/box/sx.d.ts +21 -0
- package/lib/components/box/sx.js +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import type { BackgroundProps, BorderProps, ColorProps, FlexboxProps, GridProps, LayoutProps, PositionProps, ShadowProps, SpaceProps, TypographyProps } from 'styled-system';
|
|
3
|
+
import { type SxProp } from './sx';
|
|
4
|
+
type StyledBoxProps = SxProp & SpaceProps & ColorProps & TypographyProps & LayoutProps & FlexboxProps & GridProps & BackgroundProps & BorderProps & PositionProps & ShadowProps;
|
|
5
|
+
export declare const Box: import("styled-components").StyledComponent<"div", any, StyledBoxProps, never>;
|
|
6
|
+
export type BoxProps = ComponentProps<typeof Box>;
|
|
7
|
+
export default Box;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Datalayer License
|
|
5
|
+
*/
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { background, border, color, flexbox, grid, layout, position, shadow, space, typography } from 'styled-system';
|
|
8
|
+
import sx from './sx';
|
|
9
|
+
export const Box = styled.div(space, color, typography, layout, flexbox, grid, background, border, position, shadow, sx);
|
|
10
|
+
export default Box;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SystemCssProperties, SystemStyleObject } from '@styled-system/css';
|
|
2
|
+
import type { ColorProps, BorderColorProps, ShadowProps } from 'styled-system';
|
|
3
|
+
import merge from 'deepmerge';
|
|
4
|
+
type ThemeColorPaths = string;
|
|
5
|
+
type ThemeShadowPaths = string;
|
|
6
|
+
export type BetterCssProperties = {
|
|
7
|
+
[K in keyof SystemCssProperties]: K extends keyof ColorProps ? ThemeColorPaths | SystemCssProperties[K] : K extends keyof BorderColorProps ? ThemeColorPaths | SystemCssProperties[K] : K extends keyof ShadowProps ? ThemeShadowPaths | SystemCssProperties[K] : SystemCssProperties[K];
|
|
8
|
+
};
|
|
9
|
+
export type CSSCustomProperties = {
|
|
10
|
+
[key: `--${string}`]: string | number;
|
|
11
|
+
};
|
|
12
|
+
type CSSSelectorObject = {
|
|
13
|
+
[cssSelector: string]: SystemStyleObject | CSSCustomProperties;
|
|
14
|
+
};
|
|
15
|
+
export type BetterSystemStyleObject = BetterCssProperties | SystemStyleObject | CSSCustomProperties | CSSSelectorObject;
|
|
16
|
+
export interface SxProp {
|
|
17
|
+
sx?: BetterSystemStyleObject;
|
|
18
|
+
}
|
|
19
|
+
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
|
20
|
+
export default sx;
|
|
21
|
+
export { merge };
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED