@ceed/ads 1.32.2 → 1.33.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/CurrencyInput/CurrencyInput.d.ts +2 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -1
- package/dist/components/CurrencyInput/types.d.ts +4 -0
- package/dist/components/inputs/CurrencyInput.md +19 -30
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from '@mui/joy';
|
|
3
3
|
import { MotionProps } from 'framer-motion';
|
|
4
|
+
import type { Currency } from './types';
|
|
4
5
|
export interface CurrencyInputProps {
|
|
5
|
-
currency?:
|
|
6
|
+
currency?: Currency;
|
|
6
7
|
max?: number;
|
|
7
8
|
value?: number;
|
|
8
9
|
defaultValue?: number;
|
|
@@ -39,14 +39,7 @@ import { CurrencyInput } from '@ceed/ads';
|
|
|
39
39
|
function MyComponent() {
|
|
40
40
|
const [amount, setAmount] = React.useState(0);
|
|
41
41
|
|
|
42
|
-
return (
|
|
43
|
-
<CurrencyInput
|
|
44
|
-
label="Price"
|
|
45
|
-
currency="USD"
|
|
46
|
-
value={amount}
|
|
47
|
-
onChange={(e) => setAmount(e.target.value)}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
42
|
+
return <CurrencyInput label="Price" currency="USD" value={amount} onChange={(e) => setAmount(e.target.value)} />;
|
|
50
43
|
}
|
|
51
44
|
```
|
|
52
45
|
|
|
@@ -153,11 +146,7 @@ Set the `max` prop to enforce a maximum value. When the entered value exceeds th
|
|
|
153
146
|
```
|
|
154
147
|
|
|
155
148
|
```tsx
|
|
156
|
-
<CurrencyInput
|
|
157
|
-
currency="USD"
|
|
158
|
-
max={1000000}
|
|
159
|
-
value={10000000}
|
|
160
|
-
/>
|
|
149
|
+
<CurrencyInput currency="USD" max={1000000} value={10000000} />
|
|
161
150
|
```
|
|
162
151
|
|
|
163
152
|
## Minor Unit Mode
|
|
@@ -263,23 +252,23 @@ function BudgetSetting() {
|
|
|
263
252
|
|
|
264
253
|
### Key Props
|
|
265
254
|
|
|
266
|
-
| Prop | Type | Default | Description
|
|
267
|
-
| -------------- | -------------------------------------------------------- | ------- |
|
|
268
|
-
| `value` | `number` | - | Currency value (controlled mode)
|
|
269
|
-
| `defaultValue` | `number` | - | Initial currency value (uncontrolled mode)
|
|
270
|
-
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes
|
|
271
|
-
| `currency` | `'USD' \| 'KRW' \| 'CAD'`
|
|
272
|
-
| `useMinorUnit` | `boolean` | `false` | When true, value is in minor units (e.g., cents for USD)
|
|
273
|
-
| `max` | `number` | - | Maximum allowed value
|
|
274
|
-
| `label` | `ReactNode` | - | Form label displayed above the input
|
|
275
|
-
| `helperText` | `ReactNode` | - | Helper text displayed below the input
|
|
276
|
-
| `error` | `boolean` | `false` | Applies danger color to indicate validation error
|
|
277
|
-
| `required` | `boolean` | `false` | Marks the field as required
|
|
278
|
-
| `disabled` | `boolean` | `false` | Disables the input
|
|
279
|
-
| `name` | `string` | - | HTML name attribute for form submission
|
|
280
|
-
| `placeholder` | `string` | - | Placeholder text when the input is empty
|
|
281
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size
|
|
282
|
-
| `sx` | `SxProps` | - | Custom styles using the MUI system
|
|
255
|
+
| Prop | Type | Default | Description |
|
|
256
|
+
| -------------- | -------------------------------------------------------- | ------- | ------------------------------------------------------------------------ |
|
|
257
|
+
| `value` | `number` | - | Currency value (controlled mode) |
|
|
258
|
+
| `defaultValue` | `number` | - | Initial currency value (uncontrolled mode) |
|
|
259
|
+
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes |
|
|
260
|
+
| `currency` | `'USD' \| 'KRW' \| 'CAD' \| 'usd' \| 'krw' \| 'cad'` | `'USD'` | Currency code (uppercase or lowercase; determines symbol and formatting) |
|
|
261
|
+
| `useMinorUnit` | `boolean` | `false` | When true, value is in minor units (e.g., cents for USD) |
|
|
262
|
+
| `max` | `number` | - | Maximum allowed value |
|
|
263
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
264
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
265
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
266
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
267
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
268
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
269
|
+
| `placeholder` | `string` | - | Placeholder text when the input is empty |
|
|
270
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
271
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
283
272
|
|
|
284
273
|
## Accessibility
|
|
285
274
|
|