diff --git a/docs/index.md b/docs/index.md index e17f8cb..b3abd38 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,6 +9,8 @@ - [Style Guide](style-guide.md) - визуальные правила, токены, spacing и типографика. - [JavaScript API](javascript.md) - глобальный namespace и автоинициализация. - [Vue Adapter](vue.md) - официальный Vue слой поверх CSS/JS контракта kit. +- [Vue Component API](vue/component-api.md) - props, emits, slots и короткие примеры. +- [Vue Cookbook](vue/cookbook.md) - практичные сценарии экранов. - [Vue Migration Policy](vue/migration-policy.md) - правила совместимости Vue adapter. ## Компоненты diff --git a/docs/vue.md b/docs/vue.md index c0a081b..a3c1d4a 100644 --- a/docs/vue.md +++ b/docs/vue.md @@ -118,6 +118,10 @@ See [Vue Component Map](vue/component-map.md). +For props, emits, slots, and short examples, see [Vue Component API](vue/component-api.md). + +For common screen patterns, see [Vue Cookbook](vue/cookbook.md). + ## Layout And Data Patterns Second-wave adapter components cover common application surfaces: @@ -161,3 +165,5 @@ For AI agents and project-specific rules, see [Vue AI Usage Guide](vue/ai-usage-guide.md). For compatibility rules and breaking-change policy, see [Vue Migration Policy](vue/migration-policy.md). + +For publish and package validation steps, see [Vue Release Checklist](vue/release-checklist.md). diff --git a/docs/vue/component-api.md b/docs/vue/component-api.md new file mode 100644 index 0000000..7fa3bb8 --- /dev/null +++ b/docs/vue/component-api.md @@ -0,0 +1,219 @@ +# Vue Component API + +This is the compact API reference for the official Vue adapter. Import components from `gnexus-ui-kit/vue`. + +## Foundations + +### `GnButton` + +Props: `variant`, `size`, `icon`, `loading`, `disabled`, `type`. + +Slots: default. + +```vue +Create +``` + +### `GnIconButton` + +Props: `icon`, `label`, `type`, `withoutHover`. + +```vue + +``` + +### `GnBadge`, `GnAlert` + +Props: `variant`; `GnBadge` also supports `outline`. + +```vue +Online +Check this before release. +``` + +## Forms + +### `GnInput`, `GnTextarea`, `GnSelect` + +Props: `modelValue`, `label`, `icon`, `state`, `help`. + +Emits: `update:modelValue`. + +```vue + + + +``` + +### `GnCheckbox`, `GnSwitch` + +Props: `modelValue`, `label`, `disabled`. + +Emits: `update:modelValue`. + +```vue +Enabled +``` + +### `GnRadio`, `GnRadioGroup` + +Props: `modelValue`, `value`, `label`, `name`, `disabled`; group accepts `options`. + +Emits: `update:modelValue`. + +```vue + +``` + +### `GnRange` + +Props: `modelValue`, `label`, `min`, `max`, `step`. + +Emits: `update:modelValue`. + +```vue + +``` + +### `GnCombobox` + +Props: `modelValue`, `label`, `icon`, `options`, `placeholder`, `notFoundText`, `state`, `help`. + +Emits: `update:modelValue`, `select`. + +```vue + +``` + +### `GnFileUpload` + +Props: `modelValue`, `title`, `description`, `primary`, `secondary`, `badge`, `multiple`, `accept`. + +Emits: `update:modelValue`, `change`. + +```vue + +``` + +## Navigation And Overlays + +### `GnTabs` + +Props: `modelValue`, `items`, `compact`, `vertical`, `ariaLabel`. + +Emits: `update:modelValue`. + +Slots: one slot per item id. + +```vue + + + +``` + +### `GnAccordion` + +Props: `items`, `modelValue`, `multiple`. + +Emits: `update:modelValue`. + +Slots: one slot per item id. + +### `GnDropdown`, `GnPopover`, `GnTooltip` + +`GnDropdown` props: `label`, `icon`, `variant`, `items`. + +`GnPopover` props: `label`, `title`, `text`, `icon`, `variant`. + +`GnTooltip` props: `text`. + +```vue + + +Help +``` + +### `GnNavigationShell`, `GnNavList` + +`GnNavigationShell` props: `brand`, `logoSrc`, `current`, `title`, `subtitle`, `footerLeft`, `footerRight`, `items`. + +`GnNavList` props: `items`. + +Emits: `select`. + +## Feedback + +### `GnModal`, `GnDrawer` + +Props: `open`, `title`; modal also has `closeOnBackdrop`; drawer has `position`. + +Emits: `update:open`, `close`. + +```vue + + Content + +``` + +### `GnToastProvider`, `useToast` + +Wrap the app once and call `useToast()` in descendants. The provider shows one toast at a time. + +```js +toast.success({ title: "Saved", text: "Changes applied" }); +``` + +### `GnConfirmDialog` + +Props: `open`, `title`, `message`, `confirmText`, `cancelText`, `confirmVariant`. + +Emits: `update:open`, `confirm`, `cancel`. + +## Data And Layout + +### `GnTable` + +Props: `columns`, `rows`, `caption`, `emptyText`. + +Slots: `cell-${column.key}`, `empty`. + +### `GnToolbar`, `GnSearchField`, `GnPagination` + +Use for table/list screens. + +```vue + + + + +``` + +### `GnDescriptionList`, `GnProgress`, `GnUsageMeter`, `GnProgressStages`, `GnSteps` + +Use for metadata, rollout state, and staged flows. + +### `GnChip`, `GnChipGroup` + +Props: `variant`, `icon`, `selected`, `disabled`, `removable`. + +Emits: `remove`. + +### `GnAvatar`, `GnIdentity`, `GnAvatarStack` + +Use for people/entity identity rows. + +### `GnTimeline`, `GnActivityLog` + +Use for event history and compact audit rows. + +### `GnCard`, `GnStatusCard`, `GnMetricCard`, `GnActionCard` + +Use specialized cards before writing raw `.card` markup. + +### `GnList`, `GnDefinitionList`, `GnActionList` + +Use list wrappers before raw `.list` markup when data is available as arrays. + +### `GnEmptyState`, `GnSkeleton`, `GnLoader` + +Use for loading and empty states. diff --git a/docs/vue/cookbook.md b/docs/vue/cookbook.md new file mode 100644 index 0000000..19e4714 --- /dev/null +++ b/docs/vue/cookbook.md @@ -0,0 +1,157 @@ +# Vue Cookbook + +Practical patterns for building screens with `gnexus-ui-kit/vue`. + +## CRUD Page + +```vue + + + +``` + +## Modal Form + +```vue + + + +``` + +## Details With Tabs + +```vue + + + +``` + +## File Upload + +```vue + + + +``` + +## Navigation Shell + +```vue + + + +``` + +## Toast After Save + +```vue + +``` + +Remember to wrap the app with `GnToastProvider`. diff --git a/docs/vue/release-checklist.md b/docs/vue/release-checklist.md new file mode 100644 index 0000000..fa2a2c2 --- /dev/null +++ b/docs/vue/release-checklist.md @@ -0,0 +1,61 @@ +# Vue Adapter Release Checklist + +Run this checklist before publishing or consuming a new Vue adapter version. + +## Build Checks + +```bash +npm run build +npm run test:vue-adapter +``` + +Expected Vite warnings: + +```text +/assets/fonts/... didn't resolve at build time +``` + +These are acceptable while `kit.css` uses the `/assets` runtime contract. + +## Pack Validation + +Create a package tarball: + +```bash +npm pack +``` + +Check that the tarball contains `dist/css/kit.css`, `dist/js/gnexus-ui-kit.js`, +`dist/vue/index.js`, and `dist/assets/`. The package uses the `files` whitelist +in `package.json`; keep it in sync with exported runtime assets. + +Install the tarball into a temporary Vue app and verify: + +```bash +npm install /path/to/gnexus-ui-kit-0.2.0.tgz +npm run build +``` + +The app should import: + +```js +import "gnexus-ui-kit/dist/css/kit.css"; +import "gnexus-ui-kit/dist/assets/fonts/phosphor-icons/src/css/icons.css"; +import { GnButton } from "gnexus-ui-kit/vue"; +``` + +## API Checks + +- New components are exported from `src/vue/index.js`. +- New components are registered in `src/vue/plugin.js`. +- `docs/vue/component-map.md` lists the component. +- `docs/vue/ai-usage-guide.md` explains when to use it. +- Interactive components do not require legacy `GNexusUIKit.*.init()` calls. + +## Compatibility Checks + +- No prop, emit, or slot is renamed without a migration note. +- Rendered classes still match `src/scss/components/`. +- Vue remains external; do not bundle Vue into `dist/vue/index.js`. +- `GnModal` and `GnDrawer` keep Escape, focus return, and focus trap behavior. +- `GnToastProvider` remains single-toast unless docs and API are changed. diff --git a/package.json b/package.json index cc5f11c..b6bea4a 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,11 @@ "version": "0.2.0", "private": true, "style": "dist/css/kit.css", + "files": [ + "dist/", + "docs/", + "README.md" + ], "exports": { ".": "./dist/js/gnexus-ui-kit.js", "./vue": "./dist/vue/index.js",