@getflip/swirl-components-react 0.11.0 → 0.13.0
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/dist/{_commonjsHelpers-44457d8d.ba94af77.js → _commonjsHelpers-10467d11.b7d83301.js} +0 -0
- package/dist/balancetext-31f1ec68.bd1c1b2d.js +189 -0
- package/dist/{file-manager.entry.7f94c2d2.js → file-manager.entry.44afe574.js} +2 -2
- package/dist/{floating-ui.dom.esm-1a4e8b8a.87557233.js → floating-ui.dom.esm-b9f28f6d.15013ef7.js} +0 -0
- package/dist/{index-c3028f7d.557956d2.js → index-47862d62.75c2fcf1.js} +1 -1
- package/dist/index.d74835eb.js +1416 -0
- package/dist/stencil-generated/index.d.ts +3 -0
- package/dist/{swirl-action-list-item.entry.447b2688.js → swirl-action-list-item.entry.22d34bbd.js} +9 -9
- package/dist/{swirl-action-list-section.entry.e84808c9.js → swirl-action-list-section.entry.c91e7d7a.js} +6 -6
- package/dist/{swirl-action-list.entry.2fb802dc.js → swirl-action-list.entry.0d2936d4.js} +2 -2
- package/dist/{swirl-app-layout_5.entry.875542b9.js → swirl-app-layout_5.entry.abd68f10.js} +72 -72
- package/dist/{swirl-autocomplete.entry.7be53f33.js → swirl-autocomplete.entry.ca2df230.js} +11 -11
- package/dist/{swirl-avatar-group.entry.38bafbf0.js → swirl-avatar-group.entry.c4e75b36.js} +5 -5
- package/dist/{swirl-avatar.entry.6107d926.js → swirl-avatar.entry.46fb8405.js} +13 -13
- package/dist/{swirl-badge.entry.1f4d89cf.js → swirl-badge.entry.d2d0941a.js} +4 -4
- package/dist/{swirl-banner.entry.2d29edfc.js → swirl-banner.entry.55c2e81c.js} +7 -7
- package/dist/{swirl-button-group.entry.8ce93c3c.js → swirl-button-group.entry.2a7f639c.js} +7 -7
- package/dist/{swirl-button.entry.42b57f80.js → swirl-button.entry.4fb44693.js} +22 -22
- package/dist/{swirl-card.entry.a09d5cdf.js → swirl-card.entry.ae45d1e4.js} +6 -6
- package/dist/{swirl-checkbox.entry.58064458.js → swirl-checkbox.entry.4fd6f222.js} +12 -12
- package/dist/{swirl-chip.entry.b6b676d6.js → swirl-chip.entry.d023e9b6.js} +9 -9
- package/dist/swirl-components-react.js +105 -102
- package/dist/swirl-components-react.umd.cjs +77 -42
- package/dist/{swirl-console-layout.entry.88cca8db.js → swirl-console-layout.entry.57e74dab.js} +16 -16
- package/dist/{swirl-date-input.entry.1ff3f34d.js → swirl-date-input.entry.9a19f65d.js} +622 -619
- package/dist/swirl-date-picker_2.entry.9bad1948.js +37 -0
- package/dist/{swirl-description-list-item.entry.e5e7327a.js → swirl-description-list-item.entry.2872cecd.js} +2 -2
- package/dist/{swirl-description-list.entry.b451e1b2.js → swirl-description-list.entry.e98b5f6a.js} +1 -1
- package/dist/{swirl-dialog.entry.27d08ab3.js → swirl-dialog.entry.3c314ce8.js} +5 -5
- package/dist/{swirl-file-uploader.entry.6c075751.js → swirl-file-uploader.entry.a961108f.js} +5 -5
- package/dist/{swirl-file-viewer_7.entry.2d664fd5.js → swirl-file-viewer_7.entry.80730f50.js} +13 -13
- package/dist/swirl-form-control.entry.7b7792b7.js +70 -0
- package/dist/{swirl-form-group.entry.f58b5fda.js → swirl-form-group.entry.8ab35b6b.js} +3 -3
- package/dist/{swirl-heading.entry.1761ccaf.js → swirl-heading.entry.f6f15b36.js} +20 -10
- package/dist/{swirl-icon-add-photo.entry.2be32855.js → swirl-icon-add-photo.entry.e834d584.js} +3 -3
- package/dist/{swirl-icon-add_4.entry.54bb7e89.js → swirl-icon-add_4.entry.7a361599.js} +3 -3
- package/dist/{swirl-icon-admin-panel-settings.entry.a43bcc7d.js → swirl-icon-admin-panel-settings.entry.d609d64c.js} +3 -3
- package/dist/{swirl-icon-arrow-back.entry.ee4ddf1e.js → swirl-icon-arrow-back.entry.8acd2db8.js} +3 -3
- package/dist/{swirl-icon-arrow-downward_2.entry.74231d7a.js → swirl-icon-arrow-downward_2.entry.2444d544.js} +3 -3
- package/dist/{swirl-icon-arrow-forward.entry.a895e898.js → swirl-icon-arrow-forward.entry.7faa307c.js} +3 -3
- package/dist/{swirl-icon-arrow-left_3.entry.6ea8dad5.js → swirl-icon-arrow-left_3.entry.8aafc12d.js} +3 -3
- package/dist/{swirl-icon-arrow-right-small.entry.daf39424.js → swirl-icon-arrow-right-small.entry.b71661c0.js} +3 -3
- package/dist/{swirl-icon-attachment.entry.2cb8c35f.js → swirl-icon-attachment.entry.9953efe2.js} +3 -3
- package/dist/{swirl-icon-block.entry.0d7f0e2b.js → swirl-icon-block.entry.1e6aeb65.js} +3 -3
- package/dist/{swirl-icon-cancel_4.entry.2943f0c0.js → swirl-icon-cancel_4.entry.6fb2872f.js} +3 -3
- package/dist/{swirl-icon-chat-bubble.entry.66624624.js → swirl-icon-chat-bubble.entry.0b5c13c1.js} +3 -3
- package/dist/{swirl-icon-chats-filled.entry.83e0eeb7.js → swirl-icon-chats-filled.entry.f2c5a42a.js} +3 -3
- package/dist/{swirl-icon-chats-outlined.entry.f768aca8.js → swirl-icon-chats-outlined.entry.b37c9fd2.js} +3 -3
- package/dist/{swirl-icon-check-circle.entry.03a596c7.js → swirl-icon-check-circle.entry.9a3ba07b.js} +3 -3
- package/dist/swirl-icon-check-small_4.entry.0b082015.js +1468 -0
- package/dist/{swirl-icon-check-strong.entry.88cfb7b3.js → swirl-icon-check-strong.entry.32e1c97e.js} +3 -3
- package/dist/{swirl-icon-check.entry.360c5b8c.js → swirl-icon-check.entry.965b4009.js} +3 -3
- package/dist/{swirl-icon-chevron-left.entry.d6f5077d.js → swirl-icon-chevron-left.entry.ca081027.js} +3 -3
- package/dist/{swirl-icon-chevron-right.entry.4cbdaed5.js → swirl-icon-chevron-right.entry.d63b1c26.js} +3 -3
- package/dist/{swirl-icon-close-small.entry.d223e192.js → swirl-icon-close-small.entry.3785692a.js} +3 -3
- package/dist/{swirl-icon-close.entry.eee59783.js → swirl-icon-close.entry.7d6556d2.js} +3 -3
- package/dist/{swirl-icon-cloud-upload.entry.b50d30c3.js → swirl-icon-cloud-upload.entry.ee85d552.js} +3 -3
- package/dist/{swirl-icon-column.entry.07e869e3.js → swirl-icon-column.entry.d0591e93.js} +3 -3
- package/dist/{swirl-icon-comment.entry.221fe61a.js → swirl-icon-comment.entry.43355ec3.js} +3 -3
- package/dist/{swirl-icon-copy.entry.d113e5bb.js → swirl-icon-copy.entry.a9739808.js} +3 -3
- package/dist/{swirl-icon-date-range.entry.a1eb0554.js → swirl-icon-date-range.entry.c774ab8b.js} +3 -3
- package/dist/{swirl-icon-delete.entry.ebcf7073.js → swirl-icon-delete.entry.bf4b1f3b.js} +3 -3
- package/dist/{swirl-icon-description.entry.fb0d88a1.js → swirl-icon-description.entry.b8f1d590.js} +3 -3
- package/dist/{swirl-icon-edit.entry.c6cf867f.js → swirl-icon-edit.entry.1a96f349.js} +3 -3
- package/dist/{swirl-icon-emoji-mood.entry.bf9ee6c2.js → swirl-icon-emoji-mood.entry.f0ea6dc7.js} +3 -3
- package/dist/{swirl-icon-emoji-satisfied.entry.df8c1d60.js → swirl-icon-emoji-satisfied.entry.bacaef7c.js} +3 -3
- package/dist/{swirl-icon-error_3.entry.c21fbb54.js → swirl-icon-error_3.entry.77f2e57a.js} +13 -13
- package/dist/{swirl-icon-expand-more.entry.bbde4949.js → swirl-icon-expand-more.entry.5cf4f099.js} +3 -3
- package/dist/{swirl-icon-file.entry.7ab04321.js → swirl-icon-file.entry.b7c820e1.js} +3 -3
- package/dist/{swirl-icon-filter.entry.95211f5f.js → swirl-icon-filter.entry.25e3c016.js} +3 -3
- package/dist/{swirl-icon-folder-shared.entry.052229e9.js → swirl-icon-folder-shared.entry.8c6badf3.js} +3 -3
- package/dist/{swirl-icon-group-assign.entry.bb3ba16d.js → swirl-icon-group-assign.entry.5f9bcfc3.js} +3 -3
- package/dist/{swirl-icon-groups-custom.entry.89cb31bf.js → swirl-icon-groups-custom.entry.822d8779.js} +3 -3
- package/dist/{swirl-icon-groups-filled.entry.8e4dd776.js → swirl-icon-groups-filled.entry.acb66d44.js} +3 -3
- package/dist/{swirl-icon-groups-outlined.entry.d257fa35.js → swirl-icon-groups-outlined.entry.ccdaa445.js} +3 -3
- package/dist/{swirl-icon-groups.entry.eb164fa2.js → swirl-icon-groups.entry.6a86024e.js} +3 -3
- package/dist/{swirl-icon-help.entry.95af80fe.js → swirl-icon-help.entry.b993b08d.js} +3 -3
- package/dist/{swirl-icon-image.entry.ac7fce8a.js → swirl-icon-image.entry.f2786c07.js} +3 -3
- package/dist/{swirl-icon-info.entry.7bea6932.js → swirl-icon-info.entry.a37b48cb.js} +3 -3
- package/dist/{swirl-icon-inventory.entry.7bb8c552.js → swirl-icon-inventory.entry.d51e9d40.js} +3 -3
- package/dist/{swirl-icon-like.entry.ec92b9fd.js → swirl-icon-like.entry.d2bff5cf.js} +3 -3
- package/dist/{swirl-icon-link.entry.f3d5937c.js → swirl-icon-link.entry.dd2ec94a.js} +3 -3
- package/dist/{swirl-icon-lock.entry.807d8a95.js → swirl-icon-lock.entry.dd827390.js} +3 -3
- package/dist/{swirl-icon-logout.entry.4f31d257.js → swirl-icon-logout.entry.37e7dbf7.js} +3 -3
- package/dist/{swirl-icon-mail.entry.54c49af9.js → swirl-icon-mail.entry.aa5549f0.js} +3 -3
- package/dist/{swirl-icon-manage-accounts.entry.8bc3721c.js → swirl-icon-manage-accounts.entry.0ea7b173.js} +3 -3
- package/dist/{swirl-icon-mention.entry.5cf61986.js → swirl-icon-mention.entry.625f0842.js} +3 -3
- package/dist/{swirl-icon-menu-filled.entry.1597fcdc.js → swirl-icon-menu-filled.entry.831e831b.js} +3 -3
- package/dist/{swirl-icon-menu-outlined.entry.05c230c7.js → swirl-icon-menu-outlined.entry.eefcb24d.js} +3 -3
- package/dist/{swirl-icon-menu.entry.eb38317a.js → swirl-icon-menu.entry.1cc3453e.js} +3 -3
- package/dist/{swirl-icon-message.entry.3f3b0ee6.js → swirl-icon-message.entry.2b7599f4.js} +3 -3
- package/dist/{swirl-icon-more-horizontal.entry.746bde39.js → swirl-icon-more-horizontal.entry.b5c24b7a.js} +3 -3
- package/dist/{swirl-icon-more-vertikal.entry.bf9342ef.js → swirl-icon-more-vertikal.entry.04d7e5a6.js} +3 -3
- package/dist/{swirl-icon-news-filled.entry.1c1d78f8.js → swirl-icon-news-filled.entry.6190c1e5.js} +3 -3
- package/dist/{swirl-icon-news-outlined.entry.76c94ea9.js → swirl-icon-news-outlined.entry.e547af31.js} +3 -3
- package/dist/{swirl-icon-notifications-active.entry.d8c49de6.js → swirl-icon-notifications-active.entry.443daf87.js} +3 -3
- package/dist/{swirl-icon-notifications-off.entry.2c8866a8.js → swirl-icon-notifications-off.entry.9c7a77ac.js} +3 -3
- package/dist/{swirl-icon-notifications.entry.a5c7b275.js → swirl-icon-notifications.entry.486efc01.js} +3 -3
- package/dist/{swirl-icon-open-in-new.entry.128350f5.js → swirl-icon-open-in-new.entry.9a6a0052.js} +3 -3
- package/dist/{swirl-icon-people-alt.entry.7ac6d23a.js → swirl-icon-people-alt.entry.d3886045.js} +3 -3
- package/dist/{swirl-icon-person-off.entry.fda1c4d4.js → swirl-icon-person-off.entry.b3ea5502.js} +3 -3
- package/dist/{swirl-icon-person.entry.19fc5367.js → swirl-icon-person.entry.13a5b347.js} +3 -3
- package/dist/{swirl-icon-phone.entry.73cfee35.js → swirl-icon-phone.entry.0634bc2d.js} +3 -3
- package/dist/{swirl-icon-poll.entry.4ab05380.js → swirl-icon-poll.entry.048d86d7.js} +3 -3
- package/dist/{swirl-icon-print.entry.cd89ebc5.js → swirl-icon-print.entry.bccea0d9.js} +3 -3
- package/dist/{swirl-icon-recieved.entry.56d93432.js → swirl-icon-recieved.entry.549226c8.js} +3 -3
- package/dist/{swirl-icon-search-strong.entry.904a6694.js → swirl-icon-search-strong.entry.5038a3d3.js} +3 -3
- package/dist/{swirl-icon-search.entry.cf65f83f.js → swirl-icon-search.entry.933cda43.js} +3 -3
- package/dist/{swirl-icon-send.entry.56297757.js → swirl-icon-send.entry.570f8888.js} +3 -3
- package/dist/{swirl-icon-settings.entry.1c988cf1.js → swirl-icon-settings.entry.4267149c.js} +3 -3
- package/dist/{swirl-icon-sync.entry.b88dd7b8.js → swirl-icon-sync.entry.fdfe7aba.js} +3 -3
- package/dist/{swirl-icon-tasks-filled.entry.b2bf1c6e.js → swirl-icon-tasks-filled.entry.ded975a6.js} +3 -3
- package/dist/{swirl-icon-tasks-outlined.entry.09551261.js → swirl-icon-tasks-outlined.entry.9774132f.js} +3 -3
- package/dist/{swirl-icon-time-filled.entry.4954d002.js → swirl-icon-time-filled.entry.300bac3f.js} +3 -3
- package/dist/{swirl-icon-time-outlined.entry.697e9656.js → swirl-icon-time-outlined.entry.aff5bc33.js} +3 -3
- package/dist/{swirl-icon-user-assign.entry.fe5b582b.js → swirl-icon-user-assign.entry.eb8db1a8.js} +3 -3
- package/dist/{swirl-icon-video-camera.entry.d4707dde.js → swirl-icon-video-camera.entry.8855fd0a.js} +3 -3
- package/dist/{swirl-icon-warning.entry.69762f5b.js → swirl-icon-warning.entry.4b60bf85.js} +3 -3
- package/dist/{swirl-lightbox.entry.bae60d38.js → swirl-lightbox.entry.03ab7b33.js} +6 -6
- package/dist/{swirl-link.entry.3d52e8ef.js → swirl-link.entry.ab3a7bd8.js} +3 -3
- package/dist/{swirl-list.entry.53688da6.js → swirl-list.entry.ab67b563.js} +1 -1
- package/dist/{swirl-modal.entry.4bf5e6c3.js → swirl-modal.entry.4e72a21b.js} +15 -15
- package/dist/{swirl-option-list-section.entry.898ea907.js → swirl-option-list-section.entry.e98eecf1.js} +6 -6
- package/dist/{swirl-pagination.entry.b892dbdb.js → swirl-pagination.entry.c9d0b689.js} +8 -8
- package/dist/{swirl-pdf-reader.entry.28aa5b27.js → swirl-pdf-reader.entry.fbcbb9bf.js} +7 -7
- package/dist/{swirl-popover.entry.3e96f1d7.js → swirl-popover.entry.4ef4ee64.js} +8 -8
- package/dist/{swirl-progress-indicator.entry.30f3d224.js → swirl-progress-indicator.entry.c61c12fe.js} +4 -4
- package/dist/{swirl-radio-group.entry.9cbdf732.js → swirl-radio-group.entry.c311185d.js} +2 -2
- package/dist/{swirl-radio.entry.7a24ed80.js → swirl-radio.entry.257ccde8.js} +7 -7
- package/dist/{swirl-resource-list-file-item.entry.c7c3d567.js → swirl-resource-list-file-item.entry.6fa9004b.js} +7 -7
- package/dist/{swirl-search.entry.19702179.js → swirl-search.entry.8302bf45.js} +8 -8
- package/dist/swirl-select.entry.aba0219a.js +49 -0
- package/dist/{swirl-separator.entry.6dfbb1a4.js → swirl-separator.entry.ef60c75d.js} +1 -1
- package/dist/swirl-skeleton-box.entry.bd0d35d2.js +30 -0
- package/dist/swirl-skeleton-text.entry.c803a988.js +39 -0
- package/dist/{swirl-stack.entry.43f00bc0.js → swirl-stack.entry.b5fa46e8.js} +3 -3
- package/dist/{swirl-switch.entry.eaba1cc3.js → swirl-switch.entry.049b12c8.js} +13 -13
- package/dist/swirl-tab.entry.eab57d24.js +18 -0
- package/dist/{swirl-table-cell.entry.5cacafda.js → swirl-table-cell.entry.ed35c446.js} +1 -1
- package/dist/{swirl-table-column.entry.d66cfcf5.js → swirl-table-column.entry.e61f908d.js} +3 -3
- package/dist/{swirl-table-row-group.entry.4273e651.js → swirl-table-row-group.entry.bb48715f.js} +2 -2
- package/dist/{swirl-table-row.entry.1f98e36b.js → swirl-table-row.entry.bee5e4a9.js} +7 -7
- package/dist/{swirl-table.entry.5a37f233.js → swirl-table.entry.f59b9b3e.js} +12 -12
- package/dist/{swirl-tabs.entry.a932c6b9.js → swirl-tabs.entry.7810e64a.js} +4 -4
- package/dist/{swirl-tag.entry.2fd7c670.js → swirl-tag.entry.679951ac.js} +10 -10
- package/dist/{swirl-text-input.entry.c1eb2d9c.js → swirl-text-input.entry.bddd1dae.js} +12 -11
- package/dist/swirl-text.entry.9806d4db.js +31 -0
- package/dist/{swirl-theme-provider.entry.5bf11693.js → swirl-theme-provider.entry.ece49018.js} +13 -13
- package/dist/{swirl-thumbnail.entry.3b230d52.js → swirl-thumbnail.entry.342f1f8c.js} +7 -7
- package/dist/{swirl-toast-provider.entry.da18eaab.js → swirl-toast-provider.entry.2788262d.js} +6 -6
- package/dist/{swirl-toast.entry.d0f32449.js → swirl-toast.entry.0e7927ba.js} +7 -7
- package/dist/{swirl-tooltip.entry.e444ef8c.js → swirl-tooltip.entry.c8f0bd4f.js} +4 -4
- package/dist/{swirl-tree-navigation-item.entry.49118257.js → swirl-tree-navigation-item.entry.d5c4aec7.js} +7 -7
- package/dist/{swirl-video-thumbnail.entry.786a3d11.js → swirl-video-thumbnail.entry.2e7f4010.js} +2 -2
- package/dist/{swirl-visually-hidden.entry.1da622ab.js → swirl-visually-hidden.entry.7e057e1b.js} +1 -1
- package/dist/utils-33d31b58.1488fcfe.js +46 -0
- package/dist/wc-datepicker.entry.8c191661.js +269 -0
- package/package.json +2 -2
- package/dist/index.9489626d.js +0 -1393
- package/dist/swirl-date-picker_2.entry.e9905308.js +0 -1188
- package/dist/swirl-form-control.entry.89293c5d.js +0 -65
- package/dist/swirl-icon-check-small_3.entry.b2362b00.js +0 -153
- package/dist/swirl-select.entry.3ff36072.js +0 -48
- package/dist/swirl-tab.entry.982c6bc3.js +0 -18
- package/dist/swirl-text.entry.ec8c8813.js +0 -18
- package/dist/utils-7efaa1c6.4a9c3721.js +0 -42
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { r as R, c as S, h as n, H, g as E } from "./index.d74835eb.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
function T(e, t) {
|
|
5
|
+
const a = new Date(e);
|
|
6
|
+
return a.setDate(a.getDate() + t), a;
|
|
7
|
+
}
|
|
8
|
+
function V(e, t, a) {
|
|
9
|
+
const s = [], i = b(e), d = i.getDay() === 0 ? 7 : i.getDay(), l = F(e), D = l.getDay() === 0 ? 7 : l.getDay(), g = a === 1 ? 7 : a - 1, f = [], v = [];
|
|
10
|
+
if (t) {
|
|
11
|
+
let p = (7 - a + d) % 7, m = y(i);
|
|
12
|
+
for (; p > 0; )
|
|
13
|
+
f.push(m), m = y(m), p -= 1;
|
|
14
|
+
f.reverse();
|
|
15
|
+
let w = (7 - D + g) % 7, c = C(l);
|
|
16
|
+
for (; w > 0; )
|
|
17
|
+
v.push(c), c = C(c), w -= 1;
|
|
18
|
+
}
|
|
19
|
+
let r = i;
|
|
20
|
+
for (; r.getMonth() === e.getMonth(); )
|
|
21
|
+
s.push(r), r = C(r);
|
|
22
|
+
return [...f, ...s, ...v];
|
|
23
|
+
}
|
|
24
|
+
function b(e) {
|
|
25
|
+
return u(new Date(`${P(e)}-${String(O(e)).padStart(2, "0")}-01`));
|
|
26
|
+
}
|
|
27
|
+
function h(e) {
|
|
28
|
+
if (e instanceof Date)
|
|
29
|
+
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
30
|
+
}
|
|
31
|
+
function F(e) {
|
|
32
|
+
const t = b(e);
|
|
33
|
+
return t.setMonth(t.getMonth() + 1), t.setDate(t.getDate() - 1), t;
|
|
34
|
+
}
|
|
35
|
+
function O(e) {
|
|
36
|
+
return e.getMonth() + 1;
|
|
37
|
+
}
|
|
38
|
+
function K(e) {
|
|
39
|
+
return new Array(12).fill(void 0).map((t, a) => {
|
|
40
|
+
const s = u(new Date(`2006-${String(a + 1).padStart(2, "0")}-01`));
|
|
41
|
+
return Intl.DateTimeFormat(e, {
|
|
42
|
+
month: "long"
|
|
43
|
+
}).format(s);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function C(e) {
|
|
47
|
+
return T(e, 1);
|
|
48
|
+
}
|
|
49
|
+
function N(e) {
|
|
50
|
+
const t = new Date(e);
|
|
51
|
+
return t.setMonth(t.getMonth() + 1), t;
|
|
52
|
+
}
|
|
53
|
+
function B(e) {
|
|
54
|
+
const t = new Date(e);
|
|
55
|
+
return t.setFullYear(t.getFullYear() + 1), t;
|
|
56
|
+
}
|
|
57
|
+
function y(e) {
|
|
58
|
+
return A(e, 1);
|
|
59
|
+
}
|
|
60
|
+
function Y(e) {
|
|
61
|
+
const t = new Date(e);
|
|
62
|
+
return t.setMonth(t.getMonth() - 1), t;
|
|
63
|
+
}
|
|
64
|
+
function x(e) {
|
|
65
|
+
const t = new Date(e);
|
|
66
|
+
return t.setFullYear(t.getFullYear() - 1), t;
|
|
67
|
+
}
|
|
68
|
+
function j(e, t) {
|
|
69
|
+
return new Array(7).fill(void 0).map((a, s) => (e + s) % 7 + 1).map((a) => {
|
|
70
|
+
const s = u(new Date(`2006-01-0${a}`));
|
|
71
|
+
return [
|
|
72
|
+
Intl.DateTimeFormat(t, {
|
|
73
|
+
weekday: "short"
|
|
74
|
+
}).format(s),
|
|
75
|
+
Intl.DateTimeFormat(t, {
|
|
76
|
+
weekday: "long"
|
|
77
|
+
}).format(s)
|
|
78
|
+
];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function P(e) {
|
|
82
|
+
return e.getFullYear();
|
|
83
|
+
}
|
|
84
|
+
function U(e, t) {
|
|
85
|
+
if (!e || !t || !t.from || !t.to)
|
|
86
|
+
return !1;
|
|
87
|
+
const a = t.from < t.to ? t.from : t.to, s = t.from < t.to ? t.to : t.from;
|
|
88
|
+
return e >= a && e <= s;
|
|
89
|
+
}
|
|
90
|
+
function o(e, t) {
|
|
91
|
+
return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
92
|
+
}
|
|
93
|
+
function u(e) {
|
|
94
|
+
const t = new Date(e);
|
|
95
|
+
return t.setMinutes(t.getMinutes() + t.getTimezoneOffset()), t;
|
|
96
|
+
}
|
|
97
|
+
function A(e, t) {
|
|
98
|
+
const a = new Date(e);
|
|
99
|
+
return a.setDate(a.getDate() - t), a;
|
|
100
|
+
}
|
|
101
|
+
const z = ".visually-hidden.sc-wc-datepicker{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}", q = {
|
|
102
|
+
clearButton: "Clear value",
|
|
103
|
+
monthSelect: "Select month",
|
|
104
|
+
nextMonthButton: "Next month",
|
|
105
|
+
nextYearButton: "Next year",
|
|
106
|
+
picker: "Choose date",
|
|
107
|
+
previousMonthButton: "Previous month",
|
|
108
|
+
previousYearButton: "Previous year",
|
|
109
|
+
todayButton: "Show today",
|
|
110
|
+
yearSelect: "Select year"
|
|
111
|
+
}, G = class {
|
|
112
|
+
constructor(e) {
|
|
113
|
+
R(this, e), this.selectDate = S(this, "selectDate", 7), this.changeMonth = S(this, "changeMonth", 7), this.disabled = !1, this.disableDate = () => !1, this.elementClassName = "wc-datepicker", this.firstDayOfWeek = 0, this.labels = q, this.locale = (navigator == null ? void 0 : navigator.language) || "en-US", this.showClearButton = !1, this.showMonthStepper = !0, this.showTodayButton = !1, this.showYearStepper = !1, this.startDate = h(new Date()), this.init = () => {
|
|
114
|
+
this.currentDate = this.startDate ? u(new Date(this.startDate)) : new Date(), this.updateWeekdays();
|
|
115
|
+
}, this.nextMonth = () => {
|
|
116
|
+
this.updateCurrentDate(N(this.currentDate));
|
|
117
|
+
}, this.nextYear = () => {
|
|
118
|
+
this.updateCurrentDate(B(this.currentDate));
|
|
119
|
+
}, this.previousMonth = () => {
|
|
120
|
+
this.updateCurrentDate(Y(this.currentDate));
|
|
121
|
+
}, this.previousYear = () => {
|
|
122
|
+
this.updateCurrentDate(x(this.currentDate));
|
|
123
|
+
}, this.showToday = () => {
|
|
124
|
+
this.updateCurrentDate(new Date());
|
|
125
|
+
}, this.clear = () => {
|
|
126
|
+
this.value = void 0, this.selectDate.emit(void 0);
|
|
127
|
+
}, this.onClick = (t) => {
|
|
128
|
+
if (this.disabled)
|
|
129
|
+
return;
|
|
130
|
+
const a = t.target.closest("[data-date]");
|
|
131
|
+
if (!Boolean(a))
|
|
132
|
+
return;
|
|
133
|
+
const s = u(new Date(a.dataset.date));
|
|
134
|
+
this.updateCurrentDate(s), this.onSelectDate(s);
|
|
135
|
+
}, this.onMonthSelect = (t) => {
|
|
136
|
+
const a = +t.target.value - 1, s = new Date(this.currentDate);
|
|
137
|
+
s.setMonth(a), this.updateCurrentDate(s);
|
|
138
|
+
}, this.onYearSelect = (t) => {
|
|
139
|
+
const a = +t.target.value, s = new Date(this.currentDate);
|
|
140
|
+
s.setFullYear(a), this.updateCurrentDate(s);
|
|
141
|
+
}, this.onKeyDown = (t) => {
|
|
142
|
+
this.disabled || (t.code === "ArrowLeft" ? (t.preventDefault(), this.updateCurrentDate(y(this.currentDate), !0)) : t.code === "ArrowRight" ? (t.preventDefault(), this.updateCurrentDate(C(this.currentDate), !0)) : t.code === "ArrowUp" ? (t.preventDefault(), this.updateCurrentDate(A(this.currentDate, 7), !0)) : t.code === "ArrowDown" ? (t.preventDefault(), this.updateCurrentDate(T(this.currentDate, 7), !0)) : t.code === "PageUp" ? (t.preventDefault(), t.shiftKey ? this.updateCurrentDate(x(this.currentDate), !0) : this.updateCurrentDate(Y(this.currentDate), !0)) : t.code === "PageDown" ? (t.preventDefault(), t.shiftKey ? this.updateCurrentDate(B(this.currentDate), !0) : this.updateCurrentDate(N(this.currentDate), !0)) : t.code === "Home" ? (t.preventDefault(), this.updateCurrentDate(b(this.currentDate), !0)) : t.code === "End" ? (t.preventDefault(), this.updateCurrentDate(F(this.currentDate), !0)) : (t.code === "Space" || t.code === "Enter") && (t.preventDefault(), this.onSelectDate(this.currentDate)));
|
|
143
|
+
}, this.onMouseEnter = (t) => {
|
|
144
|
+
if (this.disabled)
|
|
145
|
+
return;
|
|
146
|
+
const a = u(new Date(t.target.closest("td").dataset.date));
|
|
147
|
+
this.hoveredDate = a;
|
|
148
|
+
}, this.onMouseLeave = () => {
|
|
149
|
+
this.hoveredDate = void 0;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
componentWillLoad() {
|
|
153
|
+
this.init();
|
|
154
|
+
}
|
|
155
|
+
watchFirstDayOfWeek() {
|
|
156
|
+
this.updateWeekdays();
|
|
157
|
+
}
|
|
158
|
+
watchLocale() {
|
|
159
|
+
Boolean(this.locale) || (this.locale = (navigator == null ? void 0 : navigator.language) || "en-US"), this.updateWeekdays();
|
|
160
|
+
}
|
|
161
|
+
watchRange() {
|
|
162
|
+
this.value = void 0, this.selectDate.emit(void 0);
|
|
163
|
+
}
|
|
164
|
+
watchStartDate() {
|
|
165
|
+
this.currentDate = this.startDate ? u(new Date(this.startDate)) : new Date();
|
|
166
|
+
}
|
|
167
|
+
watchValue() {
|
|
168
|
+
Boolean(this.value) && (Array.isArray(this.value) && this.value.length >= 1 ? this.currentDate = this.value[0] : this.value instanceof Date && (this.currentDate = this.value));
|
|
169
|
+
}
|
|
170
|
+
componentDidRender() {
|
|
171
|
+
this.moveFocusAfterMonthChanged && (this.focusDate(this.currentDate), this.moveFocusAfterMonthChanged = !1);
|
|
172
|
+
}
|
|
173
|
+
updateWeekdays() {
|
|
174
|
+
this.weekdays = j(this.firstDayOfWeek === 0 ? 7 : this.firstDayOfWeek, this.locale);
|
|
175
|
+
}
|
|
176
|
+
getClassName(e) {
|
|
177
|
+
return Boolean(e) ? `${this.elementClassName}__${e}` : this.elementClassName;
|
|
178
|
+
}
|
|
179
|
+
getCalendarRows() {
|
|
180
|
+
const e = V(this.currentDate, !0, this.firstDayOfWeek === 0 ? 7 : this.firstDayOfWeek), t = [];
|
|
181
|
+
for (let a = 0; a < e.length; a += 7) {
|
|
182
|
+
const s = e.slice(a, a + 7);
|
|
183
|
+
t.push(s);
|
|
184
|
+
}
|
|
185
|
+
return t;
|
|
186
|
+
}
|
|
187
|
+
getTitle() {
|
|
188
|
+
if (!!Boolean(this.currentDate))
|
|
189
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
190
|
+
day: "numeric",
|
|
191
|
+
month: "long",
|
|
192
|
+
year: "numeric"
|
|
193
|
+
}).format(this.currentDate);
|
|
194
|
+
}
|
|
195
|
+
focusDate(e) {
|
|
196
|
+
var t;
|
|
197
|
+
(t = this.el.querySelector(`[data-date="${h(e)}"]`)) === null || t === void 0 || t.focus();
|
|
198
|
+
}
|
|
199
|
+
updateCurrentDate(e, t) {
|
|
200
|
+
const a = e.getMonth(), s = e.getFullYear();
|
|
201
|
+
(a !== this.currentDate.getMonth() || s !== this.currentDate.getFullYear()) && (this.changeMonth.emit({ month: O(e), year: P(e) }), t && (this.moveFocusAfterMonthChanged = !0)), this.currentDate = e, t && this.focusDate(this.currentDate);
|
|
202
|
+
}
|
|
203
|
+
onSelectDate(e) {
|
|
204
|
+
var t, a;
|
|
205
|
+
if (!this.disableDate(e))
|
|
206
|
+
if (this.isRangeValue(this.value)) {
|
|
207
|
+
const s = ((t = this.value) === null || t === void 0 ? void 0 : t[0]) === void 0 || this.value.length === 2 ? [e] : [this.value[0], e];
|
|
208
|
+
s.length === 2 && s[0] > s[1] && s.reverse();
|
|
209
|
+
const i = s[1] === void 0 ? [h(s[0])] : [h(s[0]), h(s[1])];
|
|
210
|
+
this.value = s, this.selectDate.emit(i);
|
|
211
|
+
} else {
|
|
212
|
+
if (((a = this.value) === null || a === void 0 ? void 0 : a.getTime()) === e.getTime())
|
|
213
|
+
return;
|
|
214
|
+
this.value = e, this.selectDate.emit(h(e));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
isRangeValue(e) {
|
|
218
|
+
return this.range;
|
|
219
|
+
}
|
|
220
|
+
render() {
|
|
221
|
+
const e = this.showTodayButton || this.showClearButton;
|
|
222
|
+
return n(H, null, n("div", { "aria-disabled": String(this.disabled), "aria-label": this.labels.picker, class: {
|
|
223
|
+
[this.getClassName()]: !0,
|
|
224
|
+
[`${this.getClassName()}--disabled`]: this.disabled
|
|
225
|
+
}, role: "group" }, n("div", { class: this.getClassName("header") }, n("span", { "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle()), this.showYearStepper && n("button", { "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), disabled: this.disabled, innerHTML: this.previousYearButtonContent || void 0, onClick: this.previousYear, type: "button" }, n("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, n("polyline", { points: "11 17 6 12 11 7" }), n("polyline", { points: "18 17 13 12 18 7" }))), this.showMonthStepper && n("button", { "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), disabled: this.disabled, innerHTML: this.previousMonthButtonContent || void 0, onClick: this.previousMonth, type: "button" }, n("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, n("polyline", { points: "15 18 9 12 15 6" }))), n("span", { class: this.getClassName("current-month") }, n("select", { "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), disabled: this.disabled, name: "month", onChange: this.onMonthSelect }, K(this.locale).map((t, a) => n("option", { key: t, selected: this.currentDate.getMonth() === a, value: a + 1 }, t))), n("input", { "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), disabled: this.disabled, max: 9999, min: 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && n("button", { "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), disabled: this.disabled, innerHTML: this.nextMonthButtonContent || void 0, onClick: this.nextMonth, type: "button" }, n("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, n("polyline", { points: "9 18 15 12 9 6" }))), this.showYearStepper && n("button", { "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), disabled: this.disabled, innerHTML: this.nextYearButtonContent || void 0, onClick: this.nextYear, type: "button" }, n("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, n("polyline", { points: "13 17 18 12 13 7" }), n("polyline", { points: "6 17 11 12 6 7" })))), n("div", { class: this.getClassName("body") }, n("table", { class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid" }, n("thead", { class: this.getClassName("calendar-header") }, n("tr", { class: this.getClassName("weekday-row") }, this.weekdays.map((t) => n("th", { abbr: t[1], class: this.getClassName("weekday"), key: t[0], scope: "col" }, n("span", null, t[0]))))), n("tbody", null, this.getCalendarRows().map((t) => {
|
|
226
|
+
const a = `row-${t[0].getMonth()}-${t[0].getDate()}`;
|
|
227
|
+
return n("tr", { class: this.getClassName("calendar-row"), key: a }, t.map((s) => {
|
|
228
|
+
var i, d, l, D, g;
|
|
229
|
+
const f = o(s, this.currentDate), v = s.getMonth() !== this.currentDate.getMonth(), r = Array.isArray(this.value) ? o(s, this.value[0]) || o(s, this.value[1]) : o(s, this.value), M = this.isRangeValue ? U(s, {
|
|
230
|
+
from: (i = this.value) === null || i === void 0 ? void 0 : i[0],
|
|
231
|
+
to: ((d = this.value) === null || d === void 0 ? void 0 : d[1]) || this.hoveredDate || this.currentDate
|
|
232
|
+
}) : !1, p = Boolean((l = this.value) === null || l === void 0 ? void 0 : l[0]) ? [
|
|
233
|
+
(D = this.value) === null || D === void 0 ? void 0 : D[0],
|
|
234
|
+
((g = this.value) === null || g === void 0 ? void 0 : g[1]) || this.hoveredDate
|
|
235
|
+
].sort((_, I) => _ - I) : [], m = this.range && o(p[0], s), k = this.range && o(p[1], s), w = o(s, new Date()), c = this.disableDate(s), L = `cell-${s.getMonth()}-${s.getDate()}`, $ = {
|
|
236
|
+
[this.getClassName("date")]: !0,
|
|
237
|
+
[this.getClassName("date--current")]: f,
|
|
238
|
+
[this.getClassName("date--disabled")]: c,
|
|
239
|
+
[this.getClassName("date--overflowing")]: v,
|
|
240
|
+
[this.getClassName("date--today")]: w,
|
|
241
|
+
[this.getClassName("date--selected")]: r,
|
|
242
|
+
[this.getClassName("date--in-range")]: M,
|
|
243
|
+
[this.getClassName("date--start")]: m,
|
|
244
|
+
[this.getClassName("date--end")]: k
|
|
245
|
+
}, W = r ? "strong" : w ? "em" : "span";
|
|
246
|
+
return n("td", { "aria-disabled": String(c), "aria-selected": r ? "true" : void 0, class: $, "data-date": h(s), key: L, onClick: this.onClick, onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave, role: "gridcell", tabIndex: o(s, this.currentDate) && !this.disabled ? 0 : -1 }, n(W, { "aria-hidden": "true" }, s.getDate()), n("span", { class: "visually-hidden" }, Intl.DateTimeFormat(this.locale, {
|
|
247
|
+
day: "numeric",
|
|
248
|
+
month: "long"
|
|
249
|
+
}).format(s)));
|
|
250
|
+
}));
|
|
251
|
+
})))), e && n("div", { class: this.getClassName("footer") }, this.showTodayButton && n("button", { class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || void 0, onClick: this.showToday, type: "button" }, this.labels.todayButton), this.showClearButton && n("button", { class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || void 0, onClick: this.clear, type: "button" }, this.labels.clearButton))));
|
|
252
|
+
}
|
|
253
|
+
get el() {
|
|
254
|
+
return E(this);
|
|
255
|
+
}
|
|
256
|
+
static get watchers() {
|
|
257
|
+
return {
|
|
258
|
+
firstDayOfWeek: ["watchFirstDayOfWeek"],
|
|
259
|
+
locale: ["watchLocale"],
|
|
260
|
+
range: ["watchRange"],
|
|
261
|
+
startDate: ["watchStartDate"],
|
|
262
|
+
value: ["watchValue"]
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
G.style = z;
|
|
267
|
+
export {
|
|
268
|
+
G as wc_datepicker
|
|
269
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getflip/swirl-components-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsc && vite build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@getflip/swirl-components": "^0.
|
|
21
|
+
"@getflip/swirl-components": "^0.14.0",
|
|
22
22
|
"react": "^18.2.0",
|
|
23
23
|
"react-dom": "^18.2.0"
|
|
24
24
|
},
|