@kanso-labs/react-native-kanso-ui 0.0.0-stage → 0.1.1

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 (145) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +205 -2
  3. package/dist/button/index.d.ts +56 -0
  4. package/dist/button/index.js +169 -0
  5. package/dist/button/index.js.map +1 -0
  6. package/dist/button/palettes.js +47 -0
  7. package/dist/button/palettes.js.map +1 -0
  8. package/dist/chip/index.js +194 -0
  9. package/dist/chip/index.js.map +1 -0
  10. package/dist/chip/styles.js +36 -0
  11. package/dist/chip/styles.js.map +1 -0
  12. package/dist/clipboard/index.js +58 -0
  13. package/dist/clipboard/index.js.map +1 -0
  14. package/dist/components/avatar/index.d.ts +82 -0
  15. package/dist/components/avatar/index.js +62 -0
  16. package/dist/components/avatar/index.js.map +1 -0
  17. package/dist/components/button/index.d.ts +87 -0
  18. package/dist/components/button/index.js +377 -0
  19. package/dist/components/button/index.js.map +1 -0
  20. package/dist/components/card/index.d.ts +78 -0
  21. package/dist/components/card/index.js +315 -0
  22. package/dist/components/card/index.js.map +1 -0
  23. package/dist/components/checkbox/index.d.ts +76 -0
  24. package/dist/components/checkbox/index.js +360 -0
  25. package/dist/components/checkbox/index.js.map +1 -0
  26. package/dist/components/chip/index.d.ts +84 -0
  27. package/dist/components/chip/index.js +257 -0
  28. package/dist/components/chip/index.js.map +1 -0
  29. package/dist/components/chip-group/index.d.ts +143 -0
  30. package/dist/components/chip-group/index.js +669 -0
  31. package/dist/components/chip-group/index.js.map +1 -0
  32. package/dist/components/copy-field/index.d.ts +60 -0
  33. package/dist/components/copy-field/index.js +277 -0
  34. package/dist/components/copy-field/index.js.map +1 -0
  35. package/dist/components/currency/index.d.ts +69 -0
  36. package/dist/components/currency/index.js +162 -0
  37. package/dist/components/currency/index.js.map +1 -0
  38. package/dist/components/form/index.d.ts +84 -0
  39. package/dist/components/form/index.js +95 -0
  40. package/dist/components/form/index.js.map +1 -0
  41. package/dist/components/icon-button/index.d.ts +68 -0
  42. package/dist/components/icon-button/index.js +289 -0
  43. package/dist/components/icon-button/index.js.map +1 -0
  44. package/dist/components/link/index.d.ts +59 -0
  45. package/dist/components/link/index.js +191 -0
  46. package/dist/components/link/index.js.map +1 -0
  47. package/dist/components/number-field/index.d.ts +151 -0
  48. package/dist/components/number-field/index.js +832 -0
  49. package/dist/components/number-field/index.js.map +1 -0
  50. package/dist/components/product-icon/index.d.ts +70 -0
  51. package/dist/components/product-icon/index.js +60 -0
  52. package/dist/components/product-icon/index.js.map +1 -0
  53. package/dist/components/radio-group/index.d.ts +105 -0
  54. package/dist/components/radio-group/index.js +597 -0
  55. package/dist/components/radio-group/index.js.map +1 -0
  56. package/dist/components/search-field/index.d.ts +98 -0
  57. package/dist/components/search-field/index.js +521 -0
  58. package/dist/components/search-field/index.js.map +1 -0
  59. package/dist/components/segmented-button/index.d.ts +113 -0
  60. package/dist/components/segmented-button/index.js +937 -0
  61. package/dist/components/segmented-button/index.js.map +1 -0
  62. package/dist/components/separator/index.d.ts +45 -0
  63. package/dist/components/separator/index.js +109 -0
  64. package/dist/components/separator/index.js.map +1 -0
  65. package/dist/components/stack/index.d.ts +70 -0
  66. package/dist/components/stack/index.js +107 -0
  67. package/dist/components/stack/index.js.map +1 -0
  68. package/dist/components/switch/index.d.ts +76 -0
  69. package/dist/components/switch/index.js +591 -0
  70. package/dist/components/switch/index.js.map +1 -0
  71. package/dist/components/text/index.d.ts +44 -0
  72. package/dist/components/text/index.js +78 -0
  73. package/dist/components/text/index.js.map +1 -0
  74. package/dist/components/text-field/index.d.ts +146 -0
  75. package/dist/components/text-field/index.js +228 -0
  76. package/dist/components/text-field/index.js.map +1 -0
  77. package/dist/control/index.js +117 -0
  78. package/dist/control/index.js.map +1 -0
  79. package/dist/control/styles.js +36 -0
  80. package/dist/control/styles.js.map +1 -0
  81. package/dist/field/index.d.ts +13 -0
  82. package/dist/field/index.js +1007 -0
  83. package/dist/field/index.js.map +1 -0
  84. package/dist/field/styles.js +131 -0
  85. package/dist/field/styles.js.map +1 -0
  86. package/dist/form/index.d.ts +24 -0
  87. package/dist/form/index.js +209 -0
  88. package/dist/form/index.js.map +1 -0
  89. package/dist/glyphs/icon-style.d.ts +25 -0
  90. package/dist/glyphs/icon-style.js +22 -0
  91. package/dist/glyphs/icon-style.js.map +1 -0
  92. package/dist/glyphs/index.js +170 -0
  93. package/dist/glyphs/index.js.map +1 -0
  94. package/dist/glyphs/styles.js +7 -0
  95. package/dist/glyphs/styles.js.map +1 -0
  96. package/dist/hooks/useWindowSizeClass.d.ts +25 -0
  97. package/dist/hooks/useWindowSizeClass.js +39 -0
  98. package/dist/hooks/useWindowSizeClass.js.map +1 -0
  99. package/dist/index.d.ts +31 -0
  100. package/dist/index.js +27 -0
  101. package/dist/mark/image.js +61 -0
  102. package/dist/mark/image.js.map +1 -0
  103. package/dist/mark/index.d.ts +9 -0
  104. package/dist/mark/index.js +234 -0
  105. package/dist/mark/index.js.map +1 -0
  106. package/dist/mark/initials.js +65 -0
  107. package/dist/mark/initials.js.map +1 -0
  108. package/dist/mark/styles.d.ts +1 -0
  109. package/dist/mark/styles.js +73 -0
  110. package/dist/mark/styles.js.map +1 -0
  111. package/dist/number/parser.js +321 -0
  112. package/dist/number/parser.js.map +1 -0
  113. package/dist/number/state.js +235 -0
  114. package/dist/number/state.js.map +1 -0
  115. package/dist/overlay/host.js +111 -0
  116. package/dist/overlay/host.js.map +1 -0
  117. package/dist/press/index.js +350 -0
  118. package/dist/press/index.js.map +1 -0
  119. package/dist/press/styles.js +31 -0
  120. package/dist/press/styles.js.map +1 -0
  121. package/dist/router/index.d.ts +28 -0
  122. package/dist/router/index.js +82 -0
  123. package/dist/router/index.js.map +1 -0
  124. package/dist/theme/color.js +25 -0
  125. package/dist/theme/color.js.map +1 -0
  126. package/dist/theme/resolve.d.ts +6 -0
  127. package/dist/theme/resolve.js +310 -0
  128. package/dist/theme/resolve.js.map +1 -0
  129. package/dist/theme/scope.d.ts +42 -0
  130. package/dist/theme/scope.js +80 -0
  131. package/dist/theme/scope.js.map +1 -0
  132. package/dist/theme/styles.js +39 -0
  133. package/dist/theme/styles.js.map +1 -0
  134. package/dist/theme-scope.d.ts +56 -0
  135. package/dist/theme-scope.js +127 -0
  136. package/dist/theme-scope.js.map +1 -0
  137. package/dist/tokens/defaults.d.ts +407 -0
  138. package/dist/tokens/defaults.js +403 -0
  139. package/dist/tokens/defaults.js.map +1 -0
  140. package/dist/typography/fonts.js +84 -0
  141. package/dist/typography/fonts.js.map +1 -0
  142. package/dist/typography/roles.d.ts +10 -0
  143. package/dist/typography/roles.js +82 -0
  144. package/dist/typography/roles.js.map +1 -0
  145. package/package.json +132 -4
