etudes 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/lib/Accordion.d.ts +80 -71
  3. package/lib/Accordion.js +173 -183
  4. package/lib/Accordion.js.map +1 -1
  5. package/lib/BurgerButton.d.ts +20 -7
  6. package/lib/BurgerButton.js +113 -20
  7. package/lib/BurgerButton.js.map +1 -1
  8. package/lib/Conditional.d.ts +2 -3
  9. package/lib/Conditional.js +0 -1
  10. package/lib/Conditional.js.map +1 -1
  11. package/lib/DebugConsole.d.ts +14 -23
  12. package/lib/DebugConsole.js +86 -87
  13. package/lib/DebugConsole.js.map +1 -1
  14. package/lib/Dial.d.ts +53 -16
  15. package/lib/Dial.js +121 -35
  16. package/lib/Dial.js.map +1 -1
  17. package/lib/Dropdown.d.ts +68 -83
  18. package/lib/Dropdown.js +226 -161
  19. package/lib/Dropdown.js.map +1 -1
  20. package/lib/Each.d.ts +2 -2
  21. package/lib/Each.js.map +1 -1
  22. package/lib/ExtractChild.d.ts +5 -4
  23. package/lib/ExtractChild.js +13 -11
  24. package/lib/ExtractChild.js.map +1 -1
  25. package/lib/ExtractChildren.d.ts +2 -2
  26. package/lib/ExtractChildren.js +7 -5
  27. package/lib/ExtractChildren.js.map +1 -1
  28. package/lib/FlatSVG.d.ts +30 -25
  29. package/lib/FlatSVG.js +28 -37
  30. package/lib/FlatSVG.js.map +1 -1
  31. package/lib/List.d.ts +97 -54
  32. package/lib/List.js +124 -63
  33. package/lib/List.js.map +1 -1
  34. package/lib/MasonryGrid.d.ts +27 -15
  35. package/lib/MasonryGrid.js +163 -148
  36. package/lib/MasonryGrid.js.map +1 -1
  37. package/lib/Panorama.d.ts +100 -21
  38. package/lib/Panorama.js +45 -44
  39. package/lib/Panorama.js.map +1 -1
  40. package/lib/PanoramaSlider.d.ts +65 -23
  41. package/lib/PanoramaSlider.js +150 -45
  42. package/lib/PanoramaSlider.js.map +1 -1
  43. package/lib/RangeSlider.d.ts +29 -89
  44. package/lib/RangeSlider.js +272 -286
  45. package/lib/RangeSlider.js.map +1 -1
  46. package/lib/Repeat.d.ts +4 -3
  47. package/lib/Repeat.js +3 -2
  48. package/lib/Repeat.js.map +1 -1
  49. package/lib/RotatingGallery.d.ts +38 -36
  50. package/lib/RotatingGallery.js +47 -17
  51. package/lib/RotatingGallery.js.map +1 -1
  52. package/lib/SelectableButton.d.ts +13 -4
  53. package/lib/SelectableButton.js +3 -14
  54. package/lib/SelectableButton.js.map +1 -1
  55. package/lib/Slider.d.ts +103 -41
  56. package/lib/Slider.js +182 -82
  57. package/lib/Slider.js.map +1 -1
  58. package/lib/StepwiseSlider.d.ts +146 -59
  59. package/lib/StepwiseSlider.js +248 -142
  60. package/lib/StepwiseSlider.js.map +1 -1
  61. package/lib/SwipeContainer.d.ts +13 -5
  62. package/lib/SwipeContainer.js +5 -15
  63. package/lib/SwipeContainer.js.map +1 -1
  64. package/lib/TextField.d.ts +1 -1
  65. package/lib/TextField.js +5 -15
  66. package/lib/TextField.js.map +1 -1
  67. package/lib/Video.d.ts +30 -51
  68. package/lib/Video.js +77 -119
  69. package/lib/Video.js.map +1 -1
  70. package/lib/WithTooltip.d.ts +16 -18
  71. package/lib/WithTooltip.js +167 -101
  72. package/lib/WithTooltip.js.map +1 -1
  73. package/lib/hooks/useDocumentTitle.d.ts +2 -1
  74. package/lib/hooks/useDocumentTitle.js +2 -1
  75. package/lib/hooks/useDocumentTitle.js.map +1 -1
  76. package/lib/hooks/useDragEffect.d.ts +25 -16
  77. package/lib/hooks/useDragEffect.js +30 -20
  78. package/lib/hooks/useDragEffect.js.map +1 -1
  79. package/lib/hooks/useElementRect.d.ts +2 -1
  80. package/lib/hooks/useElementRect.js +5 -4
  81. package/lib/hooks/useElementRect.js.map +1 -1
  82. package/lib/hooks/useInterval.d.ts +2 -2
  83. package/lib/hooks/useInterval.js +1 -1
  84. package/lib/hooks/useInterval.js.map +1 -1
  85. package/lib/hooks/useLoadImageEffect.d.ts +6 -6
  86. package/lib/hooks/useLoadImageEffect.js.map +1 -1
  87. package/lib/hooks/usePrevious.d.ts +6 -0
  88. package/lib/hooks/usePrevious.js +17 -0
  89. package/lib/hooks/usePrevious.js.map +1 -0
  90. package/lib/hooks/useResizeEffect.d.ts +2 -2
  91. package/lib/hooks/useResizeEffect.js +5 -8
  92. package/lib/hooks/useResizeEffect.js.map +1 -1
  93. package/lib/hooks/useSearchParamState.d.ts +10 -7
  94. package/lib/hooks/useSearchParamState.js +14 -10
  95. package/lib/hooks/useSearchParamState.js.map +1 -1
  96. package/lib/utils/asClassNameDict.d.ts +3 -0
  97. package/lib/utils/asClassNameDict.js +7 -0
  98. package/lib/utils/asClassNameDict.js.map +1 -0
  99. package/lib/utils/asComponentDict.d.ts +5 -0
  100. package/lib/utils/asComponentDict.js +23 -0
  101. package/lib/utils/asComponentDict.js.map +1 -0
  102. package/lib/utils/asStyleDict.d.ts +4 -0
  103. package/lib/utils/asStyleDict.js +7 -0
  104. package/lib/utils/asStyleDict.js.map +1 -0
  105. package/lib/utils/cloneStyledElement.d.ts +18 -0
  106. package/lib/utils/cloneStyledElement.js +63 -0
  107. package/lib/utils/cloneStyledElement.js.map +1 -0
  108. package/lib/utils/styles.d.ts +2 -0
  109. package/lib/utils/styles.js +22 -0
  110. package/lib/utils/styles.js.map +1 -0
  111. package/lib/utils/useDebug.d.ts +2 -0
  112. package/lib/utils/useDebug.js +46 -0
  113. package/lib/utils/useDebug.js.map +1 -0
  114. package/package.json +25 -33
  115. package/lib/AbstractSelectableCollection.d.ts +0 -94
  116. package/lib/AbstractSelectableCollection.js +0 -151
  117. package/lib/AbstractSelectableCollection.js.map +0 -1
  118. package/lib/types/index.d.ts +0 -7
  119. package/lib/types/index.js +0 -3
  120. package/lib/types/index.js.map +0 -1
