@udixio/ui-react 2.9.13 → 2.9.14
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/CHANGELOG.md +26 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +2259 -1814
- package/dist/lib/components/Button.d.ts.map +1 -1
- package/dist/lib/components/Card.d.ts +2 -2
- package/dist/lib/components/Card.d.ts.map +1 -1
- package/dist/lib/components/Checkbox.d.ts +15 -0
- package/dist/lib/components/Checkbox.d.ts.map +1 -0
- package/dist/lib/components/DatePicker.d.ts +9 -0
- package/dist/lib/components/DatePicker.d.ts.map +1 -0
- package/dist/lib/components/FabMenu.d.ts.map +1 -1
- package/dist/lib/components/IconButton.d.ts.map +1 -1
- package/dist/lib/components/TabGroup.d.ts +1 -0
- package/dist/lib/components/TabGroup.d.ts.map +1 -1
- package/dist/lib/components/TabGroupContext.d.ts +1 -0
- package/dist/lib/components/TabGroupContext.d.ts.map +1 -1
- package/dist/lib/components/TabPanel.d.ts +1 -0
- package/dist/lib/components/TabPanel.d.ts.map +1 -1
- package/dist/lib/components/TabPanels.d.ts +1 -0
- package/dist/lib/components/TabPanels.d.ts.map +1 -1
- package/dist/lib/components/TextField.d.ts +4 -4
- package/dist/lib/components/TextField.d.ts.map +1 -1
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/components/index.d.ts.map +1 -1
- package/dist/lib/effects/State.d.ts +3 -1
- package/dist/lib/effects/State.d.ts.map +1 -1
- package/dist/lib/interfaces/card.interface.d.ts +1 -1
- package/dist/lib/interfaces/card.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/checkbox.interface.d.ts +38 -0
- package/dist/lib/interfaces/checkbox.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/date-picker.interface.d.ts +67 -0
- package/dist/lib/interfaces/date-picker.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/icon-button.interface.d.ts +2 -1
- package/dist/lib/interfaces/icon-button.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/index.d.ts +1 -0
- package/dist/lib/interfaces/index.d.ts.map +1 -1
- package/dist/lib/interfaces/text-field.interface.d.ts +7 -4
- package/dist/lib/interfaces/text-field.interface.d.ts.map +1 -1
- package/dist/lib/styles/card.style.d.ts +3 -3
- package/dist/lib/styles/checkbox.style.d.ts +45 -0
- package/dist/lib/styles/checkbox.style.d.ts.map +1 -0
- package/dist/lib/styles/date-picker.style.d.ts +45 -0
- package/dist/lib/styles/date-picker.style.d.ts.map +1 -0
- package/dist/lib/styles/icon-button.style.d.ts +10 -4
- package/dist/lib/styles/icon-button.style.d.ts.map +1 -1
- package/dist/lib/styles/index.d.ts +1 -0
- package/dist/lib/styles/index.d.ts.map +1 -1
- package/dist/lib/styles/text-field.style.d.ts +18 -9
- package/dist/lib/styles/text-field.style.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/components/Button.tsx +1 -0
- package/src/lib/components/Card.tsx +9 -4
- package/src/lib/components/Checkbox.tsx +120 -0
- package/src/lib/components/DatePicker.tsx +432 -0
- package/src/lib/components/FabMenu.tsx +4 -5
- package/src/lib/components/IconButton.tsx +9 -7
- package/src/lib/components/TabGroup.tsx +8 -6
- package/src/lib/components/TabGroupContext.tsx +1 -1
- package/src/lib/components/TabPanel.tsx +1 -0
- package/src/lib/components/TabPanels.tsx +1 -0
- package/src/lib/components/TextField.tsx +95 -108
- package/src/lib/components/index.ts +2 -0
- package/src/lib/effects/State.tsx +4 -1
- package/src/lib/interfaces/card.interface.ts +1 -1
- package/src/lib/interfaces/checkbox.interface.ts +39 -0
- package/src/lib/interfaces/date-picker.interface.ts +79 -0
- package/src/lib/interfaces/icon-button.interface.ts +2 -1
- package/src/lib/interfaces/index.ts +1 -0
- package/src/lib/interfaces/text-field.interface.ts +7 -4
- package/src/lib/styles/checkbox.style.ts +64 -0
- package/src/lib/styles/date-picker.style.ts +43 -0
- package/src/lib/styles/index.ts +1 -0
- package/src/lib/styles/text-field.style.ts +2 -2
- package/src/stories/containment/card.stories.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/icon-button.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAyJlB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"icon-button.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/icon-button.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAyJlB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAG3B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAG9B,CAAC"}
|
|
@@ -2,6 +2,7 @@ export * from './button.style';
|
|
|
2
2
|
export * from './card.style';
|
|
3
3
|
export * from './carousel-item.style';
|
|
4
4
|
export * from './carousel.style';
|
|
5
|
+
export * from './checkbox.style';
|
|
5
6
|
export * from './chip.style';
|
|
6
7
|
export * from './chips.style';
|
|
7
8
|
export * from './divider.style';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -14,47 +14,56 @@ export declare const textFieldStyle: (states: {
|
|
|
14
14
|
showSupportingText: any;
|
|
15
15
|
suffix: any;
|
|
16
16
|
value: any;
|
|
17
|
+
defaultValue: any;
|
|
18
|
+
id: any;
|
|
19
|
+
style: any;
|
|
17
20
|
variant: any;
|
|
18
21
|
type: any;
|
|
19
22
|
autoComplete: any;
|
|
20
|
-
|
|
23
|
+
multiline: any;
|
|
21
24
|
} & {
|
|
22
25
|
placeholder?: string;
|
|
23
|
-
name
|
|
26
|
+
name?: string;
|
|
24
27
|
label: string;
|
|
25
28
|
disabled?: boolean;
|
|
26
29
|
errorText?: string | null;
|
|
27
30
|
supportingText?: string;
|
|
28
31
|
trailingIcon?: React.ReactElement<typeof import('..').IconButton> | import('..').Icon;
|
|
29
32
|
leadingIcon?: React.ReactElement<typeof import('..').IconButton> | import('..').Icon;
|
|
30
|
-
onChange?:
|
|
33
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
31
34
|
showSupportingText?: boolean;
|
|
32
35
|
suffix?: string;
|
|
33
|
-
value
|
|
36
|
+
value?: string;
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
style?: React.CSSProperties;
|
|
34
40
|
variant?: import('..').TextFieldVariant;
|
|
35
41
|
type?: "text" | "password" | "number";
|
|
36
42
|
autoComplete?: "on" | "off" | string;
|
|
37
|
-
|
|
43
|
+
multiline?: boolean;
|
|
38
44
|
} & import('..').TextFieldStates & {
|
|
39
45
|
className: string | ClassNameComponent<TextFieldInterface> | undefined;
|
|
40
46
|
}) => Record<"content" | "input" | "label" | "stateLayer" | "leadingIcon" | "trailingIcon" | "activeIndicator" | "supportingText" | "textField" | "suffix", string>;
|
|
41
47
|
export declare const useTextFieldStyle: (states: import('..').TextFieldStates & {
|
|
42
48
|
placeholder?: string;
|
|
43
|
-
name
|
|
49
|
+
name?: string;
|
|
44
50
|
label: string;
|
|
45
51
|
disabled?: boolean;
|
|
46
52
|
errorText?: string | null;
|
|
47
53
|
supportingText?: string;
|
|
48
54
|
trailingIcon?: React.ReactElement<typeof import('..').IconButton> | import('..').Icon;
|
|
49
55
|
leadingIcon?: React.ReactElement<typeof import('..').IconButton> | import('..').Icon;
|
|
50
|
-
onChange?:
|
|
56
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
51
57
|
showSupportingText?: boolean;
|
|
52
58
|
suffix?: string;
|
|
53
|
-
value
|
|
59
|
+
value?: string;
|
|
60
|
+
defaultValue?: string;
|
|
61
|
+
id?: string;
|
|
62
|
+
style?: React.CSSProperties;
|
|
54
63
|
variant?: import('..').TextFieldVariant;
|
|
55
64
|
type?: "text" | "password" | "number";
|
|
56
65
|
autoComplete?: "on" | "off" | string;
|
|
57
|
-
|
|
66
|
+
multiline?: boolean;
|
|
58
67
|
} & {
|
|
59
68
|
className?: string | ClassNameComponent<TextFieldInterface> | undefined;
|
|
60
69
|
}) => Record<"content" | "input" | "label" | "stateLayer" | "leadingIcon" | "trailingIcon" | "activeIndicator" | "supportingText" | "textField" | "suffix", string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/text-field.style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAmGnD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"text-field.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/text-field.style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAmGnD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mKAG1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;mKAG7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"react": "^19.1.1",
|
|
39
39
|
"react-dom": "^19.1.1",
|
|
40
|
-
"@udixio/
|
|
41
|
-
"@udixio/
|
|
40
|
+
"@udixio/theme": "2.1.13",
|
|
41
|
+
"@udixio/tailwind": "2.4.13"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
@@ -9,7 +9,7 @@ import { State } from '../effects';
|
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Layout
|
|
11
11
|
* @devx
|
|
12
|
-
* - `
|
|
12
|
+
* - `interactive` only adds a state layer; add your own click/role semantics.
|
|
13
13
|
* @limitations
|
|
14
14
|
* - No built-in header/actions slots; layout is fully custom via children.
|
|
15
15
|
*/
|
|
@@ -17,18 +17,23 @@ export const Card = ({
|
|
|
17
17
|
variant = 'outlined',
|
|
18
18
|
className,
|
|
19
19
|
children,
|
|
20
|
-
|
|
20
|
+
interactive = false,
|
|
21
21
|
ref,
|
|
22
22
|
...rest
|
|
23
23
|
}: ReactProps<CardInterface>) => {
|
|
24
|
-
const styles = useCardStyle({
|
|
24
|
+
const styles = useCardStyle({
|
|
25
|
+
className,
|
|
26
|
+
isInteractive: interactive,
|
|
27
|
+
variant,
|
|
28
|
+
children,
|
|
29
|
+
});
|
|
25
30
|
|
|
26
31
|
const defaultRef = useRef<HTMLDivElement>(null);
|
|
27
32
|
const resolvedRef = ref || defaultRef;
|
|
28
33
|
|
|
29
34
|
return (
|
|
30
35
|
<div {...rest} ref={resolvedRef} className={styles.card}>
|
|
31
|
-
{
|
|
36
|
+
{interactive && (
|
|
32
37
|
<State
|
|
33
38
|
className={styles.stateLayer}
|
|
34
39
|
colorName={'on-surface'}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useEffect, useId, useState } from 'react';
|
|
2
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
3
|
+
import { useCheckboxStyle } from '../styles/checkbox.style';
|
|
4
|
+
import { classNames } from '../utils';
|
|
5
|
+
import { ReactProps } from '../utils/component';
|
|
6
|
+
import { CheckboxInterface } from '../interfaces/checkbox.interface';
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
|
+
import { faCheck, faMinus } from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import { State } from '../effects';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checkboxes allow the user to select one or more items from a set.
|
|
13
|
+
* @status beta
|
|
14
|
+
* @category Selection
|
|
15
|
+
* @devx
|
|
16
|
+
* - Supports controlled (`checked`) and uncontrolled (`defaultChecked`) modes.
|
|
17
|
+
* - Handles `indeterminate` state strictly as visual (updates UI, but underlying input is checked/unchecked based on logic).
|
|
18
|
+
* @a11y
|
|
19
|
+
* - Uses native input for accessibility.
|
|
20
|
+
* - Supports standard keyboard interaction.
|
|
21
|
+
*/
|
|
22
|
+
export const Checkbox = ({
|
|
23
|
+
checked: checkedProp,
|
|
24
|
+
defaultChecked,
|
|
25
|
+
indeterminate = false,
|
|
26
|
+
disabled = false,
|
|
27
|
+
error = false,
|
|
28
|
+
onChange,
|
|
29
|
+
id: idProp,
|
|
30
|
+
name,
|
|
31
|
+
value,
|
|
32
|
+
style,
|
|
33
|
+
className,
|
|
34
|
+
...restProps
|
|
35
|
+
}: ReactProps<CheckboxInterface>) => {
|
|
36
|
+
const generatedId = useId();
|
|
37
|
+
const id = idProp || generatedId;
|
|
38
|
+
|
|
39
|
+
const isControlled = checkedProp !== undefined;
|
|
40
|
+
const [internalChecked, setInternalChecked] = useState(
|
|
41
|
+
defaultChecked ?? false,
|
|
42
|
+
);
|
|
43
|
+
const isChecked = isControlled ? checkedProp : internalChecked;
|
|
44
|
+
|
|
45
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
46
|
+
|
|
47
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
48
|
+
|
|
49
|
+
// Sync indeterminate state to input element for a11y
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (inputRef.current) {
|
|
52
|
+
inputRef.current.indeterminate = indeterminate;
|
|
53
|
+
}
|
|
54
|
+
}, [indeterminate]);
|
|
55
|
+
|
|
56
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
57
|
+
if (disabled) return;
|
|
58
|
+
|
|
59
|
+
if (!isControlled) {
|
|
60
|
+
setInternalChecked(e.target.checked);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (onChange) {
|
|
64
|
+
onChange(e);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const styles = useCheckboxStyle({
|
|
69
|
+
isChecked: !!isChecked,
|
|
70
|
+
isIndeterminate: indeterminate,
|
|
71
|
+
isDisabled: disabled,
|
|
72
|
+
isError: error,
|
|
73
|
+
isFocused,
|
|
74
|
+
isHovered: false, // Not used in style logic but requested by strict type if defined in interface? style config keys are flexible usually.
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
className={classNames(styles.checkbox, className, 'group/checkbox')}
|
|
80
|
+
style={style}
|
|
81
|
+
>
|
|
82
|
+
<State
|
|
83
|
+
stateClassName={styles.stateLayer}
|
|
84
|
+
colorName={isChecked || indeterminate ? 'primary' : 'on-surface'}
|
|
85
|
+
>
|
|
86
|
+
<input
|
|
87
|
+
ref={inputRef}
|
|
88
|
+
type="checkbox"
|
|
89
|
+
id={id}
|
|
90
|
+
name={name}
|
|
91
|
+
value={value}
|
|
92
|
+
checked={isChecked}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
onChange={handleChange}
|
|
95
|
+
onFocus={() => setIsFocused(true)}
|
|
96
|
+
onBlur={() => setIsFocused(false)}
|
|
97
|
+
className={styles.input}
|
|
98
|
+
{...(restProps as any)}
|
|
99
|
+
/>
|
|
100
|
+
<div className={styles.box}></div>
|
|
101
|
+
<AnimatePresence>
|
|
102
|
+
{(isChecked || indeterminate) && (
|
|
103
|
+
<motion.div
|
|
104
|
+
initial={{ opacity: 0, scale: 0.5 }}
|
|
105
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
106
|
+
exit={{ opacity: 0, scale: 0.5 }}
|
|
107
|
+
transition={{ duration: 0.15 }}
|
|
108
|
+
className={styles.icon}
|
|
109
|
+
>
|
|
110
|
+
<Icon
|
|
111
|
+
icon={indeterminate ? faMinus : faCheck}
|
|
112
|
+
className="size-3.5" // ~14px icon
|
|
113
|
+
/>
|
|
114
|
+
</motion.div>
|
|
115
|
+
)}
|
|
116
|
+
</AnimatePresence>
|
|
117
|
+
</State>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
};
|