@prosefly/astro-components 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -104,25 +104,25 @@ import '@prosefly/astro-components/markdown/image-gallery.css';
104
104
 
105
105
  ## Styling
106
106
 
107
- Consumers can theme the components with `--pl-*` custom properties:
108
-
109
- - `--pl-text-strong`
110
- - `--pl-text`
111
- - `--pl-text-muted`
112
- - `--pl-background`
113
- - `--pl-surface`
114
- - `--pl-accent`
115
- - `--pl-accent-soft`
116
- - `--pl-accent-contrast`
117
- - `--pl-{info|success|warning|danger}`
118
- - `--pl-{info|success|warning|danger}-soft`
119
- - `--pl-{info|success|warning|danger}-ink`
120
- - `--pl-{info|success|warning|danger}-contrast`
121
- - `--pl-callout-{note|tip|warning|danger}-{color|ink|bg}`
122
- - `--pl-border-subtle`
123
- - `--pl-font-sans`
124
- - `--pl-font-mono`
125
- - `--pl-radius-sm`
126
- - `--pl-radius-md`
127
- - `--pl-radius-lg`
128
- - `--pl-radius-full`
107
+ Consumers can theme the components with `--pf-*` custom properties:
108
+
109
+ - `--pf-text-strong`
110
+ - `--pf-text`
111
+ - `--pf-text-muted`
112
+ - `--pf-background`
113
+ - `--pf-surface`
114
+ - `--pf-accent`
115
+ - `--pf-accent-soft`
116
+ - `--pf-accent-contrast`
117
+ - `--pf-{info|success|warning|danger}`
118
+ - `--pf-{info|success|warning|danger}-soft`
119
+ - `--pf-{info|success|warning|danger}-ink`
120
+ - `--pf-{info|success|warning|danger}-contrast`
121
+ - `--pf-callout-{note|tip|warning|danger}-{color|ink|bg}`
122
+ - `--pf-border-subtle`
123
+ - `--pf-font-sans`
124
+ - `--pf-font-mono`
125
+ - `--pf-radius-sm`
126
+ - `--pf-radius-md`
127
+ - `--pf-radius-lg`
128
+ - `--pf-radius-full`
@@ -1,6 +1,6 @@
1
1
  export {};
2
2
  function getItems(root) {
3
- return [...root.querySelectorAll(':scope > [data-pl-accordion]')].filter((item) => item instanceof HTMLDetailsElement);
3
+ return [...root.querySelectorAll(':scope > [data-pf-accordion]')].filter((item) => item instanceof HTMLDetailsElement);
4
4
  }
5
5
  function closeSiblings(root, activeItem) {
6
6
  if (root.hasAttribute('data-multiple'))
@@ -11,7 +11,7 @@ function closeSiblings(root, activeItem) {
11
11
  }
12
12
  }
