@aquera/nile-elements 0.1.57 → 0.1.58-beta-1.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.
Files changed (121) hide show
  1. package/README.md +5 -3
  2. package/demo/index.html +10 -26
  3. package/demo/index.js +83 -0
  4. package/dist/index.cjs.js +1 -1
  5. package/dist/index.esm.js +1 -1
  6. package/dist/index.js +276 -281
  7. package/dist/internal/resizable-table-helper.cjs.js +2 -0
  8. package/dist/internal/resizable-table-helper.cjs.js.map +1 -0
  9. package/dist/internal/resizable-table-helper.esm.js +1 -0
  10. package/dist/internal/resizable-table-styles.cjs.js +2 -0
  11. package/dist/internal/resizable-table-styles.cjs.js.map +1 -0
  12. package/dist/internal/resizable-table-styles.esm.js +120 -0
  13. package/dist/nile-table-body/index.cjs.js +1 -1
  14. package/dist/nile-table-body/index.esm.js +1 -1
  15. package/dist/nile-table-body/nile-table-body.cjs.js +1 -1
  16. package/dist/nile-table-body/nile-table-body.cjs.js.map +1 -1
  17. package/dist/nile-table-body/nile-table-body.css.cjs.js +1 -1
  18. package/dist/nile-table-body/nile-table-body.css.cjs.js.map +1 -1
  19. package/dist/nile-table-body/nile-table-body.css.esm.js +5 -2
  20. package/dist/nile-table-body/nile-table-body.esm.js +3 -2
  21. package/dist/nile-table-cell-item/index.cjs.js +1 -1
  22. package/dist/nile-table-cell-item/index.esm.js +1 -1
  23. package/dist/nile-table-cell-item/nile-table-cell-item.cjs.js +1 -1
  24. package/dist/nile-table-cell-item/nile-table-cell-item.cjs.js.map +1 -1
  25. package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js +1 -1
  26. package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js.map +1 -1
  27. package/dist/nile-table-cell-item/nile-table-cell-item.css.esm.js +21 -3
  28. package/dist/nile-table-cell-item/nile-table-cell-item.esm.js +8 -3
  29. package/dist/nile-table-header-item/index.cjs.js +1 -1
  30. package/dist/nile-table-header-item/index.esm.js +1 -1
  31. package/dist/nile-table-header-item/nile-table-header-item.cjs.js +1 -1
  32. package/dist/nile-table-header-item/nile-table-header-item.cjs.js.map +1 -1
  33. package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js +1 -1
  34. package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js.map +1 -1
  35. package/dist/nile-table-header-item/nile-table-header-item.css.esm.js +8 -2
  36. package/dist/nile-table-header-item/nile-table-header-item.esm.js +64 -32
  37. package/dist/src/index.d.ts +0 -1
  38. package/dist/src/index.js +0 -1
  39. package/dist/src/index.js.map +1 -1
  40. package/dist/src/internal/resizable-table-helper.d.ts +59 -0
  41. package/dist/src/internal/resizable-table-helper.js +111 -0
  42. package/dist/src/internal/resizable-table-helper.js.map +1 -0
  43. package/dist/src/internal/resizable-table-styles.d.ts +16 -0
  44. package/dist/src/internal/resizable-table-styles.js +137 -0
  45. package/dist/src/internal/resizable-table-styles.js.map +1 -0
  46. package/dist/src/nile-table-body/nile-table-body.css.js +4 -0
  47. package/dist/src/nile-table-body/nile-table-body.css.js.map +1 -1
  48. package/dist/src/nile-table-body/nile-table-body.d.ts +2 -0
  49. package/dist/src/nile-table-body/nile-table-body.js +11 -0
  50. package/dist/src/nile-table-body/nile-table-body.js.map +1 -1
  51. package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js +20 -1
  52. package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js.map +1 -1
  53. package/dist/src/nile-table-cell-item/nile-table-cell-item.d.ts +3 -0
  54. package/dist/src/nile-table-cell-item/nile-table-cell-item.js +27 -8
  55. package/dist/src/nile-table-cell-item/nile-table-cell-item.js.map +1 -1
  56. package/dist/src/nile-table-header-item/nile-table-header-item.css.js +7 -0
  57. package/dist/src/nile-table-header-item/nile-table-header-item.css.js.map +1 -1
  58. package/dist/src/nile-table-header-item/nile-table-header-item.d.ts +3 -0
  59. package/dist/src/nile-table-header-item/nile-table-header-item.js +86 -35
  60. package/dist/src/nile-table-header-item/nile-table-header-item.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +4 -4
  63. package/src/index.ts +1 -2
  64. package/src/internal/resizable-table-helper.ts +151 -0
  65. package/src/internal/resizable-table-styles.ts +144 -0
  66. package/src/nile-table-body/nile-table-body.css.ts +4 -0
  67. package/src/nile-table-body/nile-table-body.ts +10 -0
  68. package/src/nile-table-cell-item/nile-table-cell-item.css.ts +20 -1
  69. package/src/nile-table-cell-item/nile-table-cell-item.ts +22 -5
  70. package/src/nile-table-header-item/nile-table-header-item.css.ts +7 -0
  71. package/src/nile-table-header-item/nile-table-header-item.ts +94 -45
  72. package/vscode-html-custom-data.json +59 -138
  73. package/dist/nile-slider/index.cjs.js +0 -2
  74. package/dist/nile-slider/index.cjs.js.map +0 -1
  75. package/dist/nile-slider/index.esm.js +0 -1
  76. package/dist/nile-slider/nile-slider.cjs.js +0 -2
  77. package/dist/nile-slider/nile-slider.cjs.js.map +0 -1
  78. package/dist/nile-slider/nile-slider.css.cjs.js +0 -2
  79. package/dist/nile-slider/nile-slider.css.cjs.js.map +0 -1
  80. package/dist/nile-slider/nile-slider.css.esm.js +0 -106
  81. package/dist/nile-slider/nile-slider.esm.js +0 -27
  82. package/dist/nile-slider/nile-slider.template.cjs.js +0 -2
  83. package/dist/nile-slider/nile-slider.template.cjs.js.map +0 -1
  84. package/dist/nile-slider/nile-slider.template.esm.js +0 -59
  85. package/dist/nile-slider/types/nile-slider.enums.cjs.js +0 -2
  86. package/dist/nile-slider/types/nile-slider.enums.cjs.js.map +0 -1
  87. package/dist/nile-slider/types/nile-slider.enums.esm.js +0 -1
  88. package/dist/nile-slider/types/nile-slider.types.cjs.js +0 -2
  89. package/dist/nile-slider/types/nile-slider.types.cjs.js.map +0 -1
  90. package/dist/nile-slider/types/nile-slider.types.esm.js +0 -1
  91. package/dist/nile-slider/utils/nile-slider.utils.cjs.js +0 -2
  92. package/dist/nile-slider/utils/nile-slider.utils.cjs.js.map +0 -1
  93. package/dist/nile-slider/utils/nile-slider.utils.esm.js +0 -1
  94. package/dist/src/nile-slider/index.d.ts +0 -1
  95. package/dist/src/nile-slider/index.js +0 -2
  96. package/dist/src/nile-slider/index.js.map +0 -1
  97. package/dist/src/nile-slider/nile-slider.css.d.ts +0 -6
  98. package/dist/src/nile-slider/nile-slider.css.js +0 -118
  99. package/dist/src/nile-slider/nile-slider.css.js.map +0 -1
  100. package/dist/src/nile-slider/nile-slider.d.ts +0 -48
  101. package/dist/src/nile-slider/nile-slider.js +0 -217
  102. package/dist/src/nile-slider/nile-slider.js.map +0 -1
  103. package/dist/src/nile-slider/nile-slider.template.d.ts +0 -5
  104. package/dist/src/nile-slider/nile-slider.template.js +0 -73
  105. package/dist/src/nile-slider/nile-slider.template.js.map +0 -1
  106. package/dist/src/nile-slider/types/nile-slider.enums.d.ts +0 -10
  107. package/dist/src/nile-slider/types/nile-slider.enums.js +0 -2
  108. package/dist/src/nile-slider/types/nile-slider.enums.js.map +0 -1
  109. package/dist/src/nile-slider/types/nile-slider.types.d.ts +0 -1
  110. package/dist/src/nile-slider/types/nile-slider.types.js +0 -2
  111. package/dist/src/nile-slider/types/nile-slider.types.js.map +0 -1
  112. package/dist/src/nile-slider/utils/nile-slider.utils.d.ts +0 -11
  113. package/dist/src/nile-slider/utils/nile-slider.utils.js +0 -99
  114. package/dist/src/nile-slider/utils/nile-slider.utils.js.map +0 -1
  115. package/src/nile-slider/index.ts +0 -1
  116. package/src/nile-slider/nile-slider.css.ts +0 -119
  117. package/src/nile-slider/nile-slider.template.ts +0 -77
  118. package/src/nile-slider/nile-slider.ts +0 -215
  119. package/src/nile-slider/types/nile-slider.enums.ts +0 -10
  120. package/src/nile-slider/types/nile-slider.types.ts +0 -13
  121. package/src/nile-slider/utils/nile-slider.utils.ts +0 -136
