@c15t/react 2.0.0-rc.6 → 2.0.0-rc.8

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.
Files changed (168) hide show
  1. package/README.md +9 -0
  2. package/dist/components/consent-banner/atoms/root.cjs +1 -1
  3. package/dist/components/consent-banner/atoms/root.js +1 -1
  4. package/dist/components/consent-banner/consent-banner.cjs +1 -1
  5. package/dist/components/consent-banner/consent-banner.js +1 -1
  6. package/dist/components/consent-banner/index.cjs +1 -1
  7. package/dist/components/consent-banner/index.js +1 -1
  8. package/dist/components/consent-banner/policy-actions.cjs +1 -0
  9. package/dist/components/consent-banner/policy-actions.js +1 -0
  10. package/dist/components/consent-dialog/atoms/card.cjs +1 -1
  11. package/dist/components/consent-dialog/atoms/card.js +1 -1
  12. package/dist/components/consent-dialog/atoms/root.cjs +1 -1
  13. package/dist/components/consent-dialog/atoms/root.js +1 -1
  14. package/dist/components/consent-dialog-trigger/atoms/icon.cjs +1 -1
  15. package/dist/components/consent-dialog-trigger/atoms/icon.js +1 -1
  16. package/dist/components/consent-widget/atoms/accordion.cjs +1 -1
  17. package/dist/components/consent-widget/atoms/accordion.js +1 -1
  18. package/dist/components/consent-widget/atoms/footer.cjs +1 -1
  19. package/dist/components/consent-widget/atoms/footer.js +1 -1
  20. package/dist/components/consent-widget/consent-widget.cjs +1 -1
  21. package/dist/components/consent-widget/consent-widget.js +1 -1
  22. package/dist/components/consent-widget/index.cjs +1 -1
  23. package/dist/components/consent-widget/index.js +1 -1
  24. package/dist/components/consent-widget/policy-actions.cjs +1 -0
  25. package/dist/components/consent-widget/policy-actions.js +1 -0
  26. package/dist/components/iab-consent-banner/atoms/card.cjs +1 -1
  27. package/dist/components/iab-consent-banner/atoms/card.js +1 -1
  28. package/dist/components/iab-consent-banner/atoms/footer.cjs +1 -1
  29. package/dist/components/iab-consent-banner/atoms/footer.js +1 -1
  30. package/dist/components/iab-consent-banner/atoms/header.cjs +1 -1
  31. package/dist/components/iab-consent-banner/atoms/header.js +1 -1
  32. package/dist/components/iab-consent-banner/atoms/root.cjs +1 -1
  33. package/dist/components/iab-consent-banner/atoms/root.js +1 -1
  34. package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
  35. package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
  36. package/dist/components/iab-consent-dialog/atoms/card.cjs +1 -1
  37. package/dist/components/iab-consent-dialog/atoms/card.js +1 -1
  38. package/dist/components/iab-consent-dialog/atoms/footer.cjs +1 -1
  39. package/dist/components/iab-consent-dialog/atoms/footer.js +1 -1
  40. package/dist/components/iab-consent-dialog/atoms/header.cjs +1 -1
  41. package/dist/components/iab-consent-dialog/atoms/header.js +1 -1
  42. package/dist/components/iab-consent-dialog/atoms/root.cjs +1 -1
  43. package/dist/components/iab-consent-dialog/atoms/root.js +1 -1
  44. package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
  45. package/dist/components/iab-consent-dialog/iab-consent-dialog.js +1 -1
  46. package/dist/components/shared/policy-actions.cjs +1 -0
  47. package/dist/components/shared/policy-actions.js +1 -0
  48. package/dist/components/shared/primitives/box.cjs +1 -1
  49. package/dist/components/shared/primitives/box.js +1 -1
  50. package/dist/components/shared/ui/branding.cjs +1 -0
  51. package/dist/components/shared/ui/branding.js +1 -0
  52. package/dist/components/shared/ui/logo.cjs +1 -1
  53. package/dist/components/shared/ui/logo.js +1 -1
  54. package/dist/components/shared/ui/switch/index.cjs +1 -1
  55. package/dist/components/shared/ui/switch/index.js +1 -1
  56. package/dist/hooks/index.cjs +1 -1
  57. package/dist/hooks/use-consent-manager.cjs +1 -1
  58. package/dist/hooks/use-consent-manager.js +1 -1
  59. package/dist/hooks/use-headless-consent-ui.cjs +1 -1
  60. package/dist/hooks/use-headless-consent-ui.js +1 -1
  61. package/dist/iab/styles.css +11 -1
  62. package/dist/iab/styles.tw3.css +14 -0
  63. package/dist/providers/consent-manager-provider.cjs +1 -1
  64. package/dist/providers/consent-manager-provider.js +1 -1
  65. package/dist/server/fetch-ssr-data.cjs +1 -1
  66. package/dist/server/fetch-ssr-data.js +1 -1
  67. package/dist/styles.css +10 -1
  68. package/dist/styles.tw3.css +13 -0
  69. package/dist/version.cjs +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist-types/components/consent-banner/atoms/root.d.ts +44 -13
  72. package/dist-types/components/consent-banner/consent-banner.d.ts +7 -2
  73. package/dist-types/components/consent-banner/index.d.ts +47 -24
  74. package/dist-types/components/consent-banner/policy-actions.d.ts +11 -0
  75. package/dist-types/components/consent-dialog/atoms/card.d.ts +7 -2
  76. package/dist-types/components/consent-dialog/atoms/root.d.ts +1 -1
  77. package/dist-types/components/consent-dialog/consent-dialog.d.ts +1 -1
  78. package/dist-types/components/consent-dialog/index.d.ts +29 -8
  79. package/dist-types/components/consent-dialog-trigger/atoms/icon.d.ts +1 -1
  80. package/dist-types/components/consent-dialog-trigger/types.d.ts +1 -1
  81. package/dist-types/components/consent-preferences-link/consent-preferences-link.d.ts +0 -1
  82. package/dist-types/components/consent-widget/atoms/accordion.d.ts +4 -3
  83. package/dist-types/components/consent-widget/index.d.ts +26 -6
  84. package/dist-types/components/consent-widget/policy-actions.d.ts +11 -0
  85. package/dist-types/components/frame/atoms.d.ts +1 -1
  86. package/dist-types/components/frame/types.d.ts +1 -1
  87. package/dist-types/components/iab-consent-banner/atoms/root.d.ts +1 -1
  88. package/dist-types/components/iab-consent-banner/iab-consent-banner.d.ts +1 -1
  89. package/dist-types/components/iab-consent-dialog/atoms/root.d.ts +1 -1
  90. package/dist-types/components/iab-consent-dialog/atoms/vendor-list.d.ts +1 -1
  91. package/dist-types/components/iab-consent-dialog/iab-consent-dialog.d.ts +1 -1
  92. package/dist-types/components/shared/policy-actions.d.ts +29 -0
  93. package/dist-types/components/shared/primitives/button.d.ts +1 -1
  94. package/dist-types/components/shared/primitives/button.types.d.ts +1 -1
  95. package/dist-types/components/shared/primitives/legal-links/index.d.ts +1 -1
  96. package/dist-types/components/shared/ui/accordion/accordion.d.ts +2 -2
  97. package/dist-types/components/shared/ui/accordion/accordion.types.d.ts +1 -1
  98. package/dist-types/components/shared/ui/branding.d.ts +23 -0
  99. package/dist-types/components/shared/ui/button/button.d.ts +1 -1
  100. package/dist-types/components/shared/ui/logo.d.ts +8 -0
  101. package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +1 -1
  102. package/dist-types/components/shared/ui/switch/index.d.ts +1 -1
  103. package/dist-types/components/shared/ui/switch/switch.d.ts +1 -1
  104. package/dist-types/components/shared/ui/switch/switch.types.d.ts +1 -1
  105. package/dist-types/components/shared/ui/tabs/tabs.d.ts +1 -1
  106. package/dist-types/context/consent-manager-context.d.ts +1 -1
  107. package/dist-types/headless.d.ts +1 -1
  108. package/dist-types/hooks/use-component-config.d.ts +1 -1
  109. package/dist-types/hooks/use-consent-manager.d.ts +1 -1
  110. package/dist-types/hooks/use-headless-consent-ui.d.ts +1 -1
  111. package/dist-types/hooks/use-ssr-status.d.ts +2 -1
  112. package/dist-types/hooks/use-translations.d.ts +1 -1
  113. package/dist-types/index.d.ts +2 -2
  114. package/dist-types/server/fetch-ssr-data.d.ts +1 -1
  115. package/dist-types/server/init-cache-key.d.ts +1 -1
  116. package/dist-types/server/types.d.ts +1 -1
  117. package/dist-types/types/consent-manager.d.ts +1 -1
  118. package/dist-types/types/theme/style-keys.d.ts +1 -1
  119. package/dist-types/types/theme/style-types.d.ts +2 -2
  120. package/dist-types/utils/cn.d.ts +1 -1
  121. package/dist-types/utils/theme-utils.d.ts +1 -1
  122. package/dist-types/version.d.ts +1 -1
  123. package/docs/building-headless-components.md +43 -22
  124. package/docs/callbacks.md +76 -9
  125. package/docs/components/consent-banner.md +148 -24
  126. package/docs/components/consent-dialog.md +42 -3
  127. package/docs/components/consent-manager-provider.md +3 -1
  128. package/docs/components/consent-widget.md +91 -9
  129. package/docs/concepts/client-modes.md +16 -4
  130. package/docs/concepts/initialization-flow.md +9 -2
  131. package/docs/concepts/policy-packs.md +2 -2
  132. package/docs/headless.md +13 -7
  133. package/docs/hooks/use-consent-manager/overview.md +17 -3
  134. package/docs/hooks/use-ssr-status.md +1 -1
  135. package/docs/hooks/use-translations.md +1 -0
  136. package/docs/iab/consent-banner.md +2 -5
  137. package/docs/iab/consent-dialog.md +3 -6
  138. package/docs/iab/overview.md +11 -5
  139. package/docs/integrations/building-integrations.md +405 -0
  140. package/docs/integrations/databuddy.md +22 -5
  141. package/docs/integrations/google-tag-manager.md +2 -2
  142. package/docs/integrations/google-tag.md +2 -29
  143. package/docs/integrations/linkedin-insights.md +1 -1
  144. package/docs/integrations/meta-pixel.md +1 -1
  145. package/docs/integrations/microsoft-uet.md +1 -1
  146. package/docs/integrations/overview.md +18 -2
  147. package/docs/integrations/posthog.md +39 -17
  148. package/docs/integrations/tiktok-pixel.md +1 -1
  149. package/docs/integrations/x-pixel.md +1 -1
  150. package/docs/optimization.md +2 -6
  151. package/docs/policy-packs.md +7 -7
  152. package/docs/quickstart.md +11 -5
  153. package/docs/script-loader.md +22 -1
  154. package/docs/styling/classnames.md +17 -9
  155. package/docs/styling/overview.md +166 -29
  156. package/docs/styling/slots.md +37 -7
  157. package/docs/styling/tailwind.md +25 -27
  158. package/iab/styles.css +1 -0
  159. package/package.json +15 -9
  160. package/readme.json +6 -0
  161. package/src/iab/styles.css +11 -0
  162. package/src/iab/styles.tw3.css +14 -0
  163. package/src/styles.css +10 -0
  164. package/src/styles.tw3.css +13 -0
  165. package/styles.css +1 -0
  166. package/dist/components/shared/libs/policy-actions.cjs +0 -1
  167. package/dist/components/shared/libs/policy-actions.js +0 -1
  168. package/dist-types/components/shared/libs/policy-actions.d.ts +0 -26
