@frollo/frollo-web-ui 8.4.5 → 8.5.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.
@@ -0,0 +1,181 @@
1
+ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-DpC_oIQV.js';
2
+ import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createElementVNode, normalizeStyle, toDisplayString, normalizeClass } from 'vue';
3
+ import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
4
+
5
+ var script = defineComponent({
6
+ name: 'FwSlider',
7
+ emits: ['update:minValue', 'update:maxValue'],
8
+ props: {
9
+ min: {
10
+ type: Number,
11
+ "default": -100
12
+ },
13
+ max: {
14
+ type: Number,
15
+ "default": 100
16
+ },
17
+ step: {
18
+ type: Number,
19
+ "default": 0.01
20
+ },
21
+ minValue: {
22
+ type: Number,
23
+ "default": null
24
+ },
25
+ maxValue: {
26
+ type: Number,
27
+ "default": null
28
+ }
29
+ },
30
+ setup: function setup(props, ctx) {
31
+ var _props$minValue, _props$maxValue;
32
+ var minBound = computed(function () {
33
+ return props.min != null ? Number(props.min) : 0;
34
+ });
35
+ var maxBound = computed(function () {
36
+ return props.max != null ? Number(props.max) : 100;
37
+ });
38
+ var minimumValue = ref((_props$minValue = props.minValue) !== null && _props$minValue !== void 0 ? _props$minValue : props.min);
39
+ var maximumValue = ref((_props$maxValue = props.maxValue) !== null && _props$maxValue !== void 0 ? _props$maxValue : props.max);
40
+ watch(function () {
41
+ return [props.minValue, props.maxValue];
42
+ }, function (_ref) {
43
+ var _ref2 = _slicedToArray(_ref, 2),
44
+ newMin = _ref2[0],
45
+ newMax = _ref2[1];
46
+ if (newMin != null) {
47
+ minimumValue.value = Math.min(Math.max(Number(newMin), props.min), maximumValue.value);
48
+ }
49
+ if (newMax != null) {
50
+ maximumValue.value = Math.max(Math.min(Number(newMax), props.max), minimumValue.value);
51
+ }
52
+ }, {
53
+ immediate: true
54
+ });
55
+ watch(function () {
56
+ return [props.min, props.max];
57
+ }, function () {
58
+ minimumValue.value = Math.min(Math.max(minimumValue.value, props.min), maximumValue.value);
59
+ maximumValue.value = Math.max(Math.min(maximumValue.value, props.max), minimumValue.value);
60
+ });
61
+ var clampLow = function clampLow(value) {
62
+ return Math.min(Math.max(value, minBound.value), maximumValue.value);
63
+ };
64
+ var clampHigh = function clampHigh(value) {
65
+ return Math.max(Math.min(value, maxBound.value), minimumValue.value);
66
+ };
67
+ watch([minBound, maxBound], function () {
68
+ var low = clampLow(minimumValue.value);
69
+ var high = clampHigh(maximumValue.value);
70
+ if (low !== minimumValue.value) {
71
+ minimumValue.value = low;
72
+ ctx.emit('update:minValue', low);
73
+ }
74
+ if (high !== maximumValue.value) {
75
+ maximumValue.value = high;
76
+ ctx.emit('update:maxValue', high);
77
+ }
78
+ }, {
79
+ immediate: true
80
+ });
81
+ var minPercentage = computed(function () {
82
+ return (minimumValue.value - props.min) / (props.max - props.min) * 100;
83
+ });
84
+ var maxPercentage = computed(function () {
85
+ return (maximumValue.value - props.min) / (props.max - props.min) * 100;
86
+ });
87
+ var clippingPoint = computed(function () {
88
+ return maxPercentage.value - minPercentage.value >= 3;
89
+ });
90
+ var onChangeMinInput = function onChangeMinInput(event) {
91
+ var minInput = event.target;
92
+ var value = minInput.valueAsNumber;
93
+ var maxInput = maximumValue.value;
94
+ var clamped = Math.min(Math.max(value, props.min), maxInput);
95
+ minimumValue.value = clamped;
96
+ minInput.value = String(clamped);
97
+ ctx.emit('update:minValue', clamped);
98
+ };
99
+ var onChangeMaxInput = function onChangeMaxInput(event) {
100
+ var maxInput = event.target;
101
+ var value = maxInput.valueAsNumber;
102
+ var minInput = minimumValue.value;
103
+ var clamped = Math.max(Math.min(value, props.max), minInput);
104
+ maximumValue.value = clamped;
105
+ maxInput.value = String(clamped);
106
+ ctx.emit('update:maxValue', clamped);
107
+ };
108
+ return {
109
+ minimumValue: minimumValue,
110
+ maximumValue: maximumValue,
111
+ minPercentage: minPercentage,
112
+ maxPercentage: maxPercentage,
113
+ clippingPoint: clippingPoint,
114
+ onChangeMinInput: onChangeMinInput,
115
+ onChangeMaxInput: onChangeMaxInput
116
+ };
117
+ }
118
+ });
119
+
120
+ var _hoisted_1 = {
121
+ ref: "slider",
122
+ "class": "relative py-3"
123
+ };
124
+ var _hoisted_2 = ["min", "max", "value", "step"];
125
+ var _hoisted_3 = ["min", "max", "value", "step"];
126
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
127
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("p", {
128
+ "class": "absolute -top-6 -translate-x-1/2 text-base text-primary font-semibold",
129
+ style: normalizeStyle({
130
+ left: "".concat(_ctx.minPercentage, "%")
131
+ })
132
+ }, toDisplayString(_ctx.minimumValue) + "% ", 5), createElementVNode("p", {
133
+ "class": normalizeClass(["absolute -top-6 -translate-x-1/2 text-base text-primary font-semibold", [_ctx.maxPercentage - _ctx.minPercentage < 6 ? '-top-10' : '']]),
134
+ style: normalizeStyle({
135
+ left: "".concat(_ctx.maxPercentage, "%")
136
+ })
137
+ }, toDisplayString(_ctx.maximumValue) + "% ", 7), createElementVNode("div", {
138
+ "class": "h-1.5 rounded-full bg-grey-base-light",
139
+ style: normalizeStyle({
140
+ background: "linear-gradient(to right,\n var(--track, #e5e7eb) 0%,\n var(--track, #e5e7eb) ".concat(_ctx.minPercentage, "%,\n var(--fill, #6923FF) ").concat(_ctx.minPercentage, "%,\n var(--fill, #6923FF) ").concat(_ctx.maxPercentage, "%,\n var(--track, #e5e7eb) ").concat(_ctx.maxPercentage, "%,\n var(--track, #e5e7eb) 100%)")
141
+ })
142
+ }, null, 4), createElementVNode("input", {
143
+ "class": "fw-slider absolute inset-0 w-full appearance-none bg-transparent pointer-events-none focus:outline-none",
144
+ type: "range",
145
+ name: "min",
146
+ id: "min",
147
+ min: _ctx.min,
148
+ max: _ctx.max,
149
+ value: _ctx.minimumValue,
150
+ step: _ctx.step,
151
+ onInput: _cache[0] || (_cache[0] = function ($event) {
152
+ return _ctx.onChangeMinInput($event);
153
+ }),
154
+ style: normalizeStyle({
155
+ zIndex: _ctx.clippingPoint ? 20 : 30
156
+ })
157
+ }, null, 44, _hoisted_2), createElementVNode("input", {
158
+ "class": "fw-slider absolute inset-0 w-full appearance-none bg-transparent pointer-events-none focus:outline-none",
159
+ type: "range",
160
+ name: "max",
161
+ id: "max",
162
+ min: _ctx.min,
163
+ max: _ctx.max,
164
+ value: _ctx.maximumValue,
165
+ step: _ctx.step,
166
+ onInput: _cache[1] || (_cache[1] = function ($event) {
167
+ return _ctx.onChangeMaxInput($event);
168
+ }),
169
+ style: normalizeStyle({
170
+ zIndex: _ctx.clippingPoint ? 30 : 20
171
+ })
172
+ }, null, 44, _hoisted_3)], 512);
173
+ }
174
+
175
+ var css_248z = ".fw-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#6923ff;border:2px solid #6923ff;border-radius:9999px;-webkit-box-shadow:var(--tw-shadow);box-shadow:var(--tw-shadow);cursor:pointer;height:18px;pointer-events:auto;width:18px}.fw-slider::-moz-range-thumb{background:#6923ff;border:2px solid #6923ff;border-radius:9999px;box-shadow:var(--tw-shadow);cursor:pointer;height:18px;pointer-events:auto;width:18px}";
176
+ var stylesheet = ".fw-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#6923ff;border:2px solid #6923ff;border-radius:9999px;-webkit-box-shadow:var(--tw-shadow);box-shadow:var(--tw-shadow);cursor:pointer;height:18px;pointer-events:auto;width:18px}.fw-slider::-moz-range-thumb{background:#6923ff;border:2px solid #6923ff;border-radius:9999px;box-shadow:var(--tw-shadow);cursor:pointer;height:18px;pointer-events:auto;width:18px}";
177
+ styleInject(css_248z);
178
+
179
+ script.render = render;
180
+
181
+ export { script as FwSlider };
package/esm/index.js CHANGED
@@ -6,7 +6,7 @@ import './fw-dropdown.js';
6
6
  import './fw-card.js';
