rook-cli 1.3.2 → 1.3.4

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.
Files changed (89) hide show
  1. package/package.json +3 -2
  2. package/rook-framework/PRD-INSTALL-COMMAND.md +379 -0
  3. package/rook-framework/PRD.md +1214 -0
  4. package/rook-framework/README.md +143 -0
  5. package/rook-framework/assets/rk-accordion.js +99 -0
  6. package/rook-framework/assets/rk-alert-dialog.js +132 -0
  7. package/rook-framework/assets/rk-bottom-app-bar.js +88 -0
  8. package/rook-framework/assets/rk-carousel.js +145 -0
  9. package/rook-framework/assets/rk-collapsible.js +151 -0
  10. package/rook-framework/assets/rk-dialog.js +161 -0
  11. package/rook-framework/assets/rk-drawer.js +214 -0
  12. package/rook-framework/assets/rk-framework-core.css +2554 -0
  13. package/rook-framework/assets/rk-framework-tokens.css +101 -0
  14. package/rook-framework/assets/rk-modal.js +91 -0
  15. package/rook-framework/assets/rk-popover.js +264 -0
  16. package/rook-framework/assets/rk-progress.js +81 -0
  17. package/rook-framework/assets/rk-quantity.js +91 -0
  18. package/rook-framework/assets/rk-scroll-area.js +286 -0
  19. package/rook-framework/assets/rk-sheet.js +157 -0
  20. package/rook-framework/assets/rk-tabs.js +179 -0
  21. package/rook-framework/assets/rk-toggle.js +153 -0
  22. package/rook-framework/blocks/rk-accordion.liquid +97 -0
  23. package/rook-framework/blocks/rk-badge.liquid +103 -0
  24. package/rook-framework/blocks/rk-button.liquid +166 -0
  25. package/rook-framework/blocks/rk-divider.liquid +100 -0
  26. package/rook-framework/blocks/rk-form-field.liquid +120 -0
  27. package/rook-framework/blocks/rk-icon.liquid +134 -0
  28. package/rook-framework/blocks/rk-image.liquid +198 -0
  29. package/rook-framework/blocks/rk-installments.liquid +99 -0
  30. package/rook-framework/blocks/rk-pix-discount.liquid +99 -0
  31. package/rook-framework/blocks/rk-price.liquid +128 -0
  32. package/rook-framework/blocks/rk-quantity.liquid +108 -0
  33. package/rook-framework/blocks/rk-quick-add.liquid +137 -0
  34. package/rook-framework/blocks/rk-skeleton.liquid +104 -0
  35. package/rook-framework/blocks/rk-typography.liquid +183 -0
  36. package/rook-framework/config/rk-settings_schema.json +259 -0
  37. package/rook-framework/snippets/rk-accordion.liquid +31 -0
  38. package/rook-framework/snippets/rk-alert-dialog.liquid +83 -0
  39. package/rook-framework/snippets/rk-aspect-ratio.liquid +23 -0
  40. package/rook-framework/snippets/rk-badge.liquid +17 -0
  41. package/rook-framework/snippets/rk-bottom-app-bar.liquid +51 -0
  42. package/rook-framework/snippets/rk-button.liquid +49 -0
  43. package/rook-framework/snippets/rk-card.liquid +64 -0
  44. package/rook-framework/snippets/rk-carousel.liquid +74 -0
  45. package/rook-framework/snippets/rk-checkbox.liquid +34 -0
  46. package/rook-framework/snippets/rk-collapsible.liquid +52 -0
  47. package/rook-framework/snippets/rk-dialog.liquid +85 -0
  48. package/rook-framework/snippets/rk-divider.liquid +25 -0
  49. package/rook-framework/snippets/rk-drawer.liquid +81 -0
  50. package/rook-framework/snippets/rk-external-assets copy.liquid +33 -0
  51. package/rook-framework/snippets/rk-external-assets.liquid +68 -0
  52. package/rook-framework/snippets/rk-form-field.liquid +83 -0
  53. package/rook-framework/snippets/rk-gap-style.liquid +32 -0
  54. package/rook-framework/snippets/rk-icon.liquid +28 -0
  55. package/rook-framework/snippets/rk-image.liquid +60 -0
  56. package/rook-framework/snippets/rk-input.liquid +35 -0
  57. package/rook-framework/snippets/rk-installments.liquid +54 -0
  58. package/rook-framework/snippets/rk-item.liquid +69 -0
  59. package/rook-framework/snippets/rk-layout-style.liquid +37 -0
  60. package/rook-framework/snippets/rk-modal.liquid +31 -0
  61. package/rook-framework/snippets/rk-pix-discount.liquid +34 -0
  62. package/rook-framework/snippets/rk-popover.liquid +77 -0
  63. package/rook-framework/snippets/rk-price.liquid +48 -0
  64. package/rook-framework/snippets/rk-progress.liquid +38 -0
  65. package/rook-framework/snippets/rk-quantity.liquid +56 -0
  66. package/rook-framework/snippets/rk-quick-add.liquid +67 -0
  67. package/rook-framework/snippets/rk-scripts.liquid +17 -0
  68. package/rook-framework/snippets/rk-scroll-area.liquid +60 -0
  69. package/rook-framework/snippets/rk-sheet.liquid +86 -0
  70. package/rook-framework/snippets/rk-size-style.liquid +48 -0
  71. package/rook-framework/snippets/rk-skeleton.liquid +25 -0
  72. package/rook-framework/snippets/rk-spacing-padding.liquid +18 -0
  73. package/rook-framework/snippets/rk-spacing-style.liquid +54 -0
  74. package/rook-framework/snippets/rk-spinner.liquid +43 -0
  75. package/rook-framework/snippets/rk-swatch.liquid +33 -0
  76. package/rook-framework/snippets/rk-table.liquid +44 -0
  77. package/rook-framework/snippets/rk-tabs.liquid +52 -0
  78. package/rook-framework/snippets/rk-textarea.liquid +42 -0
  79. package/rook-framework/snippets/rk-toggle-group.liquid +27 -0
  80. package/rook-framework/snippets/rk-toggle.liquid +58 -0
  81. package/rook-framework/snippets/rk-typography.liquid +27 -0
  82. package/rook-framework/snippets/rk-variables.liquid +74 -0
  83. package/src/app.js +24 -0
  84. package/src/commands/InstallCommand.js +133 -0
  85. package/src/mcp/server.js +111 -1
  86. package/src/services/FrameworkInstaller.js +379 -0
  87. package/src/templates/block.liquid.txt +0 -15
  88. package/src/ui/PromptUI.js +15 -1
  89. package/src/utils/logger.js +1 -1
