@uninspired/cookie-banner 0.0.1
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 +0 -0
- package/dist/component.d.ts +65 -0
- package/dist/component.js +4 -0
- package/dist/index-BfHatbv4.js +3653 -0
- package/dist/script.d.ts +60 -0
- package/dist/script.js +16 -0
- package/dist/style.css +1 -0
- package/dist/theme.css +94 -0
- package/package.json +39 -0
package/dist/script.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
|
|
3
|
+
declare type BannerItemOptions = BannerItemOptionsRequired | BannerItemOptionsOptional;
|
|
4
|
+
|
|
5
|
+
declare interface BannerItemOptionsBase {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
defaultSelected?: boolean;
|
|
9
|
+
sublabel?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare interface BannerItemOptionsOptional extends BannerItemOptionsBase {
|
|
15
|
+
required: false;
|
|
16
|
+
script: ScriptDefinition;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface BannerItemOptionsRequired extends BannerItemOptionsBase {
|
|
20
|
+
required: true;
|
|
21
|
+
script: undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare interface BannerOptions {
|
|
25
|
+
localStorageKey?: string;
|
|
26
|
+
heading?: string;
|
|
27
|
+
subheading?: string;
|
|
28
|
+
selectLabel?: string;
|
|
29
|
+
hideLabel?: string;
|
|
30
|
+
saveLabel?: string;
|
|
31
|
+
declineLabel?: string;
|
|
32
|
+
defaultSettingsOpen?: boolean;
|
|
33
|
+
privacyPolicy?: {
|
|
34
|
+
label: string;
|
|
35
|
+
url: string;
|
|
36
|
+
};
|
|
37
|
+
items: BannerItemOptions[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare function mountBanner(options: BannerOptions, targetElement?: HTMLElement | string): void;
|
|
41
|
+
|
|
42
|
+
declare type ScriptDefinition = z.infer<typeof scriptDefinitionSchema>;
|
|
43
|
+
|
|
44
|
+
declare const scriptDefinitionSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
45
|
+
variant: z.ZodMiniLiteral<"remote">;
|
|
46
|
+
type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
+
src: z.ZodMiniString<string>;
|
|
48
|
+
async: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
49
|
+
defer: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
50
|
+
crossorigin: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
51
|
+
integrity: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
53
|
+
variant: z.ZodMiniLiteral<"inline">;
|
|
54
|
+
type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
55
|
+
async: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
56
|
+
defer: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
57
|
+
content: z.ZodMiniString<string>;
|
|
58
|
+
}, z.core.$strip>], "variant">;
|
|
59
|
+
|
|
60
|
+
export { }
|
package/dist/script.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { J as c, u as i, B as u } from "./index-BfHatbv4.js";
|
|
2
|
+
function s(e, o) {
|
|
3
|
+
const t = o === void 0;
|
|
4
|
+
let n;
|
|
5
|
+
if (typeof o == "string") {
|
|
6
|
+
const r = document.querySelector(o);
|
|
7
|
+
if (!r)
|
|
8
|
+
throw new Error(`Element with selector "${o}" not found`);
|
|
9
|
+
n = r;
|
|
10
|
+
} else
|
|
11
|
+
n = o;
|
|
12
|
+
c(/* @__PURE__ */ i(u, { noTarget: t, ...e }), n ?? document.body);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
s as mountBanner
|
|
16
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._root_hw69b_1{all:unset;cursor:pointer;will-change:background-color;transition:background-color .15s ease-in-out;font-size:var(--cb-font-size-caption);line-height:var(--cb-line-height-caption);font-family:var(--cb-font-family-caption);letter-spacing:var(--cb-letter-spacing-caption);font-weight:var(--cb-font-weight-caption-bold);padding:var(--cb-space-xs) var(--cb-space-sm);border-radius:var(--cb-radius-md);display:flex;flex-direction:row;align-items:center}._root_hw69b_1._neutral_hw69b_17{background-color:var(--cb-color-button-neutral-background);color:var(--cb-color-button-neutral-foreground)}._root_hw69b_1._neutral_hw69b_17:hover{background-color:var(--cb-color-button-neutral-background-hover)}._root_hw69b_1._neutral_hw69b_17:active{background-color:var(--cb-color-button-neutral-background-active)}._root_hw69b_1._brand_hw69b_30{background-color:var(--cb-color-button-brand-background);color:var(--cb-color-button-brand-foreground)}._root_hw69b_1._brand_hw69b_30:hover{background-color:var(--cb-color-button-brand-background-hover)}._root_hw69b_1._brand_hw69b_30:active{background-color:var(--cb-color-button-brand-background-active)}._root_hw69b_1._ghost_hw69b_43{background-color:var(--cb-color-button-ghost-background);color:var(--cb-color-button-ghost-foreground)}._root_hw69b_1._ghost_hw69b_43:hover{background-color:var(--cb-color-button-ghost-background-hover)}._root_hw69b_1._ghost_hw69b_43:active{background-color:var(--cb-color-button-ghost-background-active)}._root_14l5h_1{color:var(--cb-color-text-default)}._root_14l5h_1._muted_14l5h_4{color:var(--cb-color-text-muted)}._root_14l5h_1._body_14l5h_8{font-size:var(--cb-font-size-body);font-family:var(--cb-font-family-body);line-height:var(--cb-line-height-body);letter-spacing:var(--cb-letter-spacing-body)}._root_14l5h_1._body_14l5h_8._normal_14l5h_14{font-weight:var(--cb-font-weight-body-normal)}._root_14l5h_1._body_14l5h_8._bold_14l5h_18{font-weight:var(--cb-font-weight-body-bold)}._root_14l5h_1._caption_14l5h_23{font-size:var(--cb-font-size-caption);font-family:var(--cb-font-family-caption);line-height:var(--cb-line-height-caption);letter-spacing:var(--cb-letter-spacing-caption)}._root_14l5h_1._caption_14l5h_23._normal_14l5h_14{font-weight:var(--cb-font-weight-caption-normal)}._root_14l5h_1._caption_14l5h_23._bold_14l5h_18{font-weight:var(--cb-font-weight-caption-bold)}._root_14l5h_1 a{all:unset;color:var(--cb-color-text-link);cursor:pointer;text-decoration:none}._root_14l5h_1 a:hover{color:var(--cb-color-text-link-hover);text-decoration:underline}@keyframes _contentShow_1wsw7_1{0%{opacity:0;transform:translate(-100px)}to{opacity:1;transform:translate(0)}}@keyframes _slideDown_1wsw7_1{0%{max-height:var(--cb-size-settings-max-height);overflow:auto}1%{max-height:var(--cb-size-settings-max-height);overflow:hidden}to{max-height:0;overflow:hidden}}@keyframes _slideUp_1wsw7_1{0%{max-height:0;overflow:hidden}99%{max-height:var(--cb-size-settings-max-height);overflow:hidden}to{max-height:var(--cb-size-settings-max-height);overflow:auto}}._root_1wsw7_42{display:flex;flex-direction:column;gap:var(--cb-space-md);padding:var(--cb-space-md);background-color:var(--cb-color-background-default);box-shadow:var(--cb-shadow-lg);border-radius:var(--cb-radius-md);overflow:hidden;animation:_contentShow_1wsw7_1 .15s cubic-bezier(.16,1,.3,1)}._root_1wsw7_42._noTarget_1wsw7_53{position:fixed;bottom:var(--cb-space-md);left:var(--cb-space-md);width:100%;max-width:var(--cb-size-banner-max-width)}._root_1wsw7_42 ._collapsible_1wsw7_62{display:contents}._root_1wsw7_42 ._collapsible_1wsw7_62 ._header_1wsw7_65{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:var(--cb-space-md)}._root_1wsw7_42 ._collapsible_1wsw7_62 ._header_1wsw7_65 ._heading_1wsw7_72{display:flex;flex-direction:column;align-items:flex-start}._root_1wsw7_42 ._collapsible_1wsw7_62 ._header_1wsw7_65 ._chevron_1wsw7_78{transform:rotate(0);will-change:transform;transition:transform .15s ease-out}._root_1wsw7_42 ._collapsible_1wsw7_62 ._header_1wsw7_65 ._chevron_1wsw7_78._open_1wsw7_83{transform:rotate(180deg)}._root_1wsw7_42 ._collapsible_1wsw7_62 ._settings_1wsw7_89{display:flex;flex-direction:column;background-color:var(--cb-color-background-muted);border-radius:var(--cb-radius-md);overflow:hidden;will-change:max-height,overflow;animation:_slideDown_1wsw7_1 .25s ease-out}._root_1wsw7_42 ._collapsible_1wsw7_62 ._settings_1wsw7_89[data-state=open]{animation:_slideUp_1wsw7_1 .25s ease-out}._root_1wsw7_42 ._collapsible_1wsw7_62 ._footer_1wsw7_103{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--cb-space-md)}._root_1wsw7_42 ._collapsible_1wsw7_62 ._footer_1wsw7_103 ._actions_1wsw7_113{display:flex;flex-direction:row;align-items:center;gap:var(--cb-space-md)}@keyframes _slideDown_mqtha_1{0%{height:0}to{height:var(--radix-accordion-content-height)}}@keyframes _slideUp_mqtha_1{0%{height:var(--radix-accordion-content-height)}to{height:0}}._root_mqtha_19{display:flex;flex-direction:column;overflow:hidden}._root_mqtha_19 ._header_mqtha_24{all:unset;display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--cb-space-sm) var(--cb-space-md);cursor:pointer}._root_mqtha_19 ._header_mqtha_24 ._label_mqtha_33{display:flex;flex-direction:column;width:100%}._root_mqtha_19 ._header_mqtha_24 ._actions_mqtha_39{display:flex;flex-direction:row;align-items:center;gap:var(--cb-space-sm)}._root_mqtha_19 ._header_mqtha_24 ._actions_mqtha_39 ._chevron_mqtha_45{color:var(--cb-color-text-default);transition:transform .15s ease-out;will-change:transform;transform:rotate(0)}._root_mqtha_19 ._header_mqtha_24 ._actions_mqtha_39 ._chevron_mqtha_45._open_mqtha_51{transform:rotate(180deg)}._root_mqtha_19 ._description_mqtha_58{padding:var(--cb-space-xs) var(--cb-space-md);max-width:96ch;overflow:hidden}._root_mqtha_19 ._description_mqtha_58[data-state=open]{animation:_slideDown_mqtha_1 .15s ease-out}._root_mqtha_19 ._description_mqtha_58[data-state=closed]{animation:_slideUp_mqtha_1 .15s ease-out}._root_dibqz_1{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--cb-space-sm)}._root_dibqz_1 ._switch_dibqz_8{width:32px;height:20px;padding:2px;border-width:1px;border-style:solid;border-color:var(--cb-color-border-neutral);border-radius:9999px;will-change:background-color;transition:background-color .15s ease-out;background-color:var(--cb-color-switch-background-neutral);position:relative}._root_dibqz_1 ._switch_dibqz_8[data-state=checked]{background-color:var(--cb-color-switch-background-brand)}._root_dibqz_1 ._switch_dibqz_8[data-disabled]{cursor:not-allowed;background-color:var(--cb-color-switch-background-disabled)}._root_dibqz_1 ._switch_dibqz_8:not([data-disabled]){cursor:pointer}._root_dibqz_1 ._switch_dibqz_8:not([data-disabled]):hover{background-color:var(--cb-color-switch-background-light)}._root_dibqz_1 ._switch_dibqz_8 ._thumb_dibqz_38{width:14px;height:14px;position:absolute;left:0;top:0;background-color:var(--cb-color-switch-thumb-background-neutral);box-shadow:var(--cb-shadow-sm);border-radius:9999px;transition:transform .15s ease-out;transform:translate(2px) translateY(2px);will-change:transform}._root_dibqz_1 ._switch_dibqz_8 ._thumb_dibqz_38[data-state=checked]{transform:translate(14px) translateY(2px)}:root{--cb-color-background-default: var(--cb-color-neutral-0);--cb-color-background-muted: var(--cb-color-neutral-50);--cb-color-text-default: var(--cb-color-neutral-900);--cb-color-text-muted: var(--cb-color-neutral-500);--cb-color-text-link: var(--cb-color-brand-600);--cb-color-text-link-hover: var(--cb-color-brand-700);--cb-color-border-neutral: var(--cb-color-neutral-200);--cb-color-border-brand: var(--cb-color-brand-200);--cb-color-switch-background-neutral: var(--cb-color-neutral-100);--cb-color-switch-background-light: var(--cb-color-brand-500);--cb-color-switch-background-brand: var(--cb-color-brand-600);--cb-color-switch-background-disabled: var(--cb-color-neutral-300);--cb-color-switch-thumb-background-neutral: var(--cb-color-neutral-0);--cb-color-button-neutral-background: var(--cb-color-neutral-100);--cb-color-button-neutral-background-hover: var(--cb-color-neutral-200);--cb-color-button-neutral-background-active: var(--cb-color-neutral-100);--cb-color-button-neutral-foreground: var(--cb-color-neutral-700);--cb-color-button-brand-background: var(--cb-color-brand-100);--cb-color-button-brand-background-hover: var(--cb-color-brand-200);--cb-color-button-brand-background-active: var(--cb-color-brand-100);--cb-color-button-brand-foreground: var(--cb-color-brand-700);--cb-color-button-ghost-background: rgba(0, 0, 0, 0);--cb-color-button-ghost-background-hover: var(--cb-color-neutral-200);--cb-color-button-ghost-background-active: var(--cb-color-neutral-100);--cb-color-button-ghost-foreground: var(--cb-color-neutral-700)}
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Colors */
|
|
3
|
+
/* Base */
|
|
4
|
+
--cb-color-neutral-0: rgb(255, 255, 255);
|
|
5
|
+
--cb-color-neutral-50: rgb(250, 250, 250);
|
|
6
|
+
--cb-color-neutral-100: rgb(245, 245, 245);
|
|
7
|
+
--cb-color-neutral-200: rgb(229, 229, 229);
|
|
8
|
+
--cb-color-neutral-300: rgb(212, 212, 212);
|
|
9
|
+
--cb-color-neutral-400: rgb(163, 163, 163);
|
|
10
|
+
--cb-color-neutral-500: rgb(115, 115, 115);
|
|
11
|
+
--cb-color-neutral-600: rgb(82, 82, 82);
|
|
12
|
+
--cb-color-neutral-700: rgb(64, 64, 64);
|
|
13
|
+
--cb-color-neutral-800: rgb(38, 38, 38);
|
|
14
|
+
--cb-color-neutral-900: rgb(23, 23, 23);
|
|
15
|
+
--cb-color-neutral-950: rgb(10, 10, 10);
|
|
16
|
+
|
|
17
|
+
--cb-color-brand-50: rgb(236, 253, 245);
|
|
18
|
+
--cb-color-brand-100: rgb(209, 250, 229);
|
|
19
|
+
--cb-color-brand-200: rgb(167, 243, 208);
|
|
20
|
+
--cb-color-brand-300: rgb(110, 231, 183);
|
|
21
|
+
--cb-color-brand-400: rgb(52, 211, 153);
|
|
22
|
+
--cb-color-brand-500: rgb(16, 185, 129);
|
|
23
|
+
--cb-color-brand-600: rgb(5, 150, 105);
|
|
24
|
+
--cb-color-brand-700: rgb(4, 120, 87);
|
|
25
|
+
--cb-color-brand-800: rgb(6, 95, 70);
|
|
26
|
+
--cb-color-brand-900: rgb(6, 78, 59);
|
|
27
|
+
|
|
28
|
+
--cb-space-base: 4px;
|
|
29
|
+
--cb-space-xs: calc(var(--cb-space-base) * 1);
|
|
30
|
+
--cb-space-sm: calc(var(--cb-space-base) * 2);
|
|
31
|
+
--cb-space-md: calc(var(--cb-space-base) * 4);
|
|
32
|
+
--cb-space-lg: calc(var(--cb-space-base) * 6);
|
|
33
|
+
--cb-space-xl: calc(var(--cb-space-base) * 12);
|
|
34
|
+
|
|
35
|
+
/* Typography */
|
|
36
|
+
--cb-font-family-body: "Nunito Sans", sans-serif;
|
|
37
|
+
--cb-font-size-body: 14px;
|
|
38
|
+
--cb-font-weight-body-normal: 400;
|
|
39
|
+
--cb-font-weight-body-bold: 500;
|
|
40
|
+
--cb-line-height-body: 20px;
|
|
41
|
+
--cb-letter-spacing-body: 0em;
|
|
42
|
+
|
|
43
|
+
--cb-font-family-caption: "Nunito Sans", sans-serif;
|
|
44
|
+
--cb-font-size-caption: 12px;
|
|
45
|
+
--cb-font-weight-caption-normal: 400;
|
|
46
|
+
--cb-font-weight-caption-bold: 500;
|
|
47
|
+
--cb-line-height-caption: 16px;
|
|
48
|
+
--cb-letter-spacing-caption: 0em;
|
|
49
|
+
|
|
50
|
+
/* Radius */
|
|
51
|
+
--cb-radius-base: 6px;
|
|
52
|
+
--cb-radius-sm: calc(var(--cb-radius-base) * 1);
|
|
53
|
+
--cb-radius-md: calc(var(--cb-radius-base) * 2);
|
|
54
|
+
--cb-radius-lg: calc(var(--cb-radius-base) * 3);
|
|
55
|
+
|
|
56
|
+
/* Shadow */
|
|
57
|
+
--cb-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
58
|
+
--cb-shadow-md:
|
|
59
|
+
0 4px 16px -2px rgb(0 0 0 / 0.08), 0 2px 4px -1px rgb(0 0 0 / 0.08);
|
|
60
|
+
--cb-shadow-lg:
|
|
61
|
+
0 12px 32px -4px rgb(0 0 0 / 0.08), 0 4px 8px -2px rgb(0 0 0 / 0.08);
|
|
62
|
+
|
|
63
|
+
/* Sizes */
|
|
64
|
+
--cb-size-banner-max-width: 448px;
|
|
65
|
+
--cb-size-settings-max-height: 448px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (prefers-color-scheme: dark) {
|
|
69
|
+
:root {
|
|
70
|
+
--cb-color-neutral-0: rgb(10, 10, 10);
|
|
71
|
+
--cb-color-neutral-50: rgb(23, 23, 23);
|
|
72
|
+
--cb-color-neutral-100: rgb(38, 38, 38);
|
|
73
|
+
--cb-color-neutral-200: rgb(64, 64, 64);
|
|
74
|
+
--cb-color-neutral-300: rgb(82, 82, 82);
|
|
75
|
+
--cb-color-neutral-400: rgb(115, 115, 115);
|
|
76
|
+
--cb-color-neutral-500: rgb(163, 163, 163);
|
|
77
|
+
--cb-color-neutral-600: rgb(212, 212, 212);
|
|
78
|
+
--cb-color-neutral-700: rgb(229, 229, 229);
|
|
79
|
+
--cb-color-neutral-800: rgb(245, 245, 245);
|
|
80
|
+
--cb-color-neutral-900: rgb(250, 250, 250);
|
|
81
|
+
--cb-color-neutral-950: rgb(255, 255, 255);
|
|
82
|
+
|
|
83
|
+
--cb-color-brand-50: rgb(15, 41, 30);
|
|
84
|
+
--cb-color-brand-100: rgb(17, 49, 35);
|
|
85
|
+
--cb-color-brand-200: rgb(19, 57, 41);
|
|
86
|
+
--cb-color-brand-300: rgb(22, 68, 48);
|
|
87
|
+
--cb-color-brand-400: rgb(27, 84, 58);
|
|
88
|
+
--cb-color-brand-500: rgb(35, 110, 74);
|
|
89
|
+
--cb-color-brand-600: rgb(48, 164, 108);
|
|
90
|
+
--cb-color-brand-700: rgb(60, 177, 121);
|
|
91
|
+
--cb-color-brand-800: rgb(76, 195, 138);
|
|
92
|
+
--cb-color-brand-900: rgb(229, 251, 235);
|
|
93
|
+
}
|
|
94
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uninspired/cookie-banner",
|
|
3
|
+
"description": "Auth client for Uninspired Studio Products",
|
|
4
|
+
"author": "Chris Kolb <chris@uninspired.studio>",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
7
|
+
"version": "0.0.1",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./*": "./dist/*"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"package.json",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "bunx --bun vite",
|
|
19
|
+
"build:safe": "tsc -b && bunx --bun vite build",
|
|
20
|
+
"build": "bunx --bun vite build",
|
|
21
|
+
"preview": "bunx --bun vite preview"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
25
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
26
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
27
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
28
|
+
"lucide-react": "^0.575.0",
|
|
29
|
+
"preact": "^10.27.2",
|
|
30
|
+
"zod": "^4.3.6"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@preact/preset-vite": "^2.10.2",
|
|
34
|
+
"@types/node": "^24.10.1",
|
|
35
|
+
"typescript": "~5.9.3",
|
|
36
|
+
"vite": "^7.3.1",
|
|
37
|
+
"vite-plugin-dts": "^4.5.4"
|
|
38
|
+
}
|
|
39
|
+
}
|