rook-cli 1.3.2 → 1.3.5
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 +3 -2
- package/rook-framework/PRD-INSTALL-COMMAND.md +379 -0
- package/rook-framework/PRD.md +1214 -0
- package/rook-framework/README.md +143 -0
- package/rook-framework/assets/rk-accordion.js +99 -0
- package/rook-framework/assets/rk-alert-dialog.js +132 -0
- package/rook-framework/assets/rk-bottom-app-bar.js +88 -0
- package/rook-framework/assets/rk-carousel.js +145 -0
- package/rook-framework/assets/rk-collapsible.js +151 -0
- package/rook-framework/assets/rk-dialog.js +161 -0
- package/rook-framework/assets/rk-drawer.js +214 -0
- package/rook-framework/assets/rk-framework-core.css +2554 -0
- package/rook-framework/assets/rk-framework-tokens.css +101 -0
- package/rook-framework/assets/rk-modal.js +91 -0
- package/rook-framework/assets/rk-popover.js +264 -0
- package/rook-framework/assets/rk-progress.js +81 -0
- package/rook-framework/assets/rk-quantity.js +91 -0
- package/rook-framework/assets/rk-scroll-area.js +286 -0
- package/rook-framework/assets/rk-sheet.js +157 -0
- package/rook-framework/assets/rk-tabs.js +179 -0
- package/rook-framework/assets/rk-toggle.js +153 -0
- package/rook-framework/blocks/rk-accordion.liquid +97 -0
- package/rook-framework/blocks/rk-badge.liquid +103 -0
- package/rook-framework/blocks/rk-button.liquid +166 -0
- package/rook-framework/blocks/rk-divider.liquid +100 -0
- package/rook-framework/blocks/rk-form-field.liquid +120 -0
- package/rook-framework/blocks/rk-icon.liquid +134 -0
- package/rook-framework/blocks/rk-image.liquid +198 -0
- package/rook-framework/blocks/rk-installments.liquid +99 -0
- package/rook-framework/blocks/rk-pix-discount.liquid +99 -0
- package/rook-framework/blocks/rk-price.liquid +128 -0
- package/rook-framework/blocks/rk-quantity.liquid +108 -0
- package/rook-framework/blocks/rk-quick-add.liquid +137 -0
- package/rook-framework/blocks/rk-skeleton.liquid +104 -0
- package/rook-framework/blocks/rk-typography.liquid +183 -0
- package/rook-framework/config/rk-color-scheme-group.json +138 -0
- package/rook-framework/config/rk-settings_schema.json +259 -0
- package/rook-framework/snippets/rk-accordion.liquid +31 -0
- package/rook-framework/snippets/rk-alert-dialog.liquid +83 -0
- package/rook-framework/snippets/rk-aspect-ratio.liquid +23 -0
- package/rook-framework/snippets/rk-badge.liquid +17 -0
- package/rook-framework/snippets/rk-bottom-app-bar.liquid +51 -0
- package/rook-framework/snippets/rk-button.liquid +49 -0
- package/rook-framework/snippets/rk-card.liquid +64 -0
- package/rook-framework/snippets/rk-carousel.liquid +74 -0
- package/rook-framework/snippets/rk-checkbox.liquid +34 -0
- package/rook-framework/snippets/rk-collapsible.liquid +52 -0
- package/rook-framework/snippets/rk-color-schemes-standalone.liquid +61 -0
- package/rook-framework/snippets/rk-color-schemes.liquid +43 -0
- package/rook-framework/snippets/rk-dialog.liquid +85 -0
- package/rook-framework/snippets/rk-divider.liquid +25 -0
- package/rook-framework/snippets/rk-drawer.liquid +81 -0
- package/rook-framework/snippets/rk-external-assets copy.liquid +33 -0
- package/rook-framework/snippets/rk-external-assets.liquid +68 -0
- package/rook-framework/snippets/rk-form-field.liquid +83 -0
- package/rook-framework/snippets/rk-gap-style.liquid +32 -0
- package/rook-framework/snippets/rk-icon.liquid +28 -0
- package/rook-framework/snippets/rk-image.liquid +60 -0
- package/rook-framework/snippets/rk-input.liquid +35 -0
- package/rook-framework/snippets/rk-installments.liquid +54 -0
- package/rook-framework/snippets/rk-item.liquid +69 -0
- package/rook-framework/snippets/rk-layout-style.liquid +37 -0
- package/rook-framework/snippets/rk-modal.liquid +31 -0
- package/rook-framework/snippets/rk-pix-discount.liquid +34 -0
- package/rook-framework/snippets/rk-popover.liquid +77 -0
- package/rook-framework/snippets/rk-price.liquid +48 -0
- package/rook-framework/snippets/rk-progress.liquid +38 -0
- package/rook-framework/snippets/rk-quantity.liquid +56 -0
- package/rook-framework/snippets/rk-quick-add.liquid +67 -0
- package/rook-framework/snippets/rk-scripts.liquid +17 -0
- package/rook-framework/snippets/rk-scroll-area.liquid +60 -0
- package/rook-framework/snippets/rk-sheet.liquid +86 -0
- package/rook-framework/snippets/rk-size-style.liquid +48 -0
- package/rook-framework/snippets/rk-skeleton.liquid +25 -0
- package/rook-framework/snippets/rk-spacing-padding.liquid +18 -0
- package/rook-framework/snippets/rk-spacing-style.liquid +54 -0
- package/rook-framework/snippets/rk-spinner.liquid +43 -0
- package/rook-framework/snippets/rk-swatch.liquid +33 -0
- package/rook-framework/snippets/rk-table.liquid +44 -0
- package/rook-framework/snippets/rk-tabs.liquid +52 -0
- package/rook-framework/snippets/rk-textarea.liquid +42 -0
- package/rook-framework/snippets/rk-toggle-group.liquid +27 -0
- package/rook-framework/snippets/rk-toggle.liquid +58 -0
- package/rook-framework/snippets/rk-typography.liquid +27 -0
- package/rook-framework/snippets/rk-variables.liquid +76 -0
- package/src/app.js +24 -0
- package/src/commands/InstallCommand.js +133 -0
- package/src/mcp/server.js +111 -1
- package/src/services/FrameworkInstaller.js +485 -0
- package/src/templates/block.liquid.txt +0 -15
- package/src/ui/PromptUI.js +15 -1
- package/src/utils/logger.js +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkQuantity
|
|
3
|
+
Renders a quantity selector wrapped in a Web Component.
|
|
4
|
+
|
|
5
|
+
@param {number} [value] - Initial quantity (default: 1)
|
|
6
|
+
@param {number} [min] - Minimum value (default: 1)
|
|
7
|
+
@param {number} [max] - Maximum value
|
|
8
|
+
@param {number} [step] - Step increment (default: 1)
|
|
9
|
+
@param {string} [name] - Input name attribute (default: 'quantity')
|
|
10
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
11
|
+
|
|
12
|
+
@example
|
|
13
|
+
{% render 'rk-quantity', value: 1, min: 1, max: 10 %}
|
|
14
|
+
{% enddoc %}
|
|
15
|
+
|
|
16
|
+
{%- liquid
|
|
17
|
+
assign qty_value = value | default: 1
|
|
18
|
+
assign qty_min = min | default: 1
|
|
19
|
+
assign qty_step = step | default: 1
|
|
20
|
+
assign qty_name = name | default: 'quantity'
|
|
21
|
+
-%}
|
|
22
|
+
|
|
23
|
+
<rk-quantity-selector class="rk-quantity{% if custom_class %} {{ custom_class }}{% endif %}">
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
class="rk-quantity__btn"
|
|
27
|
+
data-type="minus"
|
|
28
|
+
aria-label="{{ 'accessibility.decrease_quantity' | t | default: 'Diminuir quantidade' }}"
|
|
29
|
+
{% if qty_value <= qty_min %}disabled{% endif %}
|
|
30
|
+
>
|
|
31
|
+
<span aria-hidden="true">−</span>
|
|
32
|
+
</button>
|
|
33
|
+
|
|
34
|
+
<input
|
|
35
|
+
type="number"
|
|
36
|
+
class="rk-quantity__input"
|
|
37
|
+
name="{{ qty_name }}"
|
|
38
|
+
value="{{ qty_value }}"
|
|
39
|
+
min="{{ qty_min }}"
|
|
40
|
+
{% if max %}max="{{ max }}"{% endif %}
|
|
41
|
+
step="{{ qty_step }}"
|
|
42
|
+
aria-label="{{ 'accessibility.quantity' | t | default: 'Quantidade' }}"
|
|
43
|
+
inputmode="numeric"
|
|
44
|
+
pattern="[0-9]*"
|
|
45
|
+
>
|
|
46
|
+
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
class="rk-quantity__btn"
|
|
50
|
+
data-type="plus"
|
|
51
|
+
aria-label="{{ 'accessibility.increase_quantity' | t | default: 'Aumentar quantidade' }}"
|
|
52
|
+
{% if max and qty_value >= max %}disabled{% endif %}
|
|
53
|
+
>
|
|
54
|
+
<span aria-hidden="true">+</span>
|
|
55
|
+
</button>
|
|
56
|
+
</rk-quantity-selector>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkQuickAdd
|
|
3
|
+
Renders an "Add to Cart" button with optional quantity selector.
|
|
4
|
+
⚠️ EXCEPTION: This component is coupled to Horizon's quick-add.js & events.js.
|
|
5
|
+
|
|
6
|
+
@param {object} product - The product object
|
|
7
|
+
@param {string} section_id - The section ID
|
|
8
|
+
@param {boolean} [show_quantity] - Shows the rk-quantity selector (default: false)
|
|
9
|
+
@param {string} [button_text] - Override button text
|
|
10
|
+
@param {string} [button_style] - rk-button style (default: 'primary')
|
|
11
|
+
@param {string} [button_size] - rk-button size (default: 'md')
|
|
12
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
13
|
+
|
|
14
|
+
@example
|
|
15
|
+
{% render 'rk-quick-add', product: product, section_id: section.id, show_quantity: true %}
|
|
16
|
+
{% enddoc %}
|
|
17
|
+
|
|
18
|
+
{%- liquid
|
|
19
|
+
assign variant = product.selected_or_first_available_variant
|
|
20
|
+
assign form_id = 'RkQuickAdd-' | append: product.id | append: '-' | append: section_id
|
|
21
|
+
assign add_text = button_text | default: 'Adicionar ao Carrinho'
|
|
22
|
+
assign btn_style = button_style | default: 'primary'
|
|
23
|
+
assign btn_size = button_size | default: 'md'
|
|
24
|
+
|
|
25
|
+
assign can_add = false
|
|
26
|
+
if variant.available
|
|
27
|
+
assign can_add = true
|
|
28
|
+
endif
|
|
29
|
+
-%}
|
|
30
|
+
|
|
31
|
+
<quick-add-component
|
|
32
|
+
class="rk-quick-add{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
33
|
+
data-product-title="{{ product.title }}"
|
|
34
|
+
>
|
|
35
|
+
<product-form-component
|
|
36
|
+
data-section-id="{{ section_id }}"
|
|
37
|
+
data-product-id="{{ product.id }}"
|
|
38
|
+
on:submit="/handleSubmit"
|
|
39
|
+
>
|
|
40
|
+
{%- form 'product', product, id: form_id, novalidate: 'novalidate', data-type: 'add-to-cart-form' -%}
|
|
41
|
+
<input type="hidden" name="id" value="{{ variant.id }}" {% unless variant.available %}disabled{% endunless %}>
|
|
42
|
+
|
|
43
|
+
{% if show_quantity %}
|
|
44
|
+
<div style="margin-bottom: var(--rk-space-sm);">
|
|
45
|
+
{% render 'rk-quantity',
|
|
46
|
+
value: variant.quantity_rule.min | default: 1,
|
|
47
|
+
min: variant.quantity_rule.min | default: 1,
|
|
48
|
+
max: variant.quantity_rule.max,
|
|
49
|
+
step: variant.quantity_rule.increment | default: 1,
|
|
50
|
+
name: 'quantity'
|
|
51
|
+
%}
|
|
52
|
+
</div>
|
|
53
|
+
{% else %}
|
|
54
|
+
<input type="hidden" name="quantity" value="{{ variant.quantity_rule.min | default: 1 }}">
|
|
55
|
+
{% endif %}
|
|
56
|
+
|
|
57
|
+
{% render 'rk-button',
|
|
58
|
+
text: add_text,
|
|
59
|
+
type: 'submit',
|
|
60
|
+
style: btn_style,
|
|
61
|
+
size: btn_size,
|
|
62
|
+
disabled: can_add == false,
|
|
63
|
+
full_width: true
|
|
64
|
+
%}
|
|
65
|
+
{%- endform -%}
|
|
66
|
+
</product-form-component>
|
|
67
|
+
</quick-add-component>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkScripts
|
|
3
|
+
Módulo de carregamento concentrado dos web components do Rook UI Core.
|
|
4
|
+
Garante que todos os controllers JS do framework sejam injetados juntos e de forma organizada,
|
|
5
|
+
mantendo a arquitetura desacoplada e limpa (SOLID).
|
|
6
|
+
{% enddoc %}
|
|
7
|
+
|
|
8
|
+
{%- liquid
|
|
9
|
+
# Lista de componentes JS essenciais do Rook Framework
|
|
10
|
+
assign rk_components = 'quantity,modal,accordion,popover,scroll-area,drawer,dialog,sheet,tabs,toggle,progress,collapsible,carousel,bottom-app-bar'
|
|
11
|
+
assign rk_components_array = rk_components | split: ','
|
|
12
|
+
-%}
|
|
13
|
+
|
|
14
|
+
<!-- [RkScripts] Web Components Controllers -->
|
|
15
|
+
{%- for component in rk_components_array -%}
|
|
16
|
+
<script src="{{ 'rk-' | append: component | append: '.js' | asset_url }}" defer></script>
|
|
17
|
+
{%- endfor -%}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkScrollArea
|
|
3
|
+
Renders a custom scroll area with styled scrollbars.
|
|
4
|
+
Uses Web Component <rk-scroll-area> for behaviour.
|
|
5
|
+
|
|
6
|
+
@param {string} [id] - Optional unique id
|
|
7
|
+
@param {string} [orientation] - 'vertical' | 'horizontal' | 'both' (default: 'vertical')
|
|
8
|
+
@param {string} [visibility] - 'auto' | 'always' | 'hover' (default: 'auto')
|
|
9
|
+
@param {string} [height] - Container height CSS value (e.g. '300px', '50vh')
|
|
10
|
+
@param {string} [width] - Container width CSS value (e.g. '100%')
|
|
11
|
+
@param {string} [content] - HTML content to display inside the viewport
|
|
12
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
13
|
+
|
|
14
|
+
@example
|
|
15
|
+
{% capture scroll_content %}
|
|
16
|
+
<p>Long text or list of items here…</p>
|
|
17
|
+
{% endcapture %}
|
|
18
|
+
{% render 'rk-scroll-area', height: '300px', content: scroll_content %}
|
|
19
|
+
|
|
20
|
+
{% comment %} Horizontal example {% endcomment %}
|
|
21
|
+
{% render 'rk-scroll-area', orientation: 'horizontal', height: '200px', content: cards_html %}
|
|
22
|
+
{% enddoc %}
|
|
23
|
+
|
|
24
|
+
{%- liquid
|
|
25
|
+
assign sa_orientation = orientation | default: 'vertical'
|
|
26
|
+
assign sa_visibility = visibility | default: 'auto'
|
|
27
|
+
assign sa_height = height | default: '100%'
|
|
28
|
+
assign sa_width = width | default: '100%'
|
|
29
|
+
-%}
|
|
30
|
+
|
|
31
|
+
<rk-scroll-area
|
|
32
|
+
{% if id %}id="{{ id }}"{% endif %}
|
|
33
|
+
class="rk-scroll-area{% if sa_visibility == 'always' %} rk-scroll-area--always{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
34
|
+
data-visibility="{{ sa_visibility }}"
|
|
35
|
+
style="--rk-scroll-area-height: {{ sa_height }}; --rk-scroll-area-width: {{ sa_width }};"
|
|
36
|
+
>
|
|
37
|
+
{%- comment -%} Viewport {%- endcomment -%}
|
|
38
|
+
<div class="rk-scroll-area__viewport" tabindex="0">
|
|
39
|
+
{{ content }}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{%- comment -%} Vertical Scrollbar {%- endcomment -%}
|
|
43
|
+
{%- if sa_orientation == 'vertical' or sa_orientation == 'both' -%}
|
|
44
|
+
<div class="rk-scroll-area__scrollbar rk-scroll-area__scrollbar--vertical">
|
|
45
|
+
<div class="rk-scroll-area__thumb"></div>
|
|
46
|
+
</div>
|
|
47
|
+
{%- endif -%}
|
|
48
|
+
|
|
49
|
+
{%- comment -%} Horizontal Scrollbar {%- endcomment -%}
|
|
50
|
+
{%- if sa_orientation == 'horizontal' or sa_orientation == 'both' -%}
|
|
51
|
+
<div class="rk-scroll-area__scrollbar rk-scroll-area__scrollbar--horizontal">
|
|
52
|
+
<div class="rk-scroll-area__thumb"></div>
|
|
53
|
+
</div>
|
|
54
|
+
{%- endif -%}
|
|
55
|
+
|
|
56
|
+
{%- comment -%} Corner (only when both axes) {%- endcomment -%}
|
|
57
|
+
{%- if sa_orientation == 'both' -%}
|
|
58
|
+
<div class="rk-scroll-area__corner"></div>
|
|
59
|
+
{%- endif -%}
|
|
60
|
+
</rk-scroll-area>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkSheet
|
|
3
|
+
Renders a Sheet / Side Panel that slides from the viewport edges.
|
|
4
|
+
Uses Web Component <rk-sheet-element> for behaviour.
|
|
5
|
+
|
|
6
|
+
Unlike the Drawer, the Sheet occupies the full height/width of the viewport
|
|
7
|
+
and is designed for deeper interactions (filters, forms, navigation menus).
|
|
8
|
+
|
|
9
|
+
@param {string} id - Unique sheet id (required)
|
|
10
|
+
@param {string} [side] - 'right' | 'left' | 'top' | 'bottom' (default: 'right')
|
|
11
|
+
@param {string} [size] - Panel width/height CSS value (default: '400px')
|
|
12
|
+
@param {string} title - Sheet title (required for a11y)
|
|
13
|
+
@param {string} [description] - Header description / subtitle
|
|
14
|
+
@param {string} [body] - HTML for the body content
|
|
15
|
+
@param {string} [footer] - HTML for the footer (action buttons)
|
|
16
|
+
@param {boolean} [overlay_close] - Close on overlay click (default: true)
|
|
17
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
18
|
+
|
|
19
|
+
@example
|
|
20
|
+
{% capture sheet_body %}
|
|
21
|
+
<form>...</form>
|
|
22
|
+
{% endcapture %}
|
|
23
|
+
{% capture sheet_footer %}
|
|
24
|
+
{% render 'rk-button', text: 'Salvar Alterações', style: 'primary', full_width: true %}
|
|
25
|
+
{% endcapture %}
|
|
26
|
+
{% render 'rk-sheet', id: 'filters-panel', side: 'right', size: '420px', title: 'Filtros', body: sheet_body, footer: sheet_footer %}
|
|
27
|
+
|
|
28
|
+
{% comment %} Navigation menu {% endcomment %}
|
|
29
|
+
{% render 'rk-sheet', id: 'nav-menu', side: 'left', title: 'Menu', body: nav_html %}
|
|
30
|
+
{% enddoc %}
|
|
31
|
+
|
|
32
|
+
{%- liquid
|
|
33
|
+
assign s_side = side | default: 'right'
|
|
34
|
+
assign s_size = size | default: '400px'
|
|
35
|
+
assign s_overlay_close = overlay_close | default: true
|
|
36
|
+
-%}
|
|
37
|
+
|
|
38
|
+
{%- capture title_id -%}{{ id }}-title{%- endcapture -%}
|
|
39
|
+
{%- capture desc_id -%}{{ id }}-desc{%- endcapture -%}
|
|
40
|
+
|
|
41
|
+
<rk-sheet-element
|
|
42
|
+
data-sheet-id="{{ id }}"
|
|
43
|
+
data-overlay-close="{{ s_overlay_close }}"
|
|
44
|
+
>
|
|
45
|
+
<div id="{{ id }}" class="rk-sheet{% if custom_class %} {{ custom_class }}{% endif %}">
|
|
46
|
+
{%- comment -%} Overlay {%- endcomment -%}
|
|
47
|
+
<div class="rk-sheet__overlay"></div>
|
|
48
|
+
|
|
49
|
+
{%- comment -%} Panel {%- endcomment -%}
|
|
50
|
+
<div
|
|
51
|
+
class="rk-sheet__panel rk-sheet__panel--{{ s_side }}"
|
|
52
|
+
role="dialog"
|
|
53
|
+
aria-modal="true"
|
|
54
|
+
aria-labelledby="{{ title_id }}"
|
|
55
|
+
{% if description %}aria-describedby="{{ desc_id }}"{% endif %}
|
|
56
|
+
style="--rk-sheet-size: {{ s_size }};"
|
|
57
|
+
>
|
|
58
|
+
{%- comment -%} Close button {%- endcomment -%}
|
|
59
|
+
<button type="button" class="rk-sheet__close" data-action="close" aria-label="Fechar">
|
|
60
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
61
|
+
<path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
62
|
+
</svg>
|
|
63
|
+
</button>
|
|
64
|
+
|
|
65
|
+
{%- comment -%} Header {%- endcomment -%}
|
|
66
|
+
<div class="rk-sheet__header">
|
|
67
|
+
<h2 id="{{ title_id }}" class="rk-sheet__title">{{ title }}</h2>
|
|
68
|
+
{%- if description -%}
|
|
69
|
+
<p id="{{ desc_id }}" class="rk-sheet__description">{{ description }}</p>
|
|
70
|
+
{%- endif -%}
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
{%- comment -%} Body {%- endcomment -%}
|
|
74
|
+
<div class="rk-sheet__body">
|
|
75
|
+
{{ body }}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{%- comment -%} Footer {%- endcomment -%}
|
|
79
|
+
{%- if footer -%}
|
|
80
|
+
<div class="rk-sheet__footer">
|
|
81
|
+
{{ footer }}
|
|
82
|
+
</div>
|
|
83
|
+
{%- endif -%}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</rk-sheet-element>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{%- doc -%}
|
|
2
|
+
Renders CSS variables for size (width/height) styles with responsive support.
|
|
3
|
+
Portable equivalent of Horizon's `size-style.liquid` with `rk-` prefixed variables.
|
|
4
|
+
Intended for blocks and sections that provide values for all the referenced settings.
|
|
5
|
+
|
|
6
|
+
@param {object} settings - The block or section settings object containing size values
|
|
7
|
+
|
|
8
|
+
Settings keys used:
|
|
9
|
+
- settings.width: 'fill' | 'fit-content' | 'custom' | CSS value
|
|
10
|
+
- settings.custom_width: number (percentage when width == 'custom')
|
|
11
|
+
- settings.height: 'fill' | 'fit-content' | 'custom' | CSS value
|
|
12
|
+
- settings.custom_height: number (percentage when height == 'custom')
|
|
13
|
+
- settings.width_mobile: 'fill' | 'fit-content' | 'custom' (optional, mobile override)
|
|
14
|
+
- settings.custom_width_mobile: number (percentage when width_mobile == 'custom')
|
|
15
|
+
|
|
16
|
+
@example
|
|
17
|
+
<div class="rk-size-style" style="{% render 'rk-size-style', settings: block.settings %}">
|
|
18
|
+
{%- enddoc -%}
|
|
19
|
+
|
|
20
|
+
{%- comment -%}--- Width ---{%- endcomment -%}
|
|
21
|
+
{%- if settings.width == 'custom' -%}
|
|
22
|
+
--rk-width: {{ settings.custom_width }}%;
|
|
23
|
+
{%- elsif settings.width == 'fill' -%}
|
|
24
|
+
--rk-width: 100%;
|
|
25
|
+
{%- elsif settings.width != blank -%}
|
|
26
|
+
--rk-width: {{ settings.width }};
|
|
27
|
+
{%- endif -%}
|
|
28
|
+
|
|
29
|
+
{%- comment -%}--- Height ---{%- endcomment -%}
|
|
30
|
+
{%- if settings.height == 'custom' -%}
|
|
31
|
+
--rk-height: {{ settings.custom_height }}%;
|
|
32
|
+
{%- elsif settings.height == 'fill' -%}
|
|
33
|
+
--rk-height: 100%;
|
|
34
|
+
{%- elsif settings.height != blank -%}
|
|
35
|
+
--rk-height: {{ settings.height }};
|
|
36
|
+
{%- endif -%}
|
|
37
|
+
|
|
38
|
+
{%- comment -%}--- Width Mobile ---{%- endcomment -%}
|
|
39
|
+
{%- if settings.width_mobile == 'custom' -%}
|
|
40
|
+
--rk-width-mobile: {{ settings.custom_width_mobile }}%;
|
|
41
|
+
--rk-width-mobile-min: {{ settings.custom_width_mobile }}%;
|
|
42
|
+
{%- elsif settings.width_mobile == 'fill' -%}
|
|
43
|
+
--rk-width-mobile: 100%;
|
|
44
|
+
--rk-width-mobile-min: 5rem;
|
|
45
|
+
{%- elsif settings.width_mobile == 'fit-content' -%}
|
|
46
|
+
--rk-width-mobile: fit-content;
|
|
47
|
+
--rk-width-mobile-min: fit-content;
|
|
48
|
+
{%- endif -%}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkSkeleton
|
|
3
|
+
Renders a loading placeholder skeleton.
|
|
4
|
+
|
|
5
|
+
@param {string} [width] - CSS width (default: '100%')
|
|
6
|
+
@param {string} [height] - CSS height (default: '1em')
|
|
7
|
+
@param {string} [shape] - 'text' | 'circle' | 'rect' (default: 'text')
|
|
8
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
9
|
+
|
|
10
|
+
@example
|
|
11
|
+
{% render 'rk-skeleton', width: '200px', height: '20px' %}
|
|
12
|
+
{% render 'rk-skeleton', shape: 'circle', width: '48px', height: '48px' %}
|
|
13
|
+
{% enddoc %}
|
|
14
|
+
|
|
15
|
+
{%- liquid
|
|
16
|
+
assign sk_width = width | default: '100%'
|
|
17
|
+
assign sk_height = height | default: '1em'
|
|
18
|
+
assign sk_shape = shape | default: 'text'
|
|
19
|
+
-%}
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="rk-skeleton{% if sk_shape == 'circle' %} rk-skeleton--circle{% elsif sk_shape == 'text' %} rk-skeleton--text{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
23
|
+
style="width: {{ sk_width }}; height: {{ sk_height }};"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
></div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{%- doc -%}
|
|
2
|
+
Renders CSS variables for simple padding styles without responsive scaling.
|
|
3
|
+
Portable equivalent of Horizon's `spacing-padding.liquid` with `rk-` prefixed variables.
|
|
4
|
+
Use this for simpler cases where responsive scaling is not needed.
|
|
5
|
+
|
|
6
|
+
@param {object} settings - The block or section settings object containing padding values
|
|
7
|
+
|
|
8
|
+
Settings keys used:
|
|
9
|
+
- settings['padding-block-start']: number (px, default: 0)
|
|
10
|
+
- settings['padding-block-end']: number (px, default: 0)
|
|
11
|
+
- settings['padding-inline-start']: number (px, default: 0)
|
|
12
|
+
- settings['padding-inline-end']: number (px, default: 0)
|
|
13
|
+
|
|
14
|
+
@example
|
|
15
|
+
<div style="{% render 'rk-spacing-padding', settings: section.settings %}">
|
|
16
|
+
{%- enddoc -%}
|
|
17
|
+
|
|
18
|
+
--rk-pt: {{ settings.padding-block-start | default: 0 }}px; --rk-pb: {{ settings.padding-block-end | default: 0 }}px; --rk-ps: {{ settings.padding-inline-start | default: 0 }}px; --rk-pe: {{ settings.padding-inline-end | default: 0 }}px;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{%- doc -%}
|
|
2
|
+
Renders CSS variables for spacing (padding) styles with responsive scaling.
|
|
3
|
+
Portable equivalent of Horizon's `spacing-style.liquid` with `rk-` prefixed variables.
|
|
4
|
+
Intended for blocks and sections that provide values for all the referenced settings.
|
|
5
|
+
|
|
6
|
+
Values above `scale_min` (default: 20px) are wrapped in a responsive `max()` function
|
|
7
|
+
that scales down proportionally on smaller viewports using `--rk-spacing-scale`.
|
|
8
|
+
|
|
9
|
+
@param {object} settings - The block or section settings object containing spacing values
|
|
10
|
+
|
|
11
|
+
Settings keys used:
|
|
12
|
+
- settings['padding-block-start']: number (px)
|
|
13
|
+
- settings['padding-block-end']: number (px)
|
|
14
|
+
- settings['padding-inline-start']: number (px)
|
|
15
|
+
- settings['padding-inline-end']: number (px)
|
|
16
|
+
|
|
17
|
+
CSS Variables generated:
|
|
18
|
+
- --rk-pt (padding-block-start)
|
|
19
|
+
- --rk-pb (padding-block-end)
|
|
20
|
+
- --rk-ps (padding-inline-start)
|
|
21
|
+
- --rk-pe (padding-inline-end)
|
|
22
|
+
|
|
23
|
+
@example
|
|
24
|
+
<div class="rk-spacing-style" style="{% render 'rk-spacing-style', settings: block.settings %}">
|
|
25
|
+
{%- enddoc -%}
|
|
26
|
+
|
|
27
|
+
{%- liquid
|
|
28
|
+
assign rk_scale_min = 20
|
|
29
|
+
assign rk_keys = 'padding-block-start,padding-block-end,padding-inline-start,padding-inline-end' | split: ','
|
|
30
|
+
assign rk_vars = '--rk-pt,--rk-pb,--rk-ps,--rk-pe' | split: ','
|
|
31
|
+
|
|
32
|
+
for key in rk_keys
|
|
33
|
+
assign value = settings[key]
|
|
34
|
+
assign var_name = rk_vars[forloop.index0]
|
|
35
|
+
|
|
36
|
+
if value != blank
|
|
37
|
+
echo var_name
|
|
38
|
+
echo ': '
|
|
39
|
+
|
|
40
|
+
if value > rk_scale_min
|
|
41
|
+
echo 'max('
|
|
42
|
+
echo rk_scale_min
|
|
43
|
+
echo 'px, calc(var(--rk-spacing-scale, 1) * '
|
|
44
|
+
echo value
|
|
45
|
+
echo 'px))'
|
|
46
|
+
else
|
|
47
|
+
echo value
|
|
48
|
+
echo 'px'
|
|
49
|
+
endif
|
|
50
|
+
|
|
51
|
+
echo ';'
|
|
52
|
+
endif
|
|
53
|
+
endfor
|
|
54
|
+
-%}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkSpinner
|
|
3
|
+
Elemento gráfico animado em SVG para indicar processamento em andamento.
|
|
4
|
+
|
|
5
|
+
@param {string} [size] - Define o tamanho do spinner: 'sm', 'md' (padrão), 'lg'.
|
|
6
|
+
@param {string} [color] - Cor CSS/Utilitária para o spinner. Por padrão herda `currentColor`.
|
|
7
|
+
@param {string} [custom_class] - Classes CSS extras para o container.
|
|
8
|
+
@param {string} [label] - Texto para acessibilidade (Screen Readers). Padrão: "Carregando...".
|
|
9
|
+
|
|
10
|
+
@example
|
|
11
|
+
<!-- Uso básico -->
|
|
12
|
+
{% render 'rk-spinner' %}
|
|
13
|
+
|
|
14
|
+
<!-- Pequeno dentro de um botão -->
|
|
15
|
+
<button class="rk-button">
|
|
16
|
+
{% render 'rk-spinner', size: 'sm', custom_class: 'mr-2' %}
|
|
17
|
+
Salvando
|
|
18
|
+
</button>
|
|
19
|
+
{% enddoc %}
|
|
20
|
+
|
|
21
|
+
{%- liquid
|
|
22
|
+
assign t_size = size | default: 'md'
|
|
23
|
+
assign t_label = label | default: 'Carregando...'
|
|
24
|
+
-%}
|
|
25
|
+
|
|
26
|
+
<span role="status" class="rk-spinner-wrapper{% if custom_class %} {{ custom_class }}{% endif %}">
|
|
27
|
+
<svg
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
width="24"
|
|
30
|
+
height="24"
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
fill="none"
|
|
33
|
+
stroke="currentColor"
|
|
34
|
+
stroke-width="2"
|
|
35
|
+
stroke-linecap="round"
|
|
36
|
+
stroke-linejoin="round"
|
|
37
|
+
class="rk-spinner rk-spinner--{{ t_size }}{% if color %} {{ color }}{% endif %}"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56"></path>
|
|
41
|
+
</svg>
|
|
42
|
+
<span class="rk-sr-only">{{ t_label }}</span>
|
|
43
|
+
</span>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkSwatch
|
|
3
|
+
Renders a variant swatch (color, image or unavailable).
|
|
4
|
+
|
|
5
|
+
@param {object} swatch - Shopify swatch object
|
|
6
|
+
@param {object} [variant_image] - Alternative image to use
|
|
7
|
+
@param {boolean} [active] - Currently selected
|
|
8
|
+
@param {boolean} [unavailable] - Unavailable state
|
|
9
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
10
|
+
|
|
11
|
+
@example
|
|
12
|
+
{% render 'rk-swatch', swatch: swatch, active: true %}
|
|
13
|
+
{% enddoc %}
|
|
14
|
+
|
|
15
|
+
{%- liquid
|
|
16
|
+
assign swatch_value = null
|
|
17
|
+
|
|
18
|
+
if variant_image
|
|
19
|
+
assign swatch_url = variant_image | image_url: width: 64
|
|
20
|
+
assign swatch_value = 'url(' | append: swatch_url | append: ')'
|
|
21
|
+
elsif swatch.image
|
|
22
|
+
assign swatch_url = swatch.image | image_url: width: 80
|
|
23
|
+
assign swatch_value = 'url(' | append: swatch_url | append: ')'
|
|
24
|
+
elsif swatch.color
|
|
25
|
+
assign swatch_value = 'rgb(' | append: swatch.color.rgb | append: ')'
|
|
26
|
+
endif
|
|
27
|
+
-%}
|
|
28
|
+
|
|
29
|
+
<span
|
|
30
|
+
class="rk-swatch{% if active %} rk-swatch--active{% endif %}{% if unavailable %} rk-swatch--unavailable{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
31
|
+
style="--rk-swatch-bg: {{ swatch_value }};"
|
|
32
|
+
>
|
|
33
|
+
</span>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkTable
|
|
3
|
+
Renders a responsive Table component (Shadcn/UI pattern).
|
|
4
|
+
The snippet acts as a wrapper to manage horizontal scrolling on mobile,
|
|
5
|
+
while you write the semantic HTML inside it.
|
|
6
|
+
|
|
7
|
+
@param {string} content - HTML containing <thead>, <tbody>, etc.
|
|
8
|
+
@param {boolean} [striped] - Add alternating row colors (default: false)
|
|
9
|
+
@param {string} [custom_class] - Extra CSS classes for the wrapper
|
|
10
|
+
|
|
11
|
+
@example
|
|
12
|
+
{% capture table_content %}
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>Fatura</th>
|
|
16
|
+
<th>Status</th>
|
|
17
|
+
<th>Método</th>
|
|
18
|
+
<th class="rk-text-right">Valor</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>INV001</td>
|
|
24
|
+
<td>Paga</td>
|
|
25
|
+
<td>Cartão de Crédito</td>
|
|
26
|
+
<td class="rk-text-right">R$ 250,00</td>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<td>INV002</td>
|
|
30
|
+
<td>Pendente</td>
|
|
31
|
+
<td>Pix</td>
|
|
32
|
+
<td class="rk-text-right">R$ 150,00</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</tbody>
|
|
35
|
+
{% endcapture %}
|
|
36
|
+
|
|
37
|
+
{% render 'rk-table', content: table_content, striped: true %}
|
|
38
|
+
{% enddoc %}
|
|
39
|
+
|
|
40
|
+
<div class="rk-table-wrapper{% if custom_class %} {{ custom_class }}{% endif %}">
|
|
41
|
+
<table class="rk-table{% if striped %} rk-table--striped{% endif %}">
|
|
42
|
+
{{ content }}
|
|
43
|
+
</table>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkTabs
|
|
3
|
+
Renders a Tabs wrapper (Shadcn/UI pattern).
|
|
4
|
+
The snippet manages the Web Component wrapper and the basic layout.
|
|
5
|
+
You need to provide the raw HTML for triggers (buttons) and content (panels)
|
|
6
|
+
following the WAI-ARIA specs (roles and aria-attributes).
|
|
7
|
+
|
|
8
|
+
@param {string} id - Unique tabs id (for prefixing triggers/panels)
|
|
9
|
+
@param {string} triggers - HTML for the tab triggers ([role="tab"])
|
|
10
|
+
@param {string} content - HTML for the tab panels ([role="tabpanel"])
|
|
11
|
+
@param {string} [default_value] - ID of the tab to open by default
|
|
12
|
+
@param {string} [orientation] - 'horizontal' (default) or 'vertical'
|
|
13
|
+
@param {string} [custom_class] - Extra CSS classes
|
|
14
|
+
|
|
15
|
+
@example
|
|
16
|
+
{% capture tabs_triggers %}
|
|
17
|
+
<button class="rk-tabs__trigger" role="tab" aria-controls="panel-1" id="tab-1">Descrição</button>
|
|
18
|
+
<button class="rk-tabs__trigger" role="tab" aria-controls="panel-2" id="tab-2">Especificações</button>
|
|
19
|
+
{% endcapture %}
|
|
20
|
+
|
|
21
|
+
{% capture tabs_content %}
|
|
22
|
+
<div class="rk-tabs__panel" role="tabpanel" id="panel-1" aria-labelledby="tab-1">
|
|
23
|
+
<p>Texto da descrição aqui.</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="rk-tabs__panel" role="tabpanel" id="panel-2" aria-labelledby="tab-2" hidden>
|
|
26
|
+
<p>Detalhes técnicos aqui.</p>
|
|
27
|
+
</div>
|
|
28
|
+
{% endcapture %}
|
|
29
|
+
|
|
30
|
+
{% render 'rk-tabs', id: 'product-tabs', triggers: tabs_triggers, content: tabs_content, default_value: 'tab-1' %}
|
|
31
|
+
{% enddoc %}
|
|
32
|
+
|
|
33
|
+
{%- liquid
|
|
34
|
+
assign t_orientation = orientation | default: 'horizontal'
|
|
35
|
+
-%}
|
|
36
|
+
|
|
37
|
+
<rk-tabs-element
|
|
38
|
+
id="{{ id | default: 'rk-tabs' }}"
|
|
39
|
+
data-default-value="{{ default_value }}"
|
|
40
|
+
data-orientation="{{ t_orientation }}"
|
|
41
|
+
class="rk-tabs rk-tabs--{{ t_orientation }}{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
42
|
+
>
|
|
43
|
+
{%- comment -%} Tab List {%- endcomment -%}
|
|
44
|
+
<div class="rk-tabs__list" role="tablist" aria-orientation="{{ t_orientation }}">
|
|
45
|
+
{{ triggers }}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
{%- comment -%} Tab Panels {%- endcomment -%}
|
|
49
|
+
<div class="rk-tabs__content-wrapper">
|
|
50
|
+
{{ content }}
|
|
51
|
+
</div>
|
|
52
|
+
</rk-tabs-element>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{% doc %}
|
|
2
|
+
Snippet: RkTextarea
|
|
3
|
+
Campo de entrada de texto com múltiplas linhas (textarea), seguindo o estilo base (Shadcn/UI).
|
|
4
|
+
|
|
5
|
+
@param {string} [id] - ID único para o campo, vinculando-o ao Label.
|
|
6
|
+
@param {string} [name] - Nome do campo no formulário.
|
|
7
|
+
@param {string} [placeholder] - Texto de dica (placeholder).
|
|
8
|
+
@param {string} [value] - Valor inicial.
|
|
9
|
+
@param {number} [rows] - Quantidade de linhas visíveis (altura inicial). Padrão: 3.
|
|
10
|
+
@param {string} [resize] - Propriedade de redimensionamento ('none', 'vertical', 'both'). Padrão: 'vertical'.
|
|
11
|
+
@param {boolean} [required] - Se o campo é obrigatório.
|
|
12
|
+
@param {boolean} [disabled] - Se o campo está desabilitado.
|
|
13
|
+
@param {boolean} [readonly] - Se o campo é somente leitura.
|
|
14
|
+
@param {boolean} [has_error] - Define estilo de erro na borda se `true`.
|
|
15
|
+
@param {string} [custom_class] - Classes CSS customizadas.
|
|
16
|
+
|
|
17
|
+
@example
|
|
18
|
+
{% render 'rk-textarea',
|
|
19
|
+
id: 'contact_message',
|
|
20
|
+
name: 'contact[body]',
|
|
21
|
+
placeholder: 'Digite sua mensagem aqui...',
|
|
22
|
+
rows: 4,
|
|
23
|
+
required: true
|
|
24
|
+
%}
|
|
25
|
+
{% enddoc %}
|
|
26
|
+
|
|
27
|
+
{%- liquid
|
|
28
|
+
assign t_rows = rows | default: 3
|
|
29
|
+
assign t_resize = resize | default: 'vertical'
|
|
30
|
+
-%}
|
|
31
|
+
|
|
32
|
+
<textarea
|
|
33
|
+
{% if id %}id="{{ id }}"{% endif %}
|
|
34
|
+
{% if name %}name="{{ name }}"{% endif %}
|
|
35
|
+
class="rk-textarea rk-textarea--resize-{{ t_resize }}{% if has_error %} rk-textarea--error{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
|
|
36
|
+
rows="{{ t_rows }}"
|
|
37
|
+
{% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
|
|
38
|
+
{% if required %}required aria-required="true"{% endif %}
|
|
39
|
+
{% if disabled %}disabled aria-disabled="true"{% endif %}
|
|
40
|
+
{% if readonly %}readonly{% endif %}
|
|
41
|
+
{% if has_error %}aria-invalid="true"{% endif %}
|
|
42
|
+
>{{ value }}</textarea>
|