7
7
  import './fw-button.js';
8
8
  import { FwNavigationMenu as script$e } from './fw-navigation-menu.js';
9
- import { FwTab as script$j, FwTabs as script$m } from './fw-tabs.js';
9
+ import { FwTab as script$k, FwTabs as script$n } from './fw-tabs.js';
10
10
  import { FwModal as script$d } from './fw-modal.js';
11
11
  import { FwProgressBar as script$g } from './fw-progress-bar.js';
12
12
  import './fw-tag.js';
@@ -14,8 +14,8 @@ import './fw-table.js';
14
14
  import { FwAccordion as __default__ } from './fw-accordion.js';
15
15
  import './fw-image.js';
16
16
  import { FwLoadingCard as script$9, FwLoadingTable as script$b } from './fw-loading.js';
17
- import { FwToast as script$n } from './fw-toast.js';
18
- import { FwTransactionsCard as script$o } from './fw-transactions-card.js';
17
+ import { FwToast as script$o } from './fw-toast.js';
18
+ import { FwTransactionsCard as script$p } from './fw-transactions-card.js';
19
19
  import { FwBarChart as script } from './fw-bar-chart.js';
20
20
  import { FwSidebarMenu as script$i } from './fw-sidebar-menu.js';
21
21
  import { FwDrawer as script$4 } from './fw-drawer.js';