@@ -0,0 +1,151 @@
1
+ import { ValidationResult } from "../../form/index.js";
2
+ import { FieldVariant } from "../../field/index.js";
3
+ import { StyleProp, TextInput, TextInputProps, View, ViewStyle } from "react-native";
4
+ import { Ref } from "react";
5
+ //#region src/components/number-field/index.d.ts
6
+ type NumberFieldProps = Omit<TextInputProps, 'accessibilityHint' | 'accessibilityLabel' | 'aria-disabled' | 'aria-label' | 'autoComplete' | 'autoCorrect' | 'children' | 'cursorColor' | 'defaultValue' | 'editable' | 'inputMode' | 'keyboardType' | 'maxLength' | 'multiline' | 'numberOfLines' | 'onChange' | 'onChangeText' | 'placeholder' | 'placeholderTextColor' | 'readOnly' | 'selectionColor' | 'spellCheck' | 'style' | 'underlineColorAndroid' | 'value'> & {
7
+ /**
8
+ * The name of the stepper that lowers the value, for a screen reader. Left
9
+ * out, it is the English "Decrease" followed by the field's own label.
10
+ */
11
+ readonly decrementLabel?: string;
12
+ /** The value the field opens with, when it keeps its own. */
13
+ readonly defaultValue?: number;
14
+ /**
15
+ * A hint shown under the field. Replaced by `error` when there is one, so
16
+ * the two never stack.
17
+ */
18
+ readonly description?: string;
19
+ /**
20
+ * The problem with the current value, in words. Its presence is what puts
21
+ * the field in its error state: the message, the error colours, and the
22
+ * invalid state a screen reader reads all follow from it. The line under
23
+ * the field arrives with the message, so the field grows when this does,
24
+ * unless it is inside a `Form`, which keeps the line drawn. It wins over
25
+ * what `validate` and the form say, and holds a `native` form back.
26
+ */
27
+ readonly error?: string;
28
+ /**
29
+ * Whether the label sits in the empty box and floats to the top once the
30
+ * field is focused or holds a value, as the text fields page draws it.
31
+ * `false` keeps it small at the top in every state.
32
+ * @default true
33
+ */
34
+ readonly floatingLabel?: boolean;
35
+ /**
36
+ * How the value is written and read: a currency, a percentage, a unit, a
37
+ * number of fraction digits. It also decides what can be typed.
38
+ */
39
+ readonly formatOptions?: Intl.NumberFormatOptions;
40
+ /**
41
+ * The name of the stepper that raises the value, for a screen reader. Left
42
+ * out, it is the English "Increase" followed by the field's own label.
43
+ */
44
+ readonly incrementLabel?: string;
45
+ /**
46
+ * A ref to the field's own `TextInput`, which is what a call site moves
47
+ * focus to, after a server's error, say. `ref` is the field as a whole.
48
+ */
49
+ readonly inputRef?: Ref<TextInput>;
50
+ /**
51
+ * Draws the field disabled: it takes no focus, no input and no steps.
52
+ * @default false
53
+ */
54
+ readonly isDisabled?: boolean;
55
+ /**
56
+ * Shows the value and takes focus, but takes no input and no steps.
57
+ * @default false
58
+ */
59
+ readonly isReadOnly?: boolean;
60
+ /**
61
+ * Marks the label with an asterisk, as the text fields page marks a field
62
+ * that must be filled.
63
+ * @default false
64
+ */
65
+ readonly isRequired?: boolean;
66
+ /**
67
+ * What the field is for, and the name a screen reader reads for it.
68
+ * Required, since a field with no label is a box nobody can name.
69
+ */
70
+ readonly label: string;
71
+ /**
72
+ * The BCP 47 locale the value is written and read in. Defaults to the
73
+ * device's.
74
+ */
75
+ readonly locale?: string;
76
+ /** The highest value the field takes. A committed value is clamped to it. */
77
+ readonly maxValue?: number;
78
+ /** The lowest value the field takes. A committed value is clamped to it. */
79
+ readonly minValue?: number;
80
+ /**
81
+ * The name the value is submitted under by the `Form` around the field,
82
+ * and the key its `validationErrors` reach the field by. The form submits
83
+ * the number written out, such as `1234.5`, and `''` for an empty field.
84
+ */
85
+ readonly name?: string;
86
+ /**
87
+ * Renders the value in the mono face with tabular figures, for amounts and
88
+ * other numbers meant to be compared down a column. On by default, since a
89
+ * number field holds nothing else.
90
+ * @default true
91
+ */
92
+ readonly numeric?: boolean;
93
+ /**
94
+ * Called with the committed value, once it is read from what was typed or
95
+ * stepped to. `NaN` is an empty field.
96
+ */
97
+ readonly onChange?: (value: number) => void;
98
+ readonly ref?: Ref<View>;
99
+ /**
100
+ * The amount the steppers move the value by, and the multiple of it, from
101
+ * `minValue`, that a committed value snaps to.
102
+ */
103
+ readonly step?: number;
104
+ /**
105
+ * How the two steppers sit at the end of the box: stacked, the plus over
106
+ * the minus, flush with the box's edge, or side by side as extra-small
107
+ * icon buttons.
108
+ * @default 'vertical'
109
+ */
110
+ readonly steppers?: 'horizontal' | 'vertical';
111
+ /** Positions and sizes the field as a whole. */
112
+ readonly style?: StyleProp<ViewStyle>;
113
+ /**
114
+ * Checks the value, `NaN` for an empty field, and returns its problem in
115
+ * words, or several, where there is one, and `true`, `null` or `undefined`
116
+ * where there is none. Under the default `aria` validation the error shows
117
+ * as the value changes; inside a `native` form it shows once a submission
118
+ * is tried, or once the field loses focus after an edit, and holds the form
119
+ * back.
120
+ */
121
+ readonly validate?: (value: number) => ValidationResult;
122
+ /** The value, when the call site keeps it. `NaN` is an empty field. */
123
+ readonly value?: number;
124
+ /**
125
+ * The filled box, or the outlined one: no fill, an outline that thickens
126
+ * and takes the primary role while focused, and the label cutting it once
127
+ * it floats, the text fields page's two fields.
128
+ * @default 'filled'
129
+ */
130
+ readonly variant?: FieldVariant;
131
+ };
132
+ /**
133
+ * A labelled number input with steppers, the text fields page's filled or
134
+ * outlined field. Pass `value` with `onChange` to control it, or
135
+ * `defaultValue` to let it keep its own; `onChange` is handed the committed
136
+ * number, `NaN` for an empty field. `minValue`, `maxValue` and `step` shape
137
+ * it, and `formatOptions` says how it reads, in `locale`: a currency, a
138
+ * percentage, a unit.
139
+ *
140
+ * React Native's own `TextInput` props, the return key among them, reach the
141
+ * control; `style` and `ref` are the field as a whole, and `inputRef` the
142
+ * control.
143
+ *
144
+ * ```tsx
145
+ * <NumberField defaultValue={1234.5} label="Label" />
146
+ * ```
147
+ */
148
+ declare function NumberField({ decrementLabel, defaultValue, description, error, floatingLabel, formatOptions, incrementLabel, inputRef, isDisabled, isReadOnly, isRequired, label, locale, maxValue, minValue, name, numeric, onBlur, onChange, onFocus, onSubmitEditing, ref, returnKeyType, step, steppers, style, validate, value, variant, ...props }: NumberFieldProps): import("react").JSX.Element;
149
+ //#endregion
150
+ export { NumberField, type NumberFieldProps };
151
+ //# sourceMappingURL=index.d.ts.map