@@ -1,9 +1,10 @@
1
- import { HTMLAttributes } from 'react';
2
- export declare type Props = HTMLAttributes<HTMLDivElement> & {
1
+ import React, { HTMLAttributes, PropsWithChildren } from 'react';
2
+ declare type Orientation = 'horizontal' | 'vertical';
3
+ export declare type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
3
4
  /**
4
- * By default the position is a value from 0 - 1, 0 being the start of the slider and 1 being the
5
- * end. Switching on this flag inverts this behavior, where 0 becomes the end of the slider and 1
6
- * being the start.
5
+ * By default the position is a value from 0 - 1, 0 being the start of the
6
+ * slider and 1 being the end. Switching on this flag inverts this behavior,
7
+ * where 0 becomes the end of the slider and 1 being the start.
7
8
  */
8
9
  isInverted?: boolean;
9
10
  /**
@@ -11,20 +12,11 @@ export declare type Props = HTMLAttributes<HTMLDivElement> & {
11
12
  */
12
13
  isTrackInteractive?: boolean;
13
14
  /**
14
- * Indicates if position/index change events are dispatched only when dragging ends. When
15
- * disabled, aforementioned events are fired repeatedly while dragging.
15
+ * Indicates if position/index change events are dispatched only when dragging
16
+ * ends. When disabled, aforementioned events are fired repeatedly while
17
+ * dragging.
16
18
  */
17
19
  onlyDispatchesOnDragEnd?: boolean;
18
- /**
19
- * A function that returns the label to be displayed at a given slider position and closest step
20
- * index (if steps are provided).
21
- *
22
- * @param position - The current slider position.
23
- * @param index - The nearest step index (if steps are provided), or -1 if no steps are provided.
24
- *
25
- * @returns The label.
26
- */
27
- labelProvider?: (position: number, index: number) => string;
28
20
  /**
29
21
  * Padding between the track and the knob in pixels.
30
22
  */
@@ -40,11 +32,12 @@ export declare type Props = HTMLAttributes<HTMLDivElement> & {
40
32
  /**
41
33
  * Orientation of the slider.
42
34
  */
43
- orientation?: 'horizontal' | 'vertical';
35
+ orientation?: Orientation;
44
36
  /**
45
- * An array of step descriptors. A step is a position (0 - 1 inclusive) on the track where the
46
- * knob should snap to if dragging stops near it. Ensure that there are at least two steps: one
47
- * for the start of the track and one for the end.
37
+ * An array of step descriptors. A step is a position (0 - 1 inclusive) on the
38
+ * track where the knob should snap to if dragging stops near it. Ensure that
39
+ * there are at least two steps: one for the start of the track and one for
40
+ * the end.
48
41
  */
49
42
  steps?: readonly number[];
50
43
  /**
@@ -52,9 +45,21 @@ export declare type Props = HTMLAttributes<HTMLDivElement> & {
52
45
  */
53
46
  index?: number;
54
47
  /**
55
- * Handler invoked when index changes. This can either be invoked from the `index` prop
56
- * being changed or from the slider being dragged. Note that if the event is emitted at the end of
57
- * dragging due to `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
48
+ * A function that returns the label to be displayed at a given slider
49
+ * position and closest step index (if steps are provided).
50
+ *
51
+ * @param position - The current slider position.
52
+ * @param index - The nearest step index (if steps are provided), or -1 if no
53
+ * steps are provided.
54
+ *
55
+ * @returns The label.
56
+ */
57
+ labelProvider?: (position: number, index: number) => string;
58
+ /**
59
+ * Handler invoked when index changes. This can either be invoked from the
60
+ * `index` prop being changed or from the slider being dragged. Note that if
61
+ * the event is emitted at the end of dragging due to
62
+ * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
58
63
  * still `true`. This event is emitted right after `onPositionChange`.
59
64
  *
60
65
  * @param index - The current slider index.
@@ -62,9 +67,10 @@ export declare type Props = HTMLAttributes<HTMLDivElement> & {
62
67
  */
63
68
  onIndexChange?: (index: number, isDragging: boolean) => void;
64
69
  /**
65
- * Handler invoked when position changes. This can either be invoked from the `index` prop
66
- * being changed or from the slider being dragged. Note that if the event is emitted at the end of
67
- * dragging due to `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
70
+ * Handler invoked when position changes. This can either be invoked from the
71
+ * `index` prop being changed or from the slider being dragged. Note that if
72
+ * the event is emitted at the end of dragging due to
73
+ * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
68
74
  * still `true`. This event is emitted right before `onIndexChange`.
69
75
  *
70
76
  * @param position - The current slider position.
@@ -79,42 +85,123 @@ export declare type Props = HTMLAttributes<HTMLDivElement> & {
79
85
  * Handler invoked when dragging begins.
80
86
  */
81
87
  onDragStart?: () => void;
82
- };
88
+ }>;
89
+ /**
90
+ * A "stepwise" slider component supporting both horizontal and vertical
91
+ * orientations that automatically snaps to a set of predefined points on the
92
+ * slider when dragged. These points are referred to as "steps", indexed by an
93
+ * integer referred to as "index". This index can be two-way binded. The
94
+ * component consists of four customizable elements: a draggable knob, a label
95
+ * on the knob, a scroll track before the knob and a scroll track after the
96
+ * knob. While the width and height of the slider is inferred from its CSS
97
+ * rules, the width and height of the knob are set via props (`knobWidth` and
98
+ * `knobHeight`, respectively). The size of the knob does not impact the size of
99
+ * the slider. While dragging, the slider still emits a position change event,
100
+ * where the position is a decimal ranging between 0.0 and 1.0, inclusive.
101
+ *
102
+ * @exports StepwiseSliderKnob - The component for the knob.
103
+ * @exports StepwiseSliderLabel - The component for the label on the knob.
104
+ * @exports StepwiseSliderTrack - The component for the slide track on either
105
+ * side of the knob.
106
+ */
107
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
108
+ /**
109
+ * By default the position is a value from 0 - 1, 0 being the start of the
110
+ * slider and 1 being the end. Switching on this flag inverts this behavior,
111
+ * where 0 becomes the end of the slider and 1 being the start.
112
+ */
113
+ isInverted?: boolean | undefined;
114
+ /**
115
+ * Specifies if the track is clickable to set the position of the knob.
116
+ */
117
+ isTrackInteractive?: boolean | undefined;
118
+ /**
119
+ * Indicates if position/index change events are dispatched only when dragging
120
+ * ends. When disabled, aforementioned events are fired repeatedly while
121
+ * dragging.
122
+ */
123
+ onlyDispatchesOnDragEnd?: boolean | undefined;
124
+ /**
125
+ * Padding between the track and the knob in pixels.
126
+ */
127
+ trackPadding?: number | undefined;
128
+ /**
129
+ * Height of the knob in pixels.
130
+ */
131
+ knobHeight?: number | undefined;
132
+ /**
133
+ * Width of the knob in pixels.
134
+ */
135
+ knobWidth?: number | undefined;
136
+ /**
137
+ * Orientation of the slider.
138
+ */
139
+ orientation?: Orientation | undefined;
140
+ /**
141
+ * An array of step descriptors. A step is a position (0 - 1 inclusive) on the
142
+ * track where the knob should snap to if dragging stops near it. Ensure that
143
+ * there are at least two steps: one for the start of the track and one for
144
+ * the end.
145
+ */
146
+ steps?: readonly number[] | undefined;
147
+ /**
148
+ * The current index.
149
+ */
150
+ index?: number | undefined;
151
+ /**
152
+ * A function that returns the label to be displayed at a given slider
153
+ * position and closest step index (if steps are provided).
154
+ *
155
+ * @param position - The current slider position.
156
+ * @param index - The nearest step index (if steps are provided), or -1 if no
157
+ * steps are provided.
158
+ *
159
+ * @returns The label.
160
+ */
161
+ labelProvider?: ((position: number, index: number) => string) | undefined;
162
+ /**
163
+ * Handler invoked when index changes. This can either be invoked from the
164
+ * `index` prop being changed or from the slider being dragged. Note that if
165
+ * the event is emitted at the end of dragging due to
166
+ * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
167
+ * still `true`. This event is emitted right after `onPositionChange`.
168
+ *
169
+ * @param index - The current slider index.
170
+ * @param isDragging - Specifies if the index change is due to dragging.
171
+ */
172
+ onIndexChange?: ((index: number, isDragging: boolean) => void) | undefined;
173
+ /**
174
+ * Handler invoked when position changes. This can either be invoked from the
175
+ * `index` prop being changed or from the slider being dragged. Note that if
176
+ * the event is emitted at the end of dragging due to
177
+ * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
178
+ * still `true`. This event is emitted right before `onIndexChange`.
179
+ *
180
+ * @param position - The current slider position.
181
+ * @param isDragging - Specifies if the position change is due to dragging.
182
+ */
183
+ onPositionChange?: ((position: number, isDragging: boolean) => void) | undefined;
184
+ /**
185
+ * Handler invoked when dragging ends.
186
+ */
187
+ onDragEnd?: (() => void) | undefined;
188
+ /**
189
+ * Handler invoked when dragging begins.
190
+ */
191
+ onDragStart?: (() => void) | undefined;
192
+ } & {
193
+ children?: React.ReactNode;
194
+ } & React.RefAttributes<HTMLDivElement>>;
195
+ export default _default;
196
+ export declare const StepwiseSliderTrack: ({ ...props }: HTMLAttributes<HTMLDivElement>) => JSX.Element;
197
+ export declare const StepwiseSliderKnob: ({ ...props }: HTMLAttributes<HTMLDivElement>) => JSX.Element;
198
+ export declare const StepwiseSliderLabel: ({ ...props }: HTMLAttributes<HTMLDivElement>) => JSX.Element;
83
199
  /**
84
200
  * Generates a set of steps compatible with this component.
85
201
  *
86
- * @param length - The number of steps. This must be at least 2 because you must include the
87
- * starting and ending points.
202
+ * @param length - The number of steps. This must be at least 2 because you must
203
+ * include the starting and ending points.
88
204
  *
89
205
  * @returns An array of steps.
90
206
  */