@@ -24,6 +24,7 @@ import { FwDatePicker as __default__$1 } from './fw-date-picker.js';
24
24
  import { FwPopover as __default__$3 } from './fw-popover.js';
25
25
  import { FwPeriodSelector as script$f } from './fw-period-selector.js';
26
26
  import { FwMediaPicker as script$c } from './fw-media-picker.js';
27
+ import { FwSlider as script$j } from './fw-slider.js';
27
28
  import { FwEmailPulse as __default__$2, FwSuccessPulse as __default__$4 } from './fw-animations.js';
28
29
  import { F as Form } from './vee-validate.esm-3ptvCDR1.js';
29
30
  import { s as script$7 } from './fw-input-XeI-IKly.js';
@@ -31,7 +32,7 @@ import { s as script$5 } from './fw-dropdown-ClttctHK.js';
31
32
  import { s as script$2 } from './fw-card-bsYbpPmW.js';
32
33
  import { s as script$1 } from './fw-button-BhZXMN8a.js';
33
34
  import { _ as __default__$6 } from './fw-tag-DgsnsY7O.js';
34
- import { _ as __default__$5, s as script$k, a as script$l } from './fw-table-row-BlpxQ10C.js';
35
+ import { _ as __default__$5, s as script$l, a as script$m } from './fw-table-row-BlpxQ10C.js';
35
36
  import { s as script$6 } from './fw-image-6o3ZOSCW.js';
