@propellerads/cookie-message 4.0.1 → 4.0.2

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## Installation
10
10
 
11
- - `yarn add @propellerads/cookie-message` or `npm install @propellerads/cookie-message -S`
11
+ - `bun add @propellerads/cookie-message` or `npm install @propellerads/cookie-message -S`
12
12
 
13
13
  ### How to use
14
14
 
package/dist/index.js CHANGED
@@ -1,50 +1,49 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { useState as p } from "react";
3
- import h, { ButtonType as f } from "@propellerads/button";
4
- import i from "styled-components";
5
- import { borderRadius as x, white as g, baseShadow as b, spacing as o } from "@propellerads/stylevariables";
6
- const n = {
7
- LeftBottom: "left_bottom",
8
- RightBottom: "right_bottom"
9
- }, u = {
10
- [n.LeftBottom]: {
11
- left: `${o * 5}px`
12
- },
13
- [n.RightBottom]: {
14
- right: `${o * 5}px`
15
- }
16
- }, $ = i.div`
1
+ import { useState as e } from "react";
2
+ import t, { ButtonVariant as n } from "@propellerads/button";
3
+ import r from "styled-components";
4
+ import { baseShadow as i, borderRadius as a, spacing as o, white as s } from "@propellerads/stylevariables";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ //#region src/types.ts
7
+ var u = {
8
+ LeftBottom: "left_bottom",
9
+ RightBottom: "right_bottom"
10
+ }, d = {
11
+ [u.LeftBottom]: { left: `${o * 5}px` },
12
+ [u.RightBottom]: { right: `${o * 5}px` }
13
+ }, f = r.div`
17
14
  width: 320px;
18
- border-radius: ${x}px;
19
- background-color: ${g};
20
- box-shadow: ${b};
15
+ border-radius: ${a}px;
16
+ background-color: ${s};
17
+ box-shadow: ${i};
21
18
  position: fixed;
22
19
  z-index: 99999;
23
20
  bottom: ${o * 5}px;
24
21
  padding: ${o * 5}px;
25
22
 
26
- ${({ $position: e }) => u[e]}
27
- `, k = i.div`
23
+ ${({ $position: e }) => d[e]}
24
+ `, p = r.div`
28
25
  margin-bottom: ${o * 3}px;
29
- `, w = i.div`
26
+ `, m = r.div`
30
27
  margin-bottom: ${o * 3}px;
