@rettangoli/ui 0.1.31 → 1.0.0-rc1

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 (89) hide show
  1. package/README.md +20 -85
  2. package/dist/rettangoli-iife-layout.min.js +113 -173
  3. package/dist/rettangoli-iife-ui.min.js +123 -183
  4. package/package.json +5 -4
  5. package/src/common/dimensions.js +72 -0
  6. package/src/common/link.js +111 -0
  7. package/src/common/responsive.js +8 -0
  8. package/src/common.js +43 -8
  9. package/src/components/accordionItem/accordionItem.handlers.js +1 -1
  10. package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
  11. package/src/components/accordionItem/accordionItem.store.js +8 -8
  12. package/src/components/accordionItem/accordionItem.view.yaml +5 -35
  13. package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
  14. package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
  15. package/src/components/breadcrumb/breadcrumb.store.js +66 -10
  16. package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
  17. package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
  18. package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
  19. package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
  20. package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
  21. package/src/components/form/form.handlers.js +25 -108
  22. package/src/components/form/form.schema.yaml +283 -0
  23. package/src/components/form/form.store.js +19 -14
  24. package/src/components/form/form.view.yaml +28 -319
  25. package/src/components/globalUi/globalUi.handlers.js +2 -2
  26. package/src/components/globalUi/globalUi.schema.yaml +8 -0
  27. package/src/components/globalUi/globalUi.store.js +8 -8
  28. package/src/components/globalUi/globalUi.view.yaml +9 -46
  29. package/src/components/navbar/navbar.handlers.js +1 -1
  30. package/src/components/navbar/navbar.schema.yaml +25 -0
  31. package/src/components/navbar/navbar.store.js +28 -14
  32. package/src/components/navbar/navbar.view.yaml +21 -65
  33. package/src/components/pageOutline/pageOutline.handlers.js +17 -11
  34. package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
  35. package/src/components/pageOutline/pageOutline.store.js +6 -7
  36. package/src/components/pageOutline/pageOutline.view.yaml +1 -29
  37. package/src/components/popoverInput/popoverInput.handlers.js +31 -31
  38. package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
  39. package/src/components/popoverInput/popoverInput.store.js +9 -9
  40. package/src/components/popoverInput/popoverInput.view.yaml +5 -22
  41. package/src/components/select/select.handlers.js +31 -35
  42. package/src/components/select/select.schema.yaml +36 -0
  43. package/src/components/select/select.store.js +34 -35
  44. package/src/components/select/select.view.yaml +13 -56
  45. package/src/components/sidebar/sidebar.handlers.js +5 -5
  46. package/src/components/sidebar/sidebar.schema.yaml +57 -0
  47. package/src/components/sidebar/sidebar.store.js +45 -23
  48. package/src/components/sidebar/sidebar.view.yaml +79 -174
  49. package/src/components/sliderInput/sliderInput.handlers.js +28 -8
  50. package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
  51. package/src/components/sliderInput/sliderInput.store.js +9 -9
  52. package/src/components/sliderInput/sliderInput.view.yaml +8 -33
  53. package/src/components/table/table.handlers.js +3 -3
  54. package/src/components/table/table.schema.yaml +27 -0
  55. package/src/components/table/table.store.js +8 -8
  56. package/src/components/table/table.view.yaml +16 -62
  57. package/src/components/tabs/tabs.schema.yaml +26 -0
  58. package/src/components/tabs/tabs.store.js +12 -9
  59. package/src/components/tabs/tabs.view.yaml +4 -60
  60. package/src/components/tooltip/tooltip.schema.yaml +18 -0
  61. package/src/components/tooltip/tooltip.store.js +7 -7
  62. package/src/components/tooltip/tooltip.view.yaml +4 -22
  63. package/src/components/waveform/waveform.handlers.js +6 -6
  64. package/src/components/waveform/waveform.schema.yaml +25 -0
  65. package/src/components/waveform/waveform.store.js +6 -6
  66. package/src/components/waveform/waveform.view.yaml +6 -34
  67. package/src/deps/createGlobalUI.js +2 -2
  68. package/src/primitives/button.js +200 -114
  69. package/src/primitives/colorPicker.js +56 -50
  70. package/src/primitives/dialog.js +2 -1
  71. package/src/primitives/image.js +73 -103
  72. package/src/primitives/input-number.js +139 -93
  73. package/src/primitives/input.js +87 -64
  74. package/src/primitives/popover.js +36 -28
  75. package/src/primitives/slider.js +6 -4
  76. package/src/primitives/svg.js +9 -10
  77. package/src/primitives/text.js +26 -47
  78. package/src/primitives/textarea.js +25 -9
  79. package/src/primitives/view.js +49 -90
  80. package/src/setup.js +1 -7
  81. package/src/styles/buttonMarginStyles.js +1 -13
  82. package/src/styles/cursorStyles.js +1 -5
  83. package/src/styles/flexDirectionStyles.js +4 -4
  84. package/src/styles/marginStylesForTarget.js +13 -0
  85. package/src/styles/textColorStyles.js +14 -6
  86. package/src/styles/textStyles.js +4 -4
  87. package/src/styles/viewStyles.js +6 -6
  88. package/src/styles/viewStylesForTarget.js +58 -0
  89. package/src/styles/flexChildStyles.js +0 -43
