@retailcrm/embed-ui-v1-components 0.9.23-alpha.3 → 0.9.24

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/AGENTS.md CHANGED
@@ -70,6 +70,8 @@ Commonly used exports from `remote` include:
70
70
  - Prefer package public exports over reimplementing CRM-styled controls manually.
71
71
  - Match component choice to semantics:
72
72
  use `UiField` for labeled form controls, `UiAlert` for state messages, `UiPageHeader` for page-level headings.
73
+ - For widget targets, keep inline UI compact: prefer `UiToolbarButton`, `UiToolbarLink`, short text, and icons.
74
+ - Move complex widget UI into `UiModalSidebar` or `UiModalWindow` instead of expanding the target slot.
73
75
  - Keep imports on the public package boundary.
74
76
  - If you are unsure whether something is public, assume only exports from `remote` and `assets/*` are safe for consumer code.
75
77
  - If a needed capability is missing from the public API, say that clearly instead of suggesting internal imports.
@@ -96,7 +98,7 @@ Commonly used exports from `remote` include:
96
98
 
97
99
  <UiPageFooter>
98
100
  <template #actions>
99
- <UiButton @click="save">
101
+ <UiButton variant="success" @click="save">
100
102
  Сохранить
101
103
  </UiButton>
102
104
  </template>
@@ -120,6 +122,14 @@ const save = () => {}
120
122
  </script>