31
- `, C = i.div``, S = "accept_cookie_policy", L = ({
32
- title: e = "Cookies",
33
- children: s,
34
- position: d = n.LeftBottom,
35
- cookieKey: r = S
36
- }) => {
37
- const [c, m] = p(!window.localStorage.getItem(r)), l = () => {
38
- window.localStorage.setItem(r, "true"), m(!1);
39
- };
40
- return c ? /* @__PURE__ */ a($, { $position: d, children: [
41
- /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t("b", { children: e }) }),
42
- /* @__PURE__ */ t(k, { children: s }),
43
- /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(h, { elementId: "cookie-consent", type: f.Primary, onClick: l, children: "Got it" }) })
44
- ] }) : null;
28
+ `, h = r.div``, g = "accept_cookie_policy", _ = ({ title: r = "Cookies", children: i, position: a = u.LeftBottom, cookieKey: o = g }) => {
29
+ let [s, d] = e(!window.localStorage.getItem(o));
30
+ return s ? /* @__PURE__ */ l(f, {
31
+ $position: a,
32
+ children: [
33
+ /* @__PURE__ */ c(m, { children: /* @__PURE__ */ c("b", { children: r }) }),
34
+ /* @__PURE__ */ c(p, { children: i }),
35
+ /* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(t, {
36
+ id: "cookie-consent",
37
+ variant: n.Primary,
38
+ onClick: () => {
39
+ window.localStorage.setItem(o, "true"), d(!1);
40
+ },
41
+ children: "Got it"
42
+ }) })
43
+ ]
44
+ }) : null;
45
45
  };
46
- export {
47
- n as Position,
48
- L as default
49
- };
50
- //# sourceMappingURL=index.js.map
46
+ //#endregion
47
+ export { u as Position, _ as default };
48
+
49
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport const Position = {\n LeftBottom: 'left_bottom',\n RightBottom: 'right_bottom',\n} as const;\nexport type Position = (typeof Position)[keyof typeof Position];\n\nexport type CookieMessageProps = {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: Position;\n};\n","import styled, {CSSObject} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport type {Position} from './types';\nimport {Position as CookieMessagePosition} from './types';\n\ntype StyledCookieCardProps = {\n $position: Position;\n};\n\nconst positionStylesMap = {\n [CookieMessagePosition.LeftBottom]: {\n left: `${spacing * 5}px`,\n },\n [CookieMessagePosition.RightBottom]: {\n right: `${spacing * 5}px`,\n },\n} as const satisfies Record<Position, CSSObject>;\n\nconst StyledCookieCard = styled.div<StyledCookieCardProps>`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${({$position}) => positionStylesMap[$position]}\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import {useState} from 'react';\nimport Button, {ButtonType} from '@propellerads/button';\nimport type {CookieMessageProps} from './types';\nimport {Position} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = Position.LeftBottom,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n if (!isShow) {\n return null;\n }\n\n return (\n <StyledCookieCard $position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button elementId=\"cookie-consent\" type={ButtonType.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n );\n};\n\nexport default CookieMessage;\n\nexport {Position};\nexport type {CookieMessageProps};\n"],"names":["Position","positionStylesMap","CookieMessagePosition","spacing","StyledCookieCard","styled","borderRadius","white","baseShadow","$position","CookieInfo","CookieTitle","CookieAction","DEFAULT_COOKIE_KEY","CookieMessage","title","children","position","cookieKey","isShow","setShow","useState","handleClick","jsxs","jsx","Button","ButtonType"],"mappings":";;;;;AAEO,MAAMA,IAAW;AAAA,EACtB,YAAY;AAAA,EACZ,aAAa;AACf,GCIMC,IAAoB;AAAA,EACxB,CAACC,EAAsB,UAAU,GAAG;AAAA,IAClC,MAAM,GAAGC,IAAU,CAAC;AAAA,EAAA;AAAA,EAEtB,CAACD,EAAsB,WAAW,GAAG;AAAA,IACnC,OAAO,GAAGC,IAAU,CAAC;AAAA,EAAA;AAEzB,GAEMC,IAAmBC,EAAO;AAAA;AAAA,mBAEbC,CAAY;AAAA,sBACTC,CAAK;AAAA,gBACXC,CAAU;AAAA;AAAA;AAAA,YAGdL,IAAU,CAAC;AAAA,aACVA,IAAU,CAAC;AAAA;AAAA,IAEpB,CAAC,EAAC,WAAAM,QAAeR,EAAkBQ,CAAS,CAAC;AAAA,GAG3CC,IAAaL,EAAO;AAAA,mBACPF,IAAU,CAAC;AAAA,GAExBQ,IAAcN,EAAO;AAAA,mBACRF,IAAU,CAAC;AAAA,GAGxBS,IAAeP,EAAO,OChCtBQ,IAAqB,wBAErBC,IAAgB,CAAC;AAAA,EACrB,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC,IAAWjB,EAAS;AAAA,EACpB,WAAAkB,IAAYL;AACd,MAA0B;AACxB,QAAM,CAACM,GAAQC,CAAO,IAAIC,EAAS,CAAC,OAAO,aAAa,QAAQH,CAAS,CAAC,GAEpEI,IAAc,MAAM;AACxB,WAAO,aAAa,QAAQJ,GAAW,MAAM,GAC7CE,EAAQ,EAAK;AAAA,EACf;AAEA,SAAKD,IAKH,gBAAAI,EAACnB,GAAA,EAAiB,WAAWa,GAC3B,UAAA;AAAA,IAAA,gBAAAO,EAACb,GAAA,EACC,UAAA,gBAAAa,EAAC,KAAA,EAAG,UAAAT,EAAA,CAAM,GACZ;AAAA,IAEA,gBAAAS,EAACd,KAAY,UAAAM,GAAS;AAAA,IAEtB,gBAAAQ,EAACZ,GAAA,EACC,UAAA,gBAAAY,EAACC,GAAA,EAAO,WAAU,kBAAiB,MAAMC,EAAW,SAAS,SAASJ,GAAa,UAAA,SAAA,CAEnF,EAAA,CACF;AAAA,EAAA,GACF,IAhBO;AAkBX;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport const Position = {\n LeftBottom: 'left_bottom',\n RightBottom: 'right_bottom',\n} as const;\nexport type Position = (typeof Position)[keyof typeof Position];\n\nexport type CookieMessageProps = {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: Position;\n};\n","import styled, {CSSObject} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport type {Position} from './types';\nimport {Position as CookieMessagePosition} from './types';\n\ntype StyledCookieCardProps = {\n $position: Position;\n};\n\nconst positionStylesMap = {\n [CookieMessagePosition.LeftBottom]: {\n left: `${spacing * 5}px`,\n },\n [CookieMessagePosition.RightBottom]: {\n right: `${spacing * 5}px`,\n },\n} as const satisfies Record<Position, CSSObject>;\n\nconst StyledCookieCard = styled.div<StyledCookieCardProps>`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${({$position}) => positionStylesMap[$position]}\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import {useState} from 'react';\nimport Button, {ButtonVariant} from '@propellerads/button';\nimport type {CookieMessageProps} from './types';\nimport {Position} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = Position.LeftBottom,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n if (!isShow) {\n return null;\n }\n\n return (\n <StyledCookieCard $position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button id=\"cookie-consent\" variant={ButtonVariant.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n );\n};\n\nexport default CookieMessage;\n\nexport {Position};\nexport type {CookieMessageProps};\n"],"mappings":";;;;;;AAEA,IAAa,IAAW;CACtB,YAAY;CACZ,aAAa;CACd,ECIK,IAAoB;EACvB,EAAsB,aAAa,EAClC,MAAM,GAAG,IAAU,EAAE,KACtB;EACA,EAAsB,cAAc,EACnC,OAAO,GAAG,IAAU,EAAE,KACvB;CACF,EAEK,IAAmB,EAAO,GAA0B;;mBAEvC,EAAa;sBACV,EAAM;gBACZ,EAAW;;;YAGf,IAAU,EAAE;aACX,IAAU,EAAE;;KAEpB,EAAC,mBAAe,EAAkB,GAAW;GAG5C,IAAa,EAAO,GAAG;mBACV,IAAU,EAAE;GAEzB,IAAc,EAAO,GAAG;mBACX,IAAU,EAAE;GAGzB,IAAe,EAAO,GAAG,IChCzB,IAAqB,wBAErB,KAAiB,EACrB,WAAQ,WACR,aACA,cAAW,EAAS,YACpB,eAAY,QACY;CACxB,IAAM,CAAC,GAAQ,KAAW,EAAS,CAAC,OAAO,aAAa,QAAQ,EAAU,CAAC;CAW3E,OAJK,IAKH,kBAAC,GAAD;EAAkB,WAAW;YAA7B;GACE,kBAAC,GAAD,EAAA,UACE,kBAAC,KAAD,EAAA,UAAI,GAAU,CAAA,EACF,CAAA;GAEd,kBAAC,GAAD,EAAa,aAAsB,CAAA;GAEnC,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAQ,IAAG;IAAiB,SAAS,EAAc;IAAS,eAlBxC;KAExB,AADA,OAAO,aAAa,QAAQ,GAAW,OAAO,EAC9C,EAAQ,GAAM;;cAgBwE;IAEzE,CAAA,EACI,CAAA;GACE;MAhBZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/cookie-message",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -19,12 +19,12 @@
19
19
  "url": "https://github.com/propellerads/ui-components/issues"
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
22
+ "build": "tsc && vite build && bunx rollup -c rollup.dts.config.mjs"
23
23
  },
24
24
  "homepage": "https://github.com/propellerads/ui-components#readme",
25
25
  "private": false,
26
26
  "dependencies": {
27
- "@propellerads/button": "^9.0.2",
27
+ "@propellerads/button": "^10.0.0",
28
28
  "@propellerads/stylevariables": "^2.0.2"
29
29
  },
30
30
  "peerDependencies": {
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/react": "^19.2.14",
36
- "@vitejs/plugin-react": "^5.1.4",
37
- "rollup": "^4.58.0",
38
- "rollup-plugin-dts": "^6.3.0",
39
- "typescript": "^5.9.3",
40
- "vite": "^7.3.1"
36
+ "@vitejs/plugin-react": "^6.0.1",
37
+ "rollup": "^4.60.3",
38
+ "rollup-plugin-dts": "^6.4.1",
39
+ "typescript": "^6.0.3",
40
+ "vite": "^8.0.10"
41
41
  }
42
42
  }