bromcom-ui 3.0.0-alpha.2 → 3.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-c47463b1.entry.js → p-0b7de283.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-a141b2bc.entry.js → p-0e75f6ba.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-9d41ff2a.entry.js → p-112b9a62.entry.js} +1 -1
  6. package/dist/bromcom-ui/p-1535f9b1.js +5 -0
  7. package/dist/bromcom-ui/{p-2a0b6273.entry.js → p-32ce6cf6.entry.js} +1 -1
  8. package/dist/bromcom-ui/{p-46628fcd.entry.js → p-33b2ed75.entry.js} +1 -1
  9. package/dist/bromcom-ui/{p-7416d1f6.entry.js → p-4545a13d.entry.js} +1 -1
  10. package/dist/bromcom-ui/p-45b811ef.entry.js +5 -0
  11. package/dist/bromcom-ui/{p-369948e7.entry.js → p-5532696c.entry.js} +1 -1
  12. package/dist/bromcom-ui/{p-8363990a.entry.js → p-69adb859.entry.js} +1 -1
  13. package/dist/bromcom-ui/{p-d4e4aeee.js → p-6ce02d0a.js} +1 -1
  14. package/dist/bromcom-ui/p-7c08789d.entry.js +5 -0
  15. package/dist/bromcom-ui/{p-22e3161d.entry.js → p-803739bc.entry.js} +1 -1
  16. package/dist/bromcom-ui/{p-14b04371.entry.js → p-8390dd02.entry.js} +1 -1
  17. package/dist/bromcom-ui/{p-217934a4.entry.js → p-8e7274e4.entry.js} +1 -1
  18. package/dist/bromcom-ui/p-91197b04.js +5 -0
  19. package/dist/bromcom-ui/{p-cbeaa059.entry.js → p-9e0dd503.entry.js} +3 -3
  20. package/dist/bromcom-ui/p-a320cde8.entry.js +5 -0
  21. package/dist/bromcom-ui/p-a80e6310.entry.js +5 -0
  22. package/dist/bromcom-ui/{p-b85227c8.entry.js → p-acab07ec.entry.js} +1 -1
  23. package/dist/bromcom-ui/{p-51ba3626.entry.js → p-b333a3d7.entry.js} +1 -1
  24. package/dist/bromcom-ui/{p-a080c8ea.entry.js → p-b7787c11.entry.js} +1 -1
  25. package/dist/bromcom-ui/{p-6f224017.entry.js → p-b7c56cbe.entry.js} +1 -1
  26. package/dist/bromcom-ui/{p-e7c31126.entry.js → p-c36a7889.entry.js} +1 -1
  27. package/dist/bromcom-ui/p-ce0ab4e3.entry.js +5 -0
  28. package/dist/bromcom-ui/{p-367bc8e0.js → p-d3cf91a9.js} +1 -1
  29. package/dist/bromcom-ui/{p-5bf051b9.entry.js → p-d7a619c5.entry.js} +1 -1
  30. package/dist/bromcom-ui/p-ddd9e192.entry.js +5 -0
  31. package/dist/bromcom-ui/{p-9015080d.entry.js → p-e36b6b08.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-acfceb2b.entry.js → p-f15c1d3d.entry.js} +1 -1
  33. package/dist/bromcom-ui/{p-858cee66.js → p-fc29c94d.js} +1 -1
  34. package/dist/cjs/{bcm-accordion_68.cjs.entry.js → bcm-accordion_69.cjs.entry.js} +120 -43
  35. package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +4 -4
  36. package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +4 -4
  37. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +2 -2
  38. package/dist/cjs/bcm-caption.cjs.entry.js +4 -4
  39. package/dist/cjs/bcm-card.cjs.entry.js +2 -2
  40. package/dist/cjs/bcm-date-picker.cjs.entry.js +2 -2
  41. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +2 -2
  42. package/dist/cjs/bcm-default.cjs.entry.js +2 -2
  43. package/dist/cjs/bcm-form-2.cjs.entry.js +2 -2
  44. package/dist/cjs/bcm-input-2.cjs.entry.js +2 -2
  45. package/dist/cjs/bcm-input-custom.cjs.entry.js +2 -2
  46. package/dist/cjs/bcm-input-dropdown.cjs.entry.js +4 -4
  47. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +4 -4
  48. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +4 -4
  49. package/dist/cjs/bcm-modal-2.cjs.entry.js +4 -4
  50. package/dist/cjs/bcm-number-input.cjs.entry.js +4 -4
  51. package/dist/cjs/bcm-segment.cjs.entry.js +51 -0
  52. package/dist/cjs/bcm-segmented-picker.cjs.entry.js +158 -0
  53. package/dist/cjs/bcm-skeleton.cjs.entry.js +4 -4
  54. package/dist/cjs/bcm-table.cjs.entry.js +4 -4
  55. package/dist/cjs/bcm-tag.cjs.entry.js +3 -3
  56. package/dist/cjs/bcm-time-picker.cjs.entry.js +2 -2
  57. package/dist/cjs/bcm-toast.cjs.entry.js +17 -11
  58. package/dist/cjs/bromcom-ui.cjs.js +3 -3
  59. package/dist/cjs/{generate-a25d8fc8.js → generate-9d1bf6b3.js} +1 -1
  60. package/dist/cjs/{global-08c079a8.js → global-d69a64ec.js} +1 -1
  61. package/dist/cjs/loader.cjs.js +3 -3
  62. package/dist/cjs/{number-helper-3a56812f.js → number-helper-ae28b255.js} +1 -1
  63. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +3 -3
  64. package/dist/cjs/old-bcm-popover.cjs.entry.js +2 -2
  65. package/dist/cjs/{package-6afe17f3.js → package-6de220be.js} +1 -1
  66. package/dist/cjs/{validators-78797513.js → validators-3381bee2.js} +1 -1
  67. package/dist/collection/collection-manifest.json +3 -0
  68. package/dist/collection/components/molecules/color-input/color-input.css +127 -0
  69. package/dist/collection/components/molecules/color-input/color-input.js +34 -13
  70. package/dist/collection/components/molecules/color-palette/color-palette.js +114 -0
  71. package/dist/collection/components/molecules/color-palette/color-palette.style.js +25 -0
  72. package/dist/collection/components/organism/list/list.js +74 -20
  73. package/dist/collection/components/other/segmented-picker/segment.component.js +200 -0
  74. package/dist/collection/components/other/segmented-picker/segment.css +28 -0
  75. package/dist/collection/components/other/segmented-picker/segmented-picker.component.js +365 -0
  76. package/dist/collection/components/other/segmented-picker/segmented-picker.css +16 -0
  77. package/dist/collection/components/other/segmented-picker/types.js +1 -0
  78. package/dist/collection/components/other/toast/toast.js +15 -9
  79. package/dist/collection/templates/list-item-template.js +4 -4
  80. package/dist/collection/templates/list-template.js +2 -2
  81. package/dist/components/bcm-color-input.js +18 -15
  82. package/dist/components/bcm-color-palette.d.ts +11 -0
  83. package/dist/components/bcm-color-palette.js +10 -0
  84. package/dist/components/bcm-segment.d.ts +11 -0
  85. package/dist/components/bcm-segment.js +71 -0
  86. package/dist/components/bcm-segmented-picker.d.ts +11 -0
  87. package/dist/components/bcm-segmented-picker.js +182 -0
  88. package/dist/components/bcm-toast.js +15 -9
  89. package/dist/components/color-palette.js +71 -0
  90. package/dist/components/generate.js +1 -1
  91. package/dist/components/index.d.ts +3 -0
  92. package/dist/components/index.js +3 -0
  93. package/dist/components/list.js +64 -27
  94. package/dist/esm/{bcm-accordion_68.entry.js → bcm-accordion_69.entry.js} +120 -44
  95. package/dist/esm/bcm-attendance-actions-comment.entry.js +4 -4
  96. package/dist/esm/bcm-attendance-actions-dropdown.entry.js +4 -4
  97. package/dist/esm/bcm-breadcrumb.entry.js +2 -2
  98. package/dist/esm/bcm-caption.entry.js +4 -4
  99. package/dist/esm/bcm-card.entry.js +2 -2
  100. package/dist/esm/bcm-date-picker.entry.js +2 -2
  101. package/dist/esm/bcm-datetime-picker.entry.js +2 -2
  102. package/dist/esm/bcm-default.entry.js +2 -2
  103. package/dist/esm/bcm-form-2.entry.js +2 -2
  104. package/dist/esm/bcm-input-2.entry.js +2 -2
  105. package/dist/esm/bcm-input-custom.entry.js +2 -2
  106. package/dist/esm/bcm-input-dropdown.entry.js +4 -4
  107. package/dist/esm/bcm-modal-2-footer.entry.js +4 -4
  108. package/dist/esm/bcm-modal-2-header.entry.js +4 -4
  109. package/dist/esm/bcm-modal-2.entry.js +4 -4
  110. package/dist/esm/bcm-number-input.entry.js +4 -4
  111. package/dist/esm/bcm-segment.entry.js +47 -0
  112. package/dist/esm/bcm-segmented-picker.entry.js +154 -0
  113. package/dist/esm/bcm-skeleton.entry.js +4 -4
  114. package/dist/esm/bcm-table.entry.js +4 -4
  115. package/dist/esm/bcm-tag.entry.js +3 -3
  116. package/dist/esm/bcm-time-picker.entry.js +2 -2
  117. package/dist/esm/bcm-toast.entry.js +17 -11
  118. package/dist/esm/bromcom-ui.js +3 -3
  119. package/dist/esm/{generate-a4b85775.js → generate-56d49b70.js} +1 -1
  120. package/dist/esm/{global-1baa11cd.js → global-97c42a5f.js} +1 -1
  121. package/dist/esm/loader.js +3 -3
  122. package/dist/esm/{number-helper-872d5482.js → number-helper-455ab41e.js} +1 -1
  123. package/dist/esm/old-bcm-popover-box.entry.js +3 -3
  124. package/dist/esm/old-bcm-popover.entry.js +2 -2
  125. package/dist/esm/{package-1d6f13ed.js → package-edee14d5.js} +1 -1
  126. package/dist/esm/{validators-e9800e9a.js → validators-cc882165.js} +1 -1
  127. package/dist/types/components/molecules/color-input/color-input.d.ts +5 -4
  128. package/dist/types/components/molecules/color-palette/color-palette.d.ts +36 -0
  129. package/dist/types/components/molecules/color-palette/color-palette.style.d.ts +76 -0
  130. package/dist/types/components/organism/list/list.d.ts +4 -0
  131. package/dist/types/components/other/segmented-picker/segment.component.d.ts +42 -0
  132. package/dist/types/components/other/segmented-picker/segmented-picker.component.d.ts +86 -0
  133. package/dist/types/components/other/segmented-picker/types.d.ts +1 -0
  134. package/dist/types/components/other/toast/toast.d.ts +1 -0
  135. package/dist/types/components.d.ts +281 -0
  136. package/dist/types/templates/list-item-template.d.ts +2 -0
  137. package/dist/types/templates/list-template.d.ts +2 -0
  138. package/package.json +1 -1
  139. package/dist/bromcom-ui/p-485ed6c1.entry.js +0 -5
  140. package/dist/bromcom-ui/p-5c4939a7.js +0 -5
  141. package/dist/bromcom-ui/p-8457670e.entry.js +0 -5
  142. package/dist/bromcom-ui/p-dcd69786.entry.js +0 -5
  143. package/dist/bromcom-ui/p-e9a43560.js +0 -5
  144. package/dist/bromcom-ui/p-ea24a822.entry.js +0 -5
