@mrshmllw/smores-react 13.9.0 → 13.10.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.
@@ -1,9 +1,9 @@
1
1
  import { FC } from 'react';
2
- import { Color } from '../theme';
3
2
  import { MarginProps } from '../utils/space';
3
+ import { ColorTypes } from '../ThemeProvider/utils/colourMap';
4
4
  export type DividerProps = {
5
5
  maxWidth?: string;
6
6
  height?: string;
7
- color?: Color;
7
+ color?: ColorTypes;
8
8
  } & MarginProps;
9
9
  export declare const Divider: FC<DividerProps>;
@@ -1,14 +1,16 @@
1
1
  import React, { memo } from 'react';
2
- import styled, { css } from 'styled-components';
2
+ import styled, { css, useTheme } from 'styled-components';
3
3
  import { Box } from '../Box';
4
- import { theme } from '../theme';
5
- export const Divider = memo(function Divider({ maxWidth = 'none', height = '1px', color = 'oatmeal', ...marginProps }) {
6
- return (React.createElement(Line, { "$maxWidth": maxWidth, "$height": height, "$color": color, ...marginProps }));
4
+ import { resolveToThemeColor, } from '../ThemeProvider/utils/colourMap';
5
+ export const Divider = memo(function Divider({ maxWidth = 'none', height = '1px', color = 'color.illustration.neutral.300', ...marginProps }) {
6
+ const theme = useTheme();
7
+ const resolvedColor = resolveToThemeColor(color, theme);
8
+ return (React.createElement(Line, { "$maxWidth": maxWidth, "$height": height, "$color": resolvedColor, ...marginProps }));
7
9
  });
8
10
  const Line = styled(Box) `
9
11
  ${({ $color }) => $color &&
10
12
  css `
11
- background: ${theme.colors[$color]};
13
+ background: ${$color};
12
14
  `}
13
15
  display: block;
14
16
  height: ${({ $height }) => $height};
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../src/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,IAAI,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;AASvC,MAAM,CAAC,MAAM,OAAO,GAAqB,IAAI,CAAC,SAAS,OAAO,CAAC,EAC7D,QAAQ,GAAG,MAAM,EACjB,MAAM,GAAG,KAAK,EACd,KAAK,GAAG,SAAS,EACjB,GAAG,WAAW,EACf;IACC,OAAO,CACL,oBAAC,IAAI,iBACQ,QAAQ,aACV,MAAM,YACP,KAAK,KACT,WAAW,GACf,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAEvB;IACG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACf,MAAM;IACN,GAAG,CAAA;oBACa,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;KACnC;;YAEO,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;eACrB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS;;CAE1C,CAAA","sourcesContent":["import React, { FC, memo } from 'react'\nimport styled, { css } from 'styled-components'\nimport { TransientProps } from 'utils/utilTypes'\nimport { Box } from '../Box'\nimport { Color, theme } from '../theme'\nimport { MarginProps } from '../utils/space'\n\nexport type DividerProps = {\n maxWidth?: string\n height?: string\n color?: Color\n} & MarginProps\n\nexport const Divider: FC<DividerProps> = memo(function Divider({\n maxWidth = 'none',\n height = '1px',\n color = 'oatmeal',\n ...marginProps\n}) {\n return (\n <Line\n $maxWidth={maxWidth}\n $height={height}\n $color={color}\n {...marginProps}\n />\n )\n})\n\nconst Line = styled(Box)<\n TransientProps<Pick<DividerProps, 'color' | 'height' | 'maxWidth'>>\n>`\n ${({ $color }) =>\n $color &&\n css`\n background: ${theme.colors[$color]};\n `}\n display: block;\n height: ${({ $height }) => $height};\n max-width: ${({ $maxWidth }) => $maxWidth};\n width: 100%;\n`\n"]}
1
+ {"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../src/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,IAAI,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AAQzC,MAAM,CAAC,MAAM,OAAO,GAAqB,IAAI,CAAC,SAAS,OAAO,CAAC,EAC7D,QAAQ,GAAG,MAAM,EACjB,MAAM,GAAG,KAAK,EACd,KAAK,GAAG,gCAAgC,EACxC,GAAG,WAAW,EACf;IACC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAEvD,OAAO,CACL,oBAAC,IAAI,iBACQ,QAAQ,aACV,MAAM,YACP,aAAa,KACjB,WAAW,GACf,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAIvB;IACG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACf,MAAM;IACN,GAAG,CAAA;oBACa,MAAM;KACrB;;YAEO,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;eACrB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS;;CAE1C,CAAA","sourcesContent":["import React, { FC, memo } from 'react'\nimport styled, { css, useTheme } from 'styled-components'\nimport { TransientProps } from '../utils/utilTypes'\nimport { Box } from '../Box'\nimport { MarginProps } from '../utils/space'\nimport {\n ColorTypes,\n resolveToThemeColor,\n} from '../ThemeProvider/utils/colourMap'\n\nexport type DividerProps = {\n maxWidth?: string\n height?: string\n color?: ColorTypes\n} & MarginProps\n\nexport const Divider: FC<DividerProps> = memo(function Divider({\n maxWidth = 'none',\n height = '1px',\n color = 'color.illustration.neutral.300',\n ...marginProps\n}) {\n const theme = useTheme()\n const resolvedColor = resolveToThemeColor(color, theme)\n\n return (\n <Line\n $maxWidth={maxWidth}\n $height={height}\n $color={resolvedColor}\n {...marginProps}\n />\n )\n})\n\nconst Line = styled(Box)<\n TransientProps<Pick<DividerProps, 'height' | 'maxWidth'>> & {\n $color: string\n }\n>`\n ${({ $color }) =>\n $color &&\n css`\n background: ${$color};\n `}\n display: block;\n height: ${({ $height }) => $height};\n max-width: ${({ $maxWidth }) => $maxWidth};\n width: 100%;\n`\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrshmllw/smores-react",
3
- "version": "13.9.0",
3
+ "version": "13.10.0",
4
4
  "main": "./dist/index.js",
5
5
  "description": "Collection of React components used by Marshmallow Technology",
6
6
  "type": "module",