@khsura/sui-mcp 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.
@@ -8,4 +8,5 @@ components: SFormRow, SForm, SInput, SDatePickerInput, SSelect, SButton, SCard,
8
8
  - `SFormRow` wraps on a phone: `SInput` takes the free width, `SSelect` and `SDatePickerInput` keep their own width (add `grow` / `block` to stretch them), buttons keep theirs. Do not add `block` to a button in the row.
9
9
  - Keep the fields' error lines (no `hide-details`): the row and the button use them as the gap to the next row. A row whose fields all use `hide-details` adds the same gap below itself.
10
10
  - Before 1.20.0 there is no `SFormRow`: put `hide-details` on the field in a flex row so it renders no label or error line, and give it a `placeholder` or `aria-label` instead.
11
+ - `SFormRow` has no outer padding, so the fields line up with the card heading and the text below. If you lay filters out with `SRow` / `SColumn` instead, add `no-outer-gutters :gap="16"` to the row: a default `SRow` pads itself and each column by 8px, so the fields start 16px inside the heading.
11
12
  - A search runs on submit: make the button `type="submit"` inside an `SForm`, so Enter in the field searches too.
@@ -9,6 +9,7 @@ components: SContainer, SRow, SColumn, SCard, SCardTitle, SCardText, SImage, SBu
9
9
  - `cols` also takes `'auto'` (fit content) and `'grow'`.
10
10
  - `SRow justify` values are camelCase: `spaceBetween`, `spaceAround`. `align` is the cross axis.
11
11
  - Use `gap`, `dense` or `no-gutters` on `SRow` to change spacing instead of overriding margins.
12
+ - **A grid next to a heading or paragraph needs `no-outer-gutters` and `:gap` to line up.** By default `SRow` pads itself by half a gutter (8px) and each `SColumn` pads its content by another half, so the first card starts 16px inside the heading above it. `no-outer-gutters` drops the row's padding; `:gap` replaces the columns' padding with a gap between them (column widths account for it). With only `no-outer-gutters`, the cards still start 8px in. Separate stacked rows with a margin (`class="s_mt__4"`), since a gap row has no outer padding.
12
13
  - Equal-height cards: columns in one `SRow` line already share a height, so give each `SCard` `height="100%"`. Do not make the card `display: flex; flex-direction: column` to stretch it: `SImage` is `height: 100%` by default and shrinks in a flex column, so the images end up with different heights. Give `SImage` `:aspect-ratio` and `height="auto"` so it keeps its ratio.
13
14
  - Two or more `block` buttons in one flex row overflow: `block` is `width: 100%` and does not shrink. Put each in its own `SColumn` instead.
14
15
  - `SContainer` adds side padding only. Add top and bottom spacing yourself (`class="s_py__4"`) so the first card is not flush with the top of the viewport.
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <SContainer class="s_py__4">
3
- <SRow>
3
+ <h1 class="s_text--h5 s_mb__2">Dashboard</h1>
4
+ <p class="s_text--body__2 s_mb__4">Every row below starts and ends in line with this heading and paragraph.</p>
5
+
6
+ <!-- no-outer-gutters + gap: the grid lines up with the text around it (see the recipe notes). -->
7
+ <SRow no-outer-gutters :gap="GRID_GAP">
4
8
  <SColumn :cols="12" :md="8">
5
9
  <SCard class="s_pa__4" :height="160">
6
10
  <h2 class="s_text--h6">Main panel</h2>
@@ -15,7 +19,7 @@
15
19
  </SColumn>
16
20
  </SRow>
17
21
 
18
- <SRow>
22
+ <SRow no-outer-gutters :gap="GRID_GAP" class="s_mt__4">
19
23
  <SColumn v-for="stat in stats" :key="stat.label" :cols="12" :sm="6" :lg="3">
20
24
  <SCard class="s_pa__4" outlined>
21
25
  <div class="s_text--caption">{{ stat.label }}</div>
@@ -24,7 +28,7 @@
24
28
  </SColumn>
25
29
  </SRow>
26
30
 
27
- <SRow>
31
+ <SRow no-outer-gutters :gap="GRID_GAP" class="s_mt__4">
28
32
  <SColumn v-for="product in products" :key="product.name" :cols="12" :sm="6" :lg="3">
29
33
  <SCard height="100%" outlined>
30
34
  <SImage
@@ -40,7 +44,7 @@
40
44
  </SColumn>
41
45
  </SRow>
42
46
 
43
- <SRow justify="spaceBetween" align="center">
47
+ <SRow no-outer-gutters :gap="GRID_GAP" justify="spaceBetween" align="center" class="s_mt__4">
44
48
  <SColumn cols="auto">
