@santi020k/lumen-astro 0.2.0 → 0.3.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
@@ -65,6 +65,29 @@ Lucide intentionally excludes brand marks. For GitHub and other project-specific
65
65
  SVG in the default slot instead of passing an unsupported `name`; Astro warns about unknown named
66
66
  icons during development.
67
67
 
68
+ ## Code tabs
69
+
70
+ Use `CodeTabs` for related install commands, language variants, or configuration examples. Each
71
+ item supplies a stable value, visible label, code string, and optional language. A shared
72
+ `storageKey` keeps matching instances synchronized and remembers the reader's selection.
73
+
74
+ ```astro
75
+ ---
76
+ import { CodeTabs } from '@santi020k/lumen-astro'
77
+
78
+ const installCommands = [
79
+ { value: 'pnpm', label: 'pnpm', code: 'pnpm add @santi020k/lumen-astro', language: 'bash' },
80
+ { value: 'npm', label: 'npm', code: 'npm install @santi020k/lumen-astro', language: 'bash' }
81
+ ]
82
+ ---
83
+
84
+ <CodeTabs
85
+ ariaLabel="Package manager"
86
+ items={installCommands}
87
+ storageKey="preferred-package-manager"
88
+ />
89
+ ```
90
+
68
91
  ## Optimized images
69
92
 
70
93
  Lumen's Astro `Image` delegates to `astro:assets`, so imported image metadata, responsive layouts,
@@ -0,0 +1,92 @@
1
+ ---
2
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
+
4
+ import type { HTMLAttributes } from 'astro/types'
5
+
6
+ import Code from './Code.astro'
7
+ import Tabs from './Tabs.astro'
8
+
9
+ type CodeTheme = 'auto' | 'lumen' | 'santi020k'
10
+
11
+ export interface CodeTabItem {
12
+ code: string
13
+ label: string
14
+ language?: string
15
+ value: string
16
+ }
17
+
18
+ interface Props extends HTMLAttributes<'div'> {
19
+ ariaLabel?: string
20
+ class?: string | null
21
+ className?: string
22
+ copy?: boolean
23
+ initialValue?: string
24
+ items: readonly CodeTabItem[]
25
+ storageKey?: string
26
+ theme?: CodeTheme
27
+ wrap?: boolean
28
+ }
29
+
30
+ const {
31
+ ariaLabel = 'Code examples',
32
+ class: classProp = '',
33
+ className = '',
34
+ copy = true,
35
+ initialValue,
36
+ items,
37
+ storageKey,
38
+ theme = 'auto',
39
+ wrap = true,
40
+ ...rest
41
+ } = Astro.props
42
+
43
+ const selectedValue = initialValue ?? items[0]?.value
44
+ const tabsStateProps = {
45
+ ...(selectedValue === undefined ? {} : { initialValue: selectedValue }),
46
+ ...(storageKey === undefined ? {} : { storageKey })
47
+ }
48
+ const { classList, passthrough } = resolveLumenAstroProps(
49
+ rest,
50
+ ['ui-code-tabs'],
51
+ classProp ?? '',
52
+ className
53
+ )
54
+ ---
55
+
56
+ <Tabs
57
+ class:list={classList}
58
+ {...tabsStateProps}
59
+ {...passthrough}
60
+ >
61
+ <div class="ui-code-tabs__list" role="tablist" aria-label={ariaLabel}>
62
+ {items.map(item => (
63
+ <button
64
+ aria-selected={item.value === selectedValue ? 'true' : 'false'}
65
+ class="ui-code-tabs__tab"
66
+ data-value={item.value}
67
+ role="tab"
68
+ type="button"
69
+ >
70
+ {item.label}
71
+ </button>
72
+ ))}
73
+ </div>
74
+
75
+ {items.map(item => (
76
+ <div
77
+ class="ui-code-tabs__panel"
78
+ data-value={item.value}
79
+ hidden={item.value !== selectedValue}
80
+ role="tabpanel"
81
+ >
82
+ <Code
83
+ code={item.code}
84
+ copy={copy}
85
+ {...(item.language === undefined ? {} : { language: item.language })}
86
+ theme={theme}
87
+ variant="block"
88
+ wrap={wrap}
89
+ />
90
+ </div>
91
+ ))}
92
+ </Tabs>
@@ -7,6 +7,7 @@ interface Props extends HTMLAttributes<'dialog'> {
7
7
  class?: string | null
8
8
  className?: string
9
9
  glass?: boolean | 'subtle' | 'strong'
10
+ layout?: 'centered' | 'fullscreen'
10
11
  /**
11
12
  * @deprecated Use `glass` instead. `surface="glass"` maps to `glass={true}`.
12
13
  */
@@ -17,6 +18,7 @@ const {
17
18
  class: classProp = '',
18
19
  className = '',
19
20
  glass = false,
21
+ layout = 'centered',
20
22
  surface = 'default',
21
23
  ...rest
22
24
  } = Astro.props
@@ -24,6 +26,7 @@ const {
24
26
  const resolvedGlass = resolveLumenGlass(glass, surface)
25
27
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
26
28
  'ui-dialog',
29
+ layout === 'fullscreen' && 'ui-dialog--fullscreen',
27
30
  resolvedGlass && 'ui-dialog--glass',
28
31
  glass === 'subtle' && 'ui-glass-subtle',
29
32
  glass === 'strong' && 'ui-glass-strong'
@@ -32,6 +35,7 @@ const { classList, passthrough } = resolveLumenAstroProps(rest, [
32
35
 
33
36
  <dialog
34
37
  data-surface={resolvedGlass ? 'glass' : 'default'}
38
+ data-layout={layout}
35
39
  data-ui-dialog
36
40
  class:list={classList}
37
41
  {...passthrough}
package/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export { default as Cascader } from './components/Cascader.astro'
26
26
  export { default as Chart } from './components/Chart.astro'
27
27
  export { default as Checkbox } from './components/Checkbox.astro'
28
28
  export { default as Code } from './components/Code.astro'
29
+ export { default as CodeTabs } from './components/CodeTabs.astro'
29
30
  export { default as Collapsible } from './components/Collapsible.astro'
30
31
  export { default as ColorPicker } from './components/ColorPicker.astro'
31
32
  export { default as Combobox } from './components/Combobox.astro'
package/index.ts CHANGED
@@ -26,6 +26,7 @@ export { default as Cascader } from './components/Cascader.astro'
26
26
  export { default as Chart } from './components/Chart.astro'
27
27
  export { default as Checkbox } from './components/Checkbox.astro'
28
28
  export { default as Code } from './components/Code.astro'
29
+ export { default as CodeTabs } from './components/CodeTabs.astro'
29
30
  export { default as Collapsible } from './components/Collapsible.astro'
30
31
  export { default as ColorPicker } from './components/ColorPicker.astro'
31
32
  export { default as Combobox } from './components/Combobox.astro'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@santi020k/lumen-astro",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "uqr": "^0.1.3",
36
- "@santi020k/lumen": "^0.2.0",
37
- "@santi020k/lumen-core": "^0.2.0"
36
+ "@santi020k/lumen": "^0.3.0",
37
+ "@santi020k/lumen-core": "^0.3.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@astrojs/ts-plugin": "^1.10.10",