121
123
  ```
122
124
 
125
+ For page actions, use `Success Primary` for the strongest save/apply/create action, usually in
126
+ `UiPageFooter`. Use `Default Primary` for another important action with a different meaning, and
127
+ move neighboring actions to secondary or tertiary appearances.
128
+ `UiPageHeader` and `UiPageFooter` share the same page-level action scope. When a page is split into
129
+ `UiCollapseBox` sections, each collapse footer starts a local action scope: it can have its own
130
+ single `Default Primary` action, while neighboring local actions should still use secondary or
131
+ tertiary appearances.
132
+
123
133
  ## If You Need More Context
124
134
 
125
135
  - Package README:
package/docs/AI.md CHANGED
@@ -32,27 +32,29 @@ When generating UI code, use this order:
32
32
  3. open a detailed profile from [`PROFILES.md`](./PROFILES.md) if one exists;
33
33
  4. read the relevant page profile from [`PROFILES.md`](./PROFILES.md) when the task is about complete
34
34
  pages, modals, sidebars, filters, tables, or settings layouts;
35
- 5. use [`FORMAT.md`](./FORMAT.md) as the schema for what information is considered reliable;
36
- 6. read [`STYLING.md`](./STYLING.md) when the task is about classes, variables, typography, or visual zones;
37
- 7. if no profile exists yet, fall back to public type declarations and state any inference explicitly.
35
+ 5. read [`WidgetComposition.yml`](./profiles/widgets/WidgetComposition.yml) when the task is about UI
36
+ mounted through `defineWidgetRunner`;
37
+ 6. use [`FORMAT.md`](./FORMAT.md) as the schema for what information is considered reliable;
38
+ 7. read [`STYLING.md`](./STYLING.md) when the task is about classes, variables, typography, or visual zones;
39
+ 8. if no profile exists yet, fall back to public type declarations and state any inference explicitly.
38
40
 
39
41
  ## Runtime Embedding References
40
42
 
41
43
  When generating code for a CRM extension, separate UI component choice from runtime placement:
42
44
 
43
- - [`targets` and contexts](../../v1-endpoint/docs/targets.md): explains that `target` is the CRM
45
+ - In `@retailcrm/embed-ui-v1-endpoint`, `docs/targets.md` explains that `target` is the CRM
44
46
  embedding point, while `context` is the reactive CRM data available at that point.
45
- - [`menu placements`](../../v1-endpoint/docs/menu-placements.md): explains how host/manifest menu
47
+ - In `@retailcrm/embed-ui-v1-endpoint`, `docs/menu-placements.md` explains how host/manifest menu
46
48
  items map to remote page codes.
47
- - [`page routes`](../../v1-endpoint/docs/page-routes.md): explains how page `code`, CRM route names,
48
- and `definePageRunner` are connected.
49
- - [`defineWidgetRunner`](../../v1-endpoint/docs/define-widget-runner.md): shows how a widget receives
49
+ - In `@retailcrm/embed-ui-v1-endpoint`, `docs/page-routes.md` explains how page `code`, CRM route
50
+ names, and `definePageRunner` are connected.
51
+ - In `@retailcrm/embed-ui-v1-endpoint`, `docs/define-widget-runner.md` shows how a widget receives
50
52
  the current `target` prop.
51
- - [`definePageRunner`](../../v1-endpoint/docs/define-page-runner.md): shows how a page receives the
53
+ - In `@retailcrm/embed-ui-v1-endpoint`, `docs/define-page-runner.md` shows how a page receives the
52
54
  current `code` prop.
53
- - [`context concept`](../../v1-contexts/docs/ru/CONCEPT.md): explains predefined CRM contexts such as
54
- `order/card`, `customer/card`, `user/current`, and `settings`.
55
- - [`custom context`](../../v1-contexts/docs/ru/CUSTOM.md): explains custom-field contexts.
55
+ - In `@retailcrm/embed-ui-v1-contexts`, `docs/ru/CONCEPT.md` explains predefined CRM contexts such
56
+ as `order/card`, `customer/card`, `user/current`, and `settings`.
57
+ - In `@retailcrm/embed-ui-v1-contexts`, `docs/ru/CUSTOM.md` explains custom-field contexts.
56
58
 
57
59
  ## Default Recommendation For Common Forms
58
60
 
@@ -87,6 +89,8 @@ Default screen rules:
87
89
  card/settings page, multi-column page, collapse-block page, modal sidebar, or modal window;
88
90
  - use `UiPageHeader` for page identity and top-level actions;
89
91
  - use `UiPageFooter` for page-level save/cancel/delete actions instead of recreating a local footer;
92
+ - use one `Success Primary` button for the strongest save/apply/create action that commits a result; use `Default Primary`
93
+ only for another important action with a different meaning;
90
94
  - keep filters and controls near the content they affect;
91
95
  - use `UiField` around labeled form controls;
92
96
  - use `UiTable` for structured result lists;
@@ -121,6 +125,16 @@ Suggested query names:
121
125
  - `sort` and `direction` for sorting;
122
126
  - `page` and `pageSize` for pagination.
123
127
 
128
+ ## Default Recommendation For Widgets
129
+
130
+ When building a widget mounted into a CRM target, keep the inline target UI compact and predictable:
131
+
132
+ - read [`WidgetComposition.yml`](./profiles/widgets/WidgetComposition.yml) before composing widget UI;
133
+ - render only simple inline UI in the target: `UiToolbarButton`, `UiToolbarLink`, short text, and icons;
134
+ - move forms, tables, maps, filters, summaries, and multi-step flows into `UiModalSidebar` or `UiModalWindow`;
135
+ - avoid custom panels, page headers, page footers, wide fixed layouts, or standalone screens inside the target slot;
136
+ - read the endpoint target profile before choosing labels, modal type, or data access.
137
+
124
138
  ## External Documentation Patterns
125
139
 
126
140
  These references are useful when extending the profiles and examples in this package:
package/docs/PROFILES.md CHANGED
@@ -7,6 +7,7 @@ The current profile layer is structured like this:
7
7
  - the index stays in markdown so both humans and agents can navigate it easily;
8
8
  - component profiles live in `docs/profiles/components/*.yml`;
9
9
  - page-composition profiles live in `docs/profiles/pages/*.yml`;
10
+ - widget-composition profiles live in `docs/profiles/widgets/*.yml`;
10
11
  - YAML is the source of truth for structure, props, slots, emits, composition, page patterns, and AI rules.
11
12
 
12
13
  ## Table Of Contents
@@ -34,6 +35,7 @@ Use these entrypoints:
34
35
  - [`COMPONENTS.md`](./COMPONENTS.md) for the full linked component index
35
36
  - `docs/profiles/components/*.yml` for per-component machine-readable profiles
36
37
  - `docs/profiles/pages/*.yml` for page, modal, sidebar, filter, table, and settings-layout profiles
38
+ - `docs/profiles/widgets/*.yml` for embedded widget composition profiles
37
39
 
38
40
  Current high-signal core profiles:
39
41
 
@@ -62,6 +64,10 @@ Current page profiles:
62
64
  - [`ModalSidebar`](./profiles/pages/ModalSidebar.yml)
63
65
  - [`ModalWindow`](./profiles/pages/ModalWindow.yml)
64
66
 
67
+ Current widget profiles:
68
+
69
+ - [`WidgetComposition`](./profiles/widgets/WidgetComposition.yml)
70
+
65
71
  ## What To Read First
66
72
 
67
73
  - `key_props` if you need to choose a component quickly.
@@ -71,6 +77,7 @@ Current page profiles:
71
77
  - `examples` if you need copyable usage snippets.
72
78
  - `ai_notes` if the agent needs safe defaults and anti-patterns.
73
79
  - `profiles/pages/*.yml` if the task is about a full page, modal, sidebar, filter, table, or settings layout.
80
+ - `profiles/widgets/*.yml` if the task is about UI mounted through `defineWidgetRunner`.
74
81
 
75
82
  ## Styling Reads
76
83
 
@@ -82,3 +89,4 @@ Current page profiles:
82
89
  - All new updates should be made in YAML profiles.
83
90
  - Keep component-level details in `profiles/components`.
84
91
  - Keep page-composition details in `profiles/pages`.
92
+ - Keep widget-composition details in `profiles/widgets`.
package/docs/README.md CHANGED
@@ -62,7 +62,9 @@ If you need to generate UI quickly:
62
62
  5. the relevant profile from [`PROFILES.md`](./PROFILES.md)
63
63
  6. the relevant page profile from [`PROFILES.md`](./PROFILES.md) if the task is about complete pages,
64
64
  modals, sidebars, filters, tables, or settings layouts
65
- 7. [`STYLING.md`](./STYLING.md) if the task is about classes, variables, typography, or layout tuning
65
+ 7. the widget composition profile from [`PROFILES.md`](./PROFILES.md) if the task is about UI mounted
66
+ through `defineWidgetRunner`
67
+ 8. [`STYLING.md`](./STYLING.md) if the task is about classes, variables, typography, or layout tuning
66
68
 
67
69
  If you are extending the docs:
68
70
 
@@ -228,7 +228,9 @@ composition:
228
228
 
229
229
  ai_notes:
230
230
  do:
231
- - Start with appearance=primary for the main CTA.
231
+ - Start with appearance=primary for the main CTA, then choose variant by meaning.
232
+ - Use variant="success" for the strongest create/save/apply action when it commits a result, and keep only one Success Primary on a page.
233
+ - Use the default variant for an important primary action that is not the strongest commit action.
232
234
  - Use secondary or tertiary for neighboring actions near titles.
233
235
  avoid:
234
236
  - Do not replace UiButton with UiLink when the action should read as a button.
@@ -76,6 +76,26 @@ examples:
76
76
  import MyCustomIcon from '@retailcrm/embed-ui-v1-components/assets/sprites/actions/info.svg'
77
77
  import { UiCollapseBox } from '@retailcrm/embed-ui-v1-components/remote'
78
78
  </script>
79
+ - title: Section with local action
80
+ code: |
81
+ <template>
82
+ <UiCollapseBox>
83
+ <template #title>Connection settings</template>
84
+ <template #body-content>Section form content</template>
85
+ <template #footer-content>
86
+ <UiButton @click="saveSection">Save section</UiButton>
87
+ </template>
88
+ </UiCollapseBox>
89
+ </template>
90
+
91
+ <script lang="ts" setup>
92
+ import {
93
+ UiButton,
94
+ UiCollapseBox,
95
+ } from '@retailcrm/embed-ui-v1-components/remote'
96
+
97
+ const saveSection = () => {}
98
+ </script>
79
99
  use_when:
80
100
  - You need a ready-to-use collapsible box.
81
101
  - You need grouped expandable sections with consistent visuals.
@@ -112,8 +132,12 @@ ai_notes:
112
132
  do:
113
133
  - Use UiCollapseBox for structured disclosure UI.
114
134
  - Put the summary in the header and details in the body; avoid hiding critical required fields.
135
+ - Treat the footer and footer-content slots as a local action area for the section.
136
+ - Use one Default Primary button in a collapse footer for the main local action when the page has several independent sections.
137
+ - Use Success Primary in a collapse footer only when that section's local action is the strongest create/save/apply action.
115
138
  avoid:
116
139
  - Do not rebuild collapse header UI manually when this component already fits.
140
+ - Do not put several primary buttons of the same variant in one collapse footer.
117
141
 
118
142
  composition:
119
143
  works_well_with:
@@ -84,7 +84,7 @@ api:
84
84
  - wide content blocks
85
85
  - nested page sections
86
86
  layout_effect: Renders as the flexible left area and can contain multiple actions.
87
- notes: Use this slot for save, apply, cancel, or save-and-exit actions.
87
+ notes: Use this slot for save, apply, cancel, or save-and-exit actions. The main save/apply action is usually a Success Primary UiButton.
88
88
  - name: aside
89
89
  zone: right-side aside action group
90
90
  creates: Separate aside action area.
@@ -156,6 +156,8 @@ ai_notes:
156
156
  do:
157
157
  - Import UiPageFooter from @retailcrm/embed-ui-v1-components/remote.
158
158
  - Use the actions slot for primary and secondary page actions.
159
+ - Use UiButton variant="success" for the strongest save/apply/create action in the footer.
160
+ - Keep neighboring footer actions less dominant unless they are the page's single Default Primary or Danger Primary by meaning.
159
161
  - Use the aside slot for a separated destructive or secondary action.
160
162
  - Put UiButton or another public action component inside slots.
161
163
  - Add page-level positioning only in the host/page layout when the footer must stick to a specific shell area.
@@ -164,3 +166,4 @@ ai_notes:
164
166
  - Do not import UiPageFooter from internal package paths.
165
167
  - Do not expect UiPageFooter to create buttons from props.
166
168
  - Do not expect UiPageFooter to be fixed to the bottom of the window automatically.
169
+ - Do not put multiple Success Primary, Default Primary, or Danger Primary actions with the same variant in the footer.
@@ -22,6 +22,7 @@ expected_structure:
22
22
  - Main content sits on a white content surface.
23
23
  - Content can include text, buttons, fields, checkboxes, radio groups, switches, and other form controls.
24
24
  - A bottom save panel is optional.
25
+ - If a bottom save panel is used, its main save or apply action should be Success Primary.
25
26
 
26
27
  recommended_components:
27
28
  - name: UiPageHeader
@@ -54,5 +55,6 @@ ai_notes:
54
55
  - Keep form controls grouped by task or semantic section.
55
56
  - Use UiField around labelled form controls.
56
57
  - Use tabs only when they reduce visible complexity without hiding required work.
58
+ - Keep save/apply as the strongest footer action and move neighboring actions to secondary or tertiary appearances unless their variant has a distinct page-level meaning.
57
59
  avoid:
58
60
  - Do not create a decorative landing page for operational settings.
@@ -15,6 +15,9 @@ expected_structure:
15
15
  - Multiple collapsible blocks with their own content and local actions.
16
16
  - If the page contains only collapse blocks, the white page surface is not needed.
17
17
  - If every collapse block has its own save action, the bottom save panel is not needed.
18
+ - Treat each collapse block as a local mini-page with its own action priority.
19
+ - Each collapse block footer can have one Default Primary action for the main local action.
20
+ - If a block has a stronger create/save/apply action, make that local action Success Primary and move other actions to Default Primary, secondary, or tertiary by meaning.
18
21
  - Collapse blocks can contain text, buttons, fields, controls, and small tables.
19
22
 
20
23
  avoid_inside_blocks:
@@ -41,6 +44,9 @@ ai_notes:
41
44
  do:
42
45
  - Use collapses for optional or separable sections.
43
46
  - Keep required critical actions visible enough for the workflow.
47
+ - Put local section actions in the UiCollapseBox footer or footer-content slot.
48
+ - Apply primary-button limits inside each collapse block independently from the page-level footer.
44
49
  avoid:
45
50
  - Do not nest collapses inside collapses.
46
51
  - Do not hide complex tables inside collapse blocks.
52
+ - Do not add a global bottom save panel when each collapse block already has its own local save action.
@@ -17,7 +17,7 @@ expected_structure:
17
17
  - UiPageHeader with a page title.
18
18
  - One or more 48px page buttons on the right side of the header.
19
19
  - If there are multiple header buttons, one should be primary and the rest can be secondary or tertiary.
20
- - The main primary button usually creates a new entity for the list.
20
+ - The main Default Primary button usually creates a new entity for the list when there is no stronger Success Primary action on the page.
21
21
  - Filters above the table, built from controls such as select, textbox, and combobox-like selection components.
22
22
  - Filter controls should run in rows of roughly 4-5 fields, then wrap to the next row.
23
23
  - Filters can be collapsible.
@@ -16,9 +16,15 @@ scope:
16
16
  shared_rules:
17
17
  - Page title uses the large accent text style, Text large Accent 24.
18
18
  - Page-level actions sit to the right of the title.
19
- - A page can have only one Default Primary button and one Success Primary button.
20
- - Additional page actions can use secondary or tertiary variants when the task needs them.
21
- - When a group has multiple buttons, the primary action should represent the main flow.
19
+ - A full page should have at most one page-level primary button of each variant, Success Primary, Default Primary, and Danger Primary.
20
+ - Use Success Primary for the page's strongest call to action when it creates or commits a result, such as Save, Apply, or Create.
21
+ - Place the page-level Success Primary action in UiPageFooter for save or apply workflows.
22
+ - Use Default Primary for an important action that is secondary to the Success Primary or does not commit a result.
23
+ - Use Danger Primary only for one critical destructive action when the page needs it.
24
+ - If several actions compete for attention, choose the main one for Success Primary and move the rest to Default Primary, secondary, tertiary, or dropdown actions by meaning.
25
+ - UiPageHeader actions and UiPageFooter actions belong to the same page-level action scope.
26
+ - Treat each UiCollapseBox footer as a separate local action scope with the same rules scoped to that section.
27
+ - A page can have several Default Primary buttons when each one belongs to a different UiCollapseBox footer.
22
28
  - Secondary actions should support or cancel the primary flow.
23
29
  - Components inside pages and blocks should be spaced by values divisible by 4px.
24
30
  - Common spacing values are 4, 8, 12, 16, 20, 24, 28, and 32px.
@@ -51,6 +57,8 @@ ai_notes:
51
57
  - Choose ModalSidebar only when the flow is compact.
52
58
  - Choose ModalWindow or a full page when content needs wide tables, several sections, or complex controls.
53
59
  - Keep operational CRM screens dense, scannable, and work-focused.
60
+ - Prefer variant="success" for the main save/apply/create action and keep it visually dominant.
54
61
  avoid:
55
62
  - Do not turn internal CRM work screens into marketing-style layouts.
56
63
  - Do not hide filters or primary workflow controls away from the content they affect.
64
+ - Do not place multiple Success Primary, Default Primary, or Danger Primary actions with the same variant in the page-level scope or inside one collapse-box scope.
@@ -0,0 +1,113 @@
1
+ widget_profile: WidgetComposition
2
+ summary: >
3
+ Composition rules for RetailCRM embedded widgets mounted into CRM target slots.
4
+ A widget should add a small predictable inline control to the host page and move
5
+ complex workflows into UiModalSidebar or UiModalWindow.
6
+
7
+ use_when:
8
+ - You are building a component for defineWidgetRunner.
9
+ - You are rendering UI directly inside a widget target.
10
+ - You need to decide whether widget content belongs inline, in a modal sidebar, or in a modal window.
11
+
12
+ inline_target_rules:
13
+ - Keep the UI rendered directly in the widget target simple and predictable.
14
+ - Prefer UiToolbarButton for compact widget actions.
15
+ - Prefer UiToolbarLink for compact navigation or link-shaped actions.
16
+ - Simple text is allowed when the widget only needs to show a short status, value, or hint.
17
+ - Icons are allowed when they clarify the toolbar action or compact status.
18
+ - Keep inline controls close to the target's existing density and spacing.
19
+ - Use one or a few compact controls; avoid turning the target slot into a standalone screen.
20
+
21
+ complex_ui_rules:
22
+ - Put forms, tables, filters, maps, summaries, and multi-step workflows inside UiModalSidebar or UiModalWindow.
23
+ - Use UiModalSidebar for contextual editing, narrow forms, short lists, and side-panel workflows.
24
+ - Use UiModalWindow for wider workflows, maps, previews, or content that needs more horizontal room.
25
+ - The inline widget control should usually open the modal/sidebar and pass the relevant target/context data into that workflow.
26
+ - The modal/sidebar can use regular page-like components such as UiField, UiButton, UiTable, UiYandexMap, UiAlert, and UiLoader.
27
+
28
+ avoid_inline:
29
+ - large cards
30
+ - full forms
31
+ - full tables
32
+ - filter panels
33
+ - nested page layouts
34
+ - custom panels that visually compete with the CRM page
35
+ - page-level headers or footers
36
+ - heavy custom spacing or wrappers that can break the host page layout
37
+
38
+ recommended_components:
39
+ inline:
40
+ - name: UiToolbarButton
41
+ profile: ../components/UiToolbarButton.yml
42
+ - name: UiToolbarLink
43
+ profile: ../components/UiToolbarLink.yml
44
+ overlay:
45
+ - name: UiModalSidebar
46
+ profile: ../components/UiModalSidebar.yml
47
+ - name: UiModalWindow
48
+ profile: ../components/UiModalWindow.yml
49
+ - name: UiButton
50
+ profile: ../components/UiButton.yml
51
+ - name: UiField
52
+ profile: ../components/UiField.yml
53
+ - name: UiTable
54
+ profile: ../components/UiTable.yml
55
+
56
+ examples:
57
+ - title: Compact widget action that opens a sidebar
58
+ code: |
59
+ <template>
60
+ <UiToolbarButton @click="opened = true">
61
+ Show details
62
+ </UiToolbarButton>
63
+
64
+ <UiModalSidebar v-model:opened="opened">
65
+ <template #title>Widget details</template>
66
+
67
+ <UiField id="note" label="Note">
68
+ <UiTextbox v-model:value="note" />
69
+ </UiField>
70
+
71
+ <template #footer>
72
+ <UiButton @click="save">Save</UiButton>
73
+ <UiButton appearance="secondary" @click="opened = false">Cancel</UiButton>
74
+ </template>
75
+ </UiModalSidebar>
76
+ </template>
77
+
78
+ <script lang="ts" setup>
79
+ import { ref } from 'vue'
80
+
81
+ import {
82
+ UiButton,
83
+ UiField,
84
+ UiModalSidebar,
85
+ UiTextbox,
86
+ UiToolbarButton,
87
+ } from '@retailcrm/embed-ui-v1-components/remote'
88
+
89
+ const opened = ref(false)
90
+ const note = ref('')
91
+
92
+ const save = () => {
93
+ opened.value = false
94
+ }
95
+ </script>
96
+
97
+ target_awareness:
98
+ - Read the endpoint target profile before choosing inline text, button labels, or modal type.
99
+ - Match the inline affordance to the target placement; field-level targets need especially compact UI.
100
+ - Do not infer data availability from the target name; read the linked context profiles.
101
+ - Avoid adding repeated or noisy controls to targets that can appear many times on one CRM page.
102
+
103
+ ai_notes:
104
+ do:
105
+ - Render only compact, predictable UI directly in the widget target.
106
+ - Start inline widget UI with UiToolbarButton, UiToolbarLink, simple text, or an icon-enhanced compact action.
107
+ - Move complex UI into UiModalSidebar or UiModalWindow.
108
+ - Keep the host CRM page layout stable; the widget should enhance the target, not reshape the page.
109
+ avoid:
110
+ - Do not build a full page, dashboard, large card, form, or table directly inside a widget target.
111
+ - Do not use UiPageHeader or UiPageFooter for inline widget content.
112
+ - Do not add custom layout chrome around the widget unless the target profile explicitly calls for it.
113
+ - Do not make the target slot depend on wide fixed dimensions.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@retailcrm/embed-ui-v1-components",
3
3
  "bin": "bin/embed-ui-v1-components.mjs",
4
4
  "type": "module",
5
- "version": "0.9.23-alpha.3",
5
+ "version": "0.9.24",
6
6
  "license": "MIT",
7
7
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
8
8
  "repository": {