@os-design/omit-emotion-props 1.0.17 → 1.0.19

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/dist/cjs/index.js CHANGED
@@ -14,6 +14,5 @@ var omitEmotionProps = function omitEmotionProps() {
14
14
  }
15
15
  };
16
16
  };
17
- var _default = omitEmotionProps;
18
- exports["default"] = _default;
17
+ var _default = exports["default"] = omitEmotionProps;
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["omitEmotionProps","_len","arguments","length","props","Array","_key","shouldForwardProp","p","includes","_default","exports"],"sources":["../../src/index.ts"],"sourcesContent":["interface OmitEmotionPropsRes {\n shouldForwardProp: (prop: string) => boolean;\n}\n\nconst omitEmotionProps = (...props: string[]): OmitEmotionPropsRes => ({\n shouldForwardProp: (p) => !props.includes(p),\n});\n\nexport default omitEmotionProps;\n"],"mappings":";;;;;;AAIA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,KAAK,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAALF,KAAK,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,OAAqC;IACrEC,iBAAiB,EAAE,SAAAA,kBAACC,CAAC;MAAA,OAAK,CAACJ,KAAK,CAACK,QAAQ,CAACD,CAAC,CAAC;IAAA;EAC9C,CAAC;AAAA,CAAC;AAAC,IAAAE,QAAA,GAEYV,gBAAgB;AAAAW,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"index.js","names":["omitEmotionProps","_len","arguments","length","props","Array","_key","shouldForwardProp","p","includes","_default","exports"],"sources":["../../src/index.ts"],"sourcesContent":["interface OmitEmotionPropsRes {\n shouldForwardProp: (prop: string) => boolean;\n}\n\nconst omitEmotionProps = (...props: string[]): OmitEmotionPropsRes => ({\n shouldForwardProp: (p) => !props.includes(p),\n});\n\nexport default omitEmotionProps;\n"],"mappings":";;;;;;AAIA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,KAAK,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAALF,KAAK,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,OAAqC;IACrEC,iBAAiB,EAAE,SAAAA,kBAACC,CAAC;MAAA,OAAK,CAACJ,KAAK,CAACK,QAAQ,CAACD,CAAC,CAAC;IAAA;EAC9C,CAAC;AAAA,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEYX,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["omitEmotionProps","props","shouldForwardProp","p","includes"],"sources":["../../src/index.ts"],"sourcesContent":["interface OmitEmotionPropsRes {\n shouldForwardProp: (prop: string) => boolean;\n}\n\nconst omitEmotionProps = (...props: string[]): OmitEmotionPropsRes => ({\n shouldForwardProp: (p) => !props.includes(p),\n});\n\nexport default omitEmotionProps;\n"],"mappings":"AAIA,MAAMA,gBAAgB,GAAGA,CAAC,GAAGC,KAAe,MAA2B;EACrEC,iBAAiB,EAAGC,CAAC,IAAK,CAACF,KAAK,CAACG,QAAQ,CAACD,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAeH,gBAAgB"}
1
+ {"version":3,"file":"index.js","names":["omitEmotionProps","props","shouldForwardProp","p","includes"],"sources":["../../src/index.ts"],"sourcesContent":["interface OmitEmotionPropsRes {\n shouldForwardProp: (prop: string) => boolean;\n}\n\nconst omitEmotionProps = (...props: string[]): OmitEmotionPropsRes => ({\n shouldForwardProp: (p) => !props.includes(p),\n});\n\nexport default omitEmotionProps;\n"],"mappings":"AAIA,MAAMA,gBAAgB,GAAGA,CAAC,GAAGC,KAAe,MAA2B;EACrEC,iBAAiB,EAAGC,CAAC,IAAK,CAACF,KAAK,CAACG,QAAQ,CAACD,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAeH,gBAAgB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os-design/omit-emotion-props",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
6
  "main": "dist/cjs/index.js",
@@ -24,7 +24,7 @@
24
24
  "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/esm --source-maps",
25
25
  "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/cjs --source-maps",
26
26
  "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
27
- "build": "yarn clean && npm-run-all build:*",
27
+ "build": "yarn clean && npm-run-all 'build:*'",
28
28
  "ncu": "ncu -u"
29
29
  },
30
30
  "publishConfig": {
@@ -33,5 +33,5 @@
33
33
  "devDependencies": {
34
34
  "react": ">=18"
35
35
  },
36
- "gitHead": "f838bd8885cdaf45e62a3b61fa2f83f2d2036e09"
36
+ "gitHead": "1f17189e344a56fd6347dd6b896d6e7ef6e7b35d"
37
37
  }
package/src/index.mdx ADDED
@@ -0,0 +1,47 @@
1
+ import { Meta } from '@storybook/blocks';
2
+ import { Square, SquareWithoutProps } from './index.example';
3
+
4
+ <Meta title='Utils/omitEmotionProps' />
5
+
6
+ # omitEmotionProps
7
+
8
+ Disables forwarding the specified properties to the element.
9
+ See more in the [emotion docs](https://emotion.sh/docs/styled#customizing-prop-forwarding).
10
+
11
+ ## Example of usage
12
+
13
+ Pass `omitEmotionProps('prop1', 'prop2')` as a second argument of the `styled` function.
14
+ You can specify as many properties as you want.
15
+
16
+ ```tsx
17
+ import styled from '@emotion/styled';
18
+ import { omitEmotionProps } from '@os-design/styles';
19
+
20
+ interface SquareProps {
21
+ size: number;
22
+ color: string;
23
+ }
24
+
25
+ export const Square = styled.div<SquareProps>`
26
+ width: ${(p) => p.size}em;
27
+ height: ${(p) => p.size}em;
28
+ background-color: ${(p) => p.color};
29
+ `;
30
+
31
+ export const SquareWithoutProps = styled(
32
+ 'div',
33
+ omitEmotionProps('size', 'color')
34
+ )<SquareProps>`
35
+ width: ${(p) => p.size}em;
36
+ height: ${(p) => p.size}em;
37
+ background-color: ${(p) => p.color};
38
+ `;
39
+ ```
40
+
41
+ As a result, the `size` and `color` properties will not be passed to the HTML element (see the HTML code).
42
+
43
+ <SquareWithoutProps size={10} color='gray' />
44
+
45
+ If you did not use the `omitEmotionProps` function, the properties will be passed to the HTML element (see the HTML code).
46
+
47
+ <Square size={10} color='gray' />