@atom-learning/components 2.9.1 → 2.10.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 (35) hide show
  1. package/CHANGELOG.md +4 -3
  2. package/dist/components/checkbox-field/CheckboxField.d.ts +2 -10
  3. package/dist/components/checkbox-field/CheckboxField.js +1 -1
  4. package/dist/components/date-field/DateField.d.ts +2 -13
  5. package/dist/components/date-field/DateField.js +1 -1
  6. package/dist/components/field-wrapper/FieldWrapper.d.ts +5 -0
  7. package/dist/components/field-wrapper/index.d.ts +1 -1
  8. package/dist/components/index.d.ts +2 -0
  9. package/dist/components/input-field/InputField.d.ts +2 -13
  10. package/dist/components/input-field/InputField.js +1 -1
  11. package/dist/components/number-input/NumberInput.d.ts +23 -0
  12. package/dist/components/number-input/NumberInput.js +1 -0
  13. package/dist/components/number-input/NumberInputStepper.d.ts +9 -0
  14. package/dist/components/number-input/NumberInputStepper.js +1 -0
  15. package/dist/components/number-input/index.d.ts +1 -0
  16. package/dist/components/number-input-field/NumberInputField.d.ts +16 -0
  17. package/dist/components/number-input-field/NumberInputField.js +1 -0
  18. package/dist/components/number-input-field/index.d.ts +1 -0
  19. package/dist/components/password-field/PasswordField.d.ts +3 -12
  20. package/dist/components/password-field/PasswordField.js +1 -1
  21. package/dist/components/radio-button-field/RadioButtonField.d.ts +3 -12
  22. package/dist/components/radio-button-field/RadioButtonField.js +1 -1
  23. package/dist/components/search-field/SearchField.d.ts +2 -11
  24. package/dist/components/search-input/SearchInput.d.ts +1 -1
  25. package/dist/components/select-field/SelectField.d.ts +2 -6
  26. package/dist/components/select-field/SelectField.js +1 -1
  27. package/dist/components/slider-field/SliderField.d.ts +2 -7
  28. package/dist/components/slider-field/SliderField.js +1 -1
  29. package/dist/components/textarea-field/TextareaField.d.ts +2 -6
  30. package/dist/docgen.json +1 -1
  31. package/dist/docs/NumberInput.mdx +37 -0
  32. package/dist/docs/NumberInputField.mdx +26 -0
  33. package/dist/index.cjs.js +1 -1
  34. package/dist/index.js +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Number Input
3
+ component: NumberInput
4
+ description: The NumberInput component is similar to the Input component, but it has controls for incrementing or decrementing numeric values.
5
+ category: Form primitives
6
+ ---
7
+
8
+ `NumberInput` wraps `Input` set to a numeric value, along with two `ActionIcon` buttons for decrementing and incrementing the value.
9
+
10
+ ```tsx preview
11
+ <NumberInput name="age" />
12
+ ```
13
+
14
+ When min or max values are set, the corresponding decrement or increment button will become disabled when the min/max values are reached. By default, min is set to 0.
15
+
16
+ A tooltip will display on hover of a disabled button, providing information on why the button is disabled. To override the default tooltip content, pass in a `disabledTooltipContent` object.
17
+
18
+ Note: A `<ToolTipProvider />` must be rendered at the root of the app for this to work.
19
+
20
+ ```tsx preview
21
+ <NumberInput
22
+ name="age"
23
+ max={11}
24
+ disabledTooltipContent={{ increment: 'Ages over 11 are not allowed' }}
25
+ />
26
+ ```
27
+
28
+ ## Keyboard interactions
29
+
30
+ A negative `tabindex` has been added to the increment and decrement buttons to remove them from the default tabbing order. Instead, users can use the below keys to interact with the component.
31
+
32
+ - When you hit the ⬆️ or ➡️ key, the input value will be increased by step.
33
+ - When you hit the ⬅️ or ⬇️ key, the input value will be decreased by step.
34
+ - When you hit the Home button, the value will jump to the min value.
35
+ - When you hit the End button, the value will jump to the max value.
36
+
37
+ See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role#keyboard_interactions) for more information on accessibility.
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: Number Input Field
3
+ component: NumberInputField
4
+ description: NumberInputField renders a field composed of an NumberInput, a Label and a InlineMessage
5
+ category: Form fields
6
+ ---
7
+
8
+ `NumberInputField` is the preferred way to render a form field for a number input.
9
+
10
+ In addition to text `Label` (required) and a validation error (optional), `NumberInputField` accepts all the same props as `NumberInput` and will pass them on to the `NumberInput` it renders.
11
+
12
+ ```tsx preview
13
+ <Form>
14
+ <NumberInputField
15
+ label="Number of cats"
16
+ name="cats"
17
+ min={3}
18
+ validation={{
19
+ min: {
20
+ value: 3,
21
+ message: 'You must have at least 3 cats!'
22
+ }
23
+ }}
24
+ />
25
+ </Form>
26
+ ```