@salt-ds/lab 1.0.0-alpha.43 → 1.0.0-alpha.45

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 (107) hide show
  1. package/css/salt-lab.css +46 -87
  2. package/dist-cjs/calendar/Calendar.js +7 -0
  3. package/dist-cjs/calendar/Calendar.js.map +1 -1
  4. package/dist-cjs/calendar/internal/CalendarCarousel.js +1 -1
  5. package/dist-cjs/calendar/internal/CalendarCarousel.js.map +1 -1
  6. package/dist-cjs/calendar/internal/CalendarDay.css.js +1 -1
  7. package/dist-cjs/calendar/internal/CalendarDay.js +5 -1
  8. package/dist-cjs/calendar/internal/CalendarDay.js.map +1 -1
  9. package/dist-cjs/calendar/internal/CalendarMonth.js.map +1 -1
  10. package/dist-cjs/calendar/internal/CalendarNavigation.css.js +1 -1
  11. package/dist-cjs/calendar/internal/CalendarNavigation.js +2 -6
  12. package/dist-cjs/calendar/internal/CalendarNavigation.js.map +1 -1
  13. package/dist-cjs/calendar/internal/useFocusManagement.js +3 -0
  14. package/dist-cjs/calendar/internal/useFocusManagement.js.map +1 -1
  15. package/dist-cjs/calendar/useCalendar.js +30 -2
  16. package/dist-cjs/calendar/useCalendar.js.map +1 -1
  17. package/dist-cjs/calendar/useSelection.js +5 -0
  18. package/dist-cjs/calendar/useSelection.js.map +1 -1
  19. package/dist-cjs/contact-details/ContactPrimaryInfo.js.map +1 -1
  20. package/dist-cjs/contact-details/ContactSecondaryInfo.js.map +1 -1
  21. package/dist-cjs/contact-details/ContactTertiaryInfo.js.map +1 -1
  22. package/dist-cjs/date-input/DateInput.css.js +1 -1
  23. package/dist-cjs/date-input/DateInput.js +196 -49
  24. package/dist-cjs/date-input/DateInput.js.map +1 -1
  25. package/dist-cjs/date-picker/DatePicker.js +164 -0
  26. package/dist-cjs/date-picker/DatePicker.js.map +1 -0
  27. package/dist-cjs/date-picker/DatePickerContext.js +36 -0
  28. package/dist-cjs/date-picker/DatePickerContext.js.map +1 -0
  29. package/dist-cjs/date-picker/DatePickerPanel.css.js +6 -0
  30. package/dist-cjs/date-picker/DatePickerPanel.css.js.map +1 -0
  31. package/dist-cjs/date-picker/DatePickerPanel.js +139 -0
  32. package/dist-cjs/date-picker/DatePickerPanel.js.map +1 -0
  33. package/dist-cjs/index.js +4 -0
  34. package/dist-cjs/index.js.map +1 -1
  35. package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
  36. package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
  37. package/dist-cjs/stepper-input/StepperInput.css.js +1 -1
  38. package/dist-cjs/stepper-input/StepperInput.js +25 -74
  39. package/dist-cjs/stepper-input/StepperInput.js.map +1 -1
  40. package/dist-cjs/stepper-input/useStepperInput.js +19 -63
  41. package/dist-cjs/stepper-input/useStepperInput.js.map +1 -1
  42. package/dist-es/calendar/Calendar.js +7 -0
  43. package/dist-es/calendar/Calendar.js.map +1 -1
  44. package/dist-es/calendar/internal/CalendarCarousel.js +1 -1
  45. package/dist-es/calendar/internal/CalendarCarousel.js.map +1 -1
  46. package/dist-es/calendar/internal/CalendarDay.css.js +1 -1
  47. package/dist-es/calendar/internal/CalendarDay.js +5 -1
  48. package/dist-es/calendar/internal/CalendarDay.js.map +1 -1
  49. package/dist-es/calendar/internal/CalendarMonth.js.map +1 -1
  50. package/dist-es/calendar/internal/CalendarNavigation.css.js +1 -1
  51. package/dist-es/calendar/internal/CalendarNavigation.js +3 -7
  52. package/dist-es/calendar/internal/CalendarNavigation.js.map +1 -1
  53. package/dist-es/calendar/internal/useFocusManagement.js +3 -0
  54. package/dist-es/calendar/internal/useFocusManagement.js.map +1 -1
  55. package/dist-es/calendar/useCalendar.js +32 -4
  56. package/dist-es/calendar/useCalendar.js.map +1 -1
  57. package/dist-es/calendar/useSelection.js +4 -1
  58. package/dist-es/calendar/useSelection.js.map +1 -1
  59. package/dist-es/contact-details/ContactPrimaryInfo.js.map +1 -1
  60. package/dist-es/contact-details/ContactSecondaryInfo.js.map +1 -1
  61. package/dist-es/contact-details/ContactTertiaryInfo.js.map +1 -1
  62. package/dist-es/date-input/DateInput.css.js +1 -1
  63. package/dist-es/date-input/DateInput.js +200 -53
  64. package/dist-es/date-input/DateInput.js.map +1 -1
  65. package/dist-es/date-picker/DatePicker.js +160 -0
  66. package/dist-es/date-picker/DatePicker.js.map +1 -0
  67. package/dist-es/date-picker/DatePickerContext.js +31 -0
  68. package/dist-es/date-picker/DatePickerContext.js.map +1 -0
  69. package/dist-es/date-picker/DatePickerPanel.css.js +4 -0
  70. package/dist-es/date-picker/DatePickerPanel.css.js.map +1 -0
  71. package/dist-es/date-picker/DatePickerPanel.js +135 -0
  72. package/dist-es/date-picker/DatePickerPanel.js.map +1 -0
  73. package/dist-es/index.js +2 -1
  74. package/dist-es/index.js.map +1 -1
  75. package/dist-es/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
  76. package/dist-es/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
  77. package/dist-es/stepper-input/StepperInput.css.js +1 -1
  78. package/dist-es/stepper-input/StepperInput.js +27 -76
  79. package/dist-es/stepper-input/StepperInput.js.map +1 -1
  80. package/dist-es/stepper-input/useStepperInput.js +19 -63
  81. package/dist-es/stepper-input/useStepperInput.js.map +1 -1
  82. package/dist-types/calendar/internal/CalendarMonth.d.ts +0 -1
  83. package/dist-types/calendar/useSelection.d.ts +3 -0
  84. package/dist-types/contact-details/ContactPrimaryInfo.d.ts +1 -1
  85. package/dist-types/contact-details/ContactSecondaryInfo.d.ts +1 -1
  86. package/dist-types/contact-details/ContactTertiaryInfo.d.ts +1 -1
  87. package/dist-types/contact-details/types.d.ts +1 -1
  88. package/dist-types/date-input/DateInput.d.ts +21 -7
  89. package/dist-types/date-picker/DatePicker.d.ts +55 -0
  90. package/dist-types/date-picker/DatePickerContext.d.ts +23 -0
  91. package/dist-types/date-picker/DatePickerPanel.d.ts +8 -0
  92. package/dist-types/date-picker/index.d.ts +1 -0
  93. package/dist-types/index.d.ts +1 -0
  94. package/dist-types/stepped-tracker/StepLabel/StepLabel.d.ts +4 -3
  95. package/dist-types/stepper-input/StepperInput.d.ts +43 -12
  96. package/dist-types/stepper-input/useStepperInput.d.ts +7 -288
  97. package/package.json +2 -2
  98. package/dist-cjs/stepper-input/internal/useActivationIndicatorPosition.js +0 -38
  99. package/dist-cjs/stepper-input/internal/useActivationIndicatorPosition.js.map +0 -1
  100. package/dist-cjs/stepper-input/internal/useDynamicAriaLabel.js +0 -76
  101. package/dist-cjs/stepper-input/internal/useDynamicAriaLabel.js.map +0 -1
  102. package/dist-es/stepper-input/internal/useActivationIndicatorPosition.js +0 -34
  103. package/dist-es/stepper-input/internal/useActivationIndicatorPosition.js.map +0 -1
  104. package/dist-es/stepper-input/internal/useDynamicAriaLabel.js +0 -72
  105. package/dist-es/stepper-input/internal/useDynamicAriaLabel.js.map +0 -1
  106. package/dist-types/stepper-input/internal/useActivationIndicatorPosition.d.ts +0 -2
  107. package/dist-types/stepper-input/internal/useDynamicAriaLabel.d.ts +0 -3
