@mario_hahn/jumpy-ui 0.8.1 → 0.9.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.
package/README.md CHANGED
@@ -1,5 +1,72 @@
1
1
  # @mario_hahn/jumpy-ui
2
2
 
3
+ ## Text with inline tokens
4
+
5
+ `JumpTokenInput` shares the normal field shell, labels, hints, focus and alarm
6
+ styles, but its value is structured. `JumpInput` remains a native string input.
7
+
8
+ ```tsx
9
+ import { useRef, useState } from 'react'
10
+ import { JumpTokenInput, JumpButton, type JumpTokenInputValue,
11
+ type JumpTokenInputHandle } from '@mario_hahn/jumpy-ui'
12
+
13
+ function MessageEditor() {
14
+ const input = useRef<JumpTokenInputHandle>(null)
15
+ const [value, setValue] = useState<JumpTokenInputValue>([
16
+ { type: 'text', text: 'Hello ' },
17
+ { type: 'token', id: 'name-1', value: 'customer.firstName', label: 'First name' },
18
+ { type: 'text', text: '!' },
19
+ ])
20
+ return <>
21
+ <JumpTokenInput ref={input} label="Message" hint="Insert placeholders"
22
+ value={value} onChange={setValue} placeholder="Write a message" />
23
+ <JumpButton onClick={() => input.current?.insertToken({
24
+ value: 'order.number', label: 'Order number',
25
+ })}>Insert order number</JumpButton>
26
+ <JumpButton onClick={() => setValue([])}>Clear</JumpButton>
27
+ </>
28
+ }
29
+ ```
30
+
31
+ - `value`/`onChange` control the entire structured value. For uncontrolled editing
32
+ use `defaultValue`. Adjacent text parts are merged and empty text parts omitted.
33
+ - Each token instance needs a unique `id`; `value` is its business identifier and
34
+ may repeat. `label` is display text. `insertToken` generates an ID when omitted.
35
+ - Ref methods: `focus()`, `insertToken({ id?, value, label })`, `insertText(text)`,
36
+ and `removeToken(id)`. Insertion replaces the current/last selection, or appends
37
+ if there is none. Opening an external toolbar does not lose the insertion point.
38
+ - Backspace **after** a token or Delete **before** it removes the whole token.
39
+ Backspace before a token deletes the preceding character. Tokens also have a
40
+ remove button. Explicit `onTokenInsert`/`onTokenRemove` callbacks accompany edit
41
+ notifications (including undo/redo); `onChange` remains the state update API.
42
+ - Undo/redo uses Lexical history. External value replacement resets that history.
43
+ - Internal copy/paste preserves tokens and assigns fresh IDs to pasted instances.
44
+ Other applications receive plain labels/text. Plain-text paste is supported;
45
+ arbitrary HTML is not inserted. The field is single-line: pasted line breaks
46
+ become spaces and Enter does not insert a paragraph.
47
+ - `disabled`, `readOnly`, `error`, `status`, `label`, `hint`, `placeholder` and ARIA
48
+ props are supported. Read-only tokens cannot be removed. The ref is an editor
49
+ handle, not an `HTMLInputElement`. Submit the structured value through your form
50
+ state; this is not a native input's string-valued form serialization.
51
+
52
+ Playground: `/?component=token-input`. The component uses Lexical with atomic token
53
+ nodes; there is no manual HTML-to-value parsing and no consumer Tailwind dependency.
54
+
55
+ ## Dropdown popup width
56
+
57
+ The default dropdown popup aligns with the outer visible field and uses its full
58
+ width, including the icon area (but excluding helper text). For longer options:
59
+
60
+ ```tsx
61
+ <JumpDropdown label="Areas" items={items} popupMinWidth={320} />
62
+ ```
63
+
64
+ `popupMinWidth` is an optional minimum in CSS pixels. The popup never shrinks below
65
+ the field width unless viewport space requires it. It is constrained to the
66
+ available viewport and shifted at screen edges. Searching does not change its
67
+ requested width. The prop does not change the field's own width. `inputRef` still
68
+ points to the combobox input, and Escape/single selection restore input focus.
69
+
3
70
  ## Field widths
4
71
 
5
72
  Text fields, dropdowns, date pickers and time pickers fill their parent container.
@@ -85,7 +152,7 @@ Jumpy Components als ein gemeinsames UI-Paket.
85
152
  Starting with 0.5.0, Jumpy UI uses the public npmjs registry. No package token is required to install:
86
153
 
87
154
  ```bash
88
- npm install @mario_hahn/jumpy-ui@^0.8.1
155
+ npm install @mario_hahn/jumpy-ui@^0.9.0
89
156
  ```
90
157
 
91
158
  The public npm package uses the `@mario_hahn` scope. Older GitHub Packages releases
@@ -22624,6 +22624,10 @@ var providerStyles = `
22624
22624
  transform var(--jumpy-animation-duration-xsmall) var(--jumpy-animation-easing-drift);
22625
22625
  }
22626
22626
 
22627
+ [data-jumpy-theme='true'] [data-jumpy-component='token-input'] > p {
22628
+ margin: 0;
22629
+ }
22630
+
22627
22631
  [data-jumpy-theme='true'] [data-jumpy-component='card'][data-interactive='true'] {
22628
22632
  cursor: pointer;
22629
22633
  --jumpy-cmp-card-checkmark-right: var(--jumpy-spacing-gap-xsmall);