@asanchez-sa/abby 0.3.0 → 0.5.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/dist/components/badge/badge.d.ts +3 -2
- package/dist/components/badge/badge.js +27 -11
- package/dist/components/calendar/calendar.d.ts +26 -5
- package/dist/components/calendar/calendar.js +387 -72
- package/dist/components/chart/chart.d.ts +7 -0
- package/dist/components/chart/chart.js +7 -0
- package/dist/components/chart/parts/bar.d.ts +32 -0
- package/dist/components/chart/parts/bar.js +348 -0
- package/dist/components/chart/parts/categories.d.ts +32 -0
- package/dist/components/chart/parts/categories.js +212 -0
- package/dist/components/chart/parts/legend.d.ts +16 -0
- package/dist/components/chart/parts/legend.js +82 -0
- package/dist/components/chart/parts/line.d.ts +43 -0
- package/dist/components/chart/parts/line.js +266 -0
- package/dist/components/chart/parts/scale.js +96 -0
- package/dist/components/chart/parts/scatter.d.ts +67 -0
- package/dist/components/chart/parts/scatter.js +157 -0
- package/dist/components/chart/parts/surface.d.ts +26 -0
- package/dist/components/chart/parts/surface.js +76 -0
- package/dist/components/chart/parts/table.js +105 -0
- package/dist/components/chart/parts/types.d.ts +44 -0
- package/dist/components/chart/parts/types.js +12 -0
- package/dist/components/filter-chip/filter-chip.d.ts +36 -0
- package/dist/components/filter-chip/filter-chip.js +97 -0
- package/dist/components/graph/graph.d.ts +151 -0
- package/dist/components/graph/graph.js +959 -0
- package/dist/components/model-selector/model-selector.d.ts +38 -3
- package/dist/components/model-selector/model-selector.js +331 -73
- package/dist/components/number-input/number-input.d.ts +14 -3
- package/dist/components/number-input/number-input.js +193 -34
- package/dist/components/spinner/spinner.d.ts +7 -1
- package/dist/components/spinner/spinner.js +86 -26
- package/dist/components/toast/toast.d.ts +19 -2
- package/dist/components/toast/toast.js +211 -49
- package/dist/components/toggle/toggle.d.ts +18 -4
- package/dist/components/toggle/toggle.js +167 -32
- package/dist/components/week-strip/week-strip.d.ts +27 -5
- package/dist/components/week-strip/week-strip.js +288 -134
- package/dist/styles/components.css +66 -0
- package/package.json +5 -1
- package/skills/agent-ready-ui/SKILL.md +1 -1
- package/skills/blocks/SKILL.md +1 -1
- package/skills/compose-screens/SKILL.md +48 -5
- package/skills/compose-screens/references/calendar-week.md +77 -0
- package/skills/compose-screens/references/charts-and-maps.md +298 -0
- package/skills/compose-screens/references/filter-chips.md +61 -0
- package/skills/compose-screens/references/number-units.md +52 -0
- package/skills/note-editor/SKILL.md +1 -1
- package/skills/note-status/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# A unit inside a number field
|
|
2
|
+
|
|
3
|
+
Read this when you build a number field whose unit sits inside it, such as a spending cap in "USD" or a count in "seats". The main skill points here from its "Put a unit at the end of a number field" section.
|
|
4
|
+
|
|
5
|
+
`NumberInputUnit` from `abby/number-input` draws the unit at the end of the field, inside its edge and in `subtle`, so the number keeps the field's foreground and the unit reads as a label. It is a child of `NumberInputGroup`, placed after `NumberInputControl` and before `NumberInputIncrement`.
|
|
6
|
+
|
|
7
|
+
- The unit is text, as children: `<NumberInputUnit>USD</NumberInputUnit>`. The part draws only one at the end of the number; a unit in front of it is out of scope.
|
|
8
|
+
- `format` formats the number only. Pass `minimumFractionDigits` or another `Intl.NumberFormat` option there and write the unit in `NumberInputUnit`, not as a currency symbol inside `format`.
|
|
9
|
+
- The control reserves room for the unit, so the number never runs under it, and the control's font weight becomes medium while a unit is present. Nothing else about the control changes.
|
|
10
|
+
- The unit can't be selected, and a click on it focuses the field. It is `aria-hidden`: the control's `aria-describedby` gets its text next to the description `Field` gives, so a screen reader reads the unit once, as the control's description.
|
|
11
|
+
- It works with and without `NumberInputDecrement` and `NumberInputIncrement`. With the buttons, put the unit between the control and the increment button, as below.
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import {
|
|
15
|
+
NumberInput,
|
|
16
|
+
NumberInputControl,
|
|
17
|
+
NumberInputDecrement,
|
|
18
|
+
NumberInputGroup,
|
|
19
|
+
NumberInputIncrement,
|
|
20
|
+
NumberInputUnit,
|
|
21
|
+
} from "abby/number-input";
|
|
22
|
+
|
|
23
|
+
export function SpendingCap() {
|
|
24
|
+
return (
|
|
25
|
+
<NumberInput
|
|
26
|
+
defaultValue={0.02}
|
|
27
|
+
min={0}
|
|
28
|
+
step={0.01}
|
|
29
|
+
locale="es"
|
|
30
|
+
format={{ minimumFractionDigits: 2 }}
|
|
31
|
+
>
|
|
32
|
+
<NumberInputGroup>
|
|
33
|
+
<NumberInputDecrement aria-label="Decrease" />
|
|
34
|
+
<NumberInputControl aria-label="Spending cap" />
|
|
35
|
+
<NumberInputUnit>USD</NumberInputUnit>
|
|
36
|
+
<NumberInputIncrement aria-label="Increase" />
|
|
37
|
+
</NumberInputGroup>
|
|
38
|
+
</NumberInput>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Without the buttons, the group holds only the control and the unit:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<NumberInputGroup>
|
|
47
|
+
<NumberInputControl aria-label="Spending cap" />
|
|
48
|
+
<NumberInputUnit>USD</NumberInputUnit>
|
|
49
|
+
</NumberInputGroup>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The stories `Unit`, `UnitWholeAmount` and `UnitWithButtons` in `src/components/number-input/number-input.stories.tsx` show these; `UnitDescription` measures the description, the placement, the padding and the click.
|
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
and keep both usable by an agent without loading the editor.
|
|
13
13
|
type: core
|
|
14
14
|
library: abby
|
|
15
|
-
library_version: 0.
|
|
15
|
+
library_version: 0.5.0
|
|
16
16
|
sources:
|
|
17
17
|
- src/components/note-status/note-status.tsx
|
|
18
18
|
- src/components/note-place/note-place.tsx
|
package/skills/setup/SKILL.md
CHANGED