@@ -1,296 +1,15 @@
1
- import { MutableRefObject } from "react";
2
- import { ButtonProps } from "@salt-ds/core";
3
- import { InputLegacyProps as InputProps } from "../input-legacy";
1
+ import { MouseEvent, MutableRefObject } from "react";
2
+ import { InputProps } from "@salt-ds/core";
4
3
  import { StepperInputProps } from "./StepperInput";
5
- declare type Direction = "decrement" | "increment";
6
4
  export declare const useStepperInput: (props: StepperInputProps, inputRef: MutableRefObject<HTMLInputElement | null>) => {
7
5
  decrementButtonDown: boolean;
8
- getButtonIcon: (type: Direction) => "triangle-up" | "triangle-down";
9
- getButtonProps: (type?: Direction, buttonPropsProp?: ButtonProps) => {
10
- onMouseDown: (...args: any[]) => void;
11
- onMouseUp: (...args: any[]) => void;
12
- disabled?: boolean | undefined;
13
- focusableWhenDisabled?: boolean | undefined;
14
- variant?: "primary" | "secondary" | "cta" | undefined;
15
- form?: string | undefined;
16
- slot?: string | undefined;
17
- style?: import("react").CSSProperties | undefined;
18
- title?: string | undefined;
19
- type?: "button" | "reset" | "submit" | undefined;
20
- className?: string | undefined;
21
- color?: string | undefined;
22
- id?: string | undefined;
23
- lang?: string | undefined;
24
- name?: string | undefined;
25
- role?: import("react").AriaRole | undefined;
6
+ getButtonProps: (direction: string) => {
7
+ "aria-hidden": boolean;
8
+ disabled: boolean;
26
9
  tabIndex: number;
27
- 'aria-activedescendant'?: string | undefined;
28
- 'aria-atomic'?: (boolean | "true" | "false") | undefined;
29
- 'aria-autocomplete'?: "list" | "none" | "both" | "inline" | undefined;
30
- 'aria-busy'?: (boolean | "true" | "false") | undefined;
31
- 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
32
- 'aria-colcount'?: number | undefined;
33
- 'aria-colindex'?: number | undefined;
34
- 'aria-colspan'?: number | undefined;
35
- 'aria-controls'?: string | undefined;
36
- 'aria-current'?: boolean | "time" | "true" | "false" | "step" | "date" | "page" | "location" | undefined;
37
- 'aria-describedby'?: string | undefined;
38
- 'aria-details'?: string | undefined;
39
- 'aria-disabled'?: (boolean | "true" | "false") | undefined;
40
- 'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
41
- 'aria-errormessage'?: string | undefined;
42
- 'aria-expanded'?: (boolean | "true" | "false") | undefined;
43
- 'aria-flowto'?: string | undefined;
44
- 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
45
- 'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
46
- "aria-hidden": boolean | "true" | "false";
47
- 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
48
- 'aria-keyshortcuts'?: string | undefined;
49
- 'aria-label'?: string | undefined;
50
- 'aria-labelledby'?: string | undefined;
51
- 'aria-level'?: number | undefined;
52
- 'aria-live'?: "off" | "assertive" | "polite" | undefined;
53
- 'aria-modal'?: (boolean | "true" | "false") | undefined;
54
- 'aria-multiline'?: (boolean | "true" | "false") | undefined;
55
- 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
56
- 'aria-orientation'?: "horizontal" | "vertical" | undefined;
57
- 'aria-owns'?: string | undefined;
58
- 'aria-placeholder'?: string | undefined;
59
- 'aria-posinset'?: number | undefined;
60
- 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
61
- 'aria-readonly'?: (boolean | "true" | "false") | undefined;
62
- 'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
63
- 'aria-required'?: (boolean | "true" | "false") | undefined;
64
- 'aria-roledescription'?: string | undefined;
65
- 'aria-rowcount'?: number | undefined;
66
- 'aria-rowindex'?: number | undefined;
67
- 'aria-rowspan'?: number | undefined;
68
- 'aria-selected'?: (boolean | "true" | "false") | undefined;
69
- 'aria-setsize'?: number | undefined;
70
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
71
- 'aria-valuemax'?: number | undefined;
72
- 'aria-valuemin'?: number | undefined;
73
- 'aria-valuenow'?: number | undefined;
74
- 'aria-valuetext'?: string | undefined;
75
- children?: import("react").ReactNode;
76
- dangerouslySetInnerHTML?: {
77
- __html: string;
78
- } | undefined;
79
- onCopy?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
80
- onCopyCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
81
- onCut?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
82
- onCutCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
83
- onPaste?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
84
- onPasteCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
85
- onCompositionEnd?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
86
- onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
87
- onCompositionStart?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
88
- onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
89
- onCompositionUpdate?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
90
- onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
91
- onFocus?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
92
- onFocusCapture?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
93
- onBlur?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
94
- onBlurCapture?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
95
- onChange?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
96
- onChangeCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
97
- onBeforeInput?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
98
- onBeforeInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
99
- onInput?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
100
- onInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
101
- onReset?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
102
- onResetCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
103
- onSubmit?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
104
- onSubmitCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
105
- onInvalid?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
106
- onInvalidCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
107
- onLoad?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
108
- onLoadCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
109
- onError?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
110
- onErrorCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
111
- onKeyDown?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
112
- onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
113
- onKeyPress?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
114
- onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
115
- onKeyUp?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
116
- onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
117
- onAbort?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
118
- onAbortCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
119
- onCanPlay?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
120
- onCanPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
121
- onCanPlayThrough?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
122
- onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
123
- onDurationChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
124
- onDurationChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
125
- onEmptied?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
126
- onEmptiedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
127
- onEncrypted?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
128
- onEncryptedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
129
- onEnded?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
130
- onEndedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
131
- onLoadedData?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
132
- onLoadedDataCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
133
- onLoadedMetadata?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
134
- onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
135
- onLoadStart?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
136
- onLoadStartCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
137
- onPause?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
138
- onPauseCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
139
- onPlay?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
140
- onPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
141
- onPlaying?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
142
- onPlayingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
143
- onProgress?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
144
- onProgressCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
145
- onRateChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
146
- onRateChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
147
- onResize?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
148
- onResizeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
149
- onSeeked?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
150
- onSeekedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
151
- onSeeking?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
152
- onSeekingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
153
- onStalled?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
154
- onStalledCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
155
- onSuspend?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
156
- onSuspendCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
157
- onTimeUpdate?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
158
- onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
159
- onVolumeChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
160
- onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
161
- onWaiting?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
162
- onWaitingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
163
- onAuxClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
164
- onAuxClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
165
- onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
166
- onClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
167
- onContextMenu?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
168
- onContextMenuCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
169
- onDoubleClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
170
- onDoubleClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
171
- onDrag?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
172
- onDragCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
173
- onDragEnd?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
174
- onDragEndCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
175
- onDragEnter?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
176
- onDragEnterCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
177
- onDragExit?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
178
- onDragExitCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
179
- onDragLeave?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
180
- onDragLeaveCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
181
- onDragOver?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
182
- onDragOverCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
183
- onDragStart?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
184
- onDragStartCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
185
- onDrop?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
186
- onDropCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
187
- onMouseDownCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
188
- onMouseEnter?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
189
- onMouseLeave?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
190
- onMouseMove?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
191
- onMouseMoveCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
192
- onMouseOut?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
193
- onMouseOutCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
194
- onMouseOver?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
195
- onMouseOverCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
196
- onMouseUpCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
197
- onSelect?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
198
- onSelectCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
199
- onTouchCancel?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
200
- onTouchCancelCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
201
- onTouchEnd?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
202
- onTouchEndCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
203
- onTouchMove?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
204
- onTouchMoveCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
205
- onTouchStart?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
206
- onTouchStartCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
207
- onPointerDown?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
208
- onPointerDownCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
209
- onPointerMove?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
210
- onPointerMoveCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
211
- onPointerUp?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
212
- onPointerUpCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
213
- onPointerCancel?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
214
- onPointerCancelCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
215
- onPointerEnter?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
216
- onPointerEnterCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
217
- onPointerLeave?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
218
- onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
219
- onPointerOver?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
220
- onPointerOverCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
221
- onPointerOut?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
222
- onPointerOutCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
223
- onGotPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
224
- onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
225
- onLostPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
226
- onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
227
- onScroll?: import("react").UIEventHandler<HTMLButtonElement> | undefined;
228
- onScrollCapture?: import("react").UIEventHandler<HTMLButtonElement> | undefined;
229
- onWheel?: import("react").WheelEventHandler<HTMLButtonElement> | undefined;
230
- onWheelCapture?: import("react").WheelEventHandler<HTMLButtonElement> | undefined;
231
- onAnimationStart?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
232
- onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
233
- onAnimationEnd?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
234
- onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
235
- onAnimationIteration?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
236
- onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
237
- onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
238
- onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
239
- key?: import("react").Key | null | undefined;
240
- defaultChecked?: boolean | undefined;
241
- defaultValue?: string | number | readonly string[] | undefined;
242
- suppressContentEditableWarning?: boolean | undefined;
243
- suppressHydrationWarning?: boolean | undefined;
244
- accessKey?: string | undefined;
245
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
246
- contextMenu?: string | undefined;
247
- dir?: string | undefined;
248
- draggable?: (boolean | "true" | "false") | undefined;
249
- hidden?: boolean | undefined;
250
- nonce?: string | undefined;
251
- placeholder?: string | undefined;
252
- spellCheck?: (boolean | "true" | "false") | undefined;
253
- translate?: "yes" | "no" | undefined;
254
- radioGroup?: string | undefined;
255
- about?: string | undefined;
256
- datatype?: string | undefined;
257
- inlist?: any;
258
- prefix?: string | undefined;
259
- property?: string | undefined;
260
- resource?: string | undefined;
261
- typeof?: string | undefined;
262
- vocab?: string | undefined;
263
- autoCapitalize?: string | undefined;
264
- autoCorrect?: string | undefined;
265
- autoSave?: string | undefined;
266
- itemProp?: string | undefined;
267
- itemScope?: boolean | undefined;
268
- itemType?: string | undefined;
269
- itemID?: string | undefined;
270
- itemRef?: string | undefined;
271
- results?: number | undefined;
272
- security?: string | undefined;
273
- unselectable?: "on" | "off" | undefined;
274
- inputMode?: "text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
275
- is?: string | undefined;
276
- autoFocus?: boolean | undefined;
277
- formAction?: string | undefined;
278
- formEncType?: string | undefined;
279
- formMethod?: string | undefined;
280
- formNoValidate?: boolean | undefined;
281
- formTarget?: string | undefined;
282
- value?: string | number | readonly string[] | undefined;
283
- "data-testid": string;
10
+ onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
11
+ onMouseUp: () => void | undefined;
284
12
  };
285
13
  getInputProps: (inputProps?: InputProps) => InputProps | undefined;
286
14
  incrementButtonDown: boolean;
287
- isAtMax: () => boolean;
288
- isAtMin: () => boolean;
289
- refreshCurrentValue: () => void;
290
- stepperDirection: {
291
- INCREMENT: Direction;
292
- DECREMENT: Direction;
293
- };
294
- valuesHaveDiverged: () => boolean;
295
15
  };
296
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salt-ds/lab",
3
- "version": "1.0.0-alpha.43",
3
+ "version": "1.0.0-alpha.45",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "react-window": "^1.8.6",
27
27
  "rifm": "^0.12.0",
28
28
  "tinycolor2": "^1.4.2",
29
- "@salt-ds/core": "^1.27.0",
29
+ "@salt-ds/core": "^1.28.0",
30
30
  "@salt-ds/window": "^0.1.1",
31
31
  "@salt-ds/styles": "^0.2.1",
32
32
  "@salt-ds/icons": "^1.11.2"
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@salt-ds/core');
6
- require('../../form-field-context-legacy/FormFieldLegacyContext.js');
7
- var useFormFieldLegacyProps = require('../../form-field-context-legacy/useFormFieldLegacyProps.js');
8
-
9
- const refreshButtonWidth = {
10
- touch: 36,
11
- low: 28,
12
- medium: 24,
13
- high: 12
14
- };
15
- function useActivationIndicatorPosition(adornmentRef, refreshButtonVisible) {
16
- const formFieldProps = useFormFieldLegacyProps.useFormFieldLegacyProps();
17
- const { ref: formFieldRef } = formFieldProps;
18
- const density = core.useDensity();
19
- core.useIsomorphicLayoutEffect(() => {
20
- let offset;
21
- if (adornmentRef && adornmentRef.current !== null) {
22
- const marginAdjustment = density === "high" || density === "medium" ? 2 : 4;
23
- const secondaryButtonAdjustment = refreshButtonVisible ? 0 : refreshButtonWidth[density];
24
- offset = adornmentRef.current.getBoundingClientRect().width - marginAdjustment - secondaryButtonAdjustment;
25
- }
26
- if (formFieldRef && formFieldRef.current && offset) {
27
- const activationIndicator = formFieldRef.current.getElementsByClassName(
28
- "saltFormActivationIndicator-icon"
29
- );
30
- if (activationIndicator.length > 0) {
31
- activationIndicator[0].style.transform = `translateX(-${offset}px)`;
32
- }
33
- }
34
- });
35
- }
36
-
37
- exports.useActivationIndicatorPosition = useActivationIndicatorPosition;
38
- //# sourceMappingURL=useActivationIndicatorPosition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useActivationIndicatorPosition.js","sources":["../src/stepper-input/internal/useActivationIndicatorPosition.ts"],"sourcesContent":["import { useDensity, useIsomorphicLayoutEffect } from \"@salt-ds/core\";\nimport { useFormFieldLegacyProps } from \"../../form-field-context-legacy\";\nimport { MutableRefObject } from \"react\";\n\nconst refreshButtonWidth = {\n touch: 36,\n low: 28,\n medium: 24,\n high: 12,\n};\n\n// The activation indicator icon is absolutely positioned by FormField,\n// and must be offset to accommodate the end adornment added by Stepper Input.\n// Ideally, we should be able to provide an 'activationIndicator' class to FormField to\n// override its default positioning instead of directly repositioning it via its ref.\nexport function useActivationIndicatorPosition(\n adornmentRef: MutableRefObject<HTMLDivElement | null>,\n refreshButtonVisible: boolean\n) {\n const formFieldProps = useFormFieldLegacyProps();\n const { ref: formFieldRef } = formFieldProps;\n const density = useDensity();\n\n useIsomorphicLayoutEffect(() => {\n let offset;\n if (adornmentRef && adornmentRef.current !== null) {\n const marginAdjustment =\n density === \"high\" || density === \"medium\" ? 2 : 4;\n\n const secondaryButtonAdjustment = refreshButtonVisible\n ? 0\n : refreshButtonWidth[density];\n\n offset =\n adornmentRef.current.getBoundingClientRect().width -\n marginAdjustment -\n secondaryButtonAdjustment;\n }\n if (formFieldRef && formFieldRef.current && offset) {\n const activationIndicator = formFieldRef.current.getElementsByClassName(\n \"saltFormActivationIndicator-icon\"\n ) as HTMLCollectionOf<HTMLElement>;\n if (activationIndicator.length > 0) {\n activationIndicator[0].style.transform = `translateX(-${offset}px)`;\n }\n }\n });\n}\n"],"names":["useFormFieldLegacyProps","useDensity","useIsomorphicLayoutEffect"],"mappings":";;;;;;;;AAIA,MAAM,kBAA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', { value: true });
4
-
5
- var React = require('react');
6
- var core = require('@salt-ds/core');
7
-
8
- const useDynamicAriaLabel = (appendLabel, hasLiveValue, inputRef, value, valuesHaveDiverged) => {
9
- const [hasAnnounced, setHasAnnounced] = React.useState(false);
10
- const { announce } = core.useAriaAnnouncer();
11
- React.useEffect(() => {
12
- var _a;
13
- function applyAriaMessage(ariaLabel) {
14
- var _a2, _b, _c, _d;
15
- if (!ariaLabel.includes(appendLabel)) {
16
- (_a2 = inputRef.current) == null ? void 0 : _a2.setAttribute(
17
- "aria-label",
18
- `${ariaLabel}${appendLabel}`
19
- );
20
- }
21
- const currentId = ((_b = inputRef.current) == null ? void 0 : _b.getAttribute("id")) || "";
22
- const labelledBy = ((_c = inputRef.current) == null ? void 0 : _c.getAttribute("aria-labelledby")) || "";
23
- if (!labelledBy.includes(currentId)) {
24
- (_d = inputRef.current) == null ? void 0 : _d.setAttribute(
25
- "aria-labelledby",
26
- `${labelledBy} ${currentId}`
27
- );
28
- }
29
- }
30
- function removeAriaMessage(ariaLabel) {
31
- var _a2, _b, _c, _d, _e;
32
- const replacementAria = ariaLabel == null ? void 0 : ariaLabel.replace(appendLabel, "");
33
- if (replacementAria !== void 0) {
34
- (_a2 = inputRef.current) == null ? void 0 : _a2.setAttribute("aria-label", replacementAria);
35
- }
36
- const replacementLabelledBy = (_d = (_b = inputRef.current) == null ? void 0 : _b.getAttribute("aria-labelledby")) == null ? void 0 : _d.replace(` ${(_c = inputRef.current) == null ? void 0 : _c.getAttribute("id")}`, "");
37
- if (replacementLabelledBy !== void 0) {
38
- (_e = inputRef.current) == null ? void 0 : _e.setAttribute(
39
- "aria-labelledby",
40
- replacementLabelledBy
41
- );
42
- }
43
- }
44
- if (hasLiveValue) {
45
- const ariaLabel = ((_a = inputRef.current) == null ? void 0 : _a.getAttribute("aria-label")) || "";
46
- if (valuesHaveDiverged()) {
47
- applyAriaMessage(ariaLabel);
48
- } else {
49
- removeAriaMessage(ariaLabel);
50
- }
51
- }
52
- }, [appendLabel, inputRef, hasLiveValue, valuesHaveDiverged, value]);
53
- React.useEffect(() => {
54
- var _a;
55
- if (hasLiveValue && valuesHaveDiverged()) {
56
- if (inputRef.current !== document.activeElement && !hasAnnounced) {
57
- announce("");
58
- announce(`${(_a = inputRef.current) == null ? void 0 : _a.getAttribute("aria-label")}`);
59
- setHasAnnounced(true);
60
- }
61
- }
62
- }, [
63
- announce,
64
- appendLabel,
65
- hasAnnounced,
66
- inputRef,
67
- hasLiveValue,
68
- setHasAnnounced,
69
- valuesHaveDiverged,
70
- value
71
- ]);
72
- return { setHasAnnounced };
73
- };
74
-
75
- exports.useDynamicAriaLabel = useDynamicAriaLabel;
76
- //# sourceMappingURL=useDynamicAriaLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicAriaLabel.js","sources":["../src/stepper-input/internal/useDynamicAriaLabel.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { useAriaAnnouncer } from \"@salt-ds/core\";\n\n// Dynamically append a string to aria-label if the component\n// is controlled and the display value can be refreshed\nexport const useDynamicAriaLabel = (\n appendLabel: string,\n hasLiveValue: boolean,\n inputRef: React.MutableRefObject<HTMLInputElement | null>,\n value: number | string | undefined,\n valuesHaveDiverged: () => boolean\n) => {\n const [hasAnnounced, setHasAnnounced] = useState(false);\n const { announce } = useAriaAnnouncer();\n\n useEffect(() => {\n function applyAriaMessage(ariaLabel: string) {\n // Don't append the message again if it's already part of the string\n if (!ariaLabel.includes(appendLabel)) {\n inputRef.current?.setAttribute(\n \"aria-label\",\n `${ariaLabel}${appendLabel}`\n );\n }\n\n const currentId = inputRef.current?.getAttribute(\"id\") || \"\";\n const labelledBy =\n inputRef.current?.getAttribute(\"aria-labelledby\") || \"\";\n\n if (!labelledBy.includes(currentId)) {\n inputRef.current?.setAttribute(\n \"aria-labelledby\",\n `${labelledBy} ${currentId}`\n );\n }\n }\n\n function removeAriaMessage(ariaLabel: string) {\n const replacementAria = ariaLabel?.replace(appendLabel, \"\");\n if (replacementAria !== undefined) {\n inputRef.current?.setAttribute(\"aria-label\", replacementAria);\n }\n\n const replacementLabelledBy = inputRef.current\n ?.getAttribute(\"aria-labelledby\")\n ?.replace(` ${inputRef.current?.getAttribute(\"id\")}`, \"\");\n\n if (replacementLabelledBy !== undefined) {\n inputRef.current?.setAttribute(\n \"aria-labelledby\",\n replacementLabelledBy\n );\n }\n }\n\n if (hasLiveValue) {\n const ariaLabel = inputRef.current?.getAttribute(\"aria-label\") || \"\";\n if (valuesHaveDiverged()) {\n applyAriaMessage(ariaLabel);\n } else {\n removeAriaMessage(ariaLabel);\n }\n }\n }, [appendLabel, inputRef, hasLiveValue, valuesHaveDiverged, value]);\n\n useEffect(() => {\n if (hasLiveValue && valuesHaveDiverged()) {\n // Screen readers will automatically announce updates when the dynamic `aria-label`\n // changes and the component has focus. When the component *does not* have\n // focus we should announce only once for the first value update\n if (inputRef.current !== document.activeElement && !hasAnnounced) {\n // Empty announcement required until a fix is in place for announcer\n announce(\"\");\n announce(`${inputRef.current?.getAttribute(\"aria-label\")}`);\n\n // We only want to announce on the first value change, but this flag\n // is reset when the input receives focus\n setHasAnnounced(true);\n }\n }\n }, [\n announce,\n appendLabel,\n hasAnnounced,\n inputRef,\n hasLiveValue,\n setHasAnnounced,\n valuesHaveDiverged,\n value,\n ]);\n\n return { setHasAnnounced };\n};\n"],"names":["useState","useAriaAnnouncer","useEffect","_a"],"mappings":";;;;;;;AAKO,MAAM,sBAAsB,CACjC,WAAA,EACA,YACA,EAAA,QAAA,EACA,OACA,kBACG,KAAA;AACH,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAIA,eAAS,KAAK,CAAA,CAAA;AACtD,EAAM,MAAA,EAAE,QAAS,EAAA,GAAIC,qBAAiB,EAAA,CAAA;AAEtC,EAAAC,eAAA,CAAU,MAAM;AAflB,IAAA,IAAA,EAAA,CAAA;AAgBI,IAAA,SAAS,iBAAiB,SAAmB,EAAA;AAhBjD,MAAA,IAAAC,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,CAAA;AAkEI,IAAI,IAAA,YAAA,IAAgB,oBAAsB,EAAA;AAIxC,MAAA,IAAI,QAAS,CAAA,OAAA,KAAY,QAAS,CAAA,aAAA,IAAiB,CAAC,YAAc,EAAA;AAEhE,QAAA,QAAA,CAAS,EAAE,CAAA,CAAA;AACX,QAAA,QAAA,CAAS,CAAG,EAAA,CAAA,EAAA,GAAA,QAAA,CAAS,OAAT,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkB,aAAa,YAAe,CAAA,CAAA,CAAA,CAAA,CAAA;AAI1D,QAAA,eAAA,CAAgB,IAAI,CAAA,CAAA;AAAA,OACtB;AAAA,KACF;AAAA,GACC,EAAA;AAAA,IACD,QAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,EAAE,eAAgB,EAAA,CAAA;AAC3B;;;;"}
@@ -1,34 +0,0 @@
1
- import { useDensity, useIsomorphicLayoutEffect } from '@salt-ds/core';
2
- import '../../form-field-context-legacy/FormFieldLegacyContext.js';
3
- import { useFormFieldLegacyProps } from '../../form-field-context-legacy/useFormFieldLegacyProps.js';
4
-
5
- const refreshButtonWidth = {
6
- touch: 36,
7
- low: 28,
8
- medium: 24,
9
- high: 12
10
- };
11
- function useActivationIndicatorPosition(adornmentRef, refreshButtonVisible) {
12
- const formFieldProps = useFormFieldLegacyProps();
13
- const { ref: formFieldRef } = formFieldProps;
14
- const density = useDensity();
15
- useIsomorphicLayoutEffect(() => {
16
- let offset;
17
- if (adornmentRef && adornmentRef.current !== null) {
18
- const marginAdjustment = density === "high" || density === "medium" ? 2 : 4;
19
- const secondaryButtonAdjustment = refreshButtonVisible ? 0 : refreshButtonWidth[density];
20
- offset = adornmentRef.current.getBoundingClientRect().width - marginAdjustment - secondaryButtonAdjustment;
21
- }
22
- if (formFieldRef && formFieldRef.current && offset) {
23
- const activationIndicator = formFieldRef.current.getElementsByClassName(
24
- "saltFormActivationIndicator-icon"
25
- );
26
- if (activationIndicator.length > 0) {
27
- activationIndicator[0].style.transform = `translateX(-${offset}px)`;
28
- }
29
- }
30
- });
31
- }
32
-
33
- export { useActivationIndicatorPosition };
34
- //# sourceMappingURL=useActivationIndicatorPosition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useActivationIndicatorPosition.js","sources":["../src/stepper-input/internal/useActivationIndicatorPosition.ts"],"sourcesContent":["import { useDensity, useIsomorphicLayoutEffect } from \"@salt-ds/core\";\nimport { useFormFieldLegacyProps } from \"../../form-field-context-legacy\";\nimport { MutableRefObject } from \"react\";\n\nconst refreshButtonWidth = {\n touch: 36,\n low: 28,\n medium: 24,\n high: 12,\n};\n\n// The activation indicator icon is absolutely positioned by FormField,\n// and must be offset to accommodate the end adornment added by Stepper Input.\n// Ideally, we should be able to provide an 'activationIndicator' class to FormField to\n// override its default positioning instead of directly repositioning it via its ref.\nexport function useActivationIndicatorPosition(\n adornmentRef: MutableRefObject<HTMLDivElement | null>,\n refreshButtonVisible: boolean\n) {\n const formFieldProps = useFormFieldLegacyProps();\n const { ref: formFieldRef } = formFieldProps;\n const density = useDensity();\n\n useIsomorphicLayoutEffect(() => {\n let offset;\n if (adornmentRef && adornmentRef.current !== null) {\n const marginAdjustment =\n density === \"high\" || density === \"medium\" ? 2 : 4;\n\n const secondaryButtonAdjustment = refreshButtonVisible\n ? 0\n : refreshButtonWidth[density];\n\n offset =\n adornmentRef.current.getBoundingClientRect().width -\n marginAdjustment -\n secondaryButtonAdjustment;\n }\n if (formFieldRef && formFieldRef.current && offset) {\n const activationIndicator = formFieldRef.current.getElementsByClassName(\n \"saltFormActivationIndicator-icon\"\n ) as HTMLCollectionOf<HTMLElement>;\n if (activationIndicator.length > 0) {\n activationIndicator[0].style.transform = `translateX(-${offset}px)`;\n }\n }\n });\n}\n"],"names":[],"mappings":";;;;AAIA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aAnnouncer } from '@salt-ds/core';
3
-
4
- const useDynamicAriaLabel = (appendLabel, hasLiveValue, inputRef, value, valuesHaveDiverged) => {
5
- const [hasAnnounced, setHasAnnounced] = useState(false);
6
- const { announce } = useAriaAnnouncer();
7
- useEffect(() => {
8
- var _a;
9
- function applyAriaMessage(ariaLabel) {
10
- var _a2, _b, _c, _d;
11
- if (!ariaLabel.includes(appendLabel)) {
12
- (_a2 = inputRef.current) == null ? void 0 : _a2.setAttribute(
13
- "aria-label",
14
- `${ariaLabel}${appendLabel}`
15
- );
16
- }
17
- const currentId = ((_b = inputRef.current) == null ? void 0 : _b.getAttribute("id")) || "";
18
- const labelledBy = ((_c = inputRef.current) == null ? void 0 : _c.getAttribute("aria-labelledby")) || "";
19
- if (!labelledBy.includes(currentId)) {
20
- (_d = inputRef.current) == null ? void 0 : _d.setAttribute(
21
- "aria-labelledby",
22
- `${labelledBy} ${currentId}`
23
- );
24
- }
25
- }
26
- function removeAriaMessage(ariaLabel) {
27
- var _a2, _b, _c, _d, _e;
28
- const replacementAria = ariaLabel == null ? void 0 : ariaLabel.replace(appendLabel, "");
29
- if (replacementAria !== void 0) {
30
- (_a2 = inputRef.current) == null ? void 0 : _a2.setAttribute("aria-label", replacementAria);
31
- }
32
- const replacementLabelledBy = (_d = (_b = inputRef.current) == null ? void 0 : _b.getAttribute("aria-labelledby")) == null ? void 0 : _d.replace(` ${(_c = inputRef.current) == null ? void 0 : _c.getAttribute("id")}`, "");
33
- if (replacementLabelledBy !== void 0) {
34
- (_e = inputRef.current) == null ? void 0 : _e.setAttribute(
35
- "aria-labelledby",
36
- replacementLabelledBy
37
- );
38
- }
39
- }
40
- if (hasLiveValue) {
41
- const ariaLabel = ((_a = inputRef.current) == null ? void 0 : _a.getAttribute("aria-label")) || "";
42
- if (valuesHaveDiverged()) {
43
- applyAriaMessage(ariaLabel);
44
- } else {
45
- removeAriaMessage(ariaLabel);
46
- }
47
- }
48
- }, [appendLabel, inputRef, hasLiveValue, valuesHaveDiverged, value]);
49
- useEffect(() => {
50
- var _a;
51
- if (hasLiveValue && valuesHaveDiverged()) {
52
- if (inputRef.current !== document.activeElement && !hasAnnounced) {
53
- announce("");
54
- announce(`${(_a = inputRef.current) == null ? void 0 : _a.getAttribute("aria-label")}`);
55
- setHasAnnounced(true);
56
- }
57
- }
58
- }, [
59
- announce,
60
- appendLabel,
61
- hasAnnounced,
62
- inputRef,
63
- hasLiveValue,
64
- setHasAnnounced,
65
- valuesHaveDiverged,
66
- value
67
- ]);
68
- return { setHasAnnounced };
69
- };
70
-
71
- export { useDynamicAriaLabel };
72
- //# sourceMappingURL=useDynamicAriaLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicAriaLabel.js","sources":["../src/stepper-input/internal/useDynamicAriaLabel.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { useAriaAnnouncer } from \"@salt-ds/core\";\n\n// Dynamically append a string to aria-label if the component\n// is controlled and the display value can be refreshed\nexport const useDynamicAriaLabel = (\n appendLabel: string,\n hasLiveValue: boolean,\n inputRef: React.MutableRefObject<HTMLInputElement | null>,\n value: number | string | undefined,\n valuesHaveDiverged: () => boolean\n) => {\n const [hasAnnounced, setHasAnnounced] = useState(false);\n const { announce } = useAriaAnnouncer();\n\n useEffect(() => {\n function applyAriaMessage(ariaLabel: string) {\n // Don't append the message again if it's already part of the string\n if (!ariaLabel.includes(appendLabel)) {\n inputRef.current?.setAttribute(\n \"aria-label\",\n `${ariaLabel}${appendLabel}`\n );\n }\n\n const currentId = inputRef.current?.getAttribute(\"id\") || \"\";\n const labelledBy =\n inputRef.current?.getAttribute(\"aria-labelledby\") || \"\";\n\n if (!labelledBy.includes(currentId)) {\n inputRef.current?.setAttribute(\n \"aria-labelledby\",\n `${labelledBy} ${currentId}`\n );\n }\n }\n\n function removeAriaMessage(ariaLabel: string) {\n const replacementAria = ariaLabel?.replace(appendLabel, \"\");\n if (replacementAria !== undefined) {\n inputRef.current?.setAttribute(\"aria-label\", replacementAria);\n }\n\n const replacementLabelledBy = inputRef.current\n ?.getAttribute(\"aria-labelledby\")\n ?.replace(` ${inputRef.current?.getAttribute(\"id\")}`, \"\");\n\n if (replacementLabelledBy !== undefined) {\n inputRef.current?.setAttribute(\n \"aria-labelledby\",\n replacementLabelledBy\n );\n }\n }\n\n if (hasLiveValue) {\n const ariaLabel = inputRef.current?.getAttribute(\"aria-label\") || \"\";\n if (valuesHaveDiverged()) {\n applyAriaMessage(ariaLabel);\n } else {\n removeAriaMessage(ariaLabel);\n }\n }\n }, [appendLabel, inputRef, hasLiveValue, valuesHaveDiverged, value]);\n\n useEffect(() => {\n if (hasLiveValue && valuesHaveDiverged()) {\n // Screen readers will automatically announce updates when the dynamic `aria-label`\n // changes and the component has focus. When the component *does not* have\n // focus we should announce only once for the first value update\n if (inputRef.current !== document.activeElement && !hasAnnounced) {\n // Empty announcement required until a fix is in place for announcer\n announce(\"\");\n announce(`${inputRef.current?.getAttribute(\"aria-label\")}`);\n\n // We only want to announce on the first value change, but this flag\n // is reset when the input receives focus\n setHasAnnounced(true);\n }\n }\n }, [\n announce,\n appendLabel,\n hasAnnounced,\n inputRef,\n hasLiveValue,\n setHasAnnounced,\n valuesHaveDiverged,\n value,\n ]);\n\n return { setHasAnnounced };\n};\n"],"names":["_a"],"mappings":";;;AAKO,MAAM,sBAAsB,CACjC,WAAA,EACA,YACA,EAAA,QAAA,EACA,OACA,kBACG,KAAA;AACH,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACtD,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,gBAAiB,EAAA,CAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AAflB,IAAA,IAAA,EAAA,CAAA;AAgBI,IAAA,SAAS,iBAAiB,SAAmB,EAAA;AAhBjD,MAAA,IAAAA,GAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAkBM,MAAA,IAAI,CAAC,SAAA,C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AA,OAAA,KAAY,QAAS,CAAA,aAAA,IAAiB,CAAC,YAAc,EAAA;AAEhE,QAAA,QAAA,CAAS,EAAE,CAAA,CAAA;AACX,QAAA,QAAA,CAAS,CAAG,EAAA,CAAA,EAAA,GAAA,QAAA,CAAS,OAAT,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkB,aAAa,YAAe,CAAA,CAAA,CAAA,CAAA,CAAA;AAI1D,QAAA,eAAA,CAAgB,IAAI,CAAA,CAAA;AAAA,OACtB;AAAA,KACF;AAAA,GACC,EAAA;AAAA,IACD,QAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,EAAE,eAAgB,EAAA,CAAA;AAC3B;;;;"}
@@ -1,2 +0,0 @@
1
- import { MutableRefObject } from "react";
2
- export declare function useActivationIndicatorPosition(adornmentRef: MutableRefObject<HTMLDivElement | null>, refreshButtonVisible: boolean): void;
@@ -1,3 +0,0 @@
1
- export declare const useDynamicAriaLabel: (appendLabel: string, hasLiveValue: boolean, inputRef: React.MutableRefObject<HTMLInputElement | null>, value: number | string | undefined, valuesHaveDiverged: () => boolean) => {
2
- setHasAnnounced: import("react").Dispatch<import("react").SetStateAction<boolean>>;
3
- };