@@ -0,0 +1,114 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { h, Host } from "@stencil/core";
6
+ import { ColorHelper } from "../../../helper/color-helper";
7
+ import { colorPaletteStyle } from "./color-palette.style";
8
+ /**
9
+ * A component that renders a grid of Tailwind CSS colors.
10
+ * It allows users to select a specific shade from various color palettes.
11
+ *
12
+ * @component bcm-color-palette
13
+ *
14
+ * @property {string} value - The currently selected color value (e.g., '#000000'). This prop is mutable and reflected.
15
+ * @property {string[]} paletteKeys - An array of Tailwind color names to display in the grid (e.g., ['blue', 'red']).
16
+ * @property {number[]} shades - An array of shade values to generate for each color key (e.g., [100, 200, ...]).
17
+ *
18
+ * @event bcm-change - Emitted when a color is selected. The event detail contains the selected hex color string.
19
+ *
20
+ * @example
21
+ * <bcm-color-palette value="#000000"></bcm-color-palette>
22
+ */
23
+ export class BcmColorPalette {
24
+ constructor() {
25
+ this.onColorChange = (hex) => {
26
+ this.value = hex;
27
+ this.bcmChange.emit(hex);
28
+ };
29
+ this.value = undefined;
30
+ this.paletteKeys = ["orange", "yellow", "lime", "green", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink", "rose", "stone", "slate"];
31
+ this.shades = [950, 900, 800, 700, 600, 400, 300, 200, 100, 50];
32
+ }
33
+ render() {
34
+ const { host, column, box } = colorPaletteStyle();
35
+ return (h(Host, { class: host() }, this.paletteKeys.map((colorName) => (h("div", { class: column(), key: colorName }, this.shades.map((shade) => {
36
+ const colorKey = `${colorName}-${shade}`;
37
+ const hex = ColorHelper.getTwColorToHex(colorKey);
38
+ const isSelected = this.value === hex;
39
+ return (h("div", { key: colorKey, class: box({ selected: isSelected }), style: { backgroundColor: hex }, onClick: () => this.onColorChange(hex) }));
40
+ }))))));
41
+ }
42
+ static get is() { return "bcm-color-palette"; }
43
+ static get properties() {
44
+ return {
45
+ "value": {
46
+ "type": "string",
47
+ "mutable": true,
48
+ "complexType": {
49
+ "original": "string",
50
+ "resolved": "string",
51
+ "references": {}
52
+ },
53
+ "required": false,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": "Selected color value (e.g. '#000000')"
58
+ },
59
+ "attribute": "value",
60
+ "reflect": true
61
+ },
62
+ "paletteKeys": {
63
+ "type": "unknown",
64
+ "mutable": false,
65
+ "complexType": {
66
+ "original": "string[]",
67
+ "resolved": "string[]",
68
+ "references": {}
69
+ },
70
+ "required": false,
71
+ "optional": false,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": "List of tailwind color keys to display"
75
+ },
76
+ "defaultValue": "[\"orange\", \"yellow\", \"lime\", \"green\", \"teal\", \"cyan\", \"sky\", \"indigo\", \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\", \"stone\", \"slate\"]"
77
+ },
78
+ "shades": {
79
+ "type": "unknown",
80
+ "mutable": false,
81
+ "complexType": {
82
+ "original": "number[]",
83
+ "resolved": "number[]",
84
+ "references": {}
85
+ },
86
+ "required": false,
87
+ "optional": false,
88
+ "docs": {
89
+ "tags": [],
90
+ "text": "List of shades to display"
91
+ },
92
+ "defaultValue": "[950, 900, 800, 700, 600, 400, 300, 200, 100, 50]"
93
+ }
94
+ };
95
+ }
96
+ static get events() {
97
+ return [{
98
+ "method": "bcmChange",
99
+ "name": "bcm-change",
100
+ "bubbles": true,
101
+ "cancelable": true,
102
+ "composed": true,
103
+ "docs": {
104
+ "tags": [],
105
+ "text": "Emitted when a color is selected"
106
+ },
107
+ "complexType": {
108
+ "original": "string",
109
+ "resolved": "string",
110
+ "references": {}
111
+ }
112
+ }];
113
+ }
114
+ }
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { tv } from "tailwind-variants";
6
+ export const colorPaletteStyle = tv({
7
+ slots: {
8
+ host: "tw-flex tw-gap-4 tw-p-3 tw-bg-color-base tw-border tw-rounded-md tw-box-border tw-w-fit tw-h-fit",
9
+ column: "tw-flex tw-flex-col tw-gap-4",
10
+ box: "tw-w-6 tw-h-6 tw-rounded-md tw-cursor-pointer tw-transition-all tw-duration-200 tw-relative tw-flex tw-items-center tw-justify-center tw-border",
11
+ },
12
+ variants: {
13
+ selected: {
14
+ true: {
15
+ box: "tw-z-10 tw-ring-2 tw-ring-primary tw-ring-offset-2 tw-scale-100 tw-border-transparent",
16
+ },
17
+ false: {
18
+ box: "tw-border-transparent hover:tw-border-black/10 hover:tw-scale-110",
19
+ },
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ selected: false,
24
+ },
25
+ });
@@ -102,6 +102,7 @@ export class BcmList {
102
102
  this.shouldTriggerChange = undefined;
103
103
  this.placement = Bcm.Placement["bottom-start"];
104
104
  this.disableChangeEvent = false;
105
+ this.autoFocusSelected = false;
105
106
  this.data = [];
106
107
  window.addEventListener("scroll", this.handleWheel.bind(this), true);
107
108
  window.addEventListener("wheel", this.handleWheel.bind(this), true);
@@ -214,6 +215,7 @@ export class BcmList {
214
215
  }
215
216
  }
216
217
  async handleOpen() {
218
+ const isAutoSelected = this.autoFocusSelected && this.type == "select" && !this.checkboxes && this.value;
217
219
  if (this.isOpen) {
218
220
  this.detectClone();
219
221
  if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
@@ -228,10 +230,15 @@ export class BcmList {
228
230
  this.onSelectSearch();
229
231
  await delay(50);
230
232
  this.isOpenAnimation = true;
233
+ if (isAutoSelected) {
234
+ this.focusSelectedElement();
235
+ }
231
236
  }
232
237
  else {
238
+ if (!isAutoSelected) {
239
+ this.listScrollToTop();
240
+ }
233
241
  this.isOpenAnimation = false;
234
- this.listScrollToTop();
235
242
  this.close.emit();
236
243
  this.listClose.emit();
237
244
  await delay(100);
@@ -584,22 +591,33 @@ export class BcmList {
584
591
  this.markForCheck();
585
592
  }
586
593
  async initState() {
587
- var _a, _b, _c;
594
+ var _a, _b, _c, _d, _e;
588
595
  this.onClearSearch();
589
596
  await listState.setValue({
590
597
  id: this._id,
591
598
  dataSource: this.data && snq(() => (typeof this.data == "string" ? JSON.parse(this.data) : this.data), []),
592
599
  options: this,
593
600
  });
594
- const { totalRoots, totalItems } = listState.getValue(this._id);
601
+ const { totalRoots, totalItems, dataSource } = listState.getValue(this._id);
595
602
  this.totalData = (totalItems === null || totalItems === void 0 ? void 0 : totalItems.total) || 0;
596
603
  this.totalRootData = totalRoots || 0;
597
604
  this.value = this.checkboxes ? (await this.getCheckedList()).checkedList : listState.selectedItem(this._id) ? listState.selectedItem(this._id)[0] : null;
605
+ /** @description Focus selected element * BUG 282262 */
606
+ if (this.autoFocusSelected && this.type == "select" && this.value && !this.checkboxes) {
607
+ const selectedId = Array.isArray(this.value) ? (_a = this.value[0]) === null || _a === void 0 ? void 0 : _a.id : (_b = this.value) === null || _b === void 0 ? void 0 : _b.id;
608
+ if (selectedId && dataSource) {
609
+ const selectedIndex = dataSource.findIndex(item => item.id === selectedId);
610
+ if (selectedIndex !== -1 && selectedIndex >= this.limit) {
611
+ this.limit = selectedIndex + 5;
612
+ this.searchResultLimit = this.limit;
613
+ }
614
+ }
615
+ }
598
616
  if (!this.checkboxes) {
599
- this.inputText = Generate.domParser((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || null;
617
+ this.inputText = Generate.domParser((_c = this.value) === null || _c === void 0 ? void 0 : _c.text) || null;
600
618
  }
601
619
  // checkli olan subparentların indeterminate kontrolü için
602
- if (this.checkboxes && ((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) > 0) {
620
+ if (this.checkboxes && ((_d = this.value) === null || _d === void 0 ? void 0 : _d.length) > 0) {
603
621
  const checkedIDs = [];
604
622
  this.value.forEach(item => {
605
623
  if (!item.items || item.items.length === 0) {
@@ -608,7 +626,7 @@ export class BcmList {
608
626
  });
609
627
  await this.addChecked(checkedIDs, false, false);
610
628
  }
611
- await this.handleIndeterminate((_c = this.value) === null || _c === void 0 ? void 0 : _c.length, this.totalData);
629
+ await this.handleIndeterminate((_e = this.value) === null || _e === void 0 ? void 0 : _e.length, this.totalData);
612
630
  await this.markForCheck();
613
631
  }
614
632
  async markForCheck() {
@@ -691,20 +709,16 @@ export class BcmList {
691
709
  getAutoCompleteInput() {
692
710
  return document.getElementById(`bcm-list-input-tag-container-${this._id}-autocomplete-input`);
693
711
  }
712
+ /** @description Fixes the issue where the list appears empty during fast scrolling. */
694
713
  dataScrollEvent(event) {
695
- let count = 0;
696
- let io = new IntersectionObserver((data) => {
697
- if (count === 0) {
698
- count++;
699
- if (data[0].isIntersecting) {
700
- this.limit += 15;
701
- this.searchResultLimit += 15;
702
- io.disconnect();
703
- io = null;
704
- }
705
- }
706
- }, this.options);
707
- io.observe(event.target.lastElementChild);
714
+ var _a, _b;
715
+ const itemHeight = this.size === 'small' ? 28 : this.size === 'large' ? 48 : 36;
716
+ const currentScrollBottom = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.scrollTop) + ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.clientHeight);
717
+ const requiredItems = Math.ceil(currentScrollBottom / itemHeight) + 20;
718
+ if (requiredItems > this.limit) {
719
+ this.limit = requiredItems;
720
+ this.searchResultLimit = requiredItems;
721
+ }
708
722
  }
709
723
  async calculateLocation() {
710
724
  var _a, _b;
@@ -774,6 +788,28 @@ export class BcmList {
774
788
  this.listOpen.emit();
775
789
  }
776
790
  }
791
+ /** @description Focus selected element * BUG 282262 */
792
+ focusSelectedElement() {
793
+ var _a;
794
+ const listElement = document.querySelector(`#bcm-list-${this._id}`);
795
+ if (!listElement)
796
+ return;
797
+ const selectedId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
798
+ if (selectedId) {
799
+ const targetItem = listElement.querySelector(`[id*="${selectedId}"]`);
800
+ if (targetItem) {
801
+ targetItem.scrollIntoView({
802
+ block: 'center',
803
+ inline: 'nearest',
804
+ behavior: 'auto'
805
+ });
806
+ targetItem.focus();
807
+ const items = listElement.querySelectorAll(".bcm-list__item");
808
+ items.forEach(i => i.classList.remove("focused"));
809
+ targetItem.classList.add("focused");
810
+ }
811
+ }
812
+ }
777
813
  render() {
778
814
  const { checkboxes, treeview, label, size, disabled, readonly, required, hidden, fullWidth, searchable } = this.getOptions();
779
815
  const hostClasses = cs("bcm-list", `bcm-list__size-${size}`, `bcm-list__${this.type}`, size === "large" ? "size-3" : "size-2", {
@@ -802,7 +838,7 @@ export class BcmList {
802
838
  "--min-height": openedType ? "inherit" : this.minHeight,
803
839
  } }, h("div", { id: `bcm-list-label-${this._id}`, class: "bcm-list__label" }, label && (h("div", null, h("bcm-label", { tooltip: this.tooltip, size: this.size, type: this.captionType, value: label, required: required, htmlFor: this._id })))), this.type == "select" && (h("div", { id: `bcm-list-input-${this._id}`, class: bcmListInput }, h("span", { class: cs("bcm-list__input-container", { "type-single": !checkboxes, "value-empty": !this.value }) }, this.checkboxes ? (this.value && this.value.length > 0 ? (h("bcm-rc-overflow", { data: this.tagData, maxCount: this.tagCount })) : (h("span", { class: "bcm-list__input-placeholder" }, this.placeholder))) : this.value ? (this.inputText) : (h("span", { class: "bcm-list__input-placeholder" }, this.placeholder))), h("span", { class: cs("bcm-list__input-buttons", {
804
840
  disabled: disabled,
805
- }) }, this.clearable && this.value && (h("div", { class: "bcm-list__input-buttons-button" }, h("bcm-icon", { icon: "fal fa-times", onClick: e => !disabled && this.setClear(e) }))), h("div", { class: `bcm-list__input-buttons-button caret-is ${this.isOpen && this.calculatedViewport && "caret-is-open"}` }, h("bcm-icon", { icon: `far fa-angle-down` }))))), this.type === "autocomplete" && (h("div", { id: `bcm-list-input-${this._id}`, class: cs(bcmListInput, { "bcm-list__input-autocomplete": this.type == "autocomplete" }) }, h("span", { class: "bcm-list__input-container", id: `bcm-list-input-tag-container-${this._id}` }, this.checkboxes && h("span", { class: "bcm-list__input-tag-container", id: `bcm-list-input-tag-container-${this._id}-autocomplete` }), h("bcm-search", { id: `bcm-list-input-tag-container-${this._id}-autocomplete-input`, class: "bcm-list__autocomplete", data: this.data, clearable: true, "full-width": true, "no-caption": true, placeholder: this.placeholder })))), h(ListTemplate, { type: this.type, highlight: this.highlightText, searchable: this.type == "autocomplete" ? false : searchable, bcmListContainer: bcmListContainer, checkboxes: checkboxes, treeview: treeview, infoFooter: this.infoFooter, value: this.value, totalData: this.totalData, searchFound: this.searchFound, variableText: this.variableText, searchPlaceholder: this.searchPlaceholder, minSearchLength: this.minSearchLength, searchIsOnlyChilds: this.searchIsOnlyChilds, _id: this._id, tempId: this.tempId, checkAll: this.checkAll, data: this.getItems(), width: this.width, height: this.height, size: this.size, selectAllItem: this.selectAllItem, onScrollEvent: e => this.dataScrollEvent(e), items: this.getLimitedItems(this.searchGetParents), selectedItem: itemId => this.selectedItem(itemId), checkedItem: itemId => this.checkedItem(itemId), openGroup: parentId => this.openGroup(parentId), focusItem: itemId => this.focusItem(itemId), emptyText: this.emptyText, emptyIcon: this.emptyIcon, handleTransitionEnd: e => this.handleTransitionEnd(e) }), h(CaptionTemplate, { noCaption: this.noCaption, captionType: this.captionType, captionError: this.captionError, caption: this.caption })));
841
+ }) }, this.clearable && this.value && (h("div", { class: "bcm-list__input-buttons-button" }, h("bcm-icon", { icon: "fal fa-times", onClick: e => !disabled && this.setClear(e) }))), h("div", { class: `bcm-list__input-buttons-button caret-is ${this.isOpen && this.calculatedViewport && "caret-is-open"}` }, h("bcm-icon", { icon: `far fa-angle-down` }))))), this.type === "autocomplete" && (h("div", { id: `bcm-list-input-${this._id}`, class: cs(bcmListInput, { "bcm-list__input-autocomplete": this.type == "autocomplete" }) }, h("span", { class: "bcm-list__input-container", id: `bcm-list-input-tag-container-${this._id}` }, this.checkboxes && h("span", { class: "bcm-list__input-tag-container", id: `bcm-list-input-tag-container-${this._id}-autocomplete` }), h("bcm-search", { id: `bcm-list-input-tag-container-${this._id}-autocomplete-input`, class: "bcm-list__autocomplete", data: this.data, clearable: true, "full-width": true, "no-caption": true, placeholder: this.placeholder })))), h(ListTemplate, { type: this.type, highlight: this.highlightText, searchable: this.type == "autocomplete" ? false : searchable, bcmListContainer: bcmListContainer, checkboxes: checkboxes, treeview: treeview, infoFooter: this.infoFooter, value: this.value, totalData: this.totalData, searchFound: this.searchFound, variableText: this.variableText, searchPlaceholder: this.searchPlaceholder, minSearchLength: this.minSearchLength, searchIsOnlyChilds: this.searchIsOnlyChilds, _id: this._id, tempId: this.tempId, checkAll: this.checkAll, data: this.getItems(), width: this.width, height: this.height, size: this.size, selectAllItem: this.selectAllItem, onScrollEvent: e => this.dataScrollEvent(e), items: this.getLimitedItems(this.searchGetParents), selectedItem: itemId => this.selectedItem(itemId), checkedItem: itemId => this.checkedItem(itemId), openGroup: parentId => this.openGroup(parentId), focusItem: itemId => this.focusItem(itemId), emptyText: this.emptyText, emptyIcon: this.emptyIcon, handleTransitionEnd: e => this.handleTransitionEnd(e), disabled: disabled, readonly: readonly }), h(CaptionTemplate, { noCaption: this.noCaption, captionType: this.captionType, captionError: this.captionError, caption: this.caption })));
806
842
  }
807
843
  static get is() { return "bcm-list"; }
808
844
  static get originalStyleUrls() {
@@ -1620,6 +1656,24 @@ export class BcmList {
1620
1656
  "reflect": false,
1621
1657
  "defaultValue": "false"
1622
1658
  },
1659
+ "autoFocusSelected": {
1660
+ "type": "boolean",
1661
+ "mutable": false,
1662
+ "complexType": {
1663
+ "original": "boolean",
1664
+ "resolved": "boolean",
1665
+ "references": {}
1666
+ },
1667
+ "required": false,
1668
+ "optional": false,
1669
+ "docs": {
1670
+ "tags": [],
1671
+ "text": ""
1672
+ },
1673
+ "attribute": "auto-focus-selected",
1674
+ "reflect": false,
1675
+ "defaultValue": "false"
1676
+ },
1623
1677
  "data": {
1624
1678
  "type": "any",
1625
1679
  "mutable": true,
@@ -0,0 +1,200 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { h, Host } from '@stencil/core';
6
+ import cs from "classnames";
7
+ /**
8
+ * Individual segment option component
9
+ * @slot - Default slot for segment label content
10
+ */
11
+ export class BcmSegment {
12
+ constructor() {
13
+ this.handleClick = () => {
14
+ if (!this.disabled) {
15
+ this.bcmSegmentClick.emit(this.value);
16
+ }
17
+ };
18
+ this.value = undefined;
19
+ this.disabled = false;
20
+ this.selected = false;
21
+ this.size = 'medium';
22
+ this.index = 0;
23
+ this.activeIndex = 0;
24
+ this.totalSegments = 0;
25
+ }
26
+ render() {
27
+ const isLastSegment = this.totalSegments > 0 && this.index === this.totalSegments - 1;
28
+ const hideDivider = isLastSegment || this.selected || this.index === this.activeIndex - 1;
29
+ return (h(Host, { role: "radio", "aria-checked": this.selected.toString() }, h("button", { class: cs("bcm-ui-element bcm-segment__button tw-relative tw-z-20 tw-px-3 tw-text-center tw-font-medium tw-transition-colors tw-border-none tw-bg-transparent tw-select-none", {
30
+ "tw-text-2 tw-py-px": this.size === "small",
31
+ "tw-text-3 tw-py-1": this.size === "medium",
32
+ "tw-text-4 tw-py-2": this.size === "large",
33
+ }, {
34
+ "tw-text-color-header": this.selected,
35
+ "tw-text-color-helper": !this.selected,
36
+ }, {
37
+ "tw-cursor-not-allowed tw-opacity-50": this.disabled,
38
+ "tw-cursor-pointer hover:tw-text-color-header": !this.disabled,
39
+ }), onClick: this.handleClick, disabled: this.disabled, type: "button" }, h("slot", null)), h("div", { class: `bcm-segment__divider ${hideDivider ? 'bcm-segment__divider--hidden' : ''}` })));
40
+ }
41
+ static get is() { return "bcm-segment"; }
42
+ static get originalStyleUrls() {
43
+ return {
44
+ "$": ["segment.css"]
45
+ };
46
+ }
47
+ static get styleUrls() {
48
+ return {
49
+ "$": ["segment.css"]
50
+ };
51
+ }
52
+ static get properties() {
53
+ return {
54
+ "value": {
55
+ "type": "string",
56
+ "mutable": false,
57
+ "complexType": {
58
+ "original": "string",
59
+ "resolved": "string",
60
+ "references": {}
61
+ },
62
+ "required": true,
63
+ "optional": false,
64
+ "docs": {
65
+ "tags": [],
66
+ "text": "Unique identifier for this segment"
67
+ },
68
+ "attribute": "value",
69
+ "reflect": true
70
+ },
71
+ "disabled": {
72
+ "type": "boolean",
73
+ "mutable": false,
74
+ "complexType": {
75
+ "original": "boolean",
76
+ "resolved": "boolean",
77
+ "references": {}
78
+ },
79
+ "required": false,
80
+ "optional": false,
81
+ "docs": {
82
+ "tags": [],
83
+ "text": "Disabled state"
84
+ },
85
+ "attribute": "disabled",
86
+ "reflect": true,
87
+ "defaultValue": "false"
88
+ },
89
+ "selected": {
90
+ "type": "boolean",
91
+ "mutable": true,
92
+ "complexType": {
93
+ "original": "boolean",
94
+ "resolved": "boolean",
95
+ "references": {}
96
+ },
97
+ "required": false,
98
+ "optional": false,
99
+ "docs": {
100
+ "tags": [],
101
+ "text": "Selected state (controlled by parent)"
102
+ },
103
+ "attribute": "selected",
104
+ "reflect": true,
105
+ "defaultValue": "false"
106
+ },
107
+ "size": {
108
+ "type": "string",
109
+ "mutable": true,
110
+ "complexType": {
111
+ "original": "'small' | 'medium' | 'large'",
112
+ "resolved": "\"large\" | \"medium\" | \"small\"",
113
+ "references": {}
114
+ },
115
+ "required": false,
116
+ "optional": false,
117
+ "docs": {
118
+ "tags": [],
119
+ "text": "Size variant (inherited from parent)"
120
+ },
121
+ "attribute": "size",
122
+ "reflect": false,
123
+ "defaultValue": "'medium'"
124
+ },
125
+ "index": {
126
+ "type": "number",
127
+ "mutable": true,
128
+ "complexType": {
129
+ "original": "number",
130
+ "resolved": "number",
131
+ "references": {}
132
+ },
133
+ "required": false,
134
+ "optional": false,
135
+ "docs": {
136
+ "tags": [],
137
+ "text": "Index of this segment (inherited from parent)"
138
+ },
139
+ "attribute": "index",
140
+ "reflect": false,
141
+ "defaultValue": "0"
142
+ },
143
+ "activeIndex": {
144
+ "type": "number",
145
+ "mutable": true,
146
+ "complexType": {
147
+ "original": "number",
148
+ "resolved": "number",
149
+ "references": {}
150
+ },
151
+ "required": false,
152
+ "optional": false,
153
+ "docs": {
154
+ "tags": [],
155
+ "text": "Index of currently active segment (inherited from parent)"
156
+ },
157
+ "attribute": "active-index",
158
+ "reflect": false,
159
+ "defaultValue": "0"
160
+ },
161
+ "totalSegments": {
162
+ "type": "number",
163
+ "mutable": true,
164
+ "complexType": {
165
+ "original": "number",
166
+ "resolved": "number",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": "Total number of segments (inherited from parent)"
174
+ },
175
+ "attribute": "total-segments",
176
+ "reflect": false,
177
+ "defaultValue": "0"
178
+ }
179
+ };
180
+ }
181
+ static get events() {
182
+ return [{
183
+ "method": "bcmSegmentClick",
184
+ "name": "bcm-segment-click",
185
+ "bubbles": true,
186
+ "cancelable": true,
187
+ "composed": false,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": "Internal event emitted when segment is clicked"
191
+ },
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ }
197
+ }];
198
+ }
199
+ static get elementRef() { return "el"; }
200
+ }
@@ -0,0 +1,28 @@
1
+ bcm-segment {
2
+ display: flex;
3
+ align-items: center;
4
+ position: relative;
5
+ width: 100%;
6
+ }
7
+
8
+ .bcm-segment__button {
9
+ white-space: nowrap;
10
+ flex: 1;
11
+ width: 100%;
12
+ }
13
+
14
+ .bcm-segment__divider {
15
+ position: absolute;
16
+ right: 0;
17
+ top: 50%;
18
+ transform: translateY(-50%);
19
+ width: 1px;
20
+ height: 20px;
21
+ background-color: var(--bcm-ui-color-border-default);
22
+ transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1);
23
+ pointer-events: none;
24
+ }
25
+
26
+ .bcm-segment__divider--hidden {
27
+ opacity: 0;
28
+ }