36
37
  import { s as script$8 } from './fw-loading-bar-DThRjdw1.js';
37
38
  import { s as script$a } from './fw-loading-spinner-CFFbujSq.js';
@@ -71,15 +72,16 @@ var components = /*#__PURE__*/Object.freeze({
71
72
  FwProgressBar: script$g,
72
73
  FwProviderList: script$h,
73
74
  FwSidebarMenu: script$i,
75
+ FwSlider: script$j,
74
76
  FwSuccessPulse: __default__$4,
75
- FwTab: script$j,
77
+ FwTab: script$k,
76
78
  FwTable: __default__$5,
77
- FwTableHead: script$k,
78
- FwTableRow: script$l,
79
- FwTabs: script$m,
79
+ FwTableHead: script$l,
80
+ FwTableRow: script$m,
81
+ FwTabs: script$n,
80
82
  FwTag: __default__$6,
81
- FwToast: script$n,
82
- FwTransactionsCard: script$o
83
+ FwToast: script$o,
84
+ FwTransactionsCard: script$p
83
85
  });
84
86
 
85
87
  var modalService = function modalService(options) {
@@ -113,7 +115,7 @@ var toastService = function toastService() {
113
115
  }));
114
116
  createApp({
115
117
  render: function render() {
116
- return h(script$n, props);
118
+ return h(script$o, props);
117
119
  }
118
120
  }).mount(elementToMount);
119
121
  };
@@ -142,4 +144,4 @@ var install = function install(app) {
142
144
  });
143
145
  };
144
146
 
145
- export { __default__ as FwAccordion, script as FwBarChart, script$1 as FwButton, script$2 as FwCard, script$3 as FwCheckbox, __default__$1 as FwDatePicker, script$4 as FwDrawer, script$5 as FwDropdown, __default__$2 as FwEmailPulse, Form as FwForm, script$6 as FwImage, script$7 as FwInput, script$8 as FwLoadingBar, script$9 as FwLoadingCard, script$a as FwLoadingSpinner, script$b as FwLoadingTable, script$c as FwMediaPicker, script$d as FwModal, script$e as FwNavigationMenu, script$f as FwPeriodSelector, __default__$3 as FwPopover, script$g as FwProgressBar, script$h as FwProviderList, script$i as FwSidebarMenu, __default__$4 as FwSuccessPulse, script$j as FwTab, __default__$5 as FwTable, script$k as FwTableHead, script$l as FwTableRow, script$m as FwTabs, __default__$6 as FwTag, script$n as FwToast, script$o as FwTransactionsCard, install as default, modalService, toastService };
147
+ export { __default__ as FwAccordion, script as FwBarChart, script$1 as FwButton, script$2 as FwCard, script$3 as FwCheckbox, __default__$1 as FwDatePicker, script$4 as FwDrawer, script$5 as FwDropdown, __default__$2 as FwEmailPulse, Form as FwForm, script$6 as FwImage, script$7 as FwInput, script$8 as FwLoadingBar, script$9 as FwLoadingCard, script$a as FwLoadingSpinner, script$b as FwLoadingTable, script$c as FwMediaPicker, script$d as FwModal, script$e as FwNavigationMenu, script$f as FwPeriodSelector, __default__$3 as FwPopover, script$g as FwProgressBar, script$h as FwProviderList, script$i as FwSidebarMenu, script$j as FwSlider, __default__$4 as FwSuccessPulse, script$k as FwTab, __default__$5 as FwTable, script$l as FwTableHead, script$m as FwTableRow, script$n as FwTabs, __default__$6 as FwTag, script$o as FwToast, script$p as FwTransactionsCard, install as default, modalService, toastService };