@@ -4,7 +4,19 @@ description: Target individual component parts with styles using the slot system
4
4
  ---
5
5
  ## What are Slots?
6
6
 
7
- Slots let you target specific parts of consent components with styles. Each component is built from named "slots" (e.g., `consentBannerTitle`, `consentDialogFooter`) that you can style individually.
7
+ Slots let you target specific parts of consent components with styles. Each component is built from named slots such as `consentBannerTitle` and `consentDialogFooter`.
8
+
9
+ Use slots after the stock component APIs and design tokens:
10
+
11
+ * If the change is semantic, prefer tokens first. For example, the stock banner footer background comes from `theme.colors.surfaceHover`.
12
+ * If the component part is correct but you need a local tweak, use a slot.
13
+
14
+ Common banner slot choices:
15
+
16
+ * `consentBannerCard` for card radius, shadow, width, and local background treatment
17
+ * `consentBannerFooter` for spacing, borders, and local footer styling
18
+ * `consentBannerTitle` for title typography
19
+ * `buttonPrimary` and `buttonSecondary` for shared button classes
8
20
 
9
21
  ## Using Slots
10
22
 
@@ -13,8 +25,8 @@ Pass slot styles in the theme's `slots` object:
13
25
  ```tsx
14
26
  const theme = {
15
27
  slots: {
16
- // String value = className
17
- consentBannerTitle: 'text-xl font-bold text-gray-900',
28
+ consentBannerFooter: 'border-t border-black/10 px-6',
29
+ consentBannerTitle: 'text-xl font-bold tracking-tight',
18
30
 
19
31
  // Object value = className + inline styles
20
32
  consentBannerCard: {
@@ -34,13 +46,31 @@ Each slot accepts either a `string` (treated as className) or a `SlotStyle` obje
34
46
  consentBannerTitle: 'my-custom-class'
35
47
 
36
48
  // Object: className + style + noStyle
37
- consentBannerTitle: {
38
- className: 'my-custom-class',
39
- style: { color: 'red', fontSize: '1.5rem' },
40
- noStyle: false, // Set true to remove default styles for this slot
49
+ consentBannerFooter: {
50
+ className: 'border-t border-black/10',
51
+ style: { paddingBlock: '1rem' },
52
+ noStyle: false, // Set true only when you want to remove this slot's default styling
41
53
  }
42
54
  ```