@@ -1,217 +0,0 @@
1
- /**
2
- * Copyright Aquera Inc 2025
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { __decorate } from "tslib";
8
- import { styles } from './nile-slider.css';
9
- import NileElement from '../internal/nile-element';
10
- import { classMap } from 'lit/directives/class-map.js';
11
- import { html } from 'lit';
12
- import { customElement, property } from 'lit/decorators.js';
13
- import { rangeSlider, singleSlider, lableContaier } from './nile-slider.template';
14
- import { handleSingleSlider, handleRangeOne, handleRangeTwo, getHtmlElements, removeMoveListeners, valueToPercent, handleTwoThumbClick, addMoveListeners } from './utils/nile-slider.utils';
15
- /**
16
- * Nile slider component.
17
- *
18
- * @tag nile-slider
19
- */
20
- let NileSlider = class NileSlider extends NileElement {
21
- constructor() {
22
- super(...arguments);
23
- this.minValue = 0;
24
- this.value = this.minValue;
25
- this.maxValue = 100;
26
- this.rangeOneValue = this.minValue;
27
- this.rangeTwoValue = this.maxValue;
28
- this.showLabel = false;
29
- this.labelStart = "";
30
- this.labelEnd = "";
31
- this.rangeSlider = false;
32
- this.labelPosition = "top";
33
- this.tooltipPosition = "top";
34
- this.activeThumb = null;
35
- this.onMouseMove = (e) => {
36
- const rect = this.range.getBoundingClientRect();
37
- if (!this.rangeSlider) {
38
- handleSingleSlider(e, rect, this);
39
- }
40
- else {
41
- if (this.activeThumb === 'one') {
42
- handleRangeOne(e, rect, this);
43
- }
44
- else if (this.activeThumb === 'two') {
45
- handleRangeTwo(e, rect, this);
46
- }
47
- const start = valueToPercent(this.rangeOneValue, this);
48
- const end = valueToPercent(this.rangeTwoValue, this);
49
- const left = Math.min(start, end);
50
- const width = Math.abs(end - start);
51
- if (this.rangeTwoValue >= this.rangeOneValue) {
52
- this.completed.style.left = `${left}%`;
53
- this.completed.style.width = `${width}%`;
54
- }
55
- }
56
- };
57
- this.onMouseUp = () => {
58
- if (!this.rangeSlider)
59
- this.emit("nile-change-end" /* NileSliderEvents.NILE_CHANGE_END */, { value: this.value });
60
- else {
61
- this.emit("nile-button-first-change-end" /* NileSliderEvents.NILE_BUTTON_FIRST_CHANGE_END */, { value: this.rangeOneValue });
62
- this.emit("nile-button-last-change-end" /* NileSliderEvents.NILE_BUTTON_LAST_CHANGE_END */, { value: this.rangeTwoValue });
63
- }
64
- this.activeThumb = null;
65
- removeMoveListeners(this);
66
- };
67
- this.onMouseDown = (e) => {
68
- const rect = this.range.getBoundingClientRect();
69
- const clickX = e.clientX - rect.left;
70
- const percent = (clickX / rect.width) * 100;
71
- const value = this.minValue + (percent / 100) * (this.maxValue - this.minValue);
72
- if (!this.rangeSlider) {
73
- handleSingleSlider(e, rect, this);
74
- this.activeThumb = 'one';
75
- addMoveListeners(this);
76
- }
77
- else {
78
- handleTwoThumbClick(value, this);
79
- const distToOne = Math.abs(value - this.rangeOneValue);
80
- const distToTwo = Math.abs(value - this.rangeTwoValue);
81
- this.activeThumb = distToOne <= distToTwo ? 'one' : 'two';
82
- addMoveListeners(this);
83
- }
84
- };
85
- }
86
- static get styles() {
87
- return [styles];
88
- }
89
- connectedCallback() {
90
- super.connectedCallback();
91
- this.emit("nile-init" /* NileSliderEvents.NILE_INIT */);
92
- if (this.rangeSlider) {
93
- this.checkRangeValidity();
94
- }
95
- }
96
- firstUpdated(changedProps) {
97
- getHtmlElements(this);
98
- if (!this.rangeSlider && changedProps.has('value')) {
99
- this.value = this.checkValueValidity(this.value, this.minValue, this.maxValue);
100
- const percent = valueToPercent(this.value, this);
101
- this.buttonOne.style.left = `${percent}%`;
102
- this.completed.style.width = `${percent}%`;
103
- }
104
- else if (this.rangeSlider) {
105
- const percentOne = valueToPercent(this.rangeOneValue, this);
106
- const percentTwo = valueToPercent(this.rangeTwoValue, this);
107
- if (this.buttonOne)
108
- this.buttonOne.style.left = `${percentOne}%`;
109
- if (this.buttonTwo)
110
- this.buttonTwo.style.left = `${percentTwo}%`;
111
- const left = Math.min(percentOne, percentTwo);
112
- const width = Math.abs(percentTwo - percentOne);
113
- this.completed.style.left = `${left}%`;
114
- this.completed.style.width = `${width}%`;
115
- }
116
- }
117
- checkValueValidity(value, min, max) {
118
- if (max - min <= 1) {
119
- return Math.max(min, Math.min(value, max));
120
- }
121
- return Math.floor(Math.max(min, Math.min(value, max)));
122
- }
123
- checkRangeValidity() {
124
- if (this.rangeTwoValue > this.maxValue) {
125
- this.rangeTwoValue = this.maxValue;
126
- }
127
- else if (this.rangeTwoValue < this.rangeOneValue) {
128
- this.rangeTwoValue = this.rangeOneValue;
129
- }
130
- if (this.rangeOneValue < this.minValue) {
131
- this.rangeOneValue = this.minValue;
132
- }
133
- else if (this.rangeOneValue > this.rangeTwoValue) {
134
- this.rangeOneValue = this.rangeTwoValue;
135
- }
136
- }
137
- render() {
138
- const hasLabels = this.showLabel;
139
- const ariaLabelledby = hasLabels ? 'label-start label-end' : undefined;
140
- return html `
141
- <div
142
- part="base"
143
- class=${classMap({
144
- 'container': true,
145
- 'align-item-center': !hasLabels
146
- })}
147
- >
148
- <slot class="span" name="prefix"></slot>
149
-
150
- <div
151
- part="range-container"
152
- class=${classMap({
153
- 'range-container': true,
154
- 'column-reverse': this.labelPosition === 'bottom'
155
- })}
156
- >
157
- ${hasLabels ? lableContaier(this) : html ``}
158
-
159
- <div
160
- class="range"
161
- part="range"
162
- role="group"
163
- aria-labelledby=${ariaLabelledby}
164
- >
165
- <span class="range-completed" part="range-completed"></span>
166
- ${this.rangeSlider ? rangeSlider(this) : singleSlider(this)}
167
- </div>
168
- </div>
169
-
170
- <slot class="span" name="suffix"></slot>
171
- </div>
172
- `;
173
- }
174
- disconnectedCallback() {
175
- super.disconnectedCallback();
176
- this.emit("nile-destroy" /* NileSliderEvents.NILE_DESTROY */);
177
- }
178
- };
179
- __decorate([
180
- property({ type: Number })
181
- ], NileSlider.prototype, "minValue", void 0);
182
- __decorate([
183
- property({ type: Number })
184
- ], NileSlider.prototype, "value", void 0);
185
- __decorate([
186
- property({ type: Number })
187
- ], NileSlider.prototype, "maxValue", void 0);
188
- __decorate([
189
- property({ type: Number })
190
- ], NileSlider.prototype, "rangeOneValue", void 0);
191
- __decorate([
192
- property({ type: Number })
193
- ], NileSlider.prototype, "rangeTwoValue", void 0);
194
- __decorate([
195
- property({ type: Boolean })
196
- ], NileSlider.prototype, "showLabel", void 0);
197
- __decorate([
198
- property({ type: String })
199
- ], NileSlider.prototype, "labelStart", void 0);
200
- __decorate([
201
- property({ type: String })
202
- ], NileSlider.prototype, "labelEnd", void 0);
203
- __decorate([
204
- property({ type: Boolean })
205
- ], NileSlider.prototype, "rangeSlider", void 0);
206
- __decorate([
207
- property({ type: String })
208
- ], NileSlider.prototype, "labelPosition", void 0);
209
- __decorate([
210
- property({ type: String })
211
- ], NileSlider.prototype, "tooltipPosition", void 0);
212
- NileSlider = __decorate([
213
- customElement('nile-slider')
214
- ], NileSlider);
215
- export { NileSlider };
216
- export default NileSlider;
217
- //# sourceMappingURL=nile-slider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-slider.js","sourceRoot":"","sources":["../../../src/nile-slider/nile-slider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAElC;;;;GAIG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAApC;;QAKuB,aAAQ,GAAW,CAAC,CAAC;QACrB,UAAK,GAAW,IAAI,CAAC,QAAQ,CAAC;QAC9B,aAAQ,GAAW,GAAG,CAAC;QACvB,kBAAa,GAAW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;CACF,CAAA;AAzK6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAuC;AACtC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAuC;AACtC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;6CAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;+CAA8B;AAC7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA0C;AAf1D,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8KtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { styles } from './nile-slider.css';\nimport NileElement from '../internal/nile-element';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { html, CSSResultArray, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TooltipPosition } from './types/nile-slider.types';\nimport { NileSliderEvents } from './types/nile-slider.enums';\nimport { rangeSlider, singleSlider, lableContaier } from './nile-slider.template';\nimport { \n handleSingleSlider, \n handleRangeOne, \n handleRangeTwo, \n getHtmlElements, \n removeMoveListeners,\n valueToPercent,\n handleTwoThumbClick,\n addMoveListeners\n} from './utils/nile-slider.utils'\n\n/** \n * Nile slider component.\n *\n * @tag nile-slider\n */\n@customElement('nile-slider')\nexport class NileSlider extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Number }) minValue: number = 0;\n @property({ type: Number }) value: number = this.minValue;\n @property({ type: Number }) maxValue: number = 100;\n @property({ type: Number }) rangeOneValue: number = this.minValue;\n @property({ type: Number }) rangeTwoValue: number = this.maxValue;\n @property({ type: Boolean}) showLabel: boolean = false;\n @property({ type: String }) labelStart: string = \"\";\n @property({ type: String }) labelEnd: string = \"\";\n @property({ type: Boolean}) rangeSlider: boolean = false;\n @property({ type: String }) labelPosition: string = \"top\";\n @property({ type: String }) tooltipPosition: TooltipPosition = \"top\";\n\n public buttonOne!: HTMLElement;\n public buttonTwo!: HTMLElement;\n public range!: HTMLElement;\n public completed!: HTMLElement;\n public activeThumb: 'one' | 'two' | null = null;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.emit(NileSliderEvents.NILE_INIT); \n\n if(this.rangeSlider) {\n this.checkRangeValidity();\n }\n }\n\n firstUpdated(changedProps: Map<string, any>): void {\n getHtmlElements(this);\n\n if (!this.rangeSlider && changedProps.has('value')) {\n this.value = this.checkValueValidity(this.value, this.minValue, this.maxValue);\n const percent = valueToPercent(this.value, this);\n \n this.buttonOne.style.left = `${percent}%`;\n this.completed.style.width = `${percent}%`;\n } else if (this.rangeSlider) {\n \n const percentOne = valueToPercent(this.rangeOneValue, this);\n const percentTwo = valueToPercent(this.rangeTwoValue, this);\n \n if (this.buttonOne) this.buttonOne.style.left = `${percentOne}%`;\n if (this.buttonTwo) this.buttonTwo.style.left = `${percentTwo}%`;\n \n const left = Math.min(percentOne, percentTwo);\n const width = Math.abs(percentTwo - percentOne);\n \n this.completed.style.left = `${left}%`;\n this.completed.style.width = `${width}%`;\n }\n }\n\n checkValueValidity(value: number, min: number, max: number): number {\n if(max - min <= 1) { \n return Math.max(min, Math.min(value, max));\n }\n return Math.floor(Math.max(min, Math.min(value, max)));\n }\n\n checkRangeValidity(): void {\n if(this.rangeTwoValue > this.maxValue) {\n this.rangeTwoValue = this.maxValue;\n } else if(this.rangeTwoValue < this.rangeOneValue) {\n this.rangeTwoValue = this.rangeOneValue;\n }\n\n if(this.rangeOneValue < this.minValue) {\n this.rangeOneValue = this.minValue;\n } else if(this.rangeOneValue > this.rangeTwoValue) {\n this.rangeOneValue = this.rangeTwoValue;\n }\n } \n\n public onMouseMove = (e: MouseEvent): void => {\n const rect = this.range.getBoundingClientRect();\n\n if (!this.rangeSlider) {\n handleSingleSlider(e, rect, this);\n } else {\n if (this.activeThumb === 'one') {\n handleRangeOne(e, rect, this);\n } else if (this.activeThumb === 'two') {\n handleRangeTwo(e, rect, this);\n }\n\n const start = valueToPercent(this.rangeOneValue, this);\n const end = valueToPercent(this.rangeTwoValue, this);\n const left = Math.min(start, end);\n const width = Math.abs(end - start);\n\n if(this.rangeTwoValue >= this.rangeOneValue) {\n this.completed.style.left = `${left}%`;\n this.completed.style.width = `${width}%`;\n }\n }\n };\n\n public onMouseUp = (): void => {\n if(!this.rangeSlider) this.emit(NileSliderEvents.NILE_CHANGE_END, { value: this.value });\n else {\n this.emit(NileSliderEvents.NILE_BUTTON_FIRST_CHANGE_END, { value: this.rangeOneValue });\n this.emit(NileSliderEvents.NILE_BUTTON_LAST_CHANGE_END, { value: this.rangeTwoValue });\n }\n this.activeThumb = null;\n removeMoveListeners(this);\n };\n\n public onMouseDown = (e: MouseEvent): void => {\n const rect = this.range.getBoundingClientRect();\n const clickX = e.clientX - rect.left;\n const percent = (clickX / rect.width) * 100;\n const value = this.minValue + (percent / 100) * (this.maxValue - this.minValue);\n \n if (!this.rangeSlider) {\n handleSingleSlider(e, rect, this);\n this.activeThumb = 'one';\n addMoveListeners(this);\n } else {\n handleTwoThumbClick(value, this);\n const distToOne = Math.abs(value - this.rangeOneValue);\n const distToTwo = Math.abs(value - this.rangeTwoValue);\n this.activeThumb = distToOne <= distToTwo ? 'one' : 'two';\n addMoveListeners(this);\n }\n };\n\n public render(): TemplateResult {\n const hasLabels = this.showLabel;\n const ariaLabelledby = hasLabels ? 'label-start label-end' : undefined;\n \n return html`\n <div\n part=\"base\"\n class=${classMap({\n 'container': true,\n 'align-item-center': !hasLabels\n })}\n >\n <slot class=\"span\" name=\"prefix\"></slot>\n \n <div\n part=\"range-container\"\n class=${classMap({\n 'range-container': true,\n 'column-reverse': this.labelPosition === 'bottom'\n })}\n >\n ${hasLabels ? lableContaier(this) : html``}\n \n <div\n class=\"range\"\n part=\"range\"\n role=\"group\"\n aria-labelledby=${ariaLabelledby}\n >\n <span class=\"range-completed\" part=\"range-completed\"></span>\n ${this.rangeSlider ? rangeSlider(this) : singleSlider(this)}\n </div>\n </div>\n \n <slot class=\"span\" name=\"suffix\"></slot>\n </div>\n `;\n } \n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.emit(NileSliderEvents.NILE_DESTROY);\n }\n}\n\nexport default NileSlider;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-slider': NileSlider;\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- import NileSlider from './nile-slider';
3
- export declare const rangeSlider: (nileSlider: NileSlider) => TemplateResult;
4
- export declare const singleSlider: (nileSlider: NileSlider) => TemplateResult;
5
- export declare const lableContaier: (nileSlider: NileSlider) => TemplateResult;
@@ -1,73 +0,0 @@
1
- import { html } from 'lit';
2
- import { classMap } from 'lit/directives/class-map.js';
3
- export const rangeSlider = (nileSlider) => {
4
- return html `
5
- <div>
6
- <nile-tooltip
7
- content=${nileSlider.rangeOneValue}
8
- placement=${nileSlider.tooltipPosition}
9
- >
10
- <div
11
- id="range-one"
12
- class="range-button"
13
- part="range-button"
14
- role="slider"
15
- tabindex="0"
16
- aria-valuemin=${nileSlider.minValue}
17
- aria-valuemax=${nileSlider.maxValue}
18
- aria-valuenow=${nileSlider.rangeOneValue}
19
- aria-label="Minimum value"
20
- ></div>
21
- </nile-tooltip>
22
- <nile-tooltip
23
- content=${nileSlider.rangeTwoValue}
24
- placement=${nileSlider.tooltipPosition}
25
- >
26
- <div
27
- id="range-two"
28
- class="range-button-two"
29
- part="range-button-two"
30
- role="slider"
31
- tabindex="0"
32
- aria-valuemin=${nileSlider.minValue}
33
- aria-valuemax=${nileSlider.maxValue}
34
- aria-valuenow=${nileSlider.rangeTwoValue}
35
- aria-label="Maximum value"
36
- ></div>
37
- </nile-tooltip>
38
- </div>
39
- `;
40
- };
41
- export const singleSlider = (nileSlider) => {
42
- return html `
43
- <div>
44
- <nile-tooltip
45
- content=${nileSlider.value}
46
- placement=${nileSlider.tooltipPosition}
47
- >
48
- <div
49
- class=${classMap({
50
- 'range-button': true,
51
- 'range-button-active': nileSlider.activeThumb === 'one',
52
- })}
53
- part="range-button"
54
- role="slider"
55
- tabindex="0"
56
- aria-valuemin=${nileSlider.minValue}
57
- aria-valuemax=${nileSlider.maxValue}
58
- aria-valuenow=${nileSlider.value}
59
- aria-label=${nileSlider.ariaLabel || "Slider value"}
60
- ></div>
61
- </nile-tooltip>
62
- </div>
63
- `;
64
- };
65
- export const lableContaier = (nileSlider) => {
66
- return html `
67
- <div part="label-container" class="label-container">
68
- <span id="label-start">${nileSlider.labelStart}</span>
69
- <span id="label-end">${nileSlider.labelEnd}</span>
70
- </div>
71
- `;
72
- };
73
- //# sourceMappingURL=nile-slider.template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-slider.template.js","sourceRoot":"","sources":["../../../src/nile-slider/nile-slider.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAsB,EAAkB,EAAE;IACpE,OAAO,IAAI,CAAA;;;kBAGK,UAAU,CAAC,aAAa;oBACtB,UAAU,CAAC,eAAe;;;;;;;;0BAQpB,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,aAAa;;;;;kBAKhC,UAAU,CAAC,aAAa;oBACtB,UAAU,CAAC,eAAe;;;;;;;;0BAQpB,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,aAAa;;;;;GAK/C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAsB,EAAkB,EAAE;IACrE,OAAO,IAAI,CAAA;;;kBAGK,UAAU,CAAC,KAAK;oBACd,UAAU,CAAC,eAAe;;;kBAG5B,QAAQ,CAAC;QACf,cAAc,EAAE,IAAI;QACpB,qBAAqB,EAAE,UAAU,CAAC,WAAW,KAAK,KAAK;KACxD,CAAC;;;;0BAIc,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,QAAQ;0BACnB,UAAU,CAAC,KAAK;uBACnB,UAAU,CAAC,SAAS,IAAI,cAAc;;;;GAI1D,CAAC;AACJ,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAsB,EAAkB,EAAE;IACtE,OAAO,IAAI,CAAA;;+BAEkB,UAAU,CAAC,UAAU;6BACvB,UAAU,CAAC,QAAQ;;GAE7C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { TemplateResult, html } from 'lit';\nimport NileSlider from './nile-slider';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport const rangeSlider = (nileSlider: NileSlider): TemplateResult => {\n return html`\n <div>\n <nile-tooltip\n content=${nileSlider.rangeOneValue}\n placement=${nileSlider.tooltipPosition}\n >\n <div \n id=\"range-one\" \n class=\"range-button\"\n part=\"range-button\"\n role=\"slider\"\n tabindex=\"0\"\n aria-valuemin=${nileSlider.minValue}\n aria-valuemax=${nileSlider.maxValue}\n aria-valuenow=${nileSlider.rangeOneValue}\n aria-label=\"Minimum value\"\n ></div>\n </nile-tooltip>\n <nile-tooltip\n content=${nileSlider.rangeTwoValue}\n placement=${nileSlider.tooltipPosition}\n >\n <div\n id=\"range-two\"\n class=\"range-button-two\"\n part=\"range-button-two\"\n role=\"slider\"\n tabindex=\"0\"\n aria-valuemin=${nileSlider.minValue}\n aria-valuemax=${nileSlider.maxValue}\n aria-valuenow=${nileSlider.rangeTwoValue}\n aria-label=\"Maximum value\"\n ></div>\n </nile-tooltip>\n </div>\n `;\n};\n\nexport const singleSlider = (nileSlider: NileSlider): TemplateResult => {\n return html`\n <div>\n <nile-tooltip\n content=${nileSlider.value}\n placement=${nileSlider.tooltipPosition}\n >\n <div \n class=${classMap({\n 'range-button': true,\n 'range-button-active': nileSlider.activeThumb === 'one',\n })} \n part=\"range-button\"\n role=\"slider\"\n tabindex=\"0\"\n aria-valuemin=${nileSlider.minValue}\n aria-valuemax=${nileSlider.maxValue}\n aria-valuenow=${nileSlider.value}\n aria-label=${nileSlider.ariaLabel || \"Slider value\"}\n ></div>\n </nile-tooltip>\n </div>\n `;\n};\n\n\nexport const lableContaier = (nileSlider: NileSlider): TemplateResult => {\n return html`\n <div part=\"label-container\" class=\"label-container\">\n <span id=\"label-start\">${nileSlider.labelStart}</span>\n <span id=\"label-end\">${nileSlider.labelEnd}</span>\n </div>\n `;\n};"]}
@@ -1,10 +0,0 @@
1
- export declare const enum NileSliderEvents {
2
- NILE_INIT = "nile-init",
3
- NILE_CHANGE = "nile-change",
4
- NILE_CHANGE_END = "nile-change-end",
5
- NILE_BUTTON_FIRST_CHANGE = "nile-button-first-change",
6
- NILE_BUTTON_LAST_CHANGE = "nile-button-last-change",
7
- NILE_BUTTON_FIRST_CHANGE_END = "nile-button-first-change-end",
8
- NILE_BUTTON_LAST_CHANGE_END = "nile-button-last-change-end",
9
- NILE_DESTROY = "nile-destroy"
10
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=nile-slider.enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-slider.enums.js","sourceRoot":"","sources":["../../../../src/nile-slider/types/nile-slider.enums.ts"],"names":[],"mappings":"","sourcesContent":["export const enum NileSliderEvents {\n NILE_INIT = \"nile-init\",\n NILE_CHANGE = \"nile-change\",\n NILE_CHANGE_END = \"nile-change-end\",\n NILE_BUTTON_FIRST_CHANGE = \"nile-button-first-change\",\n NILE_BUTTON_LAST_CHANGE = \"nile-button-last-change\",\n NILE_BUTTON_FIRST_CHANGE_END = \"nile-button-first-change-end\",\n NILE_BUTTON_LAST_CHANGE_END = \"nile-button-last-change-end\",\n NILE_DESTROY = \"nile-destroy\", \n}"]}
@@ -1 +0,0 @@
1
- export type TooltipPosition = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=nile-slider.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-slider.types.js","sourceRoot":"","sources":["../../../../src/nile-slider/types/nile-slider.types.ts"],"names":[],"mappings":"","sourcesContent":["export type TooltipPosition =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n"]}
@@ -1,11 +0,0 @@
1
- import NileSlider from '../nile-slider';
2
- export declare const getClampedPercent: (rect: DOMRect, x: number) => number;
3
- export declare const percentToValue: (percent: number, nileSlider: NileSlider) => number;
4
- export declare const valueToPercent: (value: number, nileSlider: NileSlider) => number;
5
- export declare const handleSingleSlider: (e: MouseEvent, rect: DOMRect, nileSlider: NileSlider) => void;
6
- export declare const handleRangeOne: (e: MouseEvent, rect: DOMRect, nileSlider: NileSlider) => void;
7
- export declare const handleRangeTwo: (e: MouseEvent, rect: DOMRect, nileSlider: NileSlider) => void;
8
- export declare const getHtmlElements: (nileSlider: NileSlider) => void;
9
- export declare const addMoveListeners: (nileSlider: NileSlider) => void;
10
- export declare const removeMoveListeners: (nileSlider: NileSlider) => void;
11
- export declare const handleTwoThumbClick: (value: number, nileSlider: NileSlider) => void;
@@ -1,99 +0,0 @@
1
- export const getClampedPercent = (rect, x) => {
2
- const clampedX = Math.max(0, Math.min(x, rect.width));
3
- const percent = (clampedX / rect.width) * 100;
4
- return percent;
5
- };
6
- export const percentToValue = (percent, nileSlider) => {
7
- const value = nileSlider.minValue + (percent / 100) * (nileSlider.maxValue - nileSlider.minValue);
8
- if (nileSlider.maxValue - nileSlider.minValue < 1) {
9
- return parseFloat(value.toFixed(2));
10
- }
11
- else {
12
- return Math.floor(value);
13
- }
14
- };
15
- export const valueToPercent = (value, nileSlider) => {
16
- return ((value - nileSlider.minValue) / (nileSlider.maxValue - nileSlider.minValue)) * 100;
17
- };
18
- export const handleSingleSlider = (e, rect, nileSlider) => {
19
- const x = e.clientX - rect.left;
20
- const percent = getClampedPercent(rect, x);
21
- nileSlider.value = percentToValue(percent, nileSlider);
22
- nileSlider.emit("nile-change" /* NileSliderEvents.NILE_CHANGE */, { value: nileSlider.value });
23
- nileSlider.buttonOne.style.left = `${percent}%`;
24
- nileSlider.completed.style.width = `${percent}%`;
25
- };
26
- export const handleRangeOne = (e, rect, nileSlider) => {
27
- const x = e.clientX - rect.left;
28
- const percent = getClampedPercent(rect, x);
29
- nileSlider.rangeOneValue = percentToValue(percent, nileSlider);
30
- nileSlider.rangeOneValue = Math.min(nileSlider.rangeOneValue, nileSlider.rangeTwoValue);
31
- nileSlider.emit("nile-button-first-change" /* NileSliderEvents.NILE_BUTTON_FIRST_CHANGE */, {
32
- value: nileSlider.rangeOneValue,
33
- });
34
- if (nileSlider.rangeTwoValue > nileSlider.rangeOneValue) {
35
- nileSlider.buttonOne.style.left = `${percent}%`;
36
- }
37
- };
38
- export const handleRangeTwo = (e, rect, nileSlider) => {
39
- const x = e.clientX - rect.left;
40
- const percent = getClampedPercent(rect, x);
41
- nileSlider.rangeTwoValue = percentToValue(percent, nileSlider);
42
- nileSlider.rangeTwoValue = Math.max(nileSlider.rangeTwoValue, nileSlider.rangeOneValue);
43
- nileSlider.emit("nile-button-last-change" /* NileSliderEvents.NILE_BUTTON_LAST_CHANGE */, {
44
- value: nileSlider.rangeTwoValue,
45
- });
46
- if (nileSlider.rangeTwoValue > nileSlider.rangeOneValue) {
47
- nileSlider.buttonTwo.style.left = `${percent}%`;
48
- }
49
- };
50
- export const getHtmlElements = (nileSlider) => {
51
- nileSlider.range = nileSlider.renderRoot.querySelector('.range');
52
- nileSlider.buttonOne = nileSlider.renderRoot.querySelector('.range-button');
53
- nileSlider.buttonTwo = nileSlider.renderRoot.querySelector('.range-button-two');
54
- nileSlider.completed = nileSlider.renderRoot.querySelector('.range-completed');
55
- nileSlider.range.addEventListener('mousedown', nileSlider.onMouseDown);
56
- nileSlider.buttonOne?.addEventListener('mousedown', () => {
57
- nileSlider.activeThumb = 'one';
58
- addMoveListeners(nileSlider);
59
- });
60
- nileSlider.buttonTwo?.addEventListener('mousedown', () => {
61
- nileSlider.activeThumb = 'two';
62
- addMoveListeners(nileSlider);
63
- });
64
- };
65
- export const addMoveListeners = (nileSlider) => {
66
- window.addEventListener('mousemove', nileSlider.onMouseMove);
67
- window.addEventListener('mouseup', nileSlider.onMouseUp);
68
- };
69
- export const removeMoveListeners = (nileSlider) => {
70
- window.removeEventListener('mousemove', nileSlider.onMouseMove);
71
- window.removeEventListener('mouseup', nileSlider.onMouseUp);
72
- };
73
- export const handleTwoThumbClick = (value, nileSlider) => {
74
- const distToOne = Math.abs(value - nileSlider.rangeOneValue);
75
- const distToTwo = Math.abs(value - nileSlider.rangeTwoValue);
76
- if (distToOne <= distToTwo) {
77
- const clamped = Math.min(value, nileSlider.rangeTwoValue);
78
- nileSlider.rangeOneValue = nileSlider.checkValueValidity(clamped, nileSlider.minValue, nileSlider.maxValue);
79
- }
80
- else {
81
- const clamped = Math.max(value, nileSlider.rangeOneValue);
82
- nileSlider.rangeTwoValue = nileSlider.checkValueValidity(clamped, nileSlider.minValue, nileSlider.maxValue);
83
- }
84
- const percentOne = valueToPercent(nileSlider.rangeOneValue, nileSlider);
85
- const percentTwo = valueToPercent(nileSlider.rangeTwoValue, nileSlider);
86
- nileSlider.buttonOne.style.left = `${percentOne}%`;
87
- nileSlider.buttonTwo.style.left = `${percentTwo}%`;
88
- const left = Math.min(percentOne, percentTwo);
89
- const width = Math.abs(percentTwo - percentOne);
90
- nileSlider.completed.style.left = `${left}%`;
91
- nileSlider.completed.style.width = `${width}%`;
92
- nileSlider.emit("nile-button-first-change" /* NileSliderEvents.NILE_BUTTON_FIRST_CHANGE */, {
93
- value: nileSlider.rangeOneValue,
94
- });
95
- nileSlider.emit("nile-button-last-change" /* NileSliderEvents.NILE_BUTTON_LAST_CHANGE */, {
96
- value: nileSlider.rangeTwoValue,
97
- });
98
- };
99
- //# sourceMappingURL=nile-slider.utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-slider.utils.js","sourceRoot":"","sources":["../../../../src/nile-slider/utils/nile-slider.utils.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAa,EACb,CAAS,EACD,EAAE;IACV,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,UAAsB,EAAU,EAAE;IAChF,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,GAAG,CAAC,OAAO,GAAG,GAAG,CAA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CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;IAEhD,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC;IAC7C,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,KAAK,GAAG,CAAC;IAE/C,UAAU,CAAC,IAAI,6EAA4C;QACzD,KAAK,EAAE,UAAU,CAAC,aAAa;KAChC,CAAC,CAAC;IACH,UAAU,CAAC,IAAI,2EAA2C;QACxD,KAAK,EAAE,UAAU,CAAC,aAAa;KAChC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import NileSlider from '../nile-slider';\nimport { NileSliderEvents } from '../types/nile-slider.enums';\n\nexport const getClampedPercent = (\n rect: DOMRect,\n x: number,\n): number => {\n const clampedX = Math.max(0, Math.min(x, rect.width)); \n const percent = (clampedX / rect.width) * 100;\n return percent;\n};\n\nexport const percentToValue = (percent: number, nileSlider: NileSlider): number => {\n const value = nileSlider.minValue + (percent / 100) * (nileSlider.maxValue - nileSlider.minValue);\n if(nileSlider.maxValue - nileSlider.minValue < 1) {\n return parseFloat(value.toFixed(2));\n } else {\n return Math.floor(value);\n }\n};\n\nexport const valueToPercent = (value: number, nileSlider: NileSlider): number => {\n return ((value - nileSlider.minValue) / (nileSlider.maxValue - nileSlider.minValue)) * 100;\n};\n\nexport const handleSingleSlider = (\n e: MouseEvent,\n rect: DOMRect,\n nileSlider: NileSlider\n): void => {\n const x = e.clientX - rect.left;\n const percent = getClampedPercent(rect, x);\n nileSlider.value = percentToValue(percent, nileSlider);\n nileSlider.emit(NileSliderEvents.NILE_CHANGE, { value: nileSlider.value });\n nileSlider.buttonOne.style.left = `${percent}%`;\n nileSlider.completed.style.width = `${percent}%`;\n};\n\nexport const handleRangeOne = (\n e: MouseEvent,\n rect: DOMRect,\n nileSlider: NileSlider\n): void => {\n const x = e.clientX - rect.left;\n const percent = getClampedPercent(rect, x);\n nileSlider.rangeOneValue = percentToValue(percent, nileSlider);\n nileSlider.rangeOneValue = Math.min(nileSlider.rangeOneValue, nileSlider.rangeTwoValue);\n nileSlider.emit(NileSliderEvents.NILE_BUTTON_FIRST_CHANGE, {\n value: nileSlider.rangeOneValue,\n });\n if (nileSlider.rangeTwoValue > nileSlider.rangeOneValue) {\n nileSlider.buttonOne.style.left = `${percent}%`;\n }\n};\n\nexport const handleRangeTwo = (\n e: MouseEvent,\n rect: DOMRect,\n nileSlider: NileSlider\n): void => {\n const x = e.clientX - rect.left;\n const percent = getClampedPercent(rect, x);\n nileSlider.rangeTwoValue = percentToValue(percent, nileSlider);\n nileSlider.rangeTwoValue = Math.max(nileSlider.rangeTwoValue, nileSlider.rangeOneValue);\n nileSlider.emit(NileSliderEvents.NILE_BUTTON_LAST_CHANGE, {\n value: nileSlider.rangeTwoValue,\n });\n\n if (nileSlider.rangeTwoValue > nileSlider.rangeOneValue) {\n nileSlider.buttonTwo.style.left = `${percent}%`;\n }\n};\n\nexport const getHtmlElements = (nileSlider: NileSlider) => {\n nileSlider.range = nileSlider.renderRoot.querySelector('.range') as HTMLElement;\n nileSlider.buttonOne = nileSlider.renderRoot.querySelector('.range-button') as HTMLElement;\n nileSlider.buttonTwo = nileSlider.renderRoot.querySelector('.range-button-two') as HTMLElement;\n nileSlider.completed = nileSlider.renderRoot.querySelector('.range-completed') as HTMLElement;\n\n nileSlider.range.addEventListener('mousedown', nileSlider.onMouseDown);\n\n nileSlider.buttonOne?.addEventListener('mousedown', () => {\n nileSlider.activeThumb = 'one';\n addMoveListeners(nileSlider);\n });\n\n nileSlider.buttonTwo?.addEventListener('mousedown', () => {\n nileSlider.activeThumb = 'two';\n addMoveListeners(nileSlider);\n });\n};\n\nexport const addMoveListeners = (nileSlider: NileSlider): void => {\n window.addEventListener('mousemove', nileSlider.onMouseMove);\n window.addEventListener('mouseup', nileSlider.onMouseUp);\n};\n\nexport const removeMoveListeners = (nileSlider: NileSlider): void => {\n window.removeEventListener('mousemove', nileSlider.onMouseMove);\n window.removeEventListener('mouseup', nileSlider.onMouseUp);\n};\n\nexport const handleTwoThumbClick = (\n value: number,\n nileSlider: NileSlider\n): void => {\n const distToOne = Math.abs(value - nileSlider.rangeOneValue);\n const distToTwo = Math.abs(value - nileSlider.rangeTwoValue);\n\n if (distToOne <= distToTwo) {\n const clamped = Math.min(value, nileSlider.rangeTwoValue);\n nileSlider.rangeOneValue = nileSlider.checkValueValidity(clamped, nileSlider.minValue, nileSlider.maxValue);\n } else {\n const clamped = Math.max(value, nileSlider.rangeOneValue);\n nileSlider.rangeTwoValue = nileSlider.checkValueValidity(clamped, nileSlider.minValue, nileSlider.maxValue);\n } \n\n const percentOne = valueToPercent(nileSlider.rangeOneValue, nileSlider);\n const percentTwo = valueToPercent(nileSlider.rangeTwoValue, nileSlider);\n\n nileSlider.buttonOne.style.left = `${percentOne}%`;\n nileSlider.buttonTwo.style.left = `${percentTwo}%`;\n\n const left = Math.min(percentOne, percentTwo);\n const width = Math.abs(percentTwo - percentOne);\n\n nileSlider.completed.style.left = `${left}%`;\n nileSlider.completed.style.width = `${width}%`;\n\n nileSlider.emit(NileSliderEvents.NILE_BUTTON_FIRST_CHANGE, {\n value: nileSlider.rangeOneValue,\n });\n nileSlider.emit(NileSliderEvents.NILE_BUTTON_LAST_CHANGE, {\n value: nileSlider.rangeTwoValue,\n });\n};\n"]}
@@ -1 +0,0 @@
1
- export { NileSlider } from './nile-slider';
@@ -1,119 +0,0 @@
1
- /**
2
- * Copyright Aquera Inc 2025
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { css } from 'lit';
8
-
9
- /**
10
- * Slider CSS
11
- */
12
- export const styles = css`
13
- :host {
14
- display: block;
15
- }
16
-
17
- .container {
18
- display: flex;
19
- justify-content: center;
20
- align-items: center;
21
- gap: 10px;
22
- height: 100px;
23
- }
24
-
25
- .align-item-center {
26
- align-items: center;
27
- }
28
-
29
- slot.span {
30
- font-size: var(--nile-font-size-micro);
31
- margin-top: 14px;
32
- }
33
-
34
- .range-container {
35
- display: flex;
36
- flex-direction: column;
37
- gap: var(--nile-spacing-sm);
38
- }
39
-
40
- .column-reverse {
41
- flex-direction: column-reverse;
42
- }
43
-
44
- .label-container {
45
- display: flex;
46
- justify-content: space-between;
47
- }
48
-
49
- .label-container span {
50
- margin: var(--nile-spacing-none);
51
- padding: var(--nile-spacing-none);
52
- font-size: var(--nile-font-size-micro);
53
- }
54
-
55
- .range {
56
- position: relative;
57
- width: 228px;
58
- height: 4px;
59
- background-color: var(--nile-colors-neutral-400);
60
- user-select: none;
61
- border-radius: var(--nile-radius-radius-3xl);
62
- }
63
-
64
- .range:hover {
65
- cursor: pointer;
66
- }
67
-
68
- .range-completed {
69
- position: absolute;
70
- height: 100%;
71
- width: 0%;
72
- background-color: var(--nile-colors-primary-600);
73
- top: 0px;
74
- left: 0px;
75
- z-index: 98;
76
- border-radius: var(--nile-radius-radius-3xl);
77
- }
78
-
79
- .range-button {
80
- height: 12px;
81
- width: 12px;
82
- background-color: var(--nile-colors-primary-600);
83
- position: absolute;
84
- top: 50%;
85
- transform: translate(-50%, -50%);
86
- border-radius: var(--nile-radius-radius-3xl);
87
- left: 0;
88
- z-index: 100;
89
- box-shadow: rgba(0, 82, 145, 0.1) 0px 1px 2px 0px, rgba(0, 94, 166, 0.15) 0px 0px 0px 2px;
90
- transition: box-shadow var(--nile-transition-duration-default) ease;
91
- }
92
-
93
- .range-button:hover, .range-button-two:hover {
94
- cursor: pointer;
95
- background-color: var(--nile-colors-primary-700);
96
- }
97
-
98
- .range-button:active, .range-button-two:active {
99
- transition: box-shadow var(--nile-transition-duration-default) ease;
100
- background-color: var(--nile-colors-primary-700);
101
- box-shadow: rgba(0, 82, 145, 0.1) 0px 1px 2px 0px, rgba(0, 94, 166, 0.15) 0px 0px 0px 4px;
102
- }
103
-
104
- .range-button-two {
105
- height: 12px;
106
- width: 12px;
107
- background-color: var(--nile-colors-primary-600);
108
- position: absolute;
109
- top: 50%;
110
- transform: translate(-50%, -50%);
111
- border-radius: var(--nile-radius-radius-3xl);
112
- left: 100%;
113
- z-index: 100;
114
- box-shadow: rgba(0, 82, 145, 0.1) 0px 1px 2px 0px, rgba(0, 94, 166, 0.15) 0px 0px 0px 2px;
115
- transition: box-shadow var(--nile-transition-duration-default) ease;
116
- }
117
- `;
118
-
119
- export default [styles];