@c2n/tooltip 0.0.6

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Nguyen Thai Vinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # @c2n/tooltip
2
+
3
+ Contextual hint shown when its target is hovered or focused, built with Lit on the Popover API and floating-ui.
4
+
5
+ ```bash
6
+ npm install @c2n/tooltip
7
+ ```
8
+
9
+ ```html
10
+ <script type="module">
11
+ import '@c2n/tooltip'
12
+ </script>
13
+
14
+ <button>Save<c2-tooltip>Save changes (⌘S)</c2-tooltip></button>
15
+
16
+ <span id="term">HTTP</span>
17
+ <c2-tooltip for="term" placement="bottom">Hypertext Transfer Protocol</c2-tooltip>
18
+ ```
19
+
20
+ - **Target**: the parent element by default, the element named by `for="<id>"`, or the previous sibling with `target-strategy="previousElement"`. The `target` property can be assigned directly.
21
+ - **Text**: the slotted content, or the target's `data-tooltip` attribute when the slot is empty.
22
+ - **Behaviour**: shows after `delay` ms on hover or focus, hides on leave, blur, press or Escape (`hide-delay` keeps it a moment longer). `open` shows or hides it programmatically; `show` and `hide` events fire.
23
+ - **Placement**: `placement` (any floating-ui placement, default `top`) flips and shifts to stay on screen; the side in use is reflected as `current-placement`. `position="top,bottom"` is still accepted as a list of allowed sides.
24
+ - **Rendering**: a `popover="manual"` element in the top layer, so it is never clipped and the target is not modified. `role="tooltip"` plus `aria-describedby` on the target for assistive technology.
25
+
26
+ Theming: `--c2-tooltip--*` (colours, radius, shadow, border, font, padding, max-width, offset, animation) and `--c2-tooltip__arrow--size`; `hide-arrow` removes the arrow.