@peektravel/app-utilities 0.5.3 → 0.6.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 +4 -0
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +366 -30
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +97 -9
- package/dist/ui/index.d.ts +97 -9
- package/dist/ui/index.js +366 -30
- package/dist/ui/index.js.map +1 -1
- package/docs/ui.md +30 -7
- package/llms.txt +5 -1
- package/package.json +1 -1
package/docs/ui.md
CHANGED
|
@@ -79,10 +79,10 @@ they work declaratively in plain HTML:
|
|
|
79
79
|
|
|
80
80
|
| Component | JS property | JSON attribute fallback |
|
|
81
81
|
|---|---|---|
|
|
82
|
-
| `ody-dropdown-single` / `ody-dropdown-multi` | `el.options = [...]` | `options='[{"value":"a","label":"A"}]'` |
|
|
82
|
+
| `ody-dropdown-single` / `ody-dropdown-multi` / `ody-checkbox-group` | `el.options = [...]` | `options='[{"value":"a","label":"A"}]'` |
|
|
83
83
|
| `ody-tabs` | — | `tabs='[{"id":"a","label":"A"}]'` |
|
|
84
84
|
| `ody-toggle-button` | — | `options='[{"value":"a","label":"A"}]'` |
|
|
85
|
-
| `ody-radio-button-group`
|
|
85
|
+
| `ody-radio-button-group` | `el.options` (getter) | `options='[{"value":"a","label":"A"}]'` |
|
|
86
86
|
| `ody-datepicker` | — | `presets='[{"label":"…","value":"…"}]'` |
|
|
87
87
|
| `ody-table` | `el.columns`, `el.data` | none — JS only |
|
|
88
88
|
|
|
@@ -104,6 +104,15 @@ placeholder. So the element's children become its body/label content:
|
|
|
104
104
|
<ody-alert heading="Saved">This is the body content.</ody-alert>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
Although your children are physically relocated into that placeholder, the host
|
|
108
|
+
element forwards the standard child-mutation calls
|
|
109
|
+
(`appendChild` / `insertBefore` / `removeChild` / `replaceChild`) to the slot.
|
|
110
|
+
So a framework reconciler that adds, removes, reorders, or swaps a **direct**
|
|
111
|
+
child of a slotting element operates on the slot correctly — conditional,
|
|
112
|
+
keyed, and `.map()`-ed children all reconcile without a
|
|
113
|
+
`NotFoundError: … not a child of this node`. You do **not** need to wrap dynamic
|
|
114
|
+
children in a single stable `<div>`.
|
|
115
|
+
|
|
107
116
|
### 3.5 Framework usage
|
|
108
117
|
|
|
109
118
|
**Vanilla HTML / JS** — declarative; set rich data and add listeners via the
|
|
@@ -134,14 +143,28 @@ reflected/read-only accessor accepts assignment, so passing props directly works
|
|
|
134
143
|
and does **not** throw the `Cannot set property … which has only a getter` error
|
|
135
144
|
a getter-only property would otherwise raise. Concretely:
|
|
136
145
|
|
|
137
|
-
- **
|
|
138
|
-
|
|
139
|
-
attribute — booleans as presence, objects/arrays as a JSON string:
|
|
146
|
+
- **Boolean props reflect to the attribute.** `searchable`, `disabled`, etc.
|
|
147
|
+
take effect as attribute presence:
|
|
140
148
|
|
|
141
149
|
```jsx
|
|
142
150
|
<ody-dropdown-single searchable options={items} value={value} />
|
|
143
151
|
```
|
|
144
152
|
|
|
153
|
+
- **Rich-data props are real properties.** `options` (dropdowns, checkbox-group,
|
|
154
|
+
radio-button-group, toggle-button), `presets` (datepicker), and `data` /
|
|
155
|
+
`columns` / `rows` (table) are true getter+setter properties. Pass an **array**
|
|
156
|
+
directly (`options={items}`); a JSON **string** is also accepted for
|
|
157
|
+
backwards-compatibility. They are the source of truth and are **not** reflected
|
|
158
|
+
back onto a DOM attribute (so no giant JSON attributes).
|
|
159
|
+
|
|
160
|
+
- **Controlled `value` never fights the caret.** The text/number fields
|
|
161
|
+
(`ody-input`, `ody-inline-input`, `ody-search-input`, `ody-money-input`,
|
|
162
|
+
`ody-percentage-input`) reflect an externally-set `value` into the live control
|
|
163
|
+
in place, and the selection controls update their checked state in place — so a
|
|
164
|
+
controlled binding keeps focus. `ody-checkbox-group`'s `value` **attribute** is
|
|
165
|
+
a JSON array (comma-safe); its `.value` **property** and the `change` detail are
|
|
166
|
+
a `string[]`.
|
|
167
|
+
|
|
145
168
|
- **Read-only state accessors ignore assignment.** Props that mirror live
|
|
146
169
|
internal state (`isOpen`, `isVisible`) are inert to writes — they are not
|
|
147
170
|
controlled by re-render. Drive them imperatively through a `ref`
|
|
@@ -640,12 +663,12 @@ are blocked; on blur the value is clamped/normalised.
|
|
|
640
663
|
**Use when** several toggles, optionally with a "select all" parent (checked
|
|
641
664
|
when all selected, indeterminate when some).
|
|
642
665
|
**Attributes**
|
|
643
|
-
- `options` — JSON array of `{ label, value }
|
|
666
|
+
- `options` — JSON array of `{ label, value }` (also a JS property, below).
|
|
644
667
|
- `value` — comma-separated selected values.
|
|
645
668
|
- `select-all-label` — when present, renders the parent select-all row.
|
|
646
669
|
- `size` — `base` | `small` (default `small`).
|
|
647
670
|
- `disabled` — boolean.
|
|
648
|
-
**Properties (JS)** — `value: string[]` (get returns array, set takes array); `options: OdyCheckboxOption[]` (
|
|
671
|
+
**Properties (JS)** — `value: string[]` (get returns array, set takes array); `options: OdyCheckboxOption[]` (get parses the attribute, set writes the JSON attribute — assign `el.options = [...]` as with `<ody-dropdown-*>`).
|
|
649
672
|
**Events** — `change` → `{ value: string[] }`.
|
|
650
673
|
**Example**
|
|
651
674
|
```html
|
package/llms.txt
CHANGED
|
@@ -90,7 +90,11 @@ final authority and may still reject the request.
|
|
|
90
90
|
|
|
91
91
|
- `getProductService()` — `getAllProducts()` (flat list of activities + add-ons;
|
|
92
92
|
add-ons have `type === ADD_ON_PRODUCT_TYPE`); `Product.currency` carries the
|
|
93
|
-
activity's ISO currency (empty for add-ons).
|
|
93
|
+
activity's ISO currency (empty for add-ons). Activities also expose the catalog
|
|
94
|
+
fields `imageUrl`, `description`, and `meetingLocation`
|
|
95
|
+
(`ProductMeetingLocation { summary, address, url }`) — all nullable, and
|
|
96
|
+
`meetingLocation` is `null` when Peek reports no location detail (always `null`
|
|
97
|
+
for add-ons). Each `Product.tickets[]` entry
|
|
94
98
|
carries `minPrice`/`maxPrice` (`PricingMoney | null`, `null` for add-ons and
|
|
95
99
|
when Peek reports no range); every `PricingMoney` includes a `displayPrice`
|
|
96
100
|
string (e.g. `"$50.00"`) on values read back from the gateway.
|