+
+
+
Input Components
+
+ Interactive Lab
+
+
+
+ Pilih status untuk melihat perubahan validasi pada semua tipe input.
+
-
- {/* COLUMN: ERROR */}
-
- {/* COLUMN: NORMAL */}
-
- {/* COLUMN: INFO */}
-
- {/* COLUMN: WARNING */}
-
- {/* COLUMN: SUCCESS */}
-
+ {/* TAB SELECTOR */}
+
+ {statuses.map((item) => (
+
+ ))}
+
+
+
+ {/* RENDER COMPONENT */}
+
+
+ {/* Label Indikator Status Aktif */}
+
+ Active Status: {selectedStatus}
+
+
+
diff --git a/packages/ui/src/components/forms/index.ts b/packages/ui/src/components/forms/index.ts
index 242fa22..77167eb 100644
--- a/packages/ui/src/components/forms/index.ts
+++ b/packages/ui/src/components/forms/index.ts
@@ -3,6 +3,7 @@ export * from './form-provider';
export * from './input/input.component';
export * from './input/input-password.component';
+export * from './input/input-currency.component';
export * from './input/input-number.component';
export * from './textarea/textarea.component';
diff --git a/packages/ui/src/components/forms/input/input-currency.component.tsx b/packages/ui/src/components/forms/input/input-currency.component.tsx
new file mode 100644
index 0000000..fb2bb82
--- /dev/null
+++ b/packages/ui/src/components/forms/input/input-currency.component.tsx
@@ -0,0 +1,41 @@
+import { InputCurrencyProps } from '../types';
+import { InputNumber } from './input-number.component';
+
+export const InputCurrency = (props: InputCurrencyProps) => {
+ const { prefix = 'Rp ', ...restProps } = props;
+
+ // Change format from 10000 to "Rp 10.000"
+ const formatCurrency = (value: number | string | undefined) => {
+ if (value === undefined || value === null || value === '') {
+ return '';
+ }
+ // Convert value to string for processing
+ const valStr = `${value}`;
+ const formatted = valStr.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
+ return `${prefix}${formatted}`;
+ };
+
+ // Change parse from "Rp 10.000" to 10000
+ const parseCurrency = (displayValue: string | undefined) => {
+ if (!displayValue) return '';
+
+ // Remove prefix and all non-digit characters (except comma if decimal support is needed)
+ // Here we assume pure integer input, so dots (.) are removed.
+ const cleanValue = displayValue.replace(prefix, '').replace(/\./g, '');
+
+ // If you need decimal support (comma), use this regex instead:
+ // return displayValue.replace(prefix, '').replace(/\./g, '').replace(/,/g, '.');
+
+ return cleanValue;
+ };
+
+ return (
+
+ );
+};
diff --git a/packages/ui/src/components/forms/input/input-password.component.tsx b/packages/ui/src/components/forms/input/input-password.component.tsx
index 200196a..f396d62 100644
--- a/packages/ui/src/components/forms/input/input-password.component.tsx
+++ b/packages/ui/src/components/forms/input/input-password.component.tsx
@@ -1,6 +1,101 @@
+import React, { useState } from 'react';
import { InputPasswordProps } from '../types';
import { Input } from './input.component';
+/**
+ * Eye Icon for visibility toggle
+ * @returns JSX Element
+ */
+const EyeIcon = () => (
+
+);
+
+/**
+ * Eye Off Icon for visibility toggle
+ * @returns JSX Element
+ */
+const EyeOffIcon = () => (
+
+);
+
+/**
+ * InputPassword Component
+ * @param props InputPasswordProps
+ * @returns JSX Element
+ */
export const InputPassword = (props: InputPasswordProps) => {
- return
;
+ // Set default props and state
+ const { suffix, disabled, visibilityToggle = true, ...restProps } = props;
+ const [visible, setVisible] = useState(false);
+
+ const toggleVisibility = () => {
+ if (disabled) return;
+ setVisible(!visible);
+ };
+
+ // If no suffix and no visibility toggle, render simple password input
+ if (!suffix && !visibilityToggle) {
+ return
;
+ }
+
+ const combinedSuffix = (
+
+ {/* Suffix User */}
+ {suffix && {suffix}}
+
+ {/* Visibility Toggle Button */}
+ {visibilityToggle && (
+
+ )}
+
+ );
+
+ return (
+
+ );
};
diff --git a/packages/ui/src/components/forms/styles/input-number.style.css b/packages/ui/src/components/forms/styles/input-number.style.css
index ea0eaf6..15dfa86 100644
--- a/packages/ui/src/components/forms/styles/input-number.style.css
+++ b/packages/ui/src/components/forms/styles/input-number.style.css
@@ -163,6 +163,17 @@
border-color: var(--color-success-500) !important;
}
+ /* Info (Outlined) */
+ .input-number-variant-outlined.input-number-status-info {
+ border-color: var(--color-info-500) !important;
+ }
+ .input-number-variant-outlined.input-number-status-info:focus-within,
+ .input-number-variant-outlined.input-number-status-info.rc-input-number-focused,
+ .input-number-variant-outlined.input-number-status-info.rc-input-number-affix-wrapper-focused {
+ box-shadow: 0 0 0 3px var(--color-info-100) !important;
+ border-color: var(--color-info-500) !important;
+ }
+
/* ====================
VARIANT: FILLED
==================== */
diff --git a/packages/ui/src/components/forms/types/index.ts b/packages/ui/src/components/forms/types/index.ts
index 0abe237..a22c73e 100644
--- a/packages/ui/src/components/forms/types/index.ts
+++ b/packages/ui/src/components/forms/types/index.ts
@@ -43,12 +43,13 @@ interface BaseComponentProps {
* Define specific component props
*/
export interface InputProps extends RcInputProps, BaseComponentProps {}
+export interface InputPasswordProps extends InputProps {
+ visibilityToggle?: boolean; // Default: true
+}
-/**
- * Extend specific component props from base props
- * This ensures consistency across different input components
- * and allows for shared properties like 'status'
- */
-export interface InputPasswordProps extends InputProps {}
export interface InputNumberProps extends RcInputNumberProps, BaseComponentProps {}
+export interface InputCurrencyProps extends InputNumberProps, BaseComponentProps {
+ prefix?: string; // Optional: Custom prefix, default 'Rp '
+}
+
export interface TextAreaProps extends RcTextAreaProps, BaseComponentProps {}
diff --git a/packages/ui/src/globals.css b/packages/ui/src/globals.css
index 7075563..22267e8 100644
--- a/packages/ui/src/globals.css
+++ b/packages/ui/src/globals.css
@@ -11,7 +11,8 @@
@layer base {
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
- background-color: var(--color-gray-50);
+ /* background-color: var(--color-gray-50); */
+ background-color: #ffffff;
color: var(--color-gray-800);
@apply text-base; /* Set global base font to 13px */
-webkit-font-smoothing: antialiased;