@@ -1,74 +1,30 @@
1
- elementName: rtgl-navbar
2
-
3
- viewDataSchema:
4
- type: object
5
- properties:
6
- containerAttrString:
7
- type: string
8
- start:
9
- type: object
10
- properties:
11
- label:
12
- type: string
13
- href:
14
- type: string
15
- image:
16
- type: object
17
- properties:
18
- src:
19
- type: string
20
- hasImage:
21
- type: boolean
22
- hasHref:
23
- type: boolean
24
-
25
- propsSchema:
26
- type: object
27
- properties:
28
- start:
29
- type: object
30
- properties:
31
- label:
32
- type: string
33
- href:
34
- type: string
35
- image:
36
- type: object
37
- properties:
38
- src:
39
- type: string
40
-
41
1
  refs:
42
2
  start:
43
3
  eventListeners:
44
4
  click:
45
5
  handler: handleClickStart
46
-
47
- events:
48
- clickStart:
49
- type: object
50
- properties:
51
- path:
52
- type: string
53
-
54
6
  anchors:
55
- - &image
56
- - rtgl-text s=lg: "${start.label}"
7
+ - - rtgl-text s=lg: ${start.label}
57
8
  - $if start.image && start.image.src:
58
- - rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}:
59
-
9
+ - rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
60
10
  template:
61
11
  - rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}:
62
- - $if start.href:
63
- - a href=${start.href}:
64
- - rtgl-view d=h av=c g=lg g=md:
65
- - *image
66
- $elif start.path:
67
- - rtgl-view#start d=h av=c g=lg g=md cur=p:
68
- - *image
69
- $else:
70
- - rtgl-view d=h av=c g=lg g=md:
71
- - *image
72
- - rtgl-view flex=1:
73
- - rtgl-view d=h av=c g=lg:
74
- - slot name=right:
12
+ - $if start.href:
13
+ - a href=${start.href}:
14
+ - rtgl-view d=h av=c g=md:
15
+ - - rtgl-text s=lg: ${start.label}
16
+ - $if start.image && start.image.src:
17
+ - rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
18
+ $elif start.path:
19
+ - rtgl-view#start d=h av=c g=md cur=pointer:
20
+ - - rtgl-text s=lg: ${start.label}
21
+ - $if start.image && start.image.src:
22
+ - rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
23
+ $else:
24
+ - rtgl-view d=h av=c g=md:
25
+ - - rtgl-text s=lg: ${start.label}
26
+ - $if start.image && start.image.src:
27
+ - rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
28
+ - rtgl-view w=1fg: null
29
+ - rtgl-view d=h av=c g=lg:
30
+ - slot name=right: null
@@ -38,7 +38,7 @@ const updateToLatestCurrentId = (headingElements, offsetTop, deps) => {
38
38
  }
