@dxtmisha/wiki 0.25.1 → 0.39.1
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/package.json +2 -2
- package/src/classes/WikiStorybook.ts +92 -1
- package/src/classes/WikiStorybookItem.ts +55 -5
- package/src/classes/WikiStorybookProp.ts +109 -0
- package/src/library.ts +1 -0
- package/src/media/descriptions/wikiDescriptions.ts +4 -0
- package/src/media/descriptions/wikiDescriptionsAccordion.ts +46 -0
- package/src/media/descriptions/wikiDescriptionsActionSheet.ts +53 -0
- package/src/media/descriptions/wikiDescriptionsActions.ts +28 -0
- package/src/media/descriptions/wikiDescriptionsAnchor.ts +36 -0
- package/src/media/descriptions/wikiDescriptionsArrow.ts +33 -0
- package/src/media/descriptions/wikiDescriptionsBadge.ts +43 -0
- package/src/media/descriptions/wikiDescriptionsBars.ts +33 -0
- package/src/media/descriptions/wikiDescriptionsBlock.ts +67 -5
- package/src/media/descriptions/wikiDescriptionsButton.ts +32 -0
- package/src/media/descriptions/wikiDescriptionsCell.ts +24 -0
- package/src/media/descriptions/wikiDescriptionsChip.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsChipGroup.ts +45 -14
- package/src/media/descriptions/wikiDescriptionsDialog.ts +44 -0
- package/src/media/descriptions/wikiDescriptionsField.ts +55 -2
- package/src/media/descriptions/wikiDescriptionsFieldCounter.ts +32 -0
- package/src/media/descriptions/wikiDescriptionsFieldLabel.ts +22 -0
- package/src/media/descriptions/wikiDescriptionsFieldMessage.ts +25 -0
- package/src/media/descriptions/wikiDescriptionsIcon.ts +46 -8
- package/src/media/descriptions/wikiDescriptionsImage.ts +50 -1
- package/src/media/descriptions/wikiDescriptionsInput.ts +56 -0
- package/src/media/descriptions/wikiDescriptionsList.ts +31 -0
- package/src/media/descriptions/wikiDescriptionsListGroup.ts +57 -0
- package/src/media/descriptions/wikiDescriptionsListItem.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsListMenu.ts +41 -0
- package/src/media/descriptions/wikiDescriptionsMask.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsMenu.ts +56 -0
- package/src/media/descriptions/wikiDescriptionsModal.ts +61 -6
- package/src/media/descriptions/wikiDescriptionsMotionTransform.ts +57 -0
- package/src/media/descriptions/wikiDescriptionsPage.ts +155 -0
- package/src/media/descriptions/wikiDescriptionsProgress.ts +39 -0
- package/src/media/descriptions/wikiDescriptionsRipple.ts +42 -3
- package/src/media/descriptions/wikiDescriptionsScrollbar.ts +48 -0
- package/src/media/descriptions/wikiDescriptionsSection.ts +152 -0
- package/src/media/descriptions/wikiDescriptionsSelect.ts +44 -0
- package/src/media/descriptions/wikiDescriptionsSelectValue.ts +29 -0
- package/src/media/descriptions/wikiDescriptionsSkeleton.ts +42 -1
- package/src/media/descriptions/wikiDescriptionsTextareaAutosize.ts +30 -0
- package/src/media/descriptions/wikiDescriptionsTooltip.ts +47 -0
- package/src/media/descriptions/wikiDescriptionsWindow.ts +60 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.en.mdx +25 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.ru.mdx +25 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.vi.mdx +25 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.en.mdx +30 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.ru.mdx +30 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.vi.mdx +30 -0
- package/src/media/mdx/Image/flag.en.mdx +23 -0
- package/src/media/mdx/Image/flag.ru.mdx +23 -0
- package/src/media/mdx/Image/image.en.mdx +26 -21
- package/src/media/mdx/Image/image.ru.mdx +26 -22
- package/src/media/mdx/Image/wikiMdxImage.ts +6 -0
- package/src/media/mdx/Page/page.en.mdx +38 -0
- package/src/media/mdx/Page/page.ru.mdx +38 -0
- package/src/media/mdx/Page/wikiMdxPage.ts +19 -0
- package/src/media/mdx/Section/section.en.mdx +38 -0
- package/src/media/mdx/Section/section.ru.mdx +38 -0
- package/src/media/mdx/Section/wikiMdxSection.ts +19 -0
- package/src/media/mdx/expose/expose.clear.en.mdx +1 -1
- package/src/media/mdx/wikiMdx.ts +4 -0
- package/src/media/props/wiki.ts +2 -0
- package/src/media/props/wikiActionsInclude.ts +1 -1
- package/src/media/props/wikiAnchor.ts +3 -2
- package/src/media/props/wikiAria.ts +21 -0
- package/src/media/props/wikiArrowInclude.ts +1 -1
- package/src/media/props/wikiAttributes.ts +143 -0
- package/src/media/props/wikiBadge.ts +7 -4
- package/src/media/props/wikiBars.ts +7 -6
- package/src/media/props/wikiBarsInclude.ts +5 -3
- package/src/media/props/wikiButton.ts +8 -4
- package/src/media/props/wikiChip.ts +4 -2
- package/src/media/props/wikiDialog.ts +1 -2
- package/src/media/props/wikiField.ts +18 -10
- package/src/media/props/wikiFieldCounterInclude.ts +15 -6
- package/src/media/props/wikiForm.ts +32 -13
- package/src/media/props/wikiIcon.ts +16 -3
- package/src/media/props/wikiIconInclude.ts +12 -9
- package/src/media/props/wikiImage.ts +26 -1
- package/src/media/props/wikiInformation.ts +21 -17
- package/src/media/props/wikiList.ts +10 -4
- package/src/media/props/wikiListItem.ts +3 -2
- package/src/media/props/wikiMask.ts +2 -2
- package/src/media/props/wikiMaskInclude.ts +1 -1
- package/src/media/props/wikiMenu.ts +1 -1
- package/src/media/props/wikiMotionTransform.ts +7 -3
- package/src/media/props/wikiOption.ts +250 -7
- package/src/media/props/wikiProgress.ts +8 -5
- package/src/media/props/wikiScrollbar.ts +6 -6
- package/src/media/props/wikiSelect.ts +22 -22
- package/src/media/props/wikiStatus.ts +16 -27
- package/src/media/props/wikiStyle.ts +43 -275
- package/src/media/props/wikiTechnical.ts +77 -2
- package/src/media/props/wikiText.ts +110 -0
- package/src/media/props/wikiValue.ts +26 -91
- package/src/media/props/wikiWindow.ts +27 -17
- package/src/shims-mdx.d.ts +5 -0
- package/src/types/storybookTypes.ts +22 -0
|
@@ -85,5 +85,52 @@ export const wikiDescriptionsTooltip: StorybookComponentsDescriptionItem = {
|
|
|
85
85
|
<StorybookDescriptions componentName={'Slot'} type={'description'}/>
|
|
86
86
|
<StorybookDescriptions componentName={'Slot'} type={'body'}/>
|
|
87
87
|
`
|
|
88
|
+
},
|
|
89
|
+
ai: {
|
|
90
|
+
render: `
|
|
91
|
+
<div :class="classDemo.item">
|
|
92
|
+
<Tooltip open embedded v-bind="args">
|
|
93
|
+
<template #control="{ binds }">
|
|
94
|
+
<button v-bind="binds">Hover me</button>
|
|
95
|
+
</template>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
</div>
|
|
98
|
+
`,
|
|
99
|
+
description: `
|
|
100
|
+
Tooltip is a floating component that displays contextual information when a user interacts with a trigger element (hover or focus).
|
|
101
|
+
It is designed to provide auxiliary descriptions, labels, or helper text.
|
|
102
|
+
|
|
103
|
+
**Key Features:**
|
|
104
|
+
1. **Trigger Integration:**
|
|
105
|
+
- Uses the \`#control\` slot to wrap the target element.
|
|
106
|
+
- Provides \`binds\` (events and ARIA attributes) that **must** be applied to the trigger element using \`v-bind="binds"\`.
|
|
107
|
+
|
|
108
|
+
2. **Content & Layout:**
|
|
109
|
+
- \`label\`: Primary text content.
|
|
110
|
+
- \`description\`: Secondary text content.
|
|
111
|
+
- \`#default\`: Slot for custom HTML content.
|
|
112
|
+
- Includes a built-in \`Arrow\` component pointing to the trigger.
|
|
113
|
+
|
|
114
|
+
3. **Behavior:**
|
|
115
|
+
- **Positioning:** Automatically calculates position (top, bottom, left, right) to stay within the viewport.
|
|
116
|
+
- **Timing:** Configurable \`delay\` (open) and \`delayHide\` (close).
|
|
117
|
+
- **Interaction:** Supports \`interactive\` mode (allows hovering the tooltip content) and \`disabled\` state.
|
|
118
|
+
|
|
119
|
+
**Usage Examples:**
|
|
120
|
+
|
|
121
|
+
- **Basic Label:**
|
|
122
|
+
\`<Tooltip label="Save changes">
|
|
123
|
+
<template #control="{ binds }">
|
|
124
|
+
<button v-bind="binds">Save</button>
|
|
125
|
+
</template>
|
|
126
|
+
</Tooltip>\`
|
|
127
|
+
|
|
128
|
+
- **With Description:**
|
|
129
|
+
\`<Tooltip label="User Profile" description="Click to edit settings">
|
|
130
|
+
<template #control="{ binds }">
|
|
131
|
+
<Avatar v-bind="binds" />
|
|
132
|
+
</template>
|
|
133
|
+
</Tooltip>\`
|
|
134
|
+
`
|
|
88
135
|
}
|
|
89
136
|
}
|
|
@@ -207,5 +207,65 @@ export const wikiDescriptionsWindow: StorybookComponentsDescriptionItem = {
|
|
|
207
207
|
slots: `
|
|
208
208
|
<StorybookDescriptions componentName={'Window'} type={'slots'}/>
|
|
209
209
|
`
|
|
210
|
+
},
|
|
211
|
+
ai: {
|
|
212
|
+
render: `
|
|
213
|
+
<div :class="classDemo.item">
|
|
214
|
+
<Window embedded open v-bind="args">
|
|
215
|
+
<template #control="{ binds }">
|
|
216
|
+
<button v-bind="binds">Open Window</button>
|
|
217
|
+
</template>
|
|
218
|
+
<template #title>
|
|
219
|
+
<h3>Window Title</h3>
|
|
220
|
+
</template>
|
|
221
|
+
<template #default>
|
|
222
|
+
<p>Window content goes here. This is a demonstration of the window component capabilities.</p>
|
|
223
|
+
<p>It can contain text, images, forms, or any other content.</p>
|
|
224
|
+
</template>
|
|
225
|
+
<template #footer>
|
|
226
|
+
<div>
|
|
227
|
+
<button>Cancel</button>
|
|
228
|
+
<button>Save</button>
|
|
229
|
+
</div>
|
|
230
|
+
</template>
|
|
231
|
+
</Window>
|
|
232
|
+
</div>
|
|
233
|
+
`,
|
|
234
|
+
description: `
|
|
235
|
+
**Note:** This is a low-level component. Use it only if specialized components like \`Modal\`, \`Dialog\`, or \`Menu\` do not fit your requirements.
|
|
236
|
+
|
|
237
|
+
Window is a versatile container component used for Modals, Popups, Dropdowns, and Cards.
|
|
238
|
+
It automatically handles z-index, focus management, teleportation, and scroll locking.
|
|
239
|
+
|
|
240
|
+
**Note:** The \`embedded\` prop is used only for documentation examples to render the component inline. Do not use it in production code.
|
|
241
|
+
|
|
242
|
+
**When to use:**
|
|
243
|
+
1. **Modal/Dialog:** When a centered box overlays the page content. Use default props.
|
|
244
|
+
2. **Dropdown/Popover:** When a box appears next to a button/trigger. Use \`axis="y"\` (vertical) or \`axis="x"\` (horizontal).
|
|
245
|
+
3. **Select Menu:** When a list overlays the trigger exactly. Use \`axis="on"\`.
|
|
246
|
+
4. **Card/Panel:** When you need the visual style of a window but embedded in the page flow. Use \`staticMode\`.
|
|
247
|
+
|
|
248
|
+
**Key Features:**
|
|
249
|
+
- **Structure:**
|
|
250
|
+
- \`#control\`: The trigger element (button, link). Bind \`binds\` to this element to enable automatic toggling.
|
|
251
|
+
- \`#title\`: The header area of the window.
|
|
252
|
+
- \`#default\`: The main content area (automatically wrapped in a Scrollbar).
|
|
253
|
+
- \`#footer\`: The bottom area for action buttons.
|
|
254
|
+
|
|
255
|
+
- **Positioning (\`axis\`):**
|
|
256
|
+
- \`undefined\` (default): Centered modal.
|
|
257
|
+
- \`y\`: Opens vertically relative to the trigger (like a standard dropdown).
|
|
258
|
+
- \`x\`: Opens horizontally relative to the trigger (like a nested menu).
|
|
259
|
+
- \`on\`: Overlays the trigger element.
|
|
260
|
+
|
|
261
|
+
- **Behavior:**
|
|
262
|
+
- \`staticMode\`: Disables teleportation and absolute positioning, rendering it as a regular block.
|
|
263
|
+
- \`persistent\`: Prevents closing when clicking outside or pressing Escape.
|
|
264
|
+
- \`closeButton\`: Automatically adds a close button in the top-right corner.
|
|
265
|
+
|
|
266
|
+
**Example:**
|
|
267
|
+
\`<Window axis="y">\` creates a dropdown menu.
|
|
268
|
+
\`<Window :open="true">\` creates a modal dialog.
|
|
269
|
+
`
|
|
210
270
|
}
|
|
211
271
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/en/functional-basic/Functions/getCurrentDate - Get current date'/>
|
|
4
|
+
|
|
5
|
+
# `getCurrentDate`
|
|
6
|
+
|
|
7
|
+
Returns the current date in the specified format. The function is a wrapper around the `Datetime` class and allows you to quickly get a formatted string of the current time.
|
|
8
|
+
|
|
9
|
+
**Parameters:**
|
|
10
|
+
- `format: GeoDate` — type of date format for output (default `'datetime'`). Supports values: `'date'`, `'time'`, `'datetime'`, `'full'`, and others.
|
|
11
|
+
|
|
12
|
+
**Returns:**
|
|
13
|
+
Current date as a string.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { getCurrentDate } from '@dxtmisha/functional-basic'
|
|
17
|
+
|
|
18
|
+
// Standard format (datetime)
|
|
19
|
+
const now = getCurrentDate()
|
|
20
|
+
// Result: "2024-03-15 14:30"
|
|
21
|
+
|
|
22
|
+
// Date only
|
|
23
|
+
const date = getCurrentDate('date')
|
|
24
|
+
// Result: "2024-03-15"
|
|
25
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/ru/functional-basic/Functions/getCurrentDate - Получение текущей даты'/>
|
|
4
|
+
|
|
5
|
+
# `getCurrentDate`
|
|
6
|
+
|
|
7
|
+
Возвращает текущую дату в указанном формате. Функция является оберткой над классом `Datetime` и позволяет быстро получить отформатированную строку текущего времени.
|
|
8
|
+
|
|
9
|
+
**Параметры:**
|
|
10
|
+
- `format: GeoDate` — тип формата даты вывода (по умолчанию `'datetime'`). Поддерживает значения: `'date'`, `'time'`, `'datetime'`, `'full'` и другие.
|
|
11
|
+
|
|
12
|
+
**Возвращает:**
|
|
13
|
+
Текущая дата в виде строки.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { getCurrentDate } from '@dxtmisha/functional-basic'
|
|
17
|
+
|
|
18
|
+
// Стандартный формат (datetime)
|
|
19
|
+
const now = getCurrentDate()
|
|
20
|
+
// Результат: "2024-03-15 14:30"
|
|
21
|
+
|
|
22
|
+
// Только дата
|
|
23
|
+
const date = getCurrentDate('date')
|
|
24
|
+
// Результат: "2024-03-15"
|
|
25
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/vi/functional-basic/Functions/getCurrentDate - Lấy ngày hiện tại'/>
|
|
4
|
+
|
|
5
|
+
# `getCurrentDate`
|
|
6
|
+
|
|
7
|
+
Trả về ngày hiện tại theo định dạng được chỉ định. Hàm này là một wrapper bao quanh lớp `Datetime` và cho phép bạn nhanh chóng lấy chuỗi thời gian hiện tại đã được định dạng.
|
|
8
|
+
|
|
9
|
+
**Tham số:**
|
|
10
|
+
- `format: GeoDate` — loại định dạng ngày đầu ra (mặc định là `'datetime'`). Hỗ trợ các giá trị: `'date'`, `'time'`, `'datetime'`, `'full'` và các giá trị khác.
|
|
11
|
+
|
|
12
|
+
**Trả về:**
|
|
13
|
+
Ngày hiện tại dưới dạng chuỗi.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { getCurrentDate } from '@dxtmisha/functional-basic'
|
|
17
|
+
|
|
18
|
+
// Định dạng chuẩn (datetime)
|
|
19
|
+
const now = getCurrentDate()
|
|
20
|
+
// Kết quả: "2024-03-15 14:30"
|
|
21
|
+
|
|
22
|
+
// Chỉ ngày
|
|
23
|
+
const date = getCurrentDate('date')
|
|
24
|
+
// Kết quả: "2024-03-15"
|
|
25
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/en/functional-basic/Functions/isEnter - Check for Enter or Space key press'/>
|
|
4
|
+
|
|
5
|
+
# `isEnter`
|
|
6
|
+
|
|
7
|
+
Checks if the pressed key is `Enter` or `Space`. This function is useful for handling keyboard events when you need to react to action confirmation or element activation, while supporting accessibility (a11y) and older browsers.
|
|
8
|
+
|
|
9
|
+
**Parameters:**
|
|
10
|
+
- `event: KeyboardEvent` — the keyboard event object.
|
|
11
|
+
|
|
12
|
+
**Returns:**
|
|
13
|
+
`boolean` — `true` if the `Enter` or `Space` key is pressed, otherwise `false`.
|
|
14
|
+
|
|
15
|
+
**Supported event properties:**
|
|
16
|
+
The function checks the following event properties for maximum compatibility:
|
|
17
|
+
- `code`: `'Enter'`, `'Space'`
|
|
18
|
+
- `key`: `'Enter'`, `' '`, `'Spacebar'`
|
|
19
|
+
- `keyCode`: `13`, `32`
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { isEnter } from '@dxtmisha/functional-basic'
|
|
23
|
+
|
|
24
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
25
|
+
if (isEnter(event)) {
|
|
26
|
+
console.log('Enter or Space pressed')
|
|
27
|
+
// Perform action
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/ru/functional-basic/Functions/isEnter - Проверка нажатия Enter или Space'/>
|
|
4
|
+
|
|
5
|
+
# `isEnter`
|
|
6
|
+
|
|
7
|
+
Проверяет, является ли нажатая клавиша `Enter` или `Space`. Функция полезна для обработки событий клавиатуры, когда необходимо реагировать на подтверждение действия или активацию элемента, поддерживая при этом доступность (a11y) и старые браузеры.
|
|
8
|
+
|
|
9
|
+
**Параметры:**
|
|
10
|
+
- `event: KeyboardEvent` — объект события клавиатуры.
|
|
11
|
+
|
|
12
|
+
**Возвращает:**
|
|
13
|
+
`boolean` — `true`, если нажата клавиша `Enter` или `Space`, иначе `false`.
|
|
14
|
+
|
|
15
|
+
**Поддерживаемые свойства события:**
|
|
16
|
+
Функция проверяет следующие свойства события для максимальной совместимости:
|
|
17
|
+
- `code`: `'Enter'`, `'Space'`
|
|
18
|
+
- `key`: `'Enter'`, `' '`, `'Spacebar'`
|
|
19
|
+
- `keyCode`: `13`, `32`
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { isEnter } from '@dxtmisha/functional-basic'
|
|
23
|
+
|
|
24
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
25
|
+
if (isEnter(event)) {
|
|
26
|
+
console.log('Нажат Enter или Space')
|
|
27
|
+
// Выполнить действие
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title='@dxtmisha/vi/functional-basic/Functions/isEnter - Kiểm tra nhấn phím Enter hoặc Space'/>
|
|
4
|
+
|
|
5
|
+
# `isEnter`
|
|
6
|
+
|
|
7
|
+
Kiểm tra xem phím được nhấn có phải là `Enter` hoặc `Space` hay không. Hàm này hữu ích để xử lý các sự kiện bàn phím khi bạn cần phản ứng với việc xác nhận hành động hoặc kích hoạt phần tử, đồng thời hỗ trợ khả năng truy cập (a11y) và các trình duyệt cũ.
|
|
8
|
+
|
|
9
|
+
**Tham số:**
|
|
10
|
+
- `event: KeyboardEvent` — đối tượng sự kiện bàn phím.
|
|
11
|
+
|
|
12
|
+
**Trả về:**
|
|
13
|
+
`boolean` — `true` nếu phím `Enter` hoặc `Space` được nhấn, ngược lại là `false`.
|
|
14
|
+
|
|
15
|
+
**Các thuộc tính sự kiện được hỗ trợ:**
|
|
16
|
+
Hàm kiểm tra các thuộc tính sự kiện sau để đảm bảo khả năng tương thích tối đa:
|
|
17
|
+
- `code`: `'Enter'`, `'Space'`
|
|
18
|
+
- `key`: `'Enter'`, `' '`, `'Spacebar'`
|
|
19
|
+
- `keyCode`: `13`, `32`
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { isEnter } from '@dxtmisha/functional-basic'
|
|
23
|
+
|
|
24
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
25
|
+
if (isEnter(event)) {
|
|
26
|
+
console.log('Đã nhấn Enter hoặc Space')
|
|
27
|
+
// Thực hiện hành động
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## Flags
|
|
2
|
+
|
|
3
|
+
The `Image` component supports displaying country flags. A special format for the `value` property is used for this purpose.
|
|
4
|
+
|
|
5
|
+
**Formats:**
|
|
6
|
+
|
|
7
|
+
- `flag-xx` — standard flag (where `xx` is the ISO 3166-1 alpha-2 country code)
|
|
8
|
+
- `f-xx` — compressed flag (where `xx` is the ISO 3166-1 alpha-2 country code)
|
|
9
|
+
|
|
10
|
+
**Features:**
|
|
11
|
+
|
|
12
|
+
- Automatic flag type detection by prefix
|
|
13
|
+
- Support for all countries according to ISO 3166-1 alpha-2 standard
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<template>
|
|
17
|
+
<!-- Standard US flag -->
|
|
18
|
+
<Image value="flag-us" />
|
|
19
|
+
|
|
20
|
+
<!-- Compressed Germany flag -->
|
|
21
|
+
<Image value="f-de" />
|
|
22
|
+
</template>
|
|
23
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## Флаги
|
|
2
|
+
|
|
3
|
+
Компонент `Image` поддерживает отображение флагов стран. Для этого используется специальный формат значения свойства `value`.
|
|
4
|
+
|
|
5
|
+
**Форматы:**
|
|
6
|
+
|
|
7
|
+
- `flag-xx` — стандартный флаг (где `xx` — код страны ISO 3166-1 alpha-2)
|
|
8
|
+
- `f-xx` — сжатый флаг (где `xx` — код страны ISO 3166-1 alpha-2)
|
|
9
|
+
|
|
10
|
+
**Особенности:**
|
|
11
|
+
|
|
12
|
+
- Автоматическое определение типа флага по префиксу
|
|
13
|
+
- Поддержка всех стран по стандарту ISO 3166-1 alpha-2
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<template>
|
|
17
|
+
<!-- Стандартный флаг США -->
|
|
18
|
+
<Image value="flag-us" />
|
|
19
|
+
|
|
20
|
+
<!-- Сжатый флаг Германии -->
|
|
21
|
+
<Image value="f-de" />
|
|
22
|
+
</template>
|
|
23
|
+
```
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
Universal component for displaying images, icons, and PDF documents with advanced size, positioning, and
|
|
1
|
+
Universal component for displaying images, icons, flags, and PDF documents with advanced size, positioning, and adaptability controls.
|
|
2
2
|
|
|
3
|
-
Image provides flexible API for working with various types of visual content
|
|
3
|
+
Image provides a flexible API for working with various types of visual content. The component automatically detects the source type (image, icon, color, file), selects the optimal rendering method (`<img>`, `background-image`, `<picture>`, `<object>`, or icon font), and supports advanced cropping and adaptation features.
|
|
4
4
|
|
|
5
5
|
**Key Features:**
|
|
6
6
|
|
|
7
|
-
- Support for multiple source types (
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Load events with complete type and data information
|
|
7
|
+
- Support for multiple source types (URL, File, PDF, Material Icons, flags, colors)
|
|
8
|
+
- Flexible rendering with automatic choice between background and img tag
|
|
9
|
+
- Adaptive scaling with aspect ratio preservation and srcset support
|
|
10
|
+
- Display control via fill modes and coordinate cropping
|
|
11
|
+
- Styling support with masks and color filling
|
|
12
|
+
- Integration with Material Symbols and system flags
|
|
14
13
|
|
|
15
14
|
**Typical Use Cases:**
|
|
16
15
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- Background images with
|
|
16
|
+
- Responsive images with picture and srcset
|
|
17
|
+
- Interface icons (Material Design or SVG masks)
|
|
18
|
+
- User avatars with automatic cropping
|
|
19
|
+
- Previews of uploaded files and PDF documents
|
|
20
|
+
- Background images with complex positioning
|
|
21
|
+
- Displaying country flags via CSS sprites
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
24
|
<script setup>
|
|
@@ -26,20 +26,25 @@ import { ref } from 'vue'
|
|
|
26
26
|
import { Image } from '@dxtmisha/constructor'
|
|
27
27
|
|
|
28
28
|
const imageUrl = ref('https://example.com/image.jpg')
|
|
29
|
-
|
|
30
|
-
function handleLoad(data) {
|
|
31
|
-
console.log('Image loaded:', data.type, data.image)
|
|
32
|
-
}
|
|
33
29
|
</script>
|
|
34
30
|
|
|
35
31
|
<template>
|
|
32
|
+
<!-- Background image with cropping -->
|
|
36
33
|
<Image
|
|
37
34
|
:value="imageUrl"
|
|
38
35
|
size="cover"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
:coordinator="[10, 10, 10, 10]"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<!-- SEO-friendly image -->
|
|
40
|
+
<Image
|
|
41
|
+
:value="imageUrl"
|
|
42
|
+
tag-img
|
|
43
|
+
alt="Description"
|
|
42
44
|
/>
|
|
45
|
+
|
|
46
|
+
<!-- Material Design Icon -->
|
|
47
|
+
<Image value="filled-home" />
|
|
43
48
|
</template>
|
|
44
49
|
```
|
|
45
50
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
Универсальный компонент для отображения изображений,
|
|
1
|
+
Универсальный компонент для отображения изображений, иконок, флагов и PDF-документов с расширенными возможностями управления размером, позиционированием и адаптивностью.
|
|
2
2
|
|
|
3
|
-
Image предоставляет гибкий API для работы с различными типами визуального
|
|
3
|
+
Image предоставляет гибкий API для работы с различными типами визуального контента. Компонент автоматически определяет тип источника (изображение, иконка, цвет, файл), выбирает оптимальный способ рендеринга (`<img>`, `background-image`, `<picture>`, `<object>` или иконочный шрифт) и поддерживает продвинутые функции кадрирования и адаптации.
|
|
4
4
|
|
|
5
5
|
**Основные возможности:**
|
|
6
6
|
|
|
7
|
-
- Поддержка множества типов источников (
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- События загрузки с полной информацией о типе и данных
|
|
7
|
+
- Поддержка множества типов источников (URL, File, PDF, Material Icons, флаги, цвета)
|
|
8
|
+
- Гибкий рендеринг с автоматическим выбором между фоном и тегом img
|
|
9
|
+
- Адаптивное масштабирование с сохранением пропорций и поддержкой srcset
|
|
10
|
+
- Управление отображением через режимы заполнения и координатное кадрирование
|
|
11
|
+
- Стилизация с поддержкой масок и заливки цветом
|
|
12
|
+
- Интеграция с Material Symbols и системными флагами
|
|
14
13
|
|
|
15
14
|
**Типичные сценарии использования:**
|
|
16
15
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- Фоновые изображения
|
|
16
|
+
- Адаптивные изображения с picture и srcset
|
|
17
|
+
- Иконки интерфейса (Material Design или SVG маски)
|
|
18
|
+
- Аватары пользователей с автоматическим кадрированием
|
|
19
|
+
- Превью загружаемых файлов и PDF документов
|
|
20
|
+
- Фоновые изображения со сложным позиционированием
|
|
21
|
+
- Отображение флагов стран через CSS спрайты
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
24
|
<script setup>
|
|
@@ -26,22 +26,26 @@ import { ref } from 'vue'
|
|
|
26
26
|
import { Image } from '@dxtmisha/constructor'
|
|
27
27
|
|
|
28
28
|
const imageUrl = ref('https://example.com/image.jpg')
|
|
29
|
-
|
|
30
|
-
function handleLoad(data) {
|
|
31
|
-
console.log('Image loaded:', data.type, data.image)
|
|
32
|
-
}
|
|
33
29
|
</script>
|
|
34
30
|
|
|
35
31
|
<template>
|
|
32
|
+
<!-- Фоновое изображение с кадрированием -->
|
|
36
33
|
<Image
|
|
37
34
|
:value="imageUrl"
|
|
38
35
|
size="cover"
|
|
39
|
-
|
|
40
|
-
:coordinator="[0, 0, 100, 100]"
|
|
41
|
-
@load="handleLoad"
|
|
36
|
+
:coordinator="[10, 10, 10, 10]"
|
|
42
37
|
/>
|
|
38
|
+
|
|
39
|
+
<!-- SEO-дружественное изображение -->
|
|
40
|
+
<Image
|
|
41
|
+
:value="imageUrl"
|
|
42
|
+
tag-img
|
|
43
|
+
alt="Описание"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<!-- Иконка Material Design -->
|
|
47
|
+
<Image value="filled-home" />
|
|
43
48
|
</template>
|
|
44
49
|
```
|
|
45
50
|
|
|
46
51
|
> Компонент автоматически управляет типом контента и оптимизирует отображение в зависимости от источника.
|
|
47
|
-
|
|
@@ -10,6 +10,8 @@ import adaptiveEn from './adaptive.en.mdx'
|
|
|
10
10
|
import adaptiveRu from './adaptive.ru.mdx'
|
|
11
11
|
import imgTagEn from './img-tag.en.mdx'
|
|
12
12
|
import imgTagRu from './img-tag.ru.mdx'
|
|
13
|
+
import flagEn from './flag.en.mdx'
|
|
14
|
+
import flagRu from './flag.ru.mdx'
|
|
13
15
|
|
|
14
16
|
import eventLoadEn from './event.load.en.mdx'
|
|
15
17
|
import eventLoadRu from './event.load.ru.mdx'
|
|
@@ -40,6 +42,10 @@ export const wikiMdxImage: StorybookComponentsMdxItem = {
|
|
|
40
42
|
en: imgTagEn,
|
|
41
43
|
ru: imgTagRu
|
|
42
44
|
},
|
|
45
|
+
'flag': {
|
|
46
|
+
en: flagEn,
|
|
47
|
+
ru: flagRu
|
|
48
|
+
},
|
|
43
49
|
'event.load': {
|
|
44
50
|
en: eventLoadEn,
|
|
45
51
|
ru: eventLoadRu
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
A top-level semantic container component designed to wrap the main content of a page. It uses the `<main>` tag by default.
|
|
4
|
+
|
|
5
|
+
Page provides capabilities for displaying main headlines, labels, descriptions, captions, and icons. The main purpose of the component is to designate the unique part of the document's content, which is critical for accessibility and SEO. The headline is rendered as `<h1>` by default.
|
|
6
|
+
|
|
7
|
+
**Key Features:**
|
|
8
|
+
|
|
9
|
+
- Semantic wrapper for main content (`<main>` tag)
|
|
10
|
+
- Support for main headlines (default `<h1>`), labels, descriptions, and captions
|
|
11
|
+
- Support for icons
|
|
12
|
+
- Customizable layout and spacing
|
|
13
|
+
- Full support for slots for content customization
|
|
14
|
+
|
|
15
|
+
**Typical Use Cases:**
|
|
16
|
+
|
|
17
|
+
- Wrapper for unique page content
|
|
18
|
+
- Main application screen
|
|
19
|
+
- Article or documentation page
|
|
20
|
+
- Root element for routed components (views)
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Page
|
|
29
|
+
headline="Main Page Title"
|
|
30
|
+
label="Category"
|
|
31
|
+
description="Brief description of the page content"
|
|
32
|
+
>
|
|
33
|
+
<p>Unique page content...</p>
|
|
34
|
+
</Page>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> Page should be used once per page (or per active view) and should not include repeated navigation elements.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Описание
|
|
2
|
+
|
|
3
|
+
Семантический компонент-контейнер верхнего уровня, предназначенный для обертки основного содержимого страницы. По умолчанию использует тег `<main>`.
|
|
4
|
+
|
|
5
|
+
Page предоставляет возможности для отображения главных заголовков, меток, описаний, подписей и иконок. Основное назначение компонента — обозначение уникальной части содержимого документа, что критически важно для доступности (accessibility) и SEO. Заголовок по умолчанию рендерится как `<h1>`.
|
|
6
|
+
|
|
7
|
+
**Основные возможности:**
|
|
8
|
+
|
|
9
|
+
- Семантическая обертка основного контента (тег `<main>`)
|
|
10
|
+
- Поддержка главных заголовков (по умолчанию `<h1>`), меток, описаний и подписей
|
|
11
|
+
- Поддержка иконок
|
|
12
|
+
- Настраиваемый макет и отступы
|
|
13
|
+
- Полная поддержка слотов для кастомизации контента
|
|
14
|
+
|
|
15
|
+
**Типичные сценарии использования:**
|
|
16
|
+
|
|
17
|
+
- Обертка для уникального контента страницы
|
|
18
|
+
- Главный экран приложения
|
|
19
|
+
- Страница статьи или документации
|
|
20
|
+
- Корневой элемент для маршрутизируемых компонентов (views)
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Page
|
|
29
|
+
headline="Главный заголовок страницы"
|
|
30
|
+
label="Категория"
|
|
31
|
+
description="Краткое описание содержимого страницы"
|
|
32
|
+
>
|
|
33
|
+
<p>Уникальный контент страницы...</p>
|
|
34
|
+
</Page>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> Page должен использоваться один раз на странице (или в активном view) и не должен включать повторяющиеся элементы навигации.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StorybookComponentsMdxItem } from '../../../types/storybookTypes'
|
|
2
|
+
|
|
3
|
+
import pageEn from './page.en.mdx'
|
|
4
|
+
import pageRu from './page.ru.mdx'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MDX files for Page component
|
|
8
|
+
*
|
|
9
|
+
* MDX файлы для компонента Page
|
|
10
|
+
*/
|
|
11
|
+
export const wikiMdxPage: StorybookComponentsMdxItem = {
|
|
12
|
+
name: 'Page',
|
|
13
|
+
descriptions: {
|
|
14
|
+
block: {
|
|
15
|
+
en: pageEn,
|
|
16
|
+
ru: pageRu
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
A semantic container component designed for grouping related content. It uses the `<section>` tag by default.
|
|
4
|
+
|
|
5
|
+
Section provides capabilities for displaying headlines, labels, descriptions, captions, and icons. The main purpose of the component is to designate thematic sections of a document, which improves the semantics and accessibility of the page. The headline is rendered as `<h2>` by default.
|
|
6
|
+
|
|
7
|
+
**Key Features:**
|
|
8
|
+
|
|
9
|
+
- Semantic content grouping (`<section>` tag)
|
|
10
|
+
- Support for headlines (default `<h2>`), labels, descriptions, and captions
|
|
11
|
+
- Support for icons
|
|
12
|
+
- Customizable layout and spacing
|
|
13
|
+
- Full support for slots for content customization
|
|
14
|
+
|
|
15
|
+
**Typical Use Cases:**
|
|
16
|
+
|
|
17
|
+
- Thematic page sections
|
|
18
|
+
- Content grouping in articles
|
|
19
|
+
- Information blocks with second-level headings
|
|
20
|
+
- Landing page sections
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Section
|
|
29
|
+
headline="Section Headline"
|
|
30
|
+
label="Label"
|
|
31
|
+
description="Description of this section's content"
|
|
32
|
+
>
|
|
33
|
+
<p>Main section content...</p>
|
|
34
|
+
</Section>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> Section is the semantically correct choice for dividing a page into large logical blocks.
|