43
55
 
56
+ `noStyle` on a slot is an advanced escape hatch. Start with className and style overrides first.
57
+
58
+ ## Example: Style the stock banner without changing markup
59
+
60
+ ```tsx
61
+ const theme = {
62
+ colors: {
63
+ surface: '#fffdf8',
64
+ surfaceHover: '#f6f3ee',
65
+ },
66
+ slots: {
67
+ consentBannerCard: 'rounded-[28px] shadow-xl',
68
+ consentBannerFooter: 'border-t border-black/10 px-6',
69
+ consentBannerTitle: 'tracking-tight',
70
+ },
71
+ } satisfies Theme;
72
+ ```
73
+
44
74
  ## Available Slots
45
75
 
46
76
  Use the typed API reference below for the full slot list and descriptions. It stays in sync with the actual component slot surface.
@@ -6,50 +6,48 @@ c15t works with Tailwind CSS out of the box. Use the `slots` theme option to app
6
6
 
7
7
  ## Setup
8
8
 
9
- Import the standard c15t stylesheet once at the root of your app:
9
+ Import the standard c15t stylesheet once in your app-level CSS entrypoint:
10
10
 
11
- ```tsx
12
- // React
13
- import '@c15t/react/styles.css';
11
+ ```css
12
+ /* React: src/index.css */
13
+ @import "@c15t/react/styles.css";
14
14
 
