velvetkit 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +109 -0
- data/README.md +5 -1
- data/lib/generators/velvetkit/add/add_generator.rb +58 -0
- data/lib/velvetkit/version.rb +4 -1
- data/lib/velvetkit.rb +7 -0
- data/registry/app/assets/tailwind/velvetkit.css +90 -155
- data/registry/app/components/ui/chart.html.erb +47 -0
- data/registry/app/components/ui/chart.rb +177 -0
- data/registry/app/components/ui/command/group.rb +27 -0
- data/registry/app/components/ui/command/item.rb +64 -0
- data/registry/app/components/ui/command.html.erb +41 -0
- data/registry/app/components/ui/command.rb +122 -0
- data/registry/app/components/ui/date_picker.html.erb +58 -64
- data/registry/app/components/ui/date_picker.rb +199 -75
- data/registry/app/components/ui/file_field.html.erb +14 -4
- data/registry/app/components/ui/file_field.rb +179 -28
- data/registry/app/components/ui/gallery/image.rb +20 -0
- data/registry/app/components/ui/gallery.html.erb +52 -0
- data/registry/app/components/ui/gallery.rb +164 -0
- data/registry/app/components/ui/kbd.html.erb +27 -0
- data/registry/app/components/ui/kbd.rb +134 -0
- data/registry/app/components/ui/money_input.html.erb +8 -0
- data/registry/app/components/ui/money_input.rb +153 -0
- data/registry/app/components/ui/number_input.html.erb +11 -0
- data/registry/app/components/ui/number_input.rb +103 -0
- data/registry/app/components/ui/progress/segment.rb +25 -0
- data/registry/app/components/ui/progress.html.erb +25 -0
- data/registry/app/components/ui/progress.rb +182 -0
- data/registry/app/components/ui/scan_input.html.erb +6 -0
- data/registry/app/components/ui/scan_input.rb +94 -0
- data/registry/app/components/ui/select.html.erb +24 -5
- data/registry/app/components/ui/select.rb +44 -5
- data/registry/app/components/ui/slider.html.erb +23 -0
- data/registry/app/components/ui/slider.rb +254 -0
- data/registry/app/components/ui/timeline/item.html.erb +21 -0
- data/registry/app/components/ui/timeline/item.rb +145 -0
- data/registry/app/components/ui/timeline.html.erb +1 -0
- data/registry/app/components/ui/timeline.rb +42 -0
- data/registry/app/javascript/chart_js.ts +37 -0
- data/registry/app/javascript/controllers/ui/_internal/date_format.ts +74 -0
- data/registry/app/javascript/controllers/ui/_internal/shortcut.ts +80 -0
- data/registry/app/javascript/controllers/ui/chart_controller.ts +585 -0
- data/registry/app/javascript/controllers/ui/command_controller.ts +454 -0
- data/registry/app/javascript/controllers/ui/date_picker_controller.ts +247 -82
- data/registry/app/javascript/controllers/ui/file_field_controller.ts +288 -16
- data/registry/app/javascript/controllers/ui/gallery_controller.ts +568 -0
- data/registry/app/javascript/controllers/ui/kbd_controller.ts +60 -0
- data/registry/app/javascript/controllers/ui/money_input_controller.ts +228 -0
- data/registry/app/javascript/controllers/ui/number_input_controller.ts +111 -0
- data/registry/app/javascript/controllers/ui/progress_controller.ts +87 -0
- data/registry/app/javascript/controllers/ui/scan_input_controller.ts +143 -0
- data/registry/app/javascript/controllers/ui/select_controller.ts +198 -8
- data/registry/app/javascript/controllers/ui/slider_controller.ts +216 -0
- data/registry/app/javascript/vanilla_calendar.ts +15 -0
- data/registry/components.yml +25 -3
- data/registry/config/locales/velvetkit.en.yml +79 -0
- data/registry/icons/lucide/download.svg +17 -0
- data/registry/icons/lucide/file-plus.svg +18 -0
- data/registry/icons/lucide/file.svg +16 -0
- data/registry/icons/lucide/folder.svg +15 -0
- data/registry/icons/lucide/keyboard.svg +23 -0
- data/registry/icons/lucide/minus.svg +15 -0
- data/registry/icons/lucide/package.svg +18 -0
- data/registry/icons/lucide/pause.svg +16 -0
- data/registry/icons/lucide/percent.svg +17 -0
- data/registry/icons/lucide/printer.svg +17 -0
- data/registry/icons/lucide/receipt.svg +17 -0
- data/registry/icons/lucide/scan-barcode.svg +21 -0
- data/registry/icons/lucide/sun-moon.svg +19 -0
- data/registry/icons/lucide/truck.svg +19 -0
- data/registry/icons/lucide/user-plus.svg +18 -0
- data/registry/icons/lucide/volume-2.svg +17 -0
- data/registry/icons/lucide/volume-x.svg +17 -0
- data/registry/icons/lucide/zoom-in.svg +18 -0
- data/registry/icons/lucide/zoom-out.svg +17 -0
- data/registry/icons/phosphor/barcode.svg +2 -0
- data/registry/icons/phosphor/circle-half.svg +2 -0
- data/registry/icons/phosphor/download-simple.svg +2 -0
- data/registry/icons/phosphor/file-plus.svg +2 -0
- data/registry/icons/phosphor/file.svg +2 -0
- data/registry/icons/phosphor/folder.svg +2 -0
- data/registry/icons/phosphor/keyboard.svg +2 -0
- data/registry/icons/phosphor/magnifying-glass-minus.svg +2 -0
- data/registry/icons/phosphor/magnifying-glass-plus.svg +2 -0
- data/registry/icons/phosphor/minus.svg +2 -0
- data/registry/icons/phosphor/package.svg +2 -0
- data/registry/icons/phosphor/pause.svg +2 -0
- data/registry/icons/phosphor/percent.svg +2 -0
- data/registry/icons/phosphor/printer.svg +2 -0
- data/registry/icons/phosphor/receipt.svg +2 -0
- data/registry/icons/phosphor/speaker-high.svg +2 -0
- data/registry/icons/phosphor/speaker-x.svg +2 -0
- data/registry/icons/phosphor/truck.svg +2 -0
- data/registry/icons/phosphor/user-plus.svg +2 -0
- data/registry/icons/tabler/barcode.svg +23 -0
- data/registry/icons/tabler/download.svg +18 -0
- data/registry/icons/tabler/file-plus.svg +19 -0
- data/registry/icons/tabler/file.svg +17 -0
- data/registry/icons/tabler/folder.svg +16 -0
- data/registry/icons/tabler/keyboard.svg +23 -0
- data/registry/icons/tabler/minus.svg +16 -0
- data/registry/icons/tabler/package.svg +20 -0
- data/registry/icons/tabler/percentage.svg +18 -0
- data/registry/icons/tabler/player-pause.svg +17 -0
- data/registry/icons/tabler/printer.svg +18 -0
- data/registry/icons/tabler/receipt.svg +16 -0
- data/registry/icons/tabler/sun-moon.svg +21 -0
- data/registry/icons/tabler/truck.svg +18 -0
- data/registry/icons/tabler/user-plus.svg +19 -0
- data/registry/icons/tabler/volume-3.svg +17 -0
- data/registry/icons/tabler/volume.svg +18 -0
- data/registry/icons/tabler/zoom-in.svg +19 -0
- data/registry/icons/tabler/zoom-out.svg +18 -0
- data/registry/icons.yml +19 -0
- data/registry/test/components/previews/ui/chart_preview/cash_flow.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/donut.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/margin.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/pie.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/sales.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/stock.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/takings.html.erb +8 -0
- data/registry/test/components/previews/ui/chart_preview.rb +46 -0
- data/registry/test/components/previews/ui/command_preview/_picked.html.erb +14 -0
- data/registry/test/components/previews/ui/command_preview/dialog.html.erb +24 -0
- data/registry/test/components/previews/ui/command_preview/inline.html.erb +16 -0
- data/registry/test/components/previews/ui/command_preview/playground.html.erb +15 -0
- data/registry/test/components/previews/ui/command_preview/server_search.html.erb +24 -0
- data/registry/test/components/previews/ui/command_preview/shortcuts.html.erb +12 -0
- data/registry/test/components/previews/ui/command_preview/till.html.erb +17 -0
- data/registry/test/components/previews/ui/command_preview.rb +25 -0
- data/registry/test/components/previews/ui/date_picker_preview/custom_presets.html.erb +6 -0
- data/registry/test/components/previews/ui/date_picker_preview/in_form.html.erb +11 -0
- data/registry/test/components/previews/ui/date_picker_preview/range.html.erb +5 -0
- data/registry/test/components/previews/ui/date_picker_preview/states.html.erb +4 -3
- data/registry/test/components/previews/ui/date_picker_preview.rb +26 -6
- data/registry/test/components/previews/ui/file_field_preview/multiple_files.html.erb +1 -1
- data/registry/test/components/previews/ui/file_field_preview/product_photos.html.erb +12 -0
- data/registry/test/components/previews/ui/file_field_preview/single_image.html.erb +4 -0
- data/registry/test/components/previews/ui/file_field_preview.rb +32 -5
- data/registry/test/components/previews/ui/gallery_preview/hover_zoom.html.erb +13 -0
- data/registry/test/components/previews/ui/gallery_preview/landscape.html.erb +5 -0
- data/registry/test/components/previews/ui/gallery_preview/product_page.html.erb +13 -0
- data/registry/test/components/previews/ui/gallery_preview/single.html.erb +3 -0
- data/registry/test/components/previews/ui/gallery_preview.rb +45 -0
- data/registry/test/components/previews/ui/kbd_preview/bound.html.erb +20 -0
- data/registry/test/components/previews/ui/kbd_preview/keys.html.erb +13 -0
- data/registry/test/components/previews/ui/kbd_preview/menu.html.erb +13 -0
- data/registry/test/components/previews/ui/kbd_preview/search_field.html.erb +8 -0
- data/registry/test/components/previews/ui/kbd_preview/shortcuts_list.html.erb +17 -0
- data/registry/test/components/previews/ui/kbd_preview/till.html.erb +23 -0
- data/registry/test/components/previews/ui/kbd_preview/tooltip_and_buttons.html.erb +14 -0
- data/registry/test/components/previews/ui/kbd_preview.rb +32 -0
- data/registry/test/components/previews/ui/money_input_preview/cash_tendered.html.erb +24 -0
- data/registry/test/components/previews/ui/money_input_preview/currencies.html.erb +7 -0
- data/registry/test/components/previews/ui/money_input_preview/invoice.html.erb +24 -0
- data/registry/test/components/previews/ui/money_input_preview/sizes_and_states.html.erb +9 -0
- data/registry/test/components/previews/ui/money_input_preview.rb +34 -0
- data/registry/test/components/previews/ui/number_input_preview/cart.html.erb +11 -0
- data/registry/test/components/previews/ui/number_input_preview/decimals.html.erb +4 -0
- data/registry/test/components/previews/ui/number_input_preview/sizes.html.erb +5 -0
- data/registry/test/components/previews/ui/number_input_preview/states.html.erb +7 -0
- data/registry/test/components/previews/ui/number_input_preview/stock_adjustment.html.erb +3 -0
- data/registry/test/components/previews/ui/number_input_preview.rb +36 -0
- data/registry/test/components/previews/ui/progress_preview/file_upload.html.erb +36 -0
- data/registry/test/components/previews/ui/progress_preview/free_shipping.html.erb +4 -0
- data/registry/test/components/previews/ui/progress_preview/indeterminate.html.erb +4 -0
- data/registry/test/components/previews/ui/progress_preview/sizes_and_tones.html.erb +8 -0
- data/registry/test/components/previews/ui/progress_preview/steps.html.erb +9 -0
- data/registry/test/components/previews/ui/progress_preview/storage.html.erb +8 -0
- data/registry/test/components/previews/ui/progress_preview/storage_by_category.html.erb +7 -0
- data/registry/test/components/previews/ui/progress_preview/tasks_by_status.html.erb +14 -0
- data/registry/test/components/previews/ui/progress_preview/traffic_by_source.html.erb +15 -0
- data/registry/test/components/previews/ui/progress_preview.rb +46 -0
- data/registry/test/components/previews/ui/scan_input_preview/_simulate.html.erb +20 -0
- data/registry/test/components/previews/ui/scan_input_preview/library_checkout.html.erb +30 -0
- data/registry/test/components/previews/ui/scan_input_preview/playground.html.erb +13 -0
- data/registry/test/components/previews/ui/scan_input_preview/stock_count.html.erb +24 -0
- data/registry/test/components/previews/ui/scan_input_preview/ticket_check_in.html.erb +34 -0
- data/registry/test/components/previews/ui/scan_input_preview/till.html.erb +9 -0
- data/registry/test/components/previews/ui/scan_input_preview.rb +33 -0
- data/registry/test/components/previews/ui/select_preview/server_search.html.erb +22 -0
- data/registry/test/components/previews/ui/select_preview.rb +5 -0
- data/registry/test/components/previews/ui/slider_preview/named_steps.html.erb +7 -0
- data/registry/test/components/previews/ui/slider_preview/opening_hours.html.erb +5 -0
- data/registry/test/components/previews/ui/slider_preview/price_range.html.erb +6 -0
- data/registry/test/components/previews/ui/slider_preview/sizes_and_states.html.erb +9 -0
- data/registry/test/components/previews/ui/slider_preview/text_size.html.erb +16 -0
- data/registry/test/components/previews/ui/slider_preview/tip.html.erb +22 -0
- data/registry/test/components/previews/ui/slider_preview/volume.html.erb +5 -0
- data/registry/test/components/previews/ui/slider_preview.rb +45 -0
- data/registry/test/components/previews/ui/timeline_preview/activity_log.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/colored.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/colored_by_meaning.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/failed_delivery.html.erb +6 -0
- data/registry/test/components/previews/ui/timeline_preview/order_status.html.erb +9 -0
- data/registry/test/components/previews/ui/timeline_preview/real_dates.html.erb +5 -0
- data/registry/test/components/previews/ui/timeline_preview/stock_history.html.erb +6 -0
- data/registry/test/components/previews/ui/timeline_preview.rb +40 -0
- data/registry/test/components/ui/chart_test.rb +187 -0
- data/registry/test/components/ui/command/group_test.rb +19 -0
- data/registry/test/components/ui/command/item_test.rb +47 -0
- data/registry/test/components/ui/command_test.rb +110 -0
- data/registry/test/components/ui/date_picker_test.rb +129 -111
- data/registry/test/components/ui/file_field_test.rb +105 -9
- data/registry/test/components/ui/gallery_test.rb +192 -0
- data/registry/test/components/ui/kbd_test.rb +150 -0
- data/registry/test/components/ui/money_input_test.rb +149 -0
- data/registry/test/components/ui/number_input_test.rb +155 -0
- data/registry/test/components/ui/progress_test.rb +188 -0
- data/registry/test/components/ui/scan_input_test.rb +110 -0
- data/registry/test/components/ui/select_test.rb +62 -0
- data/registry/test/components/ui/slider_test.rb +190 -0
- data/registry/test/components/ui/timeline_test.rb +175 -0
- metadata +188 -2
- data/registry/app/javascript/cally.ts +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fbe4ce28e9bb9313488c3564f6b7fd9d3ac256be4239a51ce4c7fc9b5281d7f0
|
|
4
|
+
data.tar.gz: 88f169fe4f0888b41bb0f3c946f1481255b65ec4dd0f12ea7da7824818d8edfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c03d6d45997176736fe174e23d30b3196694cde7113721a24f5ad604013aae3b54d9a5d541ab678b0c037c087dbdd32e486975ede353624263222a034a31a7bf
|
|
7
|
+
data.tar.gz: 9f25335d481267dc430c903f5b8ae0d95e4b6cb2101d7358d297c1798f9d68a973ba7208cf63bb09594a2c9e9c4091541a26277cc048427381f557c5bafd641b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,114 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1 — 2026-11-09
|
|
4
|
+
|
|
5
|
+
New components:
|
|
6
|
+
|
|
7
|
+
- `Slider`: a handle to drag for a value, or two for a range such as a price
|
|
8
|
+
band, with value text, labelled marks and form binding. The knob follows
|
|
9
|
+
the pointer freely and the value keeps to the step.
|
|
10
|
+
- `MoneyInput`: an amount of money, grouped as it's typed (1,23,456.78 for
|
|
11
|
+
rupees, 123,456.78 otherwise) with its currency sign, decimals filled in
|
|
12
|
+
when the field is left, and the plain number (123456.78) posted in a
|
|
13
|
+
hidden field. The sign, separators and decimals follow the app's locale.
|
|
14
|
+
↑ and ↓ step by one unit, or `step:`, and Shift by ten.
|
|
15
|
+
- `ScanInput`: a field for barcode and QR scanners. Enter (or Tab) submits
|
|
16
|
+
the form with the code and empties the field, codes scanned while one is
|
|
17
|
+
still being sent wait their turn, and it keeps focus when focus falls to
|
|
18
|
+
the page. A `scan` event lets the page handle codes itself; `capture:`,
|
|
19
|
+
`keyboard: false` and `suffix: :tab` suit scan-only pages and handhelds.
|
|
20
|
+
|
|
21
|
+
## 0.4.0 — 2026-11-08
|
|
22
|
+
|
|
23
|
+
New components:
|
|
24
|
+
|
|
25
|
+
- `Timeline`: dated entries down the page (order status, stock history, an
|
|
26
|
+
activity log), drawn as circles, dots or circles in a colour each.
|
|
27
|
+
- `NumberInput`: a number field with - and + buttons that keep counting while
|
|
28
|
+
held; `change` fires once on release, so a cart row submits once.
|
|
29
|
+
- `Gallery`: product photos with thumbnails and swiping, opening over the
|
|
30
|
+
page to zoom and pan, or `zoom: :hover` for a lens and a magnified pane.
|
|
31
|
+
- `Chart`: line, bar, stacked bar, pie and donut charts on Chart.js, with a
|
|
32
|
+
legend, tooltips, keyboard reading, a table of the numbers, and animation.
|
|
33
|
+
The docs site has a Charts section with a page for each.
|
|
34
|
+
- `Progress`: a bar for an upload, an import or storage used, with a value or
|
|
35
|
+
sliding while there's none yet, in tones, and split into coloured segments
|
|
36
|
+
with a legend. Setting its value attribute from JavaScript moves it live.
|
|
37
|
+
- `Kbd`: a key or shortcut, shown as each reader's computer labels it (⌘ on a
|
|
38
|
+
Mac, Ctrl on Windows, Super on Linux), with `bind:` to press a button or
|
|
39
|
+
focus a field when the shortcut is pressed.
|
|
40
|
+
- `Command`: a search box over pages, actions and records, inline or opened
|
|
41
|
+
with ⌘K, ranking by best match, with groups, shortcuts, and server search
|
|
42
|
+
with `url:`.
|
|
43
|
+
|
|
44
|
+
Changes:
|
|
45
|
+
|
|
46
|
+
- `Select` searches the server as you type with `url:` (JSON back), with a
|
|
47
|
+
spinner when it's slow, results remembered for a minute, and choices kept
|
|
48
|
+
when later searches no longer list them.
|
|
49
|
+
- `DatePicker` moves from Cally to Vanilla Calendar Pro and takes
|
|
50
|
+
`range: true` for From and To, with presets such as Last 7 days, two months
|
|
51
|
+
side by side, and a hover preview. Typed dates take digits only, the
|
|
52
|
+
separators go in as you type, and the calendar opens on click or focus.
|
|
53
|
+
- `FileField` shows a tile for each chosen file, checks `accept:` and
|
|
54
|
+
`max_size:`, and with `direct_upload: true` sends each file to storage
|
|
55
|
+
through Active Storage as it's chosen, with a progress bar. Bound to a
|
|
56
|
+
form, it shows the record's attachments.
|
|
57
|
+
- The chart colours, `--chart-1` to `--chart-5`, are now velvet, orange,
|
|
58
|
+
aqua, blue and magenta, checked for colour-blind readers in both themes.
|
|
59
|
+
- `velvetkit:add` puts the bundles Chart, Date Picker and Data Grid load on
|
|
60
|
+
demand (`chart_js.ts`, `vanilla_calendar.ts`, `ag_grid.ts`) into the app's
|
|
61
|
+
JavaScript build: `bun.config.js`, `webpack.config.js`, or a build script
|
|
62
|
+
that lists `application.js`. Before, they were copied but never built, so
|
|
63
|
+
those components failed to load their library.
|
|
64
|
+
- The docs site's search is the kit's own `Command`.
|
|
65
|
+
|
|
66
|
+
Upgrading an app: re-run `velvetkit:add` for `date_picker`, `select` and
|
|
67
|
+
`file_field`, and copy the new `--chart-*` values into your `velvetkit.css`.
|
|
68
|
+
`date_picker` now needs `vanilla-calendar-pro` instead of `cally`, and loads
|
|
69
|
+
`app/javascript/vanilla_calendar.ts` as its own entry point; `file_field`
|
|
70
|
+
needs `@rails/activestorage`. If you added `chart_js.ts`,
|
|
71
|
+
`vanilla_calendar.ts` or `ag_grid.ts` to your build by hand, `add` leaves
|
|
72
|
+
it as it is. `progress` needs the `velvetkit-progress` keyframes from the new
|
|
73
|
+
`velvetkit.css`; without them a bar with no value doesn't move.
|
|
74
|
+
|
|
75
|
+
- Fix: Rails 8.1.4.1, for security advisories in Active Storage and Action Pack.
|
|
76
|
+
- Fix: the docs site shows a component added to the catalog without a server
|
|
77
|
+
restart.
|
|
78
|
+
|
|
79
|
+
## 0.3.0 — 2026-11-03
|
|
80
|
+
|
|
81
|
+
- `Stepper`: the steps of a multi-step form, done, current or to come, with
|
|
82
|
+
dots, centred labels, panels moved between in the browser, and links back
|
|
83
|
+
to done steps.
|
|
84
|
+
- `ConfirmDialog`: a styled dialog that answers `data-turbo-confirm`, so every
|
|
85
|
+
existing confirm uses it.
|
|
86
|
+
- `ToggleGroup`: a row of buttons choosing one or several, posting like
|
|
87
|
+
radios or checkboxes.
|
|
88
|
+
- `EmptyState`: an icon, title, text and actions for a page with nothing to
|
|
89
|
+
list.
|
|
90
|
+
- Icons come from Lucide, Tabler or Phosphor, chosen with
|
|
91
|
+
`velvetkit:install --icons=`, and are drawn as inline SVG.
|
|
92
|
+
|
|
93
|
+
## 0.2.2 — 2026-11-02
|
|
94
|
+
|
|
95
|
+
- Fix: the `plus`, `search`, `ellipsis-vertical` and `grip-vertical` icons were
|
|
96
|
+
missing from installs.
|
|
97
|
+
|
|
98
|
+
## 0.2.1 — 2026-11-01
|
|
99
|
+
|
|
100
|
+
- `NavigationMenu`: site navigation with links and panels of rich links that
|
|
101
|
+
open on hover or click.
|
|
102
|
+
|
|
103
|
+
## 0.2.0 — 2026-11-01
|
|
104
|
+
|
|
105
|
+
- `Toast`: stacked messages that dismiss themselves.
|
|
106
|
+
- `SessionTabs`: tabs for open sessions, with a button to add one.
|
|
107
|
+
- `Skeleton` and `FileField`.
|
|
108
|
+
- Fix: `Menu` content positions itself with the fixed strategy, so it isn't
|
|
109
|
+
clipped by a scrolling container.
|
|
110
|
+
- Fix: dependencies updated for security advisories in `addressable` and `rack`.
|
|
111
|
+
|
|
3
112
|
## 0.1.0.beta — 2026-10-26
|
|
4
113
|
|
|
5
114
|
- First release of the component library.
|
data/README.md
CHANGED
|
@@ -160,7 +160,11 @@ bin/rails generate velvetkit:add --all # everything
|
|
|
160
160
|
|
|
161
161
|
- copies the component, its templates and sub-components
|
|
162
162
|
- copies its Stimulus controllers and any lazily-loaded entry points (AG Grid
|
|
163
|
-
for `data_grid`,
|
|
163
|
+
for `data_grid`, Chart.js for `chart`, Vanilla Calendar Pro for `date_picker`),
|
|
164
|
+
and adds those to your JavaScript build: to `bun.config.js`'s `entrypoints`,
|
|
165
|
+
`webpack.config.js`'s `entry`, or a build script that lists `application.js`.
|
|
166
|
+
esbuild's default `app/javascript/*.*` already takes them; for any other setup
|
|
167
|
+
`add` says what to add
|
|
164
168
|
- copies the SVG of every icon it draws into `app/assets/icons`, named for
|
|
165
169
|
your icon library
|
|
166
170
|
- copies its Minitest tests and Lookbook previews. A preview that shows
|
|
@@ -90,6 +90,27 @@ module Velvetkit
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
# Bundles a component loads only when it's on the page (Chart.js,
|
|
94
|
+
# Vanilla Calendar Pro, AG Grid) are entry points of their own, so the
|
|
95
|
+
# app's JavaScript build has to know about them. Added where the build
|
|
96
|
+
# lists its entry points; an esbuild glob already takes them; anything
|
|
97
|
+
# else is told what to add.
|
|
98
|
+
def wire_entry_points
|
|
99
|
+
entry_points.each do |entry|
|
|
100
|
+
if exists?("bun.config.js") && read("bun.config.js").match?(/entrypoints:\s*\[/)
|
|
101
|
+
add_to_bun_config(entry)
|
|
102
|
+
elsif exists?("webpack.config.js") && read("webpack.config.js").match?(/entry:\s*\{/)
|
|
103
|
+
add_to_webpack_config(entry)
|
|
104
|
+
elsif build_script&.match?(%r{app/javascript/\*})
|
|
105
|
+
say_status :build, "#{entry} is built by the build script's app/javascript/* already", :blue
|
|
106
|
+
elsif build_script&.match?(%r{app/javascript/application\.[jt]s})
|
|
107
|
+
add_to_build_script(entry)
|
|
108
|
+
else
|
|
109
|
+
say_status :build, "add #{entry} to your JavaScript build as an entry point of its own, like application.js", :yellow
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
93
114
|
def add_gems
|
|
94
115
|
gemfile = File.read(File.join(destination_root, "Gemfile"))
|
|
95
116
|
resolved.flat_map { |name| registry.gems(name).to_a }.uniq.each do |name, version|
|
|
@@ -125,6 +146,43 @@ module Velvetkit
|
|
|
125
146
|
def controllers
|
|
126
147
|
resolved.flat_map { |name| registry.stimulus_controllers(name) }.uniq
|
|
127
148
|
end
|
|
149
|
+
|
|
150
|
+
# app/javascript/chart_js.ts and the like: JavaScript that isn't a
|
|
151
|
+
# Stimulus controller or one of their shared helpers.
|
|
152
|
+
def entry_points
|
|
153
|
+
resolved.flat_map { |name| registry.javascript_files(name) }.uniq
|
|
154
|
+
.select { |file| file.start_with?("app/javascript/") && !file.start_with?("app/javascript/controllers/") }
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def build_script
|
|
158
|
+
return nil unless exists?("package.json")
|
|
159
|
+
|
|
160
|
+
JSON.parse(read("package.json")).dig("scripts", "build")
|
|
161
|
+
rescue JSON::ParserError
|
|
162
|
+
nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def add_to_bun_config(entry)
|
|
166
|
+
return if read("bun.config.js").include?(entry)
|
|
167
|
+
|
|
168
|
+
gsub_file "bun.config.js", /(entrypoints:\s*\[)/, %(\\1"#{entry}", )
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def add_to_webpack_config(entry)
|
|
172
|
+
return if read("webpack.config.js").include?(entry)
|
|
173
|
+
|
|
174
|
+
gsub_file "webpack.config.js", /(entry:\s*\{\s*\n)/, %(\\1 #{File.basename(entry, ".*")}: "./#{entry}",\n)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# After application.js in the build script, written the same way ("./" or not).
|
|
178
|
+
def add_to_build_script(entry)
|
|
179
|
+
return if build_script.include?(entry)
|
|
180
|
+
|
|
181
|
+
gsub_file "package.json", %r{((?:\./)?)app/javascript/application\.[jt]s}, "\\0 \\1#{entry}"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def exists?(file) = File.exist?(File.join(destination_root, file))
|
|
185
|
+
def read(file) = File.read(File.join(destination_root, file))
|
|
128
186
|
end
|
|
129
187
|
end
|
|
130
188
|
end
|
data/lib/velvetkit/version.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Velvetkit
|
|
4
|
-
|
|
4
|
+
# Not the released version: the release workflow takes that from the tag
|
|
5
|
+
# (v0.3.0 publishes 0.3.0) and writes it here on the runner only, so this
|
|
6
|
+
# file can stay behind. See .github/workflows/release.yml.
|
|
7
|
+
VERSION = "0.4.1"
|
|
5
8
|
end
|
data/lib/velvetkit.rb
CHANGED
|
@@ -18,6 +18,13 @@ module Velvetkit
|
|
|
18
18
|
@registry ||= Registry.new(File.expand_path("../registry", __dir__))
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
# Forgets the catalog, so the next call reads components.yml again. The docs
|
|
22
|
+
# site calls it on each code reload in development, so a component added to
|
|
23
|
+
# the catalog shows up without restarting the server.
|
|
24
|
+
def self.reload_registry!
|
|
25
|
+
@registry = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
# Everything an AI agent needs to build UI in an app: the rules, then a
|
|
22
29
|
# reference for each component, all in the app's namespace.
|
|
23
30
|
def self.agent_guide(components, namespace: Namespace.new(Namespace::CANONICAL))
|
|
@@ -49,11 +49,14 @@
|
|
|
49
49
|
--ring: var(--primary);
|
|
50
50
|
--chart-pie-active: oklch(0.9137 0.1511 150.96);
|
|
51
51
|
--chart-pie-inactive: oklch(0.3533 0.0096 164.42);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
--chart-
|
|
56
|
-
--chart-
|
|
52
|
+
/* Chart series, in this order: velvet, orange, aqua, blue, magenta. Checked
|
|
53
|
+
with a colour-vision validator so neighbours stay apart for colour-blind
|
|
54
|
+
readers; dark mode keeps the same hues, stepped for the dark surface. */
|
|
55
|
+
--chart-1: #793cbb;
|
|
56
|
+
--chart-2: #eb6834;
|
|
57
|
+
--chart-3: #1baf7a;
|
|
58
|
+
--chart-4: #2a78d6;
|
|
59
|
+
--chart-5: #e87ba4;
|
|
57
60
|
--sidebar: oklch(0.985 0.001 286.32);
|
|
58
61
|
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
59
62
|
/* Accent for the active nav item; lighter in dark so it clears AA against
|
|
@@ -93,11 +96,11 @@
|
|
|
93
96
|
--ring: var(--primary);
|
|
94
97
|
--chart-pie-active: oklch(0.696 0.17 162.48);
|
|
95
98
|
--chart-pie-inactive: oklch(0.556 0 0);
|
|
96
|
-
--chart-1:
|
|
97
|
-
--chart-2:
|
|
98
|
-
--chart-3:
|
|
99
|
-
--chart-4:
|
|
100
|
-
--chart-5:
|
|
99
|
+
--chart-1: #9362d3;
|
|
100
|
+
--chart-2: #d95926;
|
|
101
|
+
--chart-3: #199e70;
|
|
102
|
+
--chart-4: #3987e5;
|
|
103
|
+
--chart-5: #d55181;
|
|
101
104
|
--sidebar: oklch(0.21 0.006 285.885);
|
|
102
105
|
--sidebar-foreground: oklch(0.985 0 0);
|
|
103
106
|
--sidebar-primary: oklch(0.7 0.15 301.6);
|
|
@@ -184,159 +187,91 @@ select:-webkit-autofill {
|
|
|
184
187
|
transition: background-color 100000s ease-in-out 0s;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
/* The date picker calendar
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* JavaScript.
|
|
193
|
-
*
|
|
194
|
-
* Layout: ‹ [May ▾] [2012 ▾] › in one header row. The selects sit in Cally's
|
|
195
|
-
* heading slot (see date_picker.html.erb), so its own heading and the month's
|
|
196
|
-
* heading would only repeat them.
|
|
190
|
+
/* The date picker's calendar: Vanilla Calendar Pro, with its light theme's
|
|
191
|
+
* colours pointed at the kit's tokens. The theme reads every colour from a
|
|
192
|
+
* --vc-* variable, so these follow dark mode and any retheme with no
|
|
193
|
+
* JavaScript. The library's own stylesheet loads with it (vanilla_calendar.ts),
|
|
194
|
+
* so a page without a date picker pays nothing for these.
|
|
197
195
|
*/
|
|
198
|
-
calendar
|
|
199
|
-
|
|
200
|
-
--color
|
|
201
|
-
--
|
|
196
|
+
.velvetkit-calendar {
|
|
197
|
+
--vc-bg: var(--popover);
|
|
198
|
+
--vc-color: var(--popover-foreground);
|
|
199
|
+
--vc-header-color: var(--popover-foreground);
|
|
200
|
+
--vc-title-color: var(--popover-foreground);
|
|
201
|
+
--vc-title-color-hover: var(--muted-foreground);
|
|
202
|
+
--vc-title-color-disabled: var(--muted-foreground);
|
|
203
|
+
--vc-focus-outline-color: var(--ring);
|
|
204
|
+
--vc-week-day-color: var(--muted-foreground);
|
|
205
|
+
--vc-week-day-color-hover: var(--foreground);
|
|
206
|
+
--vc-week-day-off-color: var(--muted-foreground);
|
|
207
|
+
--vc-week-day-off-color-hover: var(--foreground);
|
|
208
|
+
--vc-date-bg: transparent;
|
|
209
|
+
--vc-date-color: var(--popover-foreground);
|
|
210
|
+
--vc-date-bg-hover: var(--accent);
|
|
211
|
+
--vc-date-hover-bg: var(--accent);
|
|
212
|
+
--vc-date-hover-edge-bg: color-mix(in oklab, var(--primary) 20%, transparent);
|
|
213
|
+
--vc-date-outside-color: var(--muted-foreground);
|
|
214
|
+
--vc-date-disabled-color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
|
|
215
|
+
--vc-date-today-bg: var(--accent);
|
|
216
|
+
--vc-date-today-color: var(--primary);
|
|
217
|
+
--vc-date-today-outside-color: var(--muted-foreground);
|
|
218
|
+
--vc-date-selected-bg: var(--primary);
|
|
219
|
+
--vc-date-selected-color: var(--primary-foreground);
|
|
220
|
+
--vc-date-selected-outside-bg: color-mix(in oklab, var(--primary) 20%, transparent);
|
|
221
|
+
--vc-date-selected-outside-color: var(--muted-foreground);
|
|
222
|
+
/* The days inside a range: a tint, so the two ends stand out. */
|
|
223
|
+
--vc-date-range-middle-bg: color-mix(in oklab, var(--primary) 12%, transparent);
|
|
224
|
+
--vc-date-range-middle-color: var(--popover-foreground);
|
|
225
|
+
--vc-date-range-middle-outside-bg: color-mix(in oklab, var(--primary) 6%, transparent);
|
|
226
|
+
--vc-date-range-middle-outside-color: var(--muted-foreground);
|
|
227
|
+
--vc-date-range-middle-weekend-bg: var(--vc-date-range-middle-bg);
|
|
228
|
+
--vc-date-range-middle-weekend-color: var(--vc-date-range-middle-color);
|
|
229
|
+
--vc-date-range-tooltip-bg: var(--popover);
|
|
230
|
+
--vc-date-range-tooltip-color: var(--muted-foreground);
|
|
231
|
+
--vc-date-popup-bg: var(--popover);
|
|
232
|
+
--vc-date-popup-color: var(--popover-foreground);
|
|
233
|
+
/* Weekends look like any other day: in a shop, Saturday is a working day. */
|
|
234
|
+
--vc-date-weekend-color: var(--vc-date-color);
|
|
235
|
+
--vc-date-weekend-bg-hover: var(--accent);
|
|
236
|
+
--vc-date-weekend-hover-bg: var(--accent);
|
|
237
|
+
--vc-date-weekend-hover-edge-bg: var(--vc-date-hover-edge-bg);
|
|
238
|
+
--vc-date-weekend-selected-bg: var(--primary);
|
|
239
|
+
--vc-date-weekend-selected-color: var(--primary-foreground);
|
|
240
|
+
--vc-date-weekend-today-color: var(--primary);
|
|
241
|
+
--vc-date-weekend-outside-color: var(--muted-foreground);
|
|
242
|
+
--vc-date-weekend-outside-bg: transparent;
|
|
243
|
+
--vc-date-weekend-outside-bg-hover: var(--accent);
|
|
244
|
+
--vc-date-weekend-outside-hover-bg: var(--accent);
|
|
245
|
+
--vc-date-weekend-disabled-color: var(--vc-date-disabled-color);
|
|
246
|
+
--vc-date-weekend-disabled-outside-color: var(--vc-date-disabled-color);
|
|
247
|
+
--vc-date-weekend-today-disabled-color: var(--vc-date-disabled-color);
|
|
248
|
+
--vc-date-weekend-today-outside-color: var(--muted-foreground);
|
|
249
|
+
--vc-months-years-bg: transparent;
|
|
250
|
+
--vc-months-years-bg-hover: var(--accent);
|
|
251
|
+
--vc-months-years-bg-selected: var(--primary);
|
|
252
|
+
--vc-months-years-color: var(--popover-foreground);
|
|
253
|
+
--vc-months-years-color-selected: var(--primary-foreground);
|
|
254
|
+
--vc-months-years-color-disabled: var(--vc-date-disabled-color);
|
|
255
|
+
--vc-collapse-color: var(--border);
|
|
202
256
|
font-family: inherit;
|
|
203
|
-
font-size: 0.875rem;
|
|
204
|
-
color: var(--popover-foreground);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
calendar-date::part(header),
|
|
208
|
-
calendar-range::part(header) {
|
|
209
|
-
display: flex;
|
|
210
|
-
align-items: center;
|
|
211
|
-
justify-content: space-between;
|
|
212
|
-
gap: 0.25rem;
|
|
213
|
-
margin-bottom: 0.5rem;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/* The arrows: ghost icon buttons. */
|
|
217
|
-
calendar-date::part(button),
|
|
218
|
-
calendar-range::part(button) {
|
|
219
|
-
display: inline-grid;
|
|
220
|
-
place-items: center;
|
|
221
|
-
width: 2rem;
|
|
222
|
-
height: 2rem;
|
|
223
|
-
padding: 0;
|
|
224
|
-
border: 0;
|
|
225
|
-
border-radius: var(--radius-md);
|
|
226
|
-
background: transparent;
|
|
227
|
-
color: var(--muted-foreground);
|
|
228
|
-
cursor: pointer;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
calendar-date::part(button):hover,
|
|
232
|
-
calendar-range::part(button):hover {
|
|
233
|
-
background: var(--accent);
|
|
234
|
-
color: var(--accent-foreground);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
calendar-date::part(button):focus-visible,
|
|
238
|
-
calendar-range::part(button):focus-visible {
|
|
239
|
-
outline: 2px solid var(--ring);
|
|
240
|
-
outline-offset: 1px;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
calendar-date::part(disabled),
|
|
244
|
-
calendar-range::part(disabled) {
|
|
245
|
-
opacity: 0.35;
|
|
246
|
-
cursor: default;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
calendar-month::part(heading) {
|
|
250
|
-
display: none;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
calendar-month::part(th) {
|
|
254
|
-
padding-bottom: 0.25rem;
|
|
255
|
-
font-size: 0.75rem;
|
|
256
|
-
font-weight: 500;
|
|
257
|
-
color: var(--muted-foreground);
|
|
258
257
|
}
|
|
259
258
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
width: 2.25rem;
|
|
263
|
-
height: 2.25rem;
|
|
264
|
-
border: 0;
|
|
265
|
-
border-radius: var(--radius-md);
|
|
266
|
-
background: transparent;
|
|
267
|
-
color: var(--popover-foreground);
|
|
268
|
-
font-size: 0.875rem;
|
|
269
|
-
cursor: pointer;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
calendar-month::part(button):hover {
|
|
273
|
-
background: var(--accent);
|
|
274
|
-
color: var(--accent-foreground);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
calendar-month::part(button):focus-visible {
|
|
278
|
-
outline: 2px solid var(--ring);
|
|
279
|
-
outline-offset: 1px;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
calendar-month::part(outside) {
|
|
283
|
-
color: var(--muted-foreground);
|
|
284
|
-
opacity: 0.6;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/* Today: a quiet tint rather than a hard box. */
|
|
288
|
-
calendar-month::part(today) {
|
|
289
|
-
outline: none;
|
|
290
|
-
background: var(--accent);
|
|
291
|
-
color: var(--primary);
|
|
292
|
-
font-weight: 600;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/* The chosen day, after today so it wins when they're the same. */
|
|
296
|
-
calendar-month::part(selected) {
|
|
297
|
-
background: var(--primary);
|
|
298
|
-
color: var(--primary-foreground);
|
|
299
|
-
font-weight: 600;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/* Month and year: the reason this library was chosen, since reaching a birth
|
|
303
|
-
year is one click rather than a hundred and seventy. Styled like the kit's
|
|
304
|
-
fields; the open list is the platform's own. */
|
|
305
|
-
calendar-select-month::part(select),
|
|
306
|
-
calendar-select-year::part(select) {
|
|
307
|
-
appearance: none;
|
|
308
|
-
height: 2rem;
|
|
309
|
-
padding: 0 1.75rem 0 0.625rem;
|
|
310
|
-
border: 1px solid var(--input);
|
|
311
|
-
border-radius: var(--radius-md);
|
|
312
|
-
background: var(--background)
|
|
313
|
-
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
|
|
314
|
-
no-repeat right 0.5rem center / 0.875rem;
|
|
315
|
-
color: var(--foreground);
|
|
316
|
-
font: inherit;
|
|
317
|
-
font-size: 0.875rem;
|
|
318
|
-
font-weight: 500;
|
|
319
|
-
cursor: pointer;
|
|
259
|
+
.velvetkit-calendar .vc {
|
|
260
|
+
font-family: inherit;
|
|
320
261
|
}
|
|
321
262
|
|
|
322
|
-
|
|
323
|
-
calendar-
|
|
324
|
-
|
|
263
|
+
/* Only the two ends of a range are bold. */
|
|
264
|
+
.velvetkit-calendar [data-vc-date-selected="middle"] .vc-date__btn {
|
|
265
|
+
font-weight: 400;
|
|
325
266
|
}
|
|
326
267
|
|
|
327
|
-
|
|
328
|
-
calendar-
|
|
329
|
-
|
|
330
|
-
outline-offset: 1px;
|
|
268
|
+
/* The arrows are drawn dark by the theme; lighten them on a dark page. */
|
|
269
|
+
.dark .velvetkit-calendar .vc-arrow::before {
|
|
270
|
+
filter: invert(1);
|
|
331
271
|
}
|
|
332
272
|
|
|
333
|
-
/*
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
width: 1px;
|
|
338
|
-
height: 1px;
|
|
339
|
-
overflow: hidden;
|
|
340
|
-
clip-path: inset(50%);
|
|
341
|
-
white-space: nowrap;
|
|
273
|
+
/* UI::Progress with no value: a short bar sliding across the track. */
|
|
274
|
+
@keyframes velvetkit-progress {
|
|
275
|
+
from { transform: translateX(-100%); }
|
|
276
|
+
to { transform: translateX(250%); }
|
|
342
277
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<%= tag.div(**root_attrs) do %>
|
|
2
|
+
<%= tag.div class: body_classes do %>
|
|
3
|
+
<% if legend? %>
|
|
4
|
+
<%= tag.ul class: legend_classes, aria: { hidden: true } do %>
|
|
5
|
+
<% if circular? %>
|
|
6
|
+
<% slices.each do |slice| %>
|
|
7
|
+
<li class="flex items-center gap-2"><%= tag.span class: slice_swatch(slice) %><span class="min-w-0 flex-1 break-words text-muted-foreground"><%= slice.label %></span><span class="font-medium tabular-nums"><%= slice.text %></span><span class="w-10 text-end tabular-nums text-muted-foreground"><%= slice.share %></span></li>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<% series.each do |entry| %>
|
|
11
|
+
<li class="flex items-center gap-2"><%= tag.span class: swatch_classes(entry) %><%= entry.name %></li>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<%= tag.div class: frame_classes, style: frame_style do %>
|
|
17
|
+
<%= tag.canvas(**canvas_attrs) %>
|
|
18
|
+
<%# It glides from point to point and fades in and out, rather than jumping. %>
|
|
19
|
+
<%= tag.div aria: { hidden: true }, data: { "ui--chart-target": "tooltip" },
|
|
20
|
+
class: "pointer-events-none invisible absolute left-0 top-0 z-10 min-w-32 rounded-md border bg-popover px-3 py-2 text-xs text-popover-foreground opacity-0 shadow-md transition-[opacity,transform,visibility] duration-150 ease-out data-[shown]:visible data-[shown]:opacity-100 motion-reduce:transition-none" %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<details class="group/data text-sm">
|
|
24
|
+
<%= tag.summary t("ui.chart.show_data", default: "Show the data"), class: "w-fit cursor-pointer rounded-sm text-muted-foreground hover:text-foreground #{UI::Base::FOCUS_RING}" %>
|
|
25
|
+
<div class="mt-2 overflow-x-auto">
|
|
26
|
+
<table class="w-full text-sm tabular-nums">
|
|
27
|
+
<%= tag.caption label, class: "sr-only" %>
|
|
28
|
+
<thead>
|
|
29
|
+
<tr class="border-b">
|
|
30
|
+
<%= tag.th t("ui.chart.category", default: "Category"), scope: "col", class: "py-2 pe-4 text-start font-medium text-muted-foreground" %>
|
|
31
|
+
<% series.each do |entry| %><%= tag.th entry.name, scope: "col", class: "py-2 ps-4 text-end font-medium text-muted-foreground" %><% end %>
|
|
32
|
+
<% if circular? %><%= tag.th t("ui.chart.share", default: "Share"), scope: "col", class: "py-2 ps-4 text-end font-medium text-muted-foreground" %><% end %>
|
|
33
|
+
</tr>
|
|
34
|
+
</thead>
|
|
35
|
+
<tbody>
|
|
36
|
+
<% labels.each_with_index do |row, index| %>
|
|
37
|
+
<tr class="border-b last:border-0">
|
|
38
|
+
<%= tag.th row, scope: "row", class: "py-2 pe-4 text-start font-normal" %>
|
|
39
|
+
<% series.each do |entry| %><%= tag.td formatted(entry.data[index]), class: "py-2 ps-4 text-end" %><% end %>
|
|
40
|
+
<% if circular? %><%= tag.td share_text(series.first.data[index]), class: "py-2 ps-4 text-end text-muted-foreground" %><% end %>
|
|
41
|
+
</tr>
|
|
42
|
+
<% end %>
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
</div>
|
|
46
|
+
</details>
|
|
47
|
+
<% end %>
|