13
13
  function openItem(item) {
14
- const root = item.closest('[data-pl-accordions]');
14
+ const root = item.closest('[data-pf-accordions]');
15
15
  item.open = true;
16
16
  if (root)
17
17
  closeSiblings(root, item);
@@ -21,17 +21,17 @@ function openHashTarget() {
21
21
  return;
22
22
  const id = decodeURIComponent(location.hash.slice(1));
23
23
  const item = document.getElementById(id);
24
- if (item instanceof HTMLDetailsElement && item.matches('[data-pl-accordion]')) {
24
+ if (item instanceof HTMLDetailsElement && item.matches('[data-pf-accordion]')) {
25
25
  openItem(item);
26
26
  }
27
27
  }
28
28
  if (!window.__proseflyAccordionsInit) {
29
29
  window.__proseflyAccordionsInit = () => {
30
- document.querySelectorAll('[data-pl-accordions]').forEach((root) => {
31
- if (!(root instanceof HTMLElement) || root.dataset.plAccordionsReady === 'true') {
30
+ document.querySelectorAll('[data-pf-accordions]').forEach((root) => {
31
+ if (!(root instanceof HTMLElement) || root.dataset.pfAccordionsReady === 'true') {
32
32
  return;
33
33
  }
34
- root.dataset.plAccordionsReady = 'true';
34
+ root.dataset.pfAccordionsReady = 'true';
35
35
  let defaultValues = [];
36
36
  try {
37
37
  defaultValues = JSON.parse(root.getAttribute('data-default-values') || '[]');
@@ -44,7 +44,7 @@ if (!window.__proseflyAccordionsInit) {
44
44
  openItem(item);
45
45
  }
46
46
  item.addEventListener('click', (event) => {
47
- if (!(event.target instanceof Element) || !event.target.closest('[data-pl-accordion-trigger]')) {
47
+ if (!(event.target instanceof Element) || !event.target.closest('[data-pf-accordion-trigger]')) {
48
48
  return;
49
49
  }
50
50
  if (item.getAttribute('data-disabled') === 'true') {
@@ -29,7 +29,7 @@ function getItemLeft(track, item) {
29
29
  return item.getBoundingClientRect().left - track.getBoundingClientRect().left + track.scrollLeft;
30
30
  }
31
31
  function scrollToAdjacentItem(track, direction) {
32
- const items = [...track.querySelectorAll('.pl-image-gallery__item')].filter((item) => item instanceof HTMLElement);
32
+ const items = [...track.querySelectorAll('.pf-image-gallery__item')].filter((item) => item instanceof HTMLElement);
33
33
  const currentLeft = track.scrollLeft;
34
34
  const positions = items.map((item) => getItemLeft(track, item));
35
35
  const target = direction === 'previous'
@@ -41,7 +41,7 @@ function scrollToAdjacentItem(track, direction) {
41
41
  });
42
42
  }
43
43
  function measureGallery(gallery, track) {
44
- const items = [...track.querySelectorAll('.pl-image-gallery__item')].filter((item) => item instanceof HTMLElement);
44
+ const items = [...track.querySelectorAll('.pf-image-gallery__item')].filter((item) => item instanceof HTMLElement);
45
45
  const images = items
46
46
  .map((item) => item.querySelector('img'))
47
47
  .filter((image) => image instanceof HTMLImageElement);
@@ -57,14 +57,14 @@ function measureGallery(gallery, track) {
57
57
  const resolvedRatios = ratios;
58
58
  const styles = getComputedStyle(track);
59
59
  const gap = Number.parseFloat(styles.columnGap || styles.gap || '0') || 0;
60
- const previewWidth = resolveCssLength(getComputedStyle(gallery).getPropertyValue('--pl-image-gallery-preview-width'), gallery);
60
+ const previewWidth = resolveCssLength(getComputedStyle(gallery).getPropertyValue('--pf-image-gallery-preview-width'), gallery);
61
61
  const firstRatio = resolvedRatios[0];
62
62
  const targetHeight = Math.max((track.clientWidth - previewWidth - gap) / firstRatio, 1);
63
- gallery.style.setProperty('--pl-image-gallery-height', `${targetHeight.toFixed(2)}px`);
64
- gallery.dataset.plImageGalleryMeasured = 'true';
63
+ gallery.style.setProperty('--pf-image-gallery-height', `${targetHeight.toFixed(2)}px`);
64
+ gallery.dataset.pfImageGalleryMeasured = 'true';
65
65
  items.forEach((item, index) => {
66
66
  const ratio = resolvedRatios[index];
67
- item.style.setProperty('--pl-image-gallery-ratio', ratio.toFixed(5));
67
+ item.style.setProperty('--pf-image-gallery-ratio', ratio.toFixed(5));
68
68
  item.style.height = `${targetHeight.toFixed(2)}px`;
69
69
  item.style.width = `${Math.max(targetHeight * ratio, 1).toFixed(2)}px`;
70
70
  });
@@ -72,25 +72,25 @@ function measureGallery(gallery, track) {
72
72
  if (typeof window !== 'undefined') {
73
73
  if (!window.__proseflyImageGalleryInit) {
74
74
  window.__proseflyImageGalleryInit = () => {
75
- document.querySelectorAll('[data-pl-image-gallery]').forEach((gallery) => {
76
- if (!(gallery instanceof HTMLElement) || gallery.dataset.plImageGalleryReady) {
75
+ document.querySelectorAll('[data-pf-image-gallery]').forEach((gallery) => {
76
+ if (!(gallery instanceof HTMLElement) || gallery.dataset.pfImageGalleryReady) {
77
77
  return;
78
78
  }
79
- const track = gallery.querySelector('[data-pl-image-gallery-track]');
79
+ const track = gallery.querySelector('[data-pf-image-gallery-track]');
80
80
  if (!(track instanceof HTMLElement)) {
81
81
  return;
82
82
  }
83
- gallery.dataset.plImageGalleryReady = 'true';
83
+ gallery.dataset.pfImageGalleryReady = 'true';
84
84
  const measure = () => measureGallery(gallery, track);
85
85
  const images = [...track.querySelectorAll('img')].filter((image) => image instanceof HTMLImageElement);
86
86
  Promise.all(images.map(imageReady)).then(measure);
87
87
  new ResizeObserver(measure).observe(track);
88
- gallery.querySelectorAll('[data-pl-image-gallery-button]').forEach((button) => {
88
+ gallery.querySelectorAll('[data-pf-image-gallery-button]').forEach((button) => {
89
89
  if (!(button instanceof HTMLButtonElement)) {
90
90
  return;
91
91
  }
92
92
  button.addEventListener('click', () => {
93
- const direction = button.getAttribute('data-pl-image-gallery-button');
93
+ const direction = button.getAttribute('data-pf-image-gallery-button');
94
94
  scrollToAdjacentItem(track, direction === 'previous' ? 'previous' : 'next');
95
95
  });
96
96
  });
@@ -3,7 +3,7 @@ function getStoredLabel(syncKey) {
3
3
  if (!syncKey)
4
4
  return undefined;
5
5
  try {
6
- return localStorage.getItem(`pl-tabs:${syncKey}`) ?? undefined;
6
+ return localStorage.getItem(`pf-tabs:${syncKey}`) ?? undefined;
7
7
  }
8
8
  catch {
9
9
  return undefined;
@@ -13,7 +13,7 @@ function storeLabel(syncKey, label) {
13
13
  if (!syncKey || !label)
14
14
  return;
15
15
  try {
16
- localStorage.setItem(`pl-tabs:${syncKey}`, label);
16
+ localStorage.setItem(`pf-tabs:${syncKey}`, label);
17
17
  }
18
18
  catch {
19
19
  // Ignore storage failures in restricted browsing contexts.
@@ -27,26 +27,26 @@ async function writeClipboard(text) {
27
27
  throw new Error('Clipboard API is not available.');
28
28
  }
29
29
  function setCopyState(button, copied) {
30
- const copyIcon = button.querySelector('[data-pl-tabs-copy-icon="copy"]');
31
- const checkIcon = button.querySelector('[data-pl-tabs-copy-icon="check"]');
30
+ const copyIcon = button.querySelector('[data-pf-tabs-copy-icon="copy"]');
31
+ const checkIcon = button.querySelector('[data-pf-tabs-copy-icon="check"]');
32
32
  copyIcon?.toggleAttribute('hidden', copied);
33
33
  checkIcon?.toggleAttribute('hidden', !copied);
34
34
  button.setAttribute('aria-label', copied ? 'Copied' : 'Copy code');
35
35
  button.setAttribute('title', copied ? 'Copied' : 'Copy code');
36
36
  }
37
37
  function getActiveCode(root) {
38
- const activePanel = root.querySelector('.pl-tabs__panel:not([hidden])');
38
+ const activePanel = root.querySelector('.pf-tabs__panel:not([hidden])');
39
39
  const code = activePanel?.querySelector('pre code');
40
40
  return code?.textContent ?? '';
41
41
  }
42
42
  function setActiveIcon(root, panelId) {
43
- const iconContainer = root.querySelector('.pl-tabs__active-icons');
44
- const icons = [...root.querySelectorAll('[data-pl-tabs-icon-for]')];
43
+ const iconContainer = root.querySelector('.pf-tabs__active-icons');
44
+ const icons = [...root.querySelectorAll('[data-pf-tabs-icon-for]')];
45
45
  if (!(iconContainer instanceof HTMLElement))
46
46
  return;
47
47
  let hasActiveIcon = false;
48
48
  icons.forEach((icon) => {
49
- const isActive = icon.getAttribute('data-pl-tabs-icon-for') === panelId;
49
+ const isActive = icon.getAttribute('data-pf-tabs-icon-for') === panelId;
50
50
  icon.toggleAttribute('hidden', !isActive);
51
51
  hasActiveIcon ||= isActive;
52
52
  });
@@ -56,8 +56,8 @@ function activate(root, trigger, options = {}) {
56
56
  const panelId = trigger.getAttribute('data-tab-panel');
57
57
  const label = trigger.getAttribute('data-tab-label');
58
58
  const syncKey = root.getAttribute('data-sync-key');
59
- const triggers = [...root.querySelectorAll('[data-pl-tabs-trigger]')];
60
- const panels = [...root.querySelectorAll('.pl-tabs__panel')];
59
+ const triggers = [...root.querySelectorAll('[data-pf-tabs-trigger]')];
60
+ const panels = [...root.querySelectorAll('.pf-tabs__panel')];
61
61
  triggers.forEach((button) => {
62
62
  const isActive = button === trigger;
63
63
  button.setAttribute('aria-selected', isActive ? 'true' : 'false');
@@ -77,12 +77,12 @@ function activate(root, trigger, options = {}) {
77
77
  if (!syncKey || !label) {
78
78
  return;
79
79
  }
80
- document.querySelectorAll('[data-pl-tabs]').forEach((otherRoot) => {
80
+ document.querySelectorAll('[data-pf-tabs]').forEach((otherRoot) => {
81
81
  if (otherRoot === root || otherRoot.getAttribute('data-sync-key') !== syncKey) {
82
82
  return;
83
83
  }
84
84
  const matchingTrigger = [
85
- ...otherRoot.querySelectorAll('[data-pl-tabs-trigger]'),
85
+ ...otherRoot.querySelectorAll('[data-pf-tabs-trigger]'),
86
86
  ].find((button) => button.getAttribute('data-tab-label') === label);
87
87
  if (matchingTrigger) {
88
88
  activate(otherRoot, matchingTrigger, { persist: false });
@@ -91,11 +91,11 @@ function activate(root, trigger, options = {}) {
91
91
  }
92
92
  if (!window.__proseflyTabsInit) {
93
93
  window.__proseflyTabsInit = () => {
94
- document.querySelectorAll('[data-pl-tabs]').forEach((root) => {
95
- if (root instanceof HTMLElement && root.dataset.plTabsReady === 'true') {
94
+ document.querySelectorAll('[data-pf-tabs]').forEach((root) => {
95
+ if (root instanceof HTMLElement && root.dataset.pfTabsReady === 'true') {
96
96
  return;
97
97
  }
98
- const triggers = [...root.querySelectorAll('[data-pl-tabs-trigger]')];
98
+ const triggers = [...root.querySelectorAll('[data-pf-tabs-trigger]')];
99
99
  const syncKey = root.getAttribute('data-sync-key');
100
100
  const storedLabel = getStoredLabel(syncKey);
101
101
  const storedTrigger = storedLabel
@@ -105,7 +105,7 @@ if (!window.__proseflyTabsInit) {
105
105
  triggers.find((button) => button.getAttribute('aria-selected') === 'true') ??
106
106
  triggers[0];
107
107
  if (root instanceof HTMLElement) {
108
- root.dataset.plTabsReady = 'true';
108
+ root.dataset.pfTabsReady = 'true';
109
109
  }
110
110
  if (selectedTrigger) {
111
111
  activate(root, selectedTrigger, { persist: false });
@@ -133,7 +133,7 @@ if (!window.__proseflyTabsInit) {
133
133
  activate(root, nextTrigger, { focus: true });
134
134
  });
135
135
  });
136
- root.querySelectorAll('[data-pl-tabs-copy]').forEach((button) => {
136
+ root.querySelectorAll('[data-pf-tabs-copy]').forEach((button) => {
137
137
  if (!(button instanceof HTMLButtonElement)) {
138
138
  return;
139
139
  }
@@ -41,7 +41,7 @@ function createImageGallery(images) {
41
41
  type: 'element',
42
42
  tagName: 'figure',
43
43
  properties: {
44
- className: ['pl-image-gallery'],
44
+ className: ['pf-image-gallery'],
45
45
  dataImageCount: String(imageCount),
46
46
  },
47
47
  children: images,
@@ -51,9 +51,9 @@ function createImageGallery(images) {
51
51
  type: 'element',
52
52
  tagName: 'figure',
53
53
  properties: {
54
- className: ['pl-image-gallery'],
54
+ className: ['pf-image-gallery'],
55
55
  dataImageCount: String(imageCount),
56
- dataPlImageGallery: '',
56
+ dataPfImageGallery: '',
57
57
  },
58
58
  children: [
59
59
  createGalleryButton('previous'),
@@ -61,8 +61,8 @@ function createImageGallery(images) {
61
61
  type: 'element',
62
62
  tagName: 'div',
63
63
  properties: {
64
- className: ['pl-image-gallery__track'],
65
- dataPlImageGalleryTrack: '',
64
+ className: ['pf-image-gallery__track'],
65
+ dataPfImageGalleryTrack: '',
66
66
  },
67
67
  children: images.map(createGalleryItem),
68
68
  },
@@ -75,7 +75,7 @@ function createGalleryItem(image) {
75
75
  type: 'element',
76
76
  tagName: 'span',
77
77
  properties: {
78
- className: ['pl-image-gallery__item'],
78
+ className: ['pf-image-gallery__item'],
79
79
  },
80
80
  children: [image],
81
81
  };
@@ -86,8 +86,8 @@ function createGalleryButton(direction) {
86
86
  tagName: 'button',
87
87
  properties: {
88
88
  ariaLabel: direction === 'previous' ? 'Previous image' : 'Next image',
89
- className: ['pl-image-gallery__button'],
90
- dataPlImageGalleryButton: direction,
89
+ className: ['pf-image-gallery__button'],
90
+ dataPfImageGalleryButton: direction,
91
91
  type: 'button',
92
92
  },
93
93
  children: [createChevronIcon(direction)],
@@ -99,7 +99,7 @@ function createChevronIcon(direction) {
99
99
  tagName: 'svg',
100
100
  properties: {
101
101
  ariaHidden: 'true',
102
- className: ['pl-image-gallery__button-icon'],
102
+ className: ['pf-image-gallery__button-icon'],
103
103
  fill: 'none',
104
104
  height: '20',
105
105
  stroke: 'currentColor',
@@ -1,19 +1,21 @@
1
- .pl-image-gallery {
1
+ @import "../theme-tokens.css";
2
+
3
+ .pf-image-gallery {
2
4
  margin-inline: 0;
3
5
  }
4
6
 
5
- .pl-image-gallery img {
7
+ .pf-image-gallery img {
6
8
  display: block;
7
9
  margin: 0;
8
10
  width: 100%;
9
11
  }
10
12
 
11
- .pl-image-gallery:not([data-image-count="1"]) {
12
- --pl-image-gallery-preview-width: 4rem;
13
+ .pf-image-gallery:not([data-image-count="1"]) {
14
+ --pf-image-gallery-preview-width: 4rem;
13
15
  position: relative;
14
16
  }
15
17
 
16
- .pl-image-gallery__track {
18
+ .pf-image-gallery__track {
17
19
  align-items: flex-start;
18
20
  display: flex;
19
21
  gap: 0.75rem;
@@ -26,23 +28,23 @@
26
28
  scrollbar-width: none;
27
29
  }
28
30
 
29
- .pl-image-gallery__track::-webkit-scrollbar {
31
+ .pf-image-gallery__track::-webkit-scrollbar {
30
32
  display: none;
31
33
  }
32
34
 
33
- .pl-image-gallery__item {
35
+ .pf-image-gallery__item {
34
36
  align-items: center;
35
- aspect-ratio: var(--pl-image-gallery-ratio, 3 / 2);
36
- border-radius: min(var(--pl-radius-lg, 0.75rem), 1rem);
37
+ aspect-ratio: var(--pf-image-gallery-ratio, 3 / 2);
38
+ border-radius: min(var(--pf-radius-lg, 0.75rem), 1rem);
37
39
  display: flex;
38
40
  flex: 0 0 auto;
39
41
  justify-content: center;
40
42
  overflow: hidden;
41
43
  scroll-snap-align: start;
42
- width: calc(100% - var(--pl-image-gallery-preview-width));
44
+ width: calc(100% - var(--pf-image-gallery-preview-width));
43
45
  }
44
46
 
45
- .pl-image-gallery__item img {
47
+ .pf-image-gallery__item img {
46
48
  border-radius: inherit;
47
49
  height: 100%;
48
50
  object-fit: contain;
@@ -50,19 +52,19 @@
50
52
  }
51
53
 
52
54
  @media (max-width: 640px) {
53
- .pl-image-gallery:not([data-image-count="1"]) {
54
- --pl-image-gallery-preview-width: 2.75rem;
55
+ .pf-image-gallery:not([data-image-count="1"]) {
56
+ --pf-image-gallery-preview-width: 2.75rem;
55
57
  }
56
58
  }
57
59
 
58
- .pl-image-gallery__button {
60
+ .pf-image-gallery__button {
59
61
  align-items: center;
60
62
  appearance: none;
61
63
  backdrop-filter: blur(8px);
62
- background: color-mix(in oklab, var(--pl-background, #ffffff) 82%, transparent);
63
- border: 1px solid color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
64
- border-radius: var(--pl-radius-full, 999px);
65
- color: var(--pl-text-strong, var(--pl-text, #182230));
64
+ background: color-mix(in oklab, var(--pf-background, #ffffff) 82%, transparent);
65
+ border: 1px solid color-mix(in oklab, var(--pf-text-muted, #667085) 18%, transparent);
66
+ border-radius: var(--pf-radius-full, 999px);
67
+ color: var(--pf-text-strong, var(--pf-text, #182230));
66
68
  cursor: pointer;
67
69
  display: inline-flex;
68
70
  height: 2rem;
@@ -81,38 +83,38 @@
81
83
  z-index: 1;
82
84
  }
83
85
 
84
- .pl-image-gallery__button[data-pl-image-gallery-button="previous"] {
86
+ .pf-image-gallery__button[data-pf-image-gallery-button="previous"] {
85
87
  inset-inline-start: 0.75rem;
86
88
  }
87
89
 
88
- .pl-image-gallery__button[data-pl-image-gallery-button="next"] {
90
+ .pf-image-gallery__button[data-pf-image-gallery-button="next"] {
89
91
  inset-inline-end: 0.75rem;
90
92
  }
91
93
 
92
- .pl-image-gallery__button:hover {
93
- background: color-mix(in oklab, var(--pl-background, #ffffff) 94%, transparent);
94
- border-color: color-mix(in oklab, var(--pl-text-muted, #667085) 30%, transparent);
94
+ .pf-image-gallery__button:hover {
95
+ background: color-mix(in oklab, var(--pf-background, #ffffff) 94%, transparent);
96
+ border-color: color-mix(in oklab, var(--pf-text-muted, #667085) 30%, transparent);
95
97
  }
96
98
 
97
- .pl-image-gallery__button:focus-visible {
98
- outline: 2px solid var(--pl-accent, #4f46e5);
99
+ .pf-image-gallery__button:focus-visible {
100
+ outline: 2px solid var(--pf-accent, #3e7e55);
99
101
  outline-offset: 2px;
100
102
  }
101
103
 
102
- .pl-image-gallery__button-icon {
104
+ .pf-image-gallery__button-icon {
103
105
  display: block;
104
106
  height: 1.125rem;
105
107
  width: 1.125rem;
106
108
  }
107
109
 
108
110
  @media (hover: hover) {
109
- .pl-image-gallery__button {
111
+ .pf-image-gallery__button {
110
112
  opacity: 0;
111
113
  pointer-events: none;
112
114
  }
113
115
 
114
- .pl-image-gallery:hover .pl-image-gallery__button,
115
- .pl-image-gallery:focus-within .pl-image-gallery__button {
116
+ .pf-image-gallery:hover .pf-image-gallery__button,
117
+ .pf-image-gallery:focus-within .pf-image-gallery__button {
116
118
  opacity: 1;
117
119
  pointer-events: auto;
118
120
  }
@@ -288,7 +288,7 @@ function createPackageManagerCodeElement(code, language) {
288
288
  {
289
289
  type: 'mdxJsxAttribute',
290
290
  name: 'className',
291
- value: 'pl-package-manager-code',
291
+ value: 'pf-package-manager-code',
292
292
  },
293
293
  {
294
294
  type: 'mdxJsxAttribute',
@@ -23,8 +23,8 @@ if (!title) {
23
23
  ---
24
24
 
25
25
  <details
26
- class="pl-accordion"
27
- data-pl-accordion
26
+ class="pf-accordion"
27
+ data-pf-accordion
28
28
  data-value={value}
29
29
  data-disabled={disabled ? 'true' : undefined}
30
30
  id={id}
@@ -32,11 +32,11 @@ if (!title) {
32
32
  >
33
33
  <summary
34
34
  aria-disabled={disabled ? 'true' : undefined}
35
- class="pl-accordion__trigger"
36
- data-pl-accordion-trigger
35
+ class="pf-accordion__trigger"
36
+ data-pf-accordion-trigger
37
37
  >
38
- <span class="pl-accordion__title">{title}</span>
39
- <span aria-hidden="true" class="pl-accordion__chevron">
38
+ <span class="pf-accordion__title">{title}</span>
39
+ <span aria-hidden="true" class="pf-accordion__chevron">
40
40
  <svg fill="none" height="16" viewBox="0 0 24 24" width="16">
41
41
  <path
42
42
  d="m6 9 6 6 6-6"
@@ -48,7 +48,7 @@ if (!title) {
48
48
  </svg>
49
49
  </span>
50
50
  </summary>
51
- <div class="pl-accordion__content">
51
+ <div class="pf-accordion__content">
52
52
  <slot />
53
53
  </div>
54
54
  </details>
@@ -1,4 +1,6 @@
1
1
  ---
2
+ import '../theme-tokens.css';
3
+
2
4
  interface Props {
3
5
  multiple?: boolean;
4
6
  defaultValue?: string | string[];
@@ -14,10 +16,10 @@ const defaultValues =
14
16
  ---
15
17
 
16
18
  <div
17
- class="pl-accordions"
19
+ class="pf-accordions"
18
20
  data-default-values={JSON.stringify(defaultValues)}
19
21
  data-multiple={multiple ? 'true' : undefined}
20
- data-pl-accordions
22
+ data-pf-accordions
21
23
  >
22
24
  <slot />
23
25
  </div>
@@ -27,26 +29,26 @@ const defaultValues =
27
29
  </script>
28
30
 
29
31
  <style is:global>
30
- .pl-accordions {
32
+ .pf-accordions {
31
33
  border-bottom: 1px solid
32
- color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
34
+ color-mix(in oklab, var(--pf-text-muted, #667085) 18%, transparent);
33
35
  border-top: 1px solid
34
- color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
36
+ color-mix(in oklab, var(--pf-text-muted, #667085) 18%, transparent);
35
37
  margin-block: 1.5rem;
36
38
  }
37
39
 
38
- .pl-accordion {
40
+ .pf-accordion {
39
41
  border-bottom: 1px solid
40
- color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
42
+ color-mix(in oklab, var(--pf-text-muted, #667085) 18%, transparent);
41
43
  }
42
44
 
43
- .pl-accordion:last-child {
45
+ .pf-accordion:last-child {
44
46
  border-bottom: 0;
45
47
  }
46
48
 
47
- .pl-accordion__trigger {
49
+ .pf-accordion__trigger {
48
50
  align-items: center;
49
- color: var(--pl-text-strong, var(--pl-text, #182230));
51
+ color: var(--pf-text-strong, var(--pf-text, #182230));
50
52
  cursor: pointer;
51
53
  display: flex;
52
54
  gap: 1rem;
@@ -57,30 +59,30 @@ const defaultValues =
57
59
  transition: color 160ms ease;
58
60
  }
59
61
 
60
- .pl-accordion__trigger::-webkit-details-marker {
62
+ .pf-accordion__trigger::-webkit-details-marker {
61
63
  display: none;
62
64
  }
63
65
 
64
- .pl-accordion__trigger:hover {
65
- color: var(--pl-accent, #4f46e5);
66
+ .pf-accordion__trigger:hover {
67
+ color: var(--pf-accent, #3e7e55);
66
68
  text-decoration: underline;
67
69
  text-underline-offset: 0.25rem;
68
70
  }
69
71
 
70
- .pl-accordion__trigger:focus-visible {
71
- border-radius: var(--pl-radius-md, 0.5rem);
72
- outline: 2px solid var(--pl-accent, #4f46e5);
72
+ .pf-accordion__trigger:focus-visible {
73
+ border-radius: var(--pf-radius-md, 0.5rem);
74
+ outline: 2px solid var(--pf-accent, #3e7e55);
73
75
  outline-offset: 2px;
74
76
  }
75
77
 
76
- .pl-accordion__title {
78
+ .pf-accordion__title {
77
79
  font-size: 0.9375rem;
78
80
  font-weight: 500;
79
81
  line-height: 1.5rem;
80
82
  }
81
83
 
82
- .pl-accordion__chevron {
83
- color: var(--pl-text-muted, #667085);
84
+ .pf-accordion__chevron {
85
+ color: var(--pf-text-muted, #667085);
84
86
  display: inline-flex;
85
87
  flex: 0 0 auto;
86
88
  transition:
@@ -88,38 +90,38 @@ const defaultValues =
88
90
  transform 160ms ease;
89
91
  }
90
92
 
91
- .pl-accordion[open] > .pl-accordion__trigger .pl-accordion__chevron {
93
+ .pf-accordion[open] > .pf-accordion__trigger .pf-accordion__chevron {
92
94
  transform: rotate(180deg);
93
95
  }
94
96
 
95
- .pl-accordion__trigger:hover .pl-accordion__chevron {
97
+ .pf-accordion__trigger:hover .pf-accordion__chevron {
96
98
  color: currentColor;
97
99
  }
98
100
 
99
- .pl-accordion__content {
100
- color: var(--pl-text, #344054);
101
+ .pf-accordion__content {
102
+ color: var(--pf-text, #344054);
101
103
  font-size: 0.9375rem;
102
104
  line-height: 1.75;
103
105
  padding-block: 0 1rem;
104
106
  }
105
107
 
106
- .pl-accordion__content > :first-child {
108
+ .pf-accordion__content > :first-child {
107
109
  margin-block-start: 0;
108
110
  }
109
111
 
110
- .pl-accordion__content > :last-child {
112
+ .pf-accordion__content > :last-child {
111
113
  margin-block-end: 0;
112
114
  }
113
115
 
114
- .pl-accordion__content > * + * {
116
+ .pf-accordion__content > * + * {
115
117
  margin-block-start: 0.75rem;
116
118
  }
117
119
 
118
- .pl-accordion[data-disabled='true'] {
120
+ .pf-accordion[data-disabled='true'] {
119
121
  opacity: 0.55;
120
122
  }
121
123
 
122
- .pl-accordion[data-disabled='true'] > .pl-accordion__trigger {
124
+ .pf-accordion[data-disabled='true'] > .pf-accordion__trigger {
123
125
  cursor: not-allowed;
124
126
  text-decoration: none;
125
127
  }