@@ -0,0 +1,69 @@
1
+ {% doc %}
2
+ Snippet: RkItem
3
+ Componente base de lista/menu (List Item / Menu Item) com suporte a ícones, atalhos, e estados interativos.
4
+
5
+ @param {string} [as] - Tag HTML (ex: 'div', 'li', 'a', 'button'). Padrão: 'div'
6
+ @param {string} [href] - URL caso `as: 'a'`.
7
+ @param {string} [role] - Papel ARIA (ex: 'menuitem', 'option', 'listitem').
8
+ @param {boolean} [interactive] - Se true, aplica estilos de hover/focus. Automático se for link/button.
9
+ @param {boolean} [selected] - Se true, marca como visualmente ativo/selecionado (aria-selected="true").
10
+ @param {boolean} [disabled] - Se true, desativa a interação (aria-disabled="true").
11
+ @param {string} [leading] - Ícone ou elemento injetado à esquerda.
12
+ @param {string} [content] - Texto principal do item.
13
+ @param {string} [description] - Texto secundário menor exibido abaixo do content.
14
+ @param {string} [trailing] - Elemento injetado à direita (atalhos de teclado, chevron, check).
15
+ @param {string} [custom_class] - Classes CSS extras.
16
+
17
+ @example
18
+ {% render 'rk-item',
19
+ as: 'button',
20
+ leading: '<svg>...</svg>',
21
+ content: 'Configurações',
22
+ trailing: '<span class="text-sm text-muted">⌘S</span>',
23
+ interactive: true
24
+ %}
25
+ {% enddoc %}
26
+
27
+ {%- liquid
28
+ assign t_as = as | default: 'div'
29
+
30
+ assign is_link = false
31
+ if t_as == 'a' and href != blank
32
+ assign is_link = true
33
+ endif
34
+
35
+ assign is_interactive = false
36
+ if interactive == true or interactive == 'true' or is_link or t_as == 'button'
37
+ assign is_interactive = true
38
+ endif
39
+ -%}
40
+
41
+ <{{ t_as }}
42
+ class="rk-item{% if is_interactive %} rk-item--interactive{% endif %}{% if selected %} rk-item--selected{% endif %}{% if disabled %} rk-item--disabled{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
43
+ {% if role %}role="{{ role }}"{% endif %}
44
+ {% if is_link %}href="{{ href }}"{% endif %}
45
+ {% if selected %}aria-selected="true"{% endif %}
46
+ {% if disabled %}aria-disabled="true" tabindex="-1"{% endif %}
47
+ {% if t_as == 'button' and disabled %}disabled{% endif %}
48
+ >
49
+ {%- if leading != blank -%}
50
+ <span class="rk-item__leading">
51
+ {{ leading }}
52
+ </span>
53
+ {%- endif -%}
54
+
55
+ <span class="rk-item__main">
56
+ {%- if content != blank -%}
57
+ <span class="rk-item__content">{{ content }}</span>
58
+ {%- endif -%}
59
+ {%- if description != blank -%}
60
+ <span class="rk-item__description">{{ description }}</span>
61
+ {%- endif -%}
62
+ </span>
63
+
64
+ {%- if trailing != blank -%}
65
+ <span class="rk-item__trailing">
66
+ {{ trailing }}
67
+ </span>
68
+ {%- endif -%}
69
+ </{{ t_as }}>
@@ -0,0 +1,37 @@
1
+ {%- doc -%}
2
+ Renders CSS variables for layout/panel styles including flex direction, alignment, gap and wrapping.
3
+ Portable equivalent of Horizon's `layout-panel-style.liquid` with `rk-` prefixed variables.
4
+
5
+ @param {object} settings - The block or section settings object containing layout values
6
+
7
+ Settings keys used:
8
+ - settings.content_direction: 'row' | 'column' (default: 'column')
9
+ - settings.horizontal_alignment: CSS justify-content value
10
+ - settings.vertical_alignment: CSS align-items value
11
+ - settings.gap: number (px)
12
+
13
+ @example
14
+ <div class="rk-layout-style" style="{% render 'rk-layout-style', settings: block.settings %}">
15
+ {%- enddoc -%}
16
+
17
+ {%- liquid
18
+ assign rk_h_align = settings.horizontal_alignment
19
+ assign rk_v_align = settings.vertical_alignment
20
+
21
+ unless settings.content_direction == 'row'
22
+ if settings.horizontal_alignment_flex_direction_column != blank
23
+ assign rk_h_align = settings.horizontal_alignment_flex_direction_column
24
+ endif
25
+ if settings.vertical_alignment_flex_direction_column != blank
26
+ assign rk_v_align = settings.vertical_alignment_flex_direction_column
27
+ endif
28
+ endunless
29
+ -%}
30
+
31
+ --rk-flex-direction: {{ settings.content_direction | default: 'column' }};
32
+ --rk-flex-wrap: nowrap;
33
+ --rk-flex-wrap-mobile: wrap;
34
+ --rk-h-align: {{ rk_h_align }};
35
+ --rk-v-align: {{ rk_v_align }};
36
+
37
+ {% render 'rk-gap-style', value: settings.gap %}
@@ -0,0 +1,31 @@
1
+ {% doc %}
2
+ Snippet: RkModal
3
+ Renders a modal/dialog wrapper using a Web Component.
4
+
5
+ @param {string} id - Unique modal id
6
+ @param {string} content - HTML content of the modal
7
+ @param {string} [title] - Optional title
8
+ @param {string} [custom_class] - Extra CSS classes
9
+
10
+ @example
11
+ {% render 'rk-modal', id: 'my-modal', title: 'Quick View', content: some_html %}
12
+ {% enddoc %}
13
+
14
+ <rk-modal-element data-modal-id="{{ id }}">
15
+ <div id="{{ id }}" class="rk-modal{% if custom_class %} {{ custom_class }}{% endif %}">
16
+ <div class="rk-modal__overlay" data-action="close"></div>
17
+ <div class="rk-modal__content" role="dialog" aria-modal="true" {% if title %}aria-label="{{ title }}"{% endif %}>
18
+ <button type="button" class="rk-modal__close" data-action="close" aria-label="Fechar">
19
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
20
+ <path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
21
+ </svg>
22
+ </button>
23
+
24
+ {% if title %}
25
+ <h2 class="rk-typography rk-typography--lg rk-typography--bold" style="margin-bottom: var(--rk-space-md);">{{ title }}</h2>
26
+ {% endif %}
27
+
28
+ {{ content }}
29
+ </div>
30
+ </div>
31
+ </rk-modal-element>
@@ -0,0 +1,34 @@
1
+ {% doc %}
2
+ Snippet: RkPixDiscount
3
+ Renders the Pix discount price reading global settings.
4
+
5
+ @param {number} price - Price in cents to apply discount
6
+ @param {string} [custom_class] - Extra CSS classes
7
+
8
+ @example
9
+ {% render 'rk-pix-discount', price: product.selected_or_first_available_variant.price %}
10
+ {% enddoc %}
11
+
12
+ {%- liquid
13
+ unless settings.rk_pix_enabled
14
+ break
15
+ endunless
16
+
17
+ assign pix_discount_pct = settings.rk_pix_discount | default: 5
18
+ assign pix_label = settings.rk_pix_label | default: 'no Pix'
19
+
20
+ assign discount_multiplier = 100 | minus: pix_discount_pct
21
+ assign pix_price = price | times: discount_multiplier | divided_by: 100
22
+ assign formatted_pix = pix_price | money
23
+ -%}
24
+
25
+ {% if pix_discount_pct > 0 %}
26
+ <span class="rk-pix{% if custom_class %} {{ custom_class }}{% endif %}">
27
+ <svg class="rk-pix__icon" viewBox="0 0 512 512" fill="currentColor" aria-hidden="true">
28
+ <path d="M393.8 254.3l-79.3-79.3c-14.7-14.7-38.5-14.7-53.2 0L182 254.3c-14.7 14.7-14.7 38.5 0 53.2l79.3 79.3c14.7 14.7 38.5 14.7 53.2 0l79.3-79.3c14.7-14.7 14.7-38.5 0-53.2zM239.7 346.5L165.9 272.7c-3.9-3.9-3.9-10.2 0-14.1l73.8-73.8c3.9-3.9 10.2-3.9 14.1 0l73.8 73.8c3.9 3.9 3.9 10.2 0 14.1l-73.8 73.8c-3.9 3.9-10.2 3.9-14.1 0z"/>
29
+ </svg>
30
+ <span>{{ formatted_pix }}</span>
31
+ <span>{{ pix_label }}</span>
32
+ <span class="rk-pix__badge">-{{ pix_discount_pct }}%</span>
33
+ </span>
34
+ {% endif %}
@@ -0,0 +1,77 @@
1
+ {% doc %}
2
+ Snippet: RkPopover
3
+ Renders a Popover component (floating overlay triggered by click).
4
+ Uses Web Component <rk-popover-element> for behaviour.
5
+
6
+ @param {string} id - Unique popover id
7
+ @param {string} [side] - Preferred side: 'top' | 'bottom' | 'left' | 'right' (default: 'bottom')
8
+ @param {string} [align] - Alignment: 'start' | 'center' | 'end' (default: 'center')
9
+ @param {number} [side_offset] - Distance from trigger in px (default: 8)
10
+ @param {number} [align_offset] - Lateral shift in px (default: 0)
11
+ @param {boolean} [show_arrow] - Show pointing arrow (default: true)
12
+ @param {string} [title] - Optional header title
13
+ @param {string} [description] - Optional header description
14
+ @param {string} [trigger_content] - HTML for the trigger element
15
+ @param {string} [body] - HTML for the body content
16
+ @param {string} [custom_class] - Extra CSS classes for the content container
17
+ @param {string} [width] - Content container width (e.g. '320px')
18
+
19
+ @example
20
+ {% capture popover_trigger %}
21
+ {% render 'rk-button', text: 'Open Popover', style: 'outline', size: 'sm' %}
22
+ {% endcapture %}
23
+ {% capture popover_body %}
24
+ <p>Any rich content here</p>
25
+ {% endcapture %}
26
+ {% render 'rk-popover', id: 'my-pop', trigger_content: popover_trigger, body: popover_body, title: 'Settings' %}
27
+ {% enddoc %}
28
+
29
+ {%- liquid
30
+ assign pop_side = side | default: 'bottom'
31
+ assign pop_align = align | default: 'center'
32
+ assign pop_side_offset = side_offset | default: 8
33
+ assign pop_align_offset = align_offset | default: 0
34
+ assign pop_show_arrow = show_arrow | default: true
35
+ -%}
36
+
37
+ <rk-popover-element
38
+ data-side="{{ pop_side }}"
39
+ data-align="{{ pop_align }}"
40
+ data-side-offset="{{ pop_side_offset }}"
41
+ data-align-offset="{{ pop_align_offset }}"
42
+ class="rk-popover"
43
+ >
44
+ {%- comment -%} Trigger Area {%- endcomment -%}
45
+ <div data-rk-popover-trigger class="rk-popover__trigger">
46
+ {{ trigger_content }}
47
+ </div>
48
+
49
+ {%- comment -%} Content Container {%- endcomment -%}
50
+ <div
51
+ id="{{ id }}"
52
+ class="rk-popover__content{% if custom_class %} {{ custom_class }}{% endif %}"
53
+ role="dialog"
54
+ aria-modal="false"
55
+ {% if title %}aria-label="{{ title }}"{% endif %}
56
+ {% if width %}style="--rk-popover-width: {{ width }};"{% endif %}
57
+ >
58
+ {%- if pop_show_arrow -%}
59
+ <div class="rk-popover__arrow"></div>
60
+ {%- endif -%}
61
+
62
+ {%- if title or description -%}
63
+ <div class="rk-popover__header">
64
+ {%- if title -%}
65
+ <h3 class="rk-popover__title">{{ title }}</h3>
66
+ {%- endif -%}
67
+ {%- if description -%}
68
+ <p class="rk-popover__description">{{ description }}</p>
69
+ {%- endif -%}
70
+ </div>
71
+ {%- endif -%}
72
+
73
+ <div class="rk-popover__body">
74
+ {{ body }}
75
+ </div>
76
+ </div>
77
+ </rk-popover-element>
@@ -0,0 +1,48 @@
1
+ {% doc %}
2
+ Snippet: RkPrice
3
+ Renders a configurable price display with optional promotional/compare pricing.
4
+
5
+ @param {object} product - The product object
6
+ @param {boolean} [from] - Show "A partir de" prefix
7
+ @param {boolean} [show_compare] - Force show compare-at price
8
+ @param {string} [compare_position] - 'before' | 'after' (default: 'before')
9
+ @param {string} [custom_class] - Extra CSS classes
10
+
11
+ @example
12
+ {% render 'rk-price', product: product, from: true %}
13
+ {% enddoc %}
14
+
15
+ {%- liquid
16
+ assign selected_variant = product.selected_or_first_available_variant
17
+ assign current_price = selected_variant.price
18
+ assign compare_price = selected_variant.compare_at_price
19
+ assign cmp_position = compare_position | default: 'before'
20
+
21
+ assign is_on_sale = false
22
+ if compare_price > current_price
23
+ assign is_on_sale = true
24
+ endif
25
+
26
+ if product == blank
27
+ assign current_price = 1999
28
+ endif
29
+
30
+ assign formatted_price = current_price | money
31
+ assign formatted_compare = compare_price | money
32
+ -%}
33
+
34
+ <div class="rk-price{% if is_on_sale %} rk-price--sale{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}">
35
+ {%- if from -%}
36
+ <span class="rk-price__from">A partir de</span>
37
+ {%- endif -%}
38
+
39
+ {%- if is_on_sale and cmp_position == 'before' -%}
40
+ <span class="rk-price__compare">{{ formatted_compare }}</span>
41
+ {%- endif -%}
42
+
43
+ <span class="rk-price__current">{{ formatted_price }}</span>
44
+
45
+ {%- if is_on_sale and cmp_position == 'after' -%}
46
+ <span class="rk-price__compare">{{ formatted_compare }}</span>
47
+ {%- endif -%}
48
+ </div>
@@ -0,0 +1,38 @@
1
+ {% doc %}
2
+ Snippet: RkProgress
3
+ Renders a visual Progress Bar (Shadcn/UI pattern).
4
+ The Web Component `<rk-progress-element>` animates changes using CSS transform.
5
+
6
+ @param {number} value - Current progress value
7
+ @param {number} [max] - Maximum progress value (default: 100)
8
+ @param {string} [id] - Unique id for accessibility linking
9
+ @param {string} [aria_label] - Describe the context for screen readers
10
+ @param {string} [custom_class] - Extra CSS classes for sizing or coloring
11
+
12
+ @example
13
+ {% render 'rk-progress', value: 45, aria_label: 'Progresso do Frete Grátis' %}
14
+ {% enddoc %}
15
+
16
+ {%- liquid
17
+ assign t_value = value | default: 0
18
+ assign t_max = max | default: 100
19
+ -%}
20
+
21
+ <rk-progress-element
22
+ data-value="{{ t_value }}"
23
+ data-max="{{ t_max }}"
24
+ {% if id %}id="{{ id }}"{% endif %}
25
+ class="rk-progress{% if custom_class %} {{ custom_class }}{% endif %}"
26
+ >
27
+ <div
28
+ class="rk-progress__track"
29
+ role="progressbar"
30
+ aria-valuenow="{{ t_value }}"
31
+ aria-valuemin="0"
32
+ aria-valuemax="{{ t_max }}"
33
+ aria-valuetext="{{ t_value }} de {{ t_max }}"
34
+ {% if aria_label %}aria-label="{{ aria_label }}"{% endif %}
35
+ >
36
+ <div class="rk-progress__indicator"></div>
37
+ </div>
38
+ </rk-progress-element>
@@ -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>