39
39
 
40
40
  if (currentHeadingId && currentHeadingId !== store.selectCurrentId()) {
41
- store.setCurrentId(currentHeadingId);
41
+ store.setCurrentId({ id: currentHeadingId });
42
42
  render();
43
43
  }
44
44
  };
@@ -71,7 +71,7 @@ const startListening = (contentContainer, scrollContainer, offsetTop, deps) => {
71
71
  };
72
72
  });
73
73
 
74
- store.setItems(items);
74
+ store.setItems({ items });
75
75
  updateToLatestCurrentId(headingElements, offsetTop, deps);
76
76
  render();
77
77
 
@@ -88,22 +88,28 @@ const startListening = (contentContainer, scrollContainer, offsetTop, deps) => {
88
88
  };
89
89
 
90
90
  export const handleBeforeMount = (deps) => {
91
- const { attrs } = deps;
91
+ const { props } = deps;
92
+ let stopListening = () => {};
93
+
92
94
  requestAnimationFrame(() => {
93
- const targetElement = document.getElementById(attrs['target-id']);
95
+ const targetElement = document.getElementById(props.targetId);
96
+ if (!targetElement) {
97
+ return;
98
+ }
94
99
 
95
100
  // Get scroll container - default to window for page scroll if not specified
96
101
  let scrollContainer = window;
97
- if (attrs['scroll-container-id']) {
98
- scrollContainer = document.getElementById(attrs['scroll-container-id']) || window;
102
+ if (props.scrollContainerId) {
103
+ scrollContainer = document.getElementById(props.scrollContainerId) || window;
99
104
  }
100
105
 
101
106
  // Get offset top - default to 100px if not specified
102
- const offsetTop = parseInt(attrs['offset-top'] || '100', 10);
107
+ const offsetTop = parseInt(props.offsetTop || '100', 10);
103
108
 
104
- const stopListening = startListening(targetElement, scrollContainer, offsetTop, deps);
105
- return () => {
106
- stopListening();
107
- }
109
+ stopListening = startListening(targetElement, scrollContainer, offsetTop, deps);
108
110
  })
111
+
112
+ return () => {
113
+ stopListening();
114
+ };
109
115
  }
@@ -0,0 +1,16 @@
1
+ componentName: rtgl-page-outline
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ targetId:
6
+ type: string
7
+ scrollContainerId:
8
+ type: string
9
+ offsetTop:
10
+ type: string
11
+ events:
12
+ onItemClick:
13
+ type: object
14
+ methods:
15
+ type: object
16
+ properties: {}
@@ -69,17 +69,16 @@ export const selectCurrentId = ({ state }) => {
69
69
  return state.currentId;
70
70
  }
71
71
 
72
- export const setItems = (state, items) => {
73
- state.items = items;
72
+ export const setItems = ({ state }, payload = {}) => {
73
+ state.items = Array.isArray(payload.items) ? payload.items : [];
74
74
  }
75
75
 
76
- export const setCurrentId = (state, id) => {
77
- state.currentId = id;
76
+ export const setCurrentId = ({ state }, payload = {}) => {
77
+ state.currentId = payload.id;
78
78
  }
79
79
 
80
- export const setContentContainer = (state, container) => {
81
- state.contentContainer = container;
80
+ export const setContentContainer = ({ state }, payload = {}) => {
81
+ state.contentContainer = payload.container;
82
82
  }
83
83
 
84
84
 
85
-
@@ -1,36 +1,8 @@
1
- elementName: rtgl-page-outline
2
-
3
- viewDataSchema:
4
- type: object
5
- properties:
6
- items:
7
- type: array
8
- items:
9
- type: object
10
- properties:
11
- slug:
12
- type: string
13
- title:
14
- type: string
15
- selectedSlug:
16
- type: string
17
- nullable: true
18
-
19
- propsSchema:
20
- type: object
21
- properties: {}
22
-
23
1
  refs: {}
24
-
25
- events:
26
- onItemClick:
27
- type: object
28
-
29
2
  template:
30
3
  - rtgl-view h=f w=272 pr=md:
31
4
  - rtgl-view w=f mt=xl:
32
5
  - $for item, i in items:
33
6
  - rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md:
34
- - rtgl-view w=${item.ml}:
7
+ - rtgl-view w=${item.ml}: null
35
8
  - rtgl-text s=sm c=${item.c} h-c=fg: ${item.title}
36
-
@@ -1,29 +1,29 @@
1
1
  export const handleBeforeMount = (deps) => {
2
- const { store, attrs } = deps;
2
+ const { store, props } = deps;
3
3
 
4
- if (attrs.value !== undefined) {
5
- store.setValue(attrs.value || '');
4
+ if (props.value !== undefined) {
5
+ store.setValue({ value: props.value || '' });
6
6
  }
7
7
  }
8
8
 
9
9
  export const handleOnUpdate = (deps, payload) => {
10
- const { oldAttrs, newAttrs } = payload;
10
+ const { oldProps, newProps } = payload;
11
11
  const { store, render } = deps;
12
12
 
13
- if (oldAttrs?.value !== newAttrs?.value) {
14
- const value = newAttrs?.value ?? '';
15
- store.setValue(value);
13
+ if (oldProps?.value !== newProps?.value) {
14
+ const value = newProps?.value ?? '';
15
+ store.setValue({ value });
16
16
  }
17
17
 
18
18
  render();
19
19
  }
20
20
 
21
21
  export const handleTextClick = (deps, payload) => {
22
- const { store, render, getRefIds, attrs } = deps;
22
+ const { store, render, refs, props } = deps;
23
23
  const event = payload._event;
24
24
 
25
25
  const value = store.selectValue();
26
- store.setTempValue(value)
26
+ store.setTempValue({ value })
27
27
 
28
28
  store.openPopover({
29
29
  position: {
@@ -32,20 +32,20 @@ export const handleTextClick = (deps, payload) => {
32
32
  }
33
33
  });
34
34
 
35
- const { input } = getRefIds();
36
- input.elm.value = value;
35
+ const { input } = refs;
36
+ input.value = value;
37
37
  render();
38
38
 
39
- if (attrs['auto-focus']) {
39
+ if (props.autoFocus) {
40
40
  setTimeout(() => {
41
- input.elm.focus();
41
+ input.focus();
42
42
  }, 50)
43
43
  }
44
44
  }
45
45
 
46
46
  export const handlePopoverClose = (deps, payload) => {
47
47
  const { store, render } = deps;
48
- store.closePopover();
48
+ store.closePopover({});
49
49
  render();
50
50
  }
51
51
 
@@ -54,50 +54,50 @@ export const handleInputChange = (deps, payload) => {
54
54
  const event = payload._event;
55
55
  const value = event.detail.value;
56
56
 
57
- store.setTempValue(value);
57
+ store.setTempValue({ value });
58
58
 
59
- dispatchEvent(new CustomEvent('temp-input-change', {
59
+ dispatchEvent(new CustomEvent('value-input', {
60
60
  detail: { value },
61
- bubbles: true
61
+ bubbles: true,
62
62
  }));
63
63
 
64
64
  render();
65
65
  }
66
66
 
67
67
  export const handleSubmitClick = (deps) => {
68
- const { store, render, dispatchEvent, getRefIds } = deps;
69
- const { input } = getRefIds()
70
- const value = input.elm.value;
68
+ const { store, render, dispatchEvent, refs } = deps;
69
+ const { input } = refs
70
+ const value = input.value;
71
71
 
72
- store.setValue(value)
73
- store.closePopover();
72
+ store.setValue({ value });
73
+ store.closePopover({});
74
74
 
75
- dispatchEvent(new CustomEvent('input-change', {
75
+ dispatchEvent(new CustomEvent('value-change', {
76
76
  detail: { value },
77
- bubbles: true
77
+ bubbles: true,
78
78
  }));
79
79
 
80
80
  render();
81
81
  }
82
82
 
83
83
  export const handleInputKeydown = (deps, payload) => {
84
- const { store, render, dispatchEvent, getRefIds } = deps;
84
+ const { store, render, dispatchEvent, refs } = deps;
85
85
  const event = payload._event;
86
86
 
87
87
  if (event.key === 'Enter') {
88
- const { input } = getRefIds()
89
- const value = input.elm.value;
88
+ const { input } = refs
89
+ const value = input.value;
90
90
 
91
- store.closePopover();
91
+ store.closePopover({});
92
92
  // Dispatch custom event
93
- dispatchEvent(new CustomEvent('input-change', {
93
+ dispatchEvent(new CustomEvent('value-change', {
94
94
  detail: { value },
95
- bubbles: true
95
+ bubbles: true,
96
96
  }));
97
97
 
98
98
  render();
99
99
  } else if (event.key === 'Escape') {
100
- store.closePopover();
100
+ store.closePopover({});
101
101
  render();
102
102
  }
103
103
  }
@@ -0,0 +1,18 @@
1
+ componentName: rtgl-popover-input
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ value:
6
+ type: string
7
+ placeholder:
8
+ type: string
9
+ label:
10
+ type: string
11
+ autoFocus:
12
+ type: boolean
13
+ events:
14
+ value-input: {}
15
+ value-change: {}
16
+ methods:
17
+ type: object
18
+ properties: {}
@@ -8,7 +8,7 @@ export const createInitialState = () => Object.freeze({
8
8
  tempValue: '',
9
9
  });
10
10
 
11
- export const selectViewData = ({ attrs, state }) => {
11
+ export const selectViewData = ({ props, state }) => {
12
12
  const value = state.value || '-';
13
13
 
14
14
  return {
@@ -16,29 +16,29 @@ export const selectViewData = ({ attrs, state }) => {
16
16
  position: state.position,
17
17
  value: value,
18
18
  tempValue: state.tempValue,
19
- placeholder: attrs.placeholder ?? '',
20
- label: attrs.label,
19
+ placeholder: props.placeholder ?? '',
20
+ label: props.label,
21
21
  };
22
22
  }
23
23
 
24
- export const setTempValue = (state, value) => {
25
- state.tempValue = value;
24
+ export const setTempValue = ({ state }, payload = {}) => {
25
+ state.tempValue = payload.value;
26
26
  }
27
27
 
28
- export const openPopover = (state, payload) => {
28
+ export const openPopover = ({ state }, payload = {}) => {
29
29
  const { position } = payload;
30
30
  state.position = position;
31
31
  state.isOpen = true;
32
32
  state.hasUnsavedChanges = false;
33
33
  }
34
34
 
35
- export const closePopover = (state) => {
35
+ export const closePopover = ({ state }) => {
36
36
  state.isOpen = false;
37
37
  state.tempValue = '';
38
38
  }
39
39
 
40
- export const setValue = (state, value) => {
41
- state.value = value;
40
+ export const setValue = ({ state }, payload = {}) => {
41
+ state.value = payload.value;
42
42
  }
43
43
 
44
44
  export const selectValue = ({ state }) => {
@@ -1,18 +1,5 @@
1
- elementName: rtgl-popover-input
2
-
3
- viewDataSchema:
4
- type: object
5
-
6
- attrsSchema:
7
- type: object
8
- properties:
9
- value:
10
- type: string
11
- placeholder:
12
- type: string
13
-
14
1
  refs:
15
- text-display:
2
+ textDisplay:
16
3
  eventListeners:
17
4
  click:
18
5
  handler: handleTextClick
@@ -22,7 +9,7 @@ refs:
22
9
  handler: handlePopoverClose
23
10
  input:
24
11
  eventListeners:
25
- input-change:
12
+ value-input:
26
13
  handler: handleInputChange
27
14
  keydown:
28
15
  handler: handleInputKeydown
@@ -30,16 +17,12 @@ refs:
30
17
  eventListeners:
31
18
  click:
32
19
  handler: handleSubmitClick
33
-
34
- events:
35
- input-change: {}
36
-
37
20
  template:
38
- - rtgl-view#text-display w=f cur=p:
21
+ - rtgl-view#textDisplay w=f cur=pointer:
39
22
  - rtgl-text: ${value}
40
23
  - rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}:
41
- - rtgl-view g=md w=240 slot=content bgc=background br=md:
24
+ - rtgl-view g=md w=240 slot=content bgc=bg br=md:
42
25
  - rtgl-text: ${label}
43
- - rtgl-input#input w=f placeholder=${placeholder}:
26
+ - rtgl-input#input w=f placeholder=${placeholder}: null
44
27
  - rtgl-view w=f ah=e:
45
28
  - rtgl-button#submit: Submit
@@ -15,13 +15,13 @@ export const handleBeforeMount = (deps) => {
15
15
  }
16
16
 
17
17
  export const handleOnUpdate = (deps, payload) => {
18
- const { oldAttrs, newAttrs, oldProps, newProps } = payload;
18
+ const { oldProps, newProps } = payload;
19
19
  const { store, render } = deps;
20
20
 
21
21
  // Check if key changed
22
- if (oldAttrs?.key !== newAttrs?.key && newAttrs?.key) {
22
+ if (oldProps?.key !== newProps?.key && newProps?.key) {
23
23
  // Clear current state using store action
24
- store.resetSelection();
24
+ store.resetSelection({});
25
25
 
26
26
  // Re-apply the prop value if available
27
27
  const selectedValue = newProps?.selectedValue;
@@ -43,11 +43,11 @@ export const handleOnUpdate = (deps, payload) => {
43
43
  }
44
44
 
45
45
  export const handleButtonClick = (deps, payload) => {
46
- const { store, render, getRefIds, props } = deps;
46
+ const { store, render, refs, props } = deps;
47
47
  const event = payload._event;
48
48
  event.stopPropagation();
49
49
 
50
- const button = getRefIds()['select-button'].elm;
50
+ const button = refs.selectButton;
51
51
 
52
52
  // Get first child's bounding rectangle (since button has display: contents)
53
53
  const firstChild = button.firstElementChild;
@@ -74,7 +74,7 @@ export const handleButtonClick = (deps, payload) => {
74
74
 
75
75
  export const handleClickOptionsPopoverOverlay = (deps) => {
76
76
  const { store, render } = deps;
77
- store.closeOptionsPopover();
77
+ store.closeOptionsPopover({});
78
78
  render();
79
79
  }
80
80
 
@@ -82,7 +82,8 @@ export const handleOptionClick = (deps, payload) => {
82
82
  const { render, dispatchEvent, props, store } = deps;
83
83
  const event = payload._event;
84
84
  event.stopPropagation();
85
- const id = event.currentTarget.id.replace('option-', '');
85
+ const id = event.currentTarget.id.slice('option'.length);
86
+ const index = Number(id);
86
87
 
87
88
  const option = props.options[id];
88
89
 
@@ -94,15 +95,13 @@ export const handleOptionClick = (deps, payload) => {
94
95
  props.onChange(option.value);
95
96
  }
96
97
 
97
- // Dispatch custom event for backward compatibility
98
- dispatchEvent(new CustomEvent('option-selected', {
99
- detail: { value: option.value, label: option.label },
100
- bubbles: true
101
- }));
102
-
103
- // Also dispatch select-change event to match form's event listener pattern
104
- dispatchEvent(new CustomEvent('select-change', {
105
- detail: { selectedValue: option.value },
98
+ dispatchEvent(new CustomEvent('value-change', {
99
+ detail: {
100
+ value: option.value,
101
+ label: option.label,
102
+ index,
103
+ item: option,
104
+ },
106
105
  bubbles: true
107
106
  }));
108
107
 
@@ -112,14 +111,14 @@ export const handleOptionClick = (deps, payload) => {
112
111
  export const handleOptionMouseEnter = (deps, payload) => {
113
112
  const { store, render } = deps;
114
113
  const event = payload._event;
115
- const id = parseInt(event.currentTarget.id.replace('option-', ''));
116
- store.setHoveredOption(id);
114
+ const id = parseInt(event.currentTarget.id.slice('option'.length), 10);
115
+ store.setHoveredOption({ optionId: id });
117
116
  render();
118
117
  }
119
118
 
120
119
  export const handleOptionMouseLeave = (deps, payload) => {
121
120
  const { store, render } = deps;
122
- store.clearHoveredOption();
121
+ store.clearHoveredOption({});
123
122
  render();
124
123
  }
125
124
 
@@ -130,22 +129,20 @@ export const handleClearClick = (deps, payload) => {
130
129
  event.stopPropagation();
131
130
 
132
131
  // Clear the internal state
133
- store.clearSelectedValue();
132
+ store.clearSelectedValue({});
134
133
 
135
134
  // Call onChange if provided
136
135
  if (props.onChange && typeof props.onChange === 'function') {
137
136
  props.onChange(undefined);
138
137
  }
139
138
 
140
- // Dispatch custom event for backward compatibility
141
- dispatchEvent(new CustomEvent('option-selected', {
142
- detail: { value: undefined, label: undefined },
143
- bubbles: true
144
- }));
145
-
146
- // Also dispatch select-change event to match form's event listener pattern
147
- dispatchEvent(new CustomEvent('select-change', {
148
- detail: { selectedValue: undefined },
139
+ dispatchEvent(new CustomEvent('value-change', {
140
+ detail: {
141
+ value: undefined,
142
+ label: undefined,
143
+ index: null,
144
+ item: undefined,
145
+ },
149
146
  bubbles: true
150
147
  }));
151
148
 
@@ -157,11 +154,10 @@ export const handleAddOptionClick = (deps, payload) => {
157
154
  const { _event: event } = payload;
158
155
  event.stopPropagation();
159
156
  // Close the popover
160
- store.closeOptionsPopover();
157
+ store.closeOptionsPopover({});
161
158
 
162
- // Dispatch custom event for add option (no detail)
163
- dispatchEvent(new CustomEvent('add-option-selected', {
164
- bubbles: true
159
+ dispatchEvent(new CustomEvent('add-option-click', {
160
+ bubbles: true,
165
161
  }));
166
162
 
167
163
  render();
@@ -169,12 +165,12 @@ export const handleAddOptionClick = (deps, payload) => {
169
165
 
170
166
  export const handleAddOptionMouseEnter = (deps, payload) => {
171
167
  const { store, render } = deps;
172
- store.setHoveredAddOption(true);
168
+ store.setHoveredAddOption({ isHovered: true });
173
169
  render();
174
170
  }
175
171
 
176
172
  export const handleAddOptionMouseLeave = (deps, payload) => {
177
173
  const { store, render } = deps;
178
- store.setHoveredAddOption(false);
174
+ store.setHoveredAddOption({ isHovered: false });
179
175
  render();
180
176
  }
@@ -0,0 +1,36 @@
1
+ componentName: rtgl-select
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ placeholder:
6
+ type: string
7
+ options:
8
+ type: array
9
+ items:
10
+ type: object
11
+ properties:
12
+ label:
13
+ type: string
14
+ value:
15
+ type: any
16
+ testId:
17
+ type: string
18
+ selectedValue:
19
+ type: any
20
+ onChange:
21
+ type: function
22
+ noClear:
23
+ type: boolean
24
+ addOption:
25
+ type: object
26
+ properties:
27
+ label:
28
+ type: string
29
+ w:
30
+ type: string
31
+ events:
32
+ value-change: {}
33
+ add-option-click: {}
34
+ methods:
35
+ type: object
36
+ properties: {}