15
- // Next.js
16
- import '@c15t/nextjs/styles.css';
15
+ /* Next.js: app/globals.css */
16
+ @import "@c15t/nextjs/styles.css";
17
17
  ```
18
18
 
19
+ Keeping the c15t stylesheet in your global CSS entrypoint makes layer and cascade order explicit. JS/TSX side-effect imports can load in a different order across framework and Tailwind tooling, which makes style regressions harder to debug.
20
+
19
21
  ### Tailwind v4
20
22
 
21
- Tailwind v4 automatically scans your source files. Declare c15t's layer order once in your global CSS so utilities stay last:
23
+ Tailwind v4 automatically scans your source files. Import Tailwind normally, then place the c15t stylesheet immediately after it. c15t component styles join Tailwind's `components` layer automatically, so no extra c15t-specific layer declaration is needed:
22
24
 
23
- ```css
24
- @layer theme, base, components, c15t, utilities;
25
+ ```css title="src/index.css"
25
26
  @import "tailwindcss";
27
+ @import "@c15t/react/styles.css";
26
28
  ```
27
29
 
28
- ### Tailwind v3
29
-
30
- Keep Tailwind's directives in your app stylesheet, but wrap `@tailwind base` in a native `base` layer so c15t's `@layer c15t` rules can sit above Preflight:
31
-
32
30
  ```css title="app/globals.css"
33
- @layer base, components, c15t;
31
+ @import "tailwindcss";
32
+ @import "@c15t/nextjs/styles.css";
33
+ ```
34
34
 