45
49
  <span class="s_text--subtitle__1">Showing 4 of 12</span>
46
50
  </SColumn>
@@ -73,6 +77,8 @@ const stats: Stat[] = [
73
77
  ]
74
78
 
75
79
  const IMAGE_ASPECT_RATIO = 4 / 3
80
+ // The space between columns (and between wrapped lines), in px: one grid gutter.
81
+ const GRID_GAP = 16
76
82
 
77
83
  const products: Product[] = [
78
84
  { name: 'Desk lamp', description: 'Warm light.', image: 'https://picsum.photos/seed/lamp/400/300' },
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Tabbed sections
3
+ whenToUse: A settings, detail or help page split into a few sections the user switches between with tabs, which must still work on a 375px phone.
4
+ components: SCard, SCardText, STabs, STab
5
+ ---
6
+
7
+ - Use the plain setup: `<STabs v-model="activeTab">` with one `<STab :tab="value">` per section, rendered with `v-for` from an array. Don't add `shrink`, `cols`, `SSlideGroup` or `overflow-x: auto`: `STabs` already keeps the tabs on one row.
8
+ - When the tabs do not fit (a phone, a narrow card), the row scrolls sideways. The end that hides tabs fades out, so it is visibly scrollable (swipe it) instead of looking clipped, and the selected tab is always scrolled fully into view. When every tab fits, there is no fade. Add `show-arrows` for scroll arrows at the hidden ends, or set `wrap` to flow the tabs onto several rows instead.
9
+ - `STabs` renders only the tab buttons. Render each panel yourself with `v-show="activeTab === value"` (keeps panel state when switching) and give it `role="tabpanel"`.
10
+ - Keep labels short (one or two words). Long labels still work, they just mean more scrolling on a phone; never truncate them with CSS.
11
+ - Keyboard: the selected tab is the single Tab stop; the arrow keys, Home and End move between tabs.
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="s_pa__4">
3
+ <SCard :max-width="720">
4
+ <STabs v-model="activeSection">
5
+ <STab v-for="section in sections" :key="section.value" :tab="section.value">{{ section.label }}</STab>
6
+ </STabs>
7
+ <SCardText>
8
+ <div v-for="section in sections" v-show="activeSection === section.value" :key="section.value" role="tabpanel">
9
+ <h2 class="s_text--h6 s_mb__2">{{ section.label }}</h2>
10
+ <p class="s_text--body__2">{{ section.description }}</p>
11
+ </div>
12
+ </SCardText>
13
+ </SCard>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import { ref } from 'vue'
19
+ import { SCard, SCardText, STab, STabs } from '@khsura/sui'
20
+
21
+ const sections = [
22
+ { value: 'getting-started', label: 'Getting started', description: 'Create a workspace and invite your team.' },
23
+ { value: 'billing', label: 'Billing', description: 'Plans, invoices and payment methods.' },
24
+ { value: 'account', label: 'Account', description: 'Your profile, password and sign-in methods.' },
25
+ { value: 'notifications', label: 'Notifications', description: 'Choose which emails and alerts you receive.' },
26
+ { value: 'security', label: 'Security', description: 'Two-factor authentication and active sessions.' },
27
+ ]
28
+
29
+ const activeSection = ref('getting-started')
30
+ </script>
@@ -34,3 +34,4 @@ createApp(App)
34
34
  - Options are deep-merged with the defaults, so pass only what you change.
35
35
  - `presetColors` keys: `primary`, `secondary`, `success`, `info`, `warning`, `important`, `error` (extra keys become usable as `color`). Use opaque hex values.
36
36
  - `useTheme()` returns `{ theme, setTheme }`. Toggle with `setTheme(theme.value === 'dark' ? 'light' : 'dark')`; `setTheme(null)` follows the OS. There is no `toggleTheme()`.
37
+ - The swatch row is `SRow no-outer-gutters :gap="8"`: `no-outer-gutters` drops the row's own 8px padding so the buttons start in line with the paragraph above them.
@@ -4,7 +4,8 @@
4
4
  <SCardText>
5
5
  <SSwitch v-model="isDark" label="Dark mode" />
6
6
  <p class="s_text--body__2 s_mb__2">Preset colors from the active theme:</p>
7
- <SRow :gap="8">
7
+ <!-- no-outer-gutters: the buttons start in line with the paragraph above (SRow pads itself by default). -->
8
+ <SRow no-outer-gutters :gap="8">
8
9
  <SButton v-for="color in PRESET_COLOR_NAMES" :key="color" :color="color" size="small">{{ color }}</SButton>
9
10
  </SRow>
10
11
  </SCardText>