91
207
  export declare function generateSteps(length: number): readonly number[];
92
- /**
93
- * A "stepwise" slider component supporting both horizontal and vertical orientations that
94
- * automatically snaps to a set of predefined points on the slider when dragged. These points are
95
- * referred to as "steps", indexed by an integer referred to as "index". This index can be two-way
96
- * binded. The component consists of four customizable elements: a draggable knob, a label on the
97
- * knob, a scroll track before the knob and a scroll track after the knob. While the width and
98
- * height of the slider is inferred from its CSS rules, the width and height of the knob are set via
99
- * props (`knobWidth` and `knobHeight`, respectively). The size of the knob does not impact the size
100
- * of the slider. While dragging, the slider still emits a position change event, where the position
101
- * is a decimal ranging between 0.0 and 1.0, inclusive.
102
- *
103
- * @exports StepwiseSliderKnob - The component for the knob.
104
- * @exports StepwiseSliderKnobLabel - The component for the label on the knob.
105
- * @exports StepwiseSliderStartingTrack - The component for the slide track before the knob.
106
- * @exports StepwiseSliderEndingTrack - The component for the slide track after the knob.
107
- */
108
- export default function StepwiseSlider({ index: externalIndex, isInverted, isTrackInteractive, knobHeight, knobWidth, labelProvider, onlyDispatchesOnDragEnd, orientation, steps, trackPadding, onDragEnd, onDragStart, onIndexChange, onPositionChange, ...props }: Props): JSX.Element;
109
- export declare const StepwiseSliderStartingTrack: import("styled-components").StyledComponent<"div", any, {
110
- orientation: NonNullable<Props['orientation']>;
111
- isClickable: boolean;
112
- }, never>;
113
- export declare const StepwiseSliderEndingTrack: import("styled-components").StyledComponent<"div", any, {
114
- orientation: NonNullable<Props['orientation']>;
115
- isClickable: boolean;
116
- }, never>;
117
- export declare const StepwiseSliderKnob: import("styled-components").StyledComponent<"div", any, {}, never>;
118
- export declare const StepwiseSliderKnobLabel: import("styled-components").StyledComponent<"label", any, {
119
- knobHeight: NonNullable<Props['knobHeight']>;
120
- }, never>;