35
- @layer base {
36
- @tailwind base;
37
- }
35
+ ### Tailwind v3
36
+
37
+ Import the Tailwind 3-compatible c15t stylesheet after `@tailwind components;` and before `@tailwind utilities;`:
38
38
 
39
+ ```css title="src/index.css"
40
+ @tailwind base;
39
41
  @tailwind components;
42
+ @import "@c15t/react/styles.tw3.css";
40
43
  @tailwind utilities;
41
44
  ```
42
45
 
43
- Then add c15t's component paths to your `content` array:
44
-
45
- ```js title="tailwind.config.js"
46
- module.exports = {
47
- content: [
48
- './src/**/*.{js,ts,jsx,tsx}',
49
- './node_modules/@c15t/react/**/*.{js,mjs}',
50
- './node_modules/@c15t/nextjs/**/*.{js,mjs}',
51
- ],
52
- };
46
+ ```css title="app/globals.css"
47
+ @tailwind base;
48
+ @tailwind components;
49
+ @import "@c15t/nextjs/styles.tw3.css";
50
+ @tailwind utilities;
53
51
  ```
54
52
 
55
53
  ## Using Tailwind with Slots
package/iab/styles.css ADDED
@@ -0,0 +1 @@
1
+ @import "../dist/iab/styles.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c15t/react",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0-rc.8",
4
4
  "description": "Developer-first CMP for React: cookie banner, consent manager, preferences centre. GDPR ready with minimal setup and rich customization",
5
5
  "keywords": [
6
6
  "react",
@@ -32,14 +32,16 @@
32
32
  "type": "module",
33
33
  "exports": {
34
34
  "./styles.css": "./dist/styles.css",
35
+ "./styles.tw3.css": "./dist/styles.tw3.css",
35
36
  "./iab/styles.css": "./dist/iab/styles.css",
37
+ "./iab/styles.tw3.css": "./dist/iab/styles.tw3.css",
36
38
  "./primitives": {
37
- "types": "./dist/primitives.d.ts",
39
+ "types": "./dist-types/primitives.d.ts",
38
40
  "import": "./dist/primitives.js",
39
41
  "require": "./dist/primitives.cjs"
40
42
  },
41
43
  "./primitives/*": {
42
- "types": "./dist/primitives/*.d.ts",
44
+ "types": "./dist-types/primitives/*.d.ts",
43
45
  "import": "./dist/primitives/*.js",
44
46
  "require": "./dist/primitives/*.cjs"
45
47
  },
@@ -137,15 +139,19 @@
137
139
  "docs",
138
140
  "dist-types",
139
141
  "client",
142
+ "styles.css",
143
+ "iab",
144
+ "src/styles.tw3.css",
145
+ "src/iab/styles.tw3.css",
140
146
  "!dist/mockServiceWorker.js"
141
147
  ],
142
148
  "scripts": {
143
149
  "prebuild": "genversion --esm --semi src/version.ts",
144
- "build": "bun prebuild && rslib build && bun run clean:dist:test-artifacts && bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/react",
150
+ "build": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs && bun scripts/generate-distribution-css.ts && bun run clean:dist:test-artifacts && bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/react",
145
151
  "build:agent-docs": "bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/react",
146
152
  "check-types": "bun prebuild && tsc --noEmit",
147
153
  "clean:dist:test-artifacts": "bun --eval \"import { rmSync } from 'node:fs'; rmSync('dist/mockServiceWorker.js', { force: true });\"",
148
- "dev": "bun prebuild && rslib build",
154
+ "dev": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs && bun scripts/generate-distribution-css.ts",
149
155
  "fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
150
156
  "lint": "bun biome lint ./src",
151
157
  "prepack": "cd ../.. && bunx turbo run build --filter=@c15t/react",
@@ -158,13 +164,13 @@
158
164
  "not op_mini all"
159
165
  ],
160
166
  "dependencies": {
161
- "@c15t/ui": "2.0.0-rc.6",
162
- "c15t": "2.0.0-rc.6",
167
+ "@c15t/ui": "2.0.0-rc.8",
168
+ "c15t": "2.0.0-rc.8",
163
169
  "clsx": "2.1.1"
164
170
  },
165
171
  "devDependencies": {
166
- "@c15t/backend": "2.0.0-rc.6",
167
- "@c15t/iab": "2.0.0-rc.6",
172
+ "@c15t/backend": "2.0.0-rc.8",
173
+ "@c15t/iab": "2.0.0-rc.8",
168
174
  "@c15t/typescript-config": "0.0.1-beta.1",
169
175
  "@c15t/vitest-config": "1.0.0",
170
176
  "@iabtechlabtcf/core": "^1.5.20",
package/readme.json CHANGED
@@ -21,6 +21,12 @@
21
21
  "",
22
22
  "```bash\npnpm add @c15t/react\n```",
23
23
  "",
24
+ "Then add the prebuilt stylesheet to your app-level CSS entrypoint:",
25
+ "",
26
+ "```css\n/* src/index.css */\n@import \"@c15t/react/styles.css\";\n```",
27
+ "",
28
+ "If you use the prebuilt IAB TCF UI, also import `@c15t/react/iab/styles.css`. It is published separately so non-IAB apps do not ship those component rules.",
29
+ "",
24
30
  "To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/react/quickstart#manual-setup)."
25
31
  ],
26
32
  "usage": [
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @c15t/react — IAB TCF component styles.
3
+ *
4
+ * Add this stylesheet to the same global CSS entrypoint as your base c15t styles
5
+ * when using IAB consent components. Do not import either stylesheet from JS/TSX.
6
+ *
7
+ * Usage (src/index.css):
8
+ * @import "@c15t/react/styles.css";
9
+ * @import "@c15t/react/iab/styles.css";
10
+ */
11
+ @import "@c15t/ui/iab/styles.css";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @c15t/react/iab — Tailwind 3-compatible IAB component styles.
3
+ *
4
+ * Add this stylesheet to the same global CSS entrypoint as your base c15t styles.
5
+ * Do not import either stylesheet from JS/TSX files.
6
+ *
7
+ * Usage (src/index.css):
8
+ * @tailwind base;
9
+ * @tailwind components;
10
+ * @import "@c15t/react/styles.tw3.css";
11
+ * @import "@c15t/react/iab/styles.tw3.css";
12
+ * @tailwind utilities;
13
+ */
14
+ @import "@c15t/ui/iab/styles.tw3.css";
package/src/styles.css ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @c15t/react — Non-IAB prebuilt component styles.
3
+ *
4
+ * Import this stylesheet once from your app-level CSS entrypoint
5
+ * when using prebuilt (styled) consent components.
6
+ *
7
+ * Usage (src/index.css):
8
+ * @import "@c15t/react/styles.css";
9
+ */
10
+ @import "@c15t/ui/styles.css";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @c15t/react — Tailwind 3-compatible prebuilt component styles.
3
+ *
4
+ * Import this stylesheet in the same global CSS entrypoint as Tailwind 3,
5
+ * after `@tailwind components;` and before `@tailwind utilities;`.
6
+ *
7
+ * Usage (src/index.css):
8
+ * @tailwind base;
9
+ * @tailwind components;
10
+ * @import "@c15t/react/styles.tw3.css";
11
+ * @tailwind utilities;
12
+ */
13
+ @import "@c15t/ui/styles.tw3.css";
package/styles.css ADDED
@@ -0,0 +1 @@
1
+ @import "./dist/styles.css";
@@ -1 +0,0 @@
1
- "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,o)=>{for(var r in o)__webpack_require__.o(o,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},__webpack_require__.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{flattenPolicyActionGroups:()=>flattenPolicyActionGroups,hasPolicyHints:()=>hasPolicyHints,resolvePolicyActionGroups:()=>resolvePolicyActionGroups,resolvePolicyAllowedActions:()=>resolvePolicyAllowedActions,resolvePolicyDirection:()=>resolvePolicyDirection,resolvePolicyOrderedActions:()=>resolvePolicyOrderedActions,resolvePolicyPrimaryActions:()=>resolvePolicyPrimaryActions,resolvePolicyUiProfile:()=>resolvePolicyUiProfile,shouldFillPolicyActions:()=>shouldFillPolicyActions});const DEFAULT_POLICY_ACTIONS=["reject","accept","customize"];function dedupeActions(e){return e&&0!==e.length?[...new Set(e)]:[]}function resolvePolicyAllowedActions(e){let o=dedupeActions(e.allowedActions);return o.length>0?o:[...DEFAULT_POLICY_ACTIONS]}function flattenPolicyActionGroups(e){return e&&0!==e.length?e.flatMap(e=>Array.isArray(e)?e:[e]):[]}function resolvePolicyActionGroups(e){let o=dedupeActions(e.allowedActions);if(0===o.length)return[];if(!e.layout||0===e.layout.length)return[[...o]];let r=new Set(o),i=[],t=new Set;for(let o of e.layout){let e=dedupeActions(Array.isArray(o)?o:[o]).filter(e=>!(!r.has(e)||t.has(e))&&(t.add(e),!0));e.length>0&&i.push(e)}return i.length>0?i:[[...o]]}function resolvePolicyOrderedActions(e){return flattenPolicyActionGroups(resolvePolicyActionGroups({allowedActions:e.allowedActions,layout:e.layout}))}function resolvePolicyPrimaryActions(e){let o=e.orderedActions.includes("customize")?["customize"]:[];if(!e.primaryActions||0===e.primaryActions.length)return o;let r=e.primaryActions.filter(o=>e.orderedActions.includes(o));return r.length>0?r:o}function resolvePolicyDirection(e){return"column"===e?"column":"row"}function resolvePolicyUiProfile(e){return"balanced"===e||"compact"===e||"strict"===e?e:"compact"}function shouldFillPolicyActions(e){let o=resolvePolicyUiProfile(e.uiProfile),r=new Set(e.actionGroups.flat()).size,i=e.actionGroups.length>1,t="column"===e.direction;return"strict"===o||"balanced"===o&&(r<=2||3===r&&(i||t))}function hasPolicyHints(e){return!!e&&Object.values(e).some(e=>Array.isArray(e)?e.length>0:void 0!==e)}for(var __rspack_i in exports.flattenPolicyActionGroups=__webpack_exports__.flattenPolicyActionGroups,exports.hasPolicyHints=__webpack_exports__.hasPolicyHints,exports.resolvePolicyActionGroups=__webpack_exports__.resolvePolicyActionGroups,exports.resolvePolicyAllowedActions=__webpack_exports__.resolvePolicyAllowedActions,exports.resolvePolicyDirection=__webpack_exports__.resolvePolicyDirection,exports.resolvePolicyOrderedActions=__webpack_exports__.resolvePolicyOrderedActions,exports.resolvePolicyPrimaryActions=__webpack_exports__.resolvePolicyPrimaryActions,exports.resolvePolicyUiProfile=__webpack_exports__.resolvePolicyUiProfile,exports.shouldFillPolicyActions=__webpack_exports__.shouldFillPolicyActions,__webpack_exports__)-1===["flattenPolicyActionGroups","hasPolicyHints","resolvePolicyActionGroups","resolvePolicyAllowedActions","resolvePolicyDirection","resolvePolicyOrderedActions","resolvePolicyPrimaryActions","resolvePolicyUiProfile","shouldFillPolicyActions"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1 +0,0 @@
1
- let t=["reject","accept","customize"];function e(t){return t&&0!==t.length?[...new Set(t)]:[]}function o(o){let n=e(o.allowedActions);return n.length>0?n:[...t]}function n(t){return t&&0!==t.length?t.flatMap(t=>Array.isArray(t)?t:[t]):[]}function r(t){let o=e(t.allowedActions);if(0===o.length)return[];if(!t.layout||0===t.layout.length)return[[...o]];let n=new Set(o),r=[],l=new Set;for(let o of t.layout){let t=e(Array.isArray(o)?o:[o]).filter(t=>!(!n.has(t)||l.has(t))&&(l.add(t),!0));t.length>0&&r.push(t)}return r.length>0?r:[[...o]]}function l(t){return n(r({allowedActions:t.allowedActions,layout:t.layout}))}function i(t){let e=t.orderedActions.includes("customize")?["customize"]:[];if(!t.primaryActions||0===t.primaryActions.length)return e;let o=t.primaryActions.filter(e=>t.orderedActions.includes(e));return o.length>0?o:e}function c(t){return"column"===t?"column":"row"}function u(t){return"balanced"===t||"compact"===t||"strict"===t?t:"compact"}function s(t){let e=u(t.uiProfile),o=new Set(t.actionGroups.flat()).size,n=t.actionGroups.length>1,r="column"===t.direction;return"strict"===e||"balanced"===e&&(o<=2||3===o&&(n||r))}function a(t){return!!t&&Object.values(t).some(t=>Array.isArray(t)?t.length>0:void 0!==t)}export{n as flattenPolicyActionGroups,a as hasPolicyHints,r as resolvePolicyActionGroups,o as resolvePolicyAllowedActions,c as resolvePolicyDirection,l as resolvePolicyOrderedActions,i as resolvePolicyPrimaryActions,u as resolvePolicyUiProfile,s as shouldFillPolicyActions};
@@ -1,26 +0,0 @@
1
- import type { PolicyUiAction, PolicyUiActionDirection, PolicyUiActionGroup, PolicyUiProfile, PolicyUiSurfaceConfig } from '../../../../../core/dist-types/index.d.ts';
2
- export type { PolicyUiAction, PolicyUiActionDirection, PolicyUiActionGroup, PolicyUiProfile, PolicyUiSurfaceConfig, };
3
- export declare function resolvePolicyAllowedActions(params: {
4
- allowedActions?: PolicyUiAction[];
5
- }): PolicyUiAction[];
6
- export declare function flattenPolicyActionGroups(layout?: PolicyUiActionGroup[]): PolicyUiAction[];
7
- export declare function resolvePolicyActionGroups(params: {
8
- allowedActions: PolicyUiAction[];
9
- layout?: PolicyUiActionGroup[];
10
- }): PolicyUiAction[][];
11
- export declare function resolvePolicyOrderedActions(params: {
12
- allowedActions: PolicyUiAction[];
13
- layout?: PolicyUiActionGroup[];
14
- }): PolicyUiAction[];
15
- export declare function resolvePolicyPrimaryActions(params: {
16
- orderedActions: PolicyUiAction[];
17
- primaryActions?: PolicyUiAction[];
18
- }): PolicyUiAction[];
19
- export declare function resolvePolicyDirection(direction?: PolicyUiActionDirection): PolicyUiActionDirection;
20
- export declare function resolvePolicyUiProfile(profile?: PolicyUiProfile): PolicyUiProfile;
21
- export declare function shouldFillPolicyActions(params: {
22
- uiProfile?: PolicyUiProfile;
23
- actionGroups: PolicyUiAction[][];
24
- direction?: PolicyUiActionDirection;
25
- }): boolean;
26
- export declare function hasPolicyHints(surface?: PolicyUiSurfaceConfig): boolean;