@impulse-ui-native/theme 2.9.0 → 4.0.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/constants/index.d.mts +1 -1
- package/dist/constants/style.constants.d.mts +3 -3
- package/dist/constants/style.constants.js +3 -3
- package/dist/constants/style.constants.js.map +1 -1
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/use-colors.hook.d.mts +2 -1
- package/dist/hooks/use-components-tokens.hook.d.mts +2 -1
- package/dist/hooks/use-theme.hook.d.mts +2 -1
- package/dist/hooks/use-themed-styles.d.mts +2 -1
- package/dist/index.d.mts +22 -13
- package/dist/providers/index.d.mts +2 -1
- package/dist/providers/theme.provider.d.mts +2 -1
- package/dist/theme/create-accordion-tokens.d.mts +2 -1
- package/dist/theme/create-accordion-tokens.js +24 -7
- package/dist/theme/create-accordion-tokens.js.map +1 -1
- package/dist/theme/create-avatar-tokens.d.mts +2 -1
- package/dist/theme/create-avatar-tokens.js +0 -10
- package/dist/theme/create-avatar-tokens.js.map +1 -1
- package/dist/theme/create-badge-tokens.d.mts +2 -1
- package/dist/theme/create-badge-tokens.js +0 -10
- package/dist/theme/create-badge-tokens.js.map +1 -1
- package/dist/theme/create-button-tokens.d.mts +2 -1
- package/dist/theme/create-button-tokens.js +60 -32
- package/dist/theme/create-button-tokens.js.map +1 -1
- package/dist/theme/create-card-tokens.d.mts +2 -1
- package/dist/theme/create-checkbox-tokens.d.mts +2 -1
- package/dist/theme/create-checkbox-tokens.js +60 -24
- package/dist/theme/create-checkbox-tokens.js.map +1 -1
- package/dist/theme/create-control-tokens.d.mts +2 -1
- package/dist/theme/create-control-tokens.js +86 -97
- package/dist/theme/create-control-tokens.js.map +1 -1
- package/dist/theme/create-data-state-tokens.d.mts +2 -1
- package/dist/theme/create-data-state-tokens.js.map +1 -1
- package/dist/theme/create-datetime-picker.d.mts +2 -1
- package/dist/theme/create-datetime-picker.js +18 -6
- package/dist/theme/create-datetime-picker.js.map +1 -1
- package/dist/theme/create-divider-tokens.d.mts +2 -1
- package/dist/theme/create-flyout-tokens.d.mts +2 -1
- package/dist/theme/create-flyout-tokens.js.map +1 -1
- package/dist/theme/create-icon-button-tokens.d.mts +2 -1
- package/dist/theme/create-icon-button-tokens.js +60 -32
- package/dist/theme/create-icon-button-tokens.js.map +1 -1
- package/dist/theme/create-progress-tokens.d.mts +2 -1
- package/dist/theme/create-radio-tokens.d.mts +2 -1
- package/dist/theme/create-radio-tokens.js +60 -24
- package/dist/theme/create-radio-tokens.js.map +1 -1
- package/dist/theme/create-select-tokens.d.mts +2 -1
- package/dist/theme/create-select-tokens.js +10 -3
- package/dist/theme/create-select-tokens.js.map +1 -1
- package/dist/theme/create-skeleton-tokens.d.mts +2 -1
- package/dist/theme/create-skeleton-tokens.js.map +1 -1
- package/dist/theme/create-slider-tokens.d.mts +31 -0
- package/dist/theme/create-slider-tokens.js +182 -0
- package/dist/theme/create-slider-tokens.js.map +1 -0
- package/dist/theme/create-spinner-tokens.d.mts +2 -1
- package/dist/theme/create-stepper-tokens.d.mts +2 -1
- package/dist/theme/create-switch-tokens.d.mts +2 -1
- package/dist/theme/create-switch-tokens.js +48 -25
- package/dist/theme/create-switch-tokens.js.map +1 -1
- package/dist/theme/create-tag-tokens.d.mts +2 -1
- package/dist/theme/create-tag-tokens.js +228 -68
- package/dist/theme/create-tag-tokens.js.map +1 -1
- package/dist/theme/create-textarea-tokens.d.mts +2 -1
- package/dist/theme/create-textarea-tokens.js +6 -3
- package/dist/theme/create-textarea-tokens.js.map +1 -1
- package/dist/theme/create-time-picker-tokens.d.mts +2 -1
- package/dist/theme/create-time-picker-tokens.js +10 -4
- package/dist/theme/create-time-picker-tokens.js.map +1 -1
- package/dist/theme/dark.theme.d.mts +2 -1
- package/dist/theme/index.d.mts +3 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/light.theme.d.mts +2 -1
- package/dist/theme/tokens.theme.d.mts +2 -1
- package/dist/theme/tokens.theme.js +2 -0
- package/dist/theme/tokens.theme.js.map +1 -1
- package/dist/types/accordion-tokens.types.d.mts +11 -7
- package/dist/types/avatar-tokens.types.d.mts +2 -2
- package/dist/types/badge-tokens.types.d.mts +2 -2
- package/dist/types/buttons-tokens.types.d.mts +6 -15
- package/dist/types/checkbox-tokens.types.d.mts +5 -9
- package/dist/types/components.types.d.mts +36 -2
- package/dist/types/control-tokens.types.d.mts +57 -0
- package/dist/types/control-tokens.types.js +1 -0
- package/dist/types/datetime-picker-tokens.types.d.mts +14 -7
- package/dist/types/index.d.mts +13 -12
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/radio-tokens.types.d.mts +5 -9
- package/dist/types/select-tokens.types.d.mts +8 -4
- package/dist/types/slider-tokens.types.d.mts +43 -0
- package/dist/types/slider-tokens.types.js +1 -0
- package/dist/types/slider-tokens.types.js.map +1 -0
- package/dist/types/switch-tokens.types.d.mts +11 -13
- package/dist/types/tag-tokens.types.d.mts +5 -7
- package/dist/types/textarea-tokens.types.d.mts +6 -5
- package/dist/types/theme-provider.types.d.mts +3 -1
- package/dist/types/time-picker-token.types.d.mts +8 -5
- package/dist/utils/action-state.utils.d.mts +5 -0
- package/dist/utils/action-state.utils.js +9 -0
- package/dist/utils/action-state.utils.js.map +1 -0
- package/dist/utils/availability-state.utils.d.mts +5 -0
- package/dist/utils/availability-state.utils.js +8 -0
- package/dist/utils/availability-state.utils.js.map +1 -0
- package/dist/utils/control-state.utils.d.mts +5 -0
- package/dist/utils/control-state.utils.js +9 -0
- package/dist/utils/control-state.utils.js.map +1 -0
- package/dist/utils/datetime-picker-state.utils.d.mts +6 -0
- package/dist/utils/datetime-picker-state.utils.js +10 -0
- package/dist/utils/datetime-picker-state.utils.js.map +1 -0
- package/dist/utils/field-state.utils.d.mts +5 -0
- package/dist/utils/field-state.utils.js +9 -0
- package/dist/utils/field-state.utils.js.map +1 -0
- package/dist/utils/index.d.mts +11 -3
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/selection-item-state.utils.d.mts +5 -0
- package/dist/utils/selection-item-state.utils.js +8 -0
- package/dist/utils/selection-item-state.utils.js.map +1 -0
- package/dist/utils/selection-state.utils.d.mts +5 -0
- package/dist/utils/selection-state.utils.js +11 -0
- package/dist/utils/selection-state.utils.js.map +1 -0
- package/dist/utils/style.utils.d.mts +2 -1
- package/dist/utils/style.utils.js +2 -2
- package/dist/utils/style.utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/types/control-tokes.types.d.mts +0 -62
- package/dist/types/control-tokes.types.js +0 -1
- /package/dist/types/{control-tokes.types.js.map → control-tokens.types.js.map} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComponentSize, SelectionVariant, VisualStateTokens, ControlVisualState } from './components.types.mjs';
|
|
2
|
+
|
|
3
|
+
/** @deprecated Use SelectionVariant. */
|
|
4
|
+
type SliderVariant = SelectionVariant;
|
|
5
|
+
type SliderSizeTokens = Record<ComponentSize, {
|
|
6
|
+
trackHeight: number;
|
|
7
|
+
thumbSize: number;
|
|
8
|
+
markSize: number;
|
|
9
|
+
hitSlop: number;
|
|
10
|
+
}>;
|
|
11
|
+
interface SliderAppearanceTokens {
|
|
12
|
+
activeMarkColor: string;
|
|
13
|
+
activeTrackColor: string;
|
|
14
|
+
focusRingBorderWidth: number;
|
|
15
|
+
inactiveTrackColor: string;
|
|
16
|
+
labelColor: string;
|
|
17
|
+
markColor: string;
|
|
18
|
+
thumbBackgroundColor: string;
|
|
19
|
+
thumbBorderColor: string;
|
|
20
|
+
thumbBorderWidth: number;
|
|
21
|
+
thumbHighlightColor: string;
|
|
22
|
+
valueBubbleBackgroundColor: string;
|
|
23
|
+
valueBubbleBorderColor: string;
|
|
24
|
+
valueBubbleColor: string;
|
|
25
|
+
}
|
|
26
|
+
type SliderVariantTokens = Record<SelectionVariant, VisualStateTokens<ControlVisualState, SliderAppearanceTokens>>;
|
|
27
|
+
interface SliderTokens {
|
|
28
|
+
trackBorderRadius: number;
|
|
29
|
+
thumbBorderRadius: number;
|
|
30
|
+
focusRingWidth: number;
|
|
31
|
+
focusRingOffset: number;
|
|
32
|
+
focusRingColor: string;
|
|
33
|
+
valueBubbleBorderRadius: number;
|
|
34
|
+
valueBubbleBorderWidth: number;
|
|
35
|
+
valueBubblePaddingHorizontal: number;
|
|
36
|
+
valueBubblePaddingVertical: number;
|
|
37
|
+
valueBubbleGap: number;
|
|
38
|
+
labelGap: number;
|
|
39
|
+
sizes: SliderSizeTokens;
|
|
40
|
+
variants: SliderVariantTokens;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { SliderAppearanceTokens, SliderSizeTokens, SliderTokens, SliderVariant, SliderVariantTokens };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=slider-tokens.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentSize,
|
|
1
|
+
import { ComponentSize, SelectionVariant, VisualStateTokens, AvailabilityVisualState } from './components.types.mjs';
|
|
2
2
|
|
|
3
3
|
type SwitchSizeTokens = Record<ComponentSize, {
|
|
4
4
|
width: number;
|
|
@@ -8,25 +8,23 @@ type SwitchSizeTokens = Record<ComponentSize, {
|
|
|
8
8
|
loadingIndicatorScale: number;
|
|
9
9
|
hitSlop: number;
|
|
10
10
|
}>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
interface SwitchAppearanceTokens {
|
|
12
|
+
activeBackgroundColor: string;
|
|
13
|
+
activeBorderColor: string;
|
|
14
|
+
activeThumbColor: string;
|
|
15
|
+
inactiveBackgroundColor: string;
|
|
16
|
+
inactiveBorderColor: string;
|
|
17
|
+
inactiveThumbColor: string;
|
|
18
|
+
}
|
|
19
|
+
type SwitchVariantTokens = Record<SelectionVariant, VisualStateTokens<AvailabilityVisualState, SwitchAppearanceTokens>>;
|
|
16
20
|
interface SwitchTokens {
|
|
17
21
|
animationDuration: number;
|
|
18
22
|
borderWidth: number;
|
|
19
23
|
borderRadius: number;
|
|
20
24
|
thumbBorderRadius: number;
|
|
21
|
-
uncheckedBackgroundColor: string;
|
|
22
|
-
uncheckedBorderColor: string;
|
|
23
|
-
uncheckedThumbColor: string;
|
|
24
|
-
disabledBackgroundColor: string;
|
|
25
|
-
disabledBorderColor: string;
|
|
26
|
-
disabledThumbColor: string;
|
|
27
25
|
loadingIndicatorColor: string;
|
|
28
26
|
sizes: SwitchSizeTokens;
|
|
29
27
|
variants: SwitchVariantTokens;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
export type { SwitchSizeTokens, SwitchTokens, SwitchVariantTokens };
|
|
30
|
+
export type { SwitchAppearanceTokens, SwitchSizeTokens, SwitchTokens, SwitchVariantTokens };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentSize,
|
|
1
|
+
import { ComponentSize, DisplayVariant, VisualStateTokens, AvailabilityVisualState } from './components.types.mjs';
|
|
2
2
|
|
|
3
3
|
type TagColor = "primary" | "secondary" | "error" | "warning" | "success" | "info";
|
|
4
4
|
type TagSizeTokens = Record<ComponentSize, {
|
|
@@ -7,14 +7,12 @@ type TagSizeTokens = Record<ComponentSize, {
|
|
|
7
7
|
minWidth: number;
|
|
8
8
|
fontSize: number;
|
|
9
9
|
}>;
|
|
10
|
-
|
|
10
|
+
interface TagAppearanceTokens {
|
|
11
11
|
backgroundColor: string;
|
|
12
12
|
borderColor: string;
|
|
13
13
|
color: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
disabledColor: string;
|
|
17
|
-
}>;
|
|
14
|
+
}
|
|
15
|
+
type TagVariantTokens = Record<DisplayVariant, VisualStateTokens<AvailabilityVisualState, TagAppearanceTokens>>;
|
|
18
16
|
type TagColorTokens = Record<TagColor, TagVariantTokens>;
|
|
19
17
|
interface TagTokens {
|
|
20
18
|
borderWidth: number;
|
|
@@ -26,4 +24,4 @@ interface TagTokens {
|
|
|
26
24
|
colors: TagColorTokens;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
export type { TagColor, TagColorTokens, TagSizeTokens, TagTokens, TagVariantTokens };
|
|
27
|
+
export type { TagAppearanceTokens, TagColor, TagColorTokens, TagSizeTokens, TagTokens, TagVariantTokens };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { ComponentSize } from './components.types.mjs';
|
|
1
|
+
import { ComponentSize, VisualStateTokens, FieldVisualState } from './components.types.mjs';
|
|
2
2
|
|
|
3
3
|
type TextareaSizeTokens = Record<ComponentSize, {
|
|
4
4
|
lineHeight: number;
|
|
5
5
|
paddingVertical: number;
|
|
6
6
|
}>;
|
|
7
|
-
interface
|
|
7
|
+
interface TextareaAppearanceTokens {
|
|
8
8
|
counterColor: string;
|
|
9
|
+
}
|
|
10
|
+
interface TextareaTokens {
|
|
9
11
|
counterFontSize: number;
|
|
10
|
-
disabledCounterColor: string;
|
|
11
|
-
errorCounterColor: string;
|
|
12
12
|
footerGap: number;
|
|
13
13
|
footerMarginTop: number;
|
|
14
14
|
sizes: TextareaSizeTokens;
|
|
15
|
+
states: VisualStateTokens<FieldVisualState, TextareaAppearanceTokens>;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export type { TextareaSizeTokens, TextareaTokens };
|
|
18
|
+
export type { TextareaAppearanceTokens, TextareaSizeTokens, TextareaTokens };
|
|
@@ -5,7 +5,7 @@ import { AccordionTokens } from './accordion-tokens.types.mjs';
|
|
|
5
5
|
import { AvatarTokens } from './avatar-tokens.types.mjs';
|
|
6
6
|
import { ButtonTokens, IconButtonTokens } from './buttons-tokens.types.mjs';
|
|
7
7
|
import { CardTokens } from './card-tokens.types.mjs';
|
|
8
|
-
import { ControlAddonTokens, ControlContainerTokens, ControlErrorTokens, ControlInputTokens, ControlLabelTokens } from './control-
|
|
8
|
+
import { ControlAddonTokens, ControlContainerTokens, ControlErrorTokens, ControlInputTokens, ControlLabelTokens } from './control-tokens.types.mjs';
|
|
9
9
|
import { DataStateTokens } from './data-state-tokens.types.mjs';
|
|
10
10
|
import { DatetimePickerTokens } from './datetime-picker-tokens.types.mjs';
|
|
11
11
|
import { DividerTokens } from './divider-tokens.types.mjs';
|
|
@@ -15,6 +15,7 @@ import { PressableTokens } from './pressable-tokens.types.mjs';
|
|
|
15
15
|
import { ProgressTokens } from './progress-tokens.types.mjs';
|
|
16
16
|
import { SelectTokens } from './select-tokens.types.mjs';
|
|
17
17
|
import { SkeletonTokens } from './skeleton-tokens.types.mjs';
|
|
18
|
+
import { SliderTokens } from './slider-tokens.types.mjs';
|
|
18
19
|
import { SpinnerTokens } from './spinner-tokens.types.mjs';
|
|
19
20
|
import { StepperTokens } from './stepper-tokens.types.mjs';
|
|
20
21
|
import { SwitchTokens } from './switch-tokens.types.mjs';
|
|
@@ -95,6 +96,7 @@ interface ComponentsTokens {
|
|
|
95
96
|
timePicker: TimePickerTokens;
|
|
96
97
|
flyout: FlyoutTokens;
|
|
97
98
|
skeleton: SkeletonTokens;
|
|
99
|
+
slider: SliderTokens;
|
|
98
100
|
spinner: SpinnerTokens;
|
|
99
101
|
stepper: StepperTokens;
|
|
100
102
|
switch: SwitchTokens;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { VisualStateTokens, SelectionItemVisualState } from './components.types.mjs';
|
|
2
|
+
|
|
3
|
+
interface TimePickerColumnAppearanceTokens {
|
|
4
|
+
color: string;
|
|
5
|
+
fontWeight: number;
|
|
6
|
+
}
|
|
1
7
|
interface TimePickerColumnTokens {
|
|
2
8
|
width: number;
|
|
3
9
|
height: number;
|
|
@@ -8,10 +14,7 @@ interface TimePickerColumnTokens {
|
|
|
8
14
|
verticalPadding: number;
|
|
9
15
|
initialScrollIndexViewOffset: number;
|
|
10
16
|
fontSize: number;
|
|
11
|
-
|
|
12
|
-
color: string;
|
|
13
|
-
selectedFontWeight: number;
|
|
14
|
-
fontWeight: number;
|
|
17
|
+
states: VisualStateTokens<SelectionItemVisualState, TimePickerColumnAppearanceTokens>;
|
|
15
18
|
}
|
|
16
19
|
interface TimePickerFlyoutTokens {
|
|
17
20
|
gap: number;
|
|
@@ -31,4 +34,4 @@ interface TimePickerTokens {
|
|
|
31
34
|
columns: TimePickerColumnsTokens;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
export type { TimePickerColumnTokens, TimePickerColumnsTokens, TimePickerFlyoutTokens, TimePickerTokens };
|
|
37
|
+
export type { TimePickerColumnAppearanceTokens, TimePickerColumnTokens, TimePickerColumnsTokens, TimePickerFlyoutTokens, TimePickerTokens };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function getActionStateTokens(tokens, state) {
|
|
2
|
+
const { disabled = false, loading = false } = state;
|
|
3
|
+
if (disabled) return tokens.disabled;
|
|
4
|
+
return loading ? tokens.loading : tokens.default;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
getActionStateTokens
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=action-state.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/action-state.utils.ts"],"sourcesContent":["import type {\n ActionState,\n ActionVisualState,\n VisualStateTokens,\n} from \"../types\";\n\nexport function getActionStateTokens<Tokens>(\n tokens: VisualStateTokens<ActionVisualState, Tokens>,\n state: ActionState,\n): Tokens {\n const { disabled = false, loading = false } = state;\n\n if (disabled) return tokens.disabled;\n return loading ? tokens.loading : tokens.default;\n}\n"],"mappings":"AAMO,SAAS,qBACd,QACA,OACQ;AACR,QAAM,EAAE,WAAW,OAAO,UAAU,MAAM,IAAI;AAE9C,MAAI,SAAU,QAAO,OAAO;AAC5B,SAAO,UAAU,OAAO,UAAU,OAAO;AAC3C;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VisualStateTokens, AvailabilityVisualState, AvailabilityState } from '../types/components.types.mjs';
|
|
2
|
+
|
|
3
|
+
declare function getAvailabilityStateTokens<Tokens>(tokens: VisualStateTokens<AvailabilityVisualState, Tokens>, state: AvailabilityState): Tokens;
|
|
4
|
+
|
|
5
|
+
export { getAvailabilityStateTokens };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/availability-state.utils.ts"],"sourcesContent":["import type {\n AvailabilityState,\n AvailabilityVisualState,\n VisualStateTokens,\n} from \"../types\";\n\nexport function getAvailabilityStateTokens<Tokens>(\n tokens: VisualStateTokens<AvailabilityVisualState, Tokens>,\n state: AvailabilityState,\n): Tokens {\n const { disabled = false } = state;\n\n return disabled ? tokens.disabled : tokens.default;\n}\n"],"mappings":"AAMO,SAAS,2BACd,QACA,OACQ;AACR,QAAM,EAAE,WAAW,MAAM,IAAI;AAE7B,SAAO,WAAW,OAAO,WAAW,OAAO;AAC7C;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VisualStateTokens, ControlVisualState, ControlState } from '../types/components.types.mjs';
|
|
2
|
+
|
|
3
|
+
declare function getControlStateTokens<Tokens>(tokens: VisualStateTokens<ControlVisualState, Tokens>, state: ControlState): Tokens;
|
|
4
|
+
|
|
5
|
+
export { getControlStateTokens };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function getControlStateTokens(tokens, state) {
|
|
2
|
+
const { disabled = false, focused = false } = state;
|
|
3
|
+
if (disabled) return tokens.disabled;
|
|
4
|
+
return focused ? tokens.focused : tokens.default;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
getControlStateTokens
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=control-state.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/control-state.utils.ts"],"sourcesContent":["import type {\n ControlState,\n ControlVisualState,\n VisualStateTokens,\n} from \"../types\";\n\nexport function getControlStateTokens<Tokens>(\n tokens: VisualStateTokens<ControlVisualState, Tokens>,\n state: ControlState,\n): Tokens {\n const { disabled = false, focused = false } = state;\n\n if (disabled) return tokens.disabled;\n return focused ? tokens.focused : tokens.default;\n}\n"],"mappings":"AAMO,SAAS,sBACd,QACA,OACQ;AACR,QAAM,EAAE,WAAW,OAAO,UAAU,MAAM,IAAI;AAE9C,MAAI,SAAU,QAAO,OAAO;AAC5B,SAAO,UAAU,OAAO,UAAU,OAAO;AAC3C;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DatetimePickerDayTokens, DatetimePickerDayState, DatetimePickerDayAppearanceTokens } from '../types/datetime-picker-tokens.types.mjs';
|
|
2
|
+
import '../types/components.types.mjs';
|
|
3
|
+
|
|
4
|
+
declare function getDatetimePickerDayStateTokens(tokens: DatetimePickerDayTokens["states"], state: DatetimePickerDayState): DatetimePickerDayAppearanceTokens;
|
|
5
|
+
|
|
6
|
+
export { getDatetimePickerDayStateTokens };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function getDatetimePickerDayStateTokens(tokens, state) {
|
|
2
|
+
const { currentMonth = false, inRange = false, selected = false } = state;
|
|
3
|
+
if (selected) return tokens.selected;
|
|
4
|
+
if (inRange) return tokens.range;
|
|
5
|
+
return currentMonth ? tokens.default : tokens.outsideMonth;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
getDatetimePickerDayStateTokens
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=datetime-picker-state.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/datetime-picker-state.utils.ts"],"sourcesContent":["import type {\n DatetimePickerDayAppearanceTokens,\n DatetimePickerDayState,\n DatetimePickerDayTokens,\n} from \"../types\";\n\nexport function getDatetimePickerDayStateTokens(\n tokens: DatetimePickerDayTokens[\"states\"],\n state: DatetimePickerDayState,\n): DatetimePickerDayAppearanceTokens {\n const { currentMonth = false, inRange = false, selected = false } = state;\n\n if (selected) return tokens.selected;\n if (inRange) return tokens.range;\n return currentMonth ? tokens.default : tokens.outsideMonth;\n}\n"],"mappings":"AAMO,SAAS,gCACd,QACA,OACmC;AACnC,QAAM,EAAE,eAAe,OAAO,UAAU,OAAO,WAAW,MAAM,IAAI;AAEpE,MAAI,SAAU,QAAO,OAAO;AAC5B,MAAI,QAAS,QAAO,OAAO;AAC3B,SAAO,eAAe,OAAO,UAAU,OAAO;AAChD;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function getFieldStateTokens(tokens, state) {
|
|
2
|
+
const { disabled = false, error = false } = state;
|
|
3
|
+
if (disabled) return error ? tokens.disabledError : tokens.disabled;
|
|
4
|
+
return error ? tokens.error : tokens.default;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
getFieldStateTokens
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=field-state.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/field-state.utils.ts"],"sourcesContent":["import type { FieldState, FieldVisualState, VisualStateTokens } from \"../types\";\n\nexport function getFieldStateTokens<Tokens>(\n tokens: VisualStateTokens<FieldVisualState, Tokens>,\n state: FieldState,\n): Tokens {\n const { disabled = false, error = false } = state;\n\n if (disabled) return error ? tokens.disabledError : tokens.disabled;\n return error ? tokens.error : tokens.default;\n}\n"],"mappings":"AAEO,SAAS,oBACd,QACA,OACQ;AACR,QAAM,EAAE,WAAW,OAAO,QAAQ,MAAM,IAAI;AAE5C,MAAI,SAAU,QAAO,QAAQ,OAAO,gBAAgB,OAAO;AAC3D,SAAO,QAAQ,OAAO,QAAQ,OAAO;AACvC;","names":[]}
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
export { getActionStateTokens } from './action-state.utils.mjs';
|
|
2
|
+
export { getAvailabilityStateTokens } from './availability-state.utils.mjs';
|
|
3
|
+
export { getControlStateTokens } from './control-state.utils.mjs';
|
|
4
|
+
export { getDatetimePickerDayStateTokens } from './datetime-picker-state.utils.mjs';
|
|
5
|
+
export { getFieldStateTokens } from './field-state.utils.mjs';
|
|
6
|
+
export { getSelectionItemStateTokens } from './selection-item-state.utils.mjs';
|
|
7
|
+
export { getSelectionStateTokens } from './selection-state.utils.mjs';
|
|
1
8
|
export { createStyleKey, extractStyleProps, getShadowStyle } from './style.utils.mjs';
|
|
9
|
+
import '../types/components.types.mjs';
|
|
10
|
+
import '../types/datetime-picker-tokens.types.mjs';
|
|
2
11
|
import 'react-native';
|
|
3
12
|
import '../types/shadow.types.mjs';
|
|
4
13
|
import '../types/style.types.mjs';
|
|
@@ -11,16 +20,14 @@ import '../types/typography.types.mjs';
|
|
|
11
20
|
import '../types/tokens.types.mjs';
|
|
12
21
|
import '../types/theme-provider.types.mjs';
|
|
13
22
|
import '../types/badge-tokens.types.mjs';
|
|
14
|
-
import '../types/components.types.mjs';
|
|
15
23
|
import '../types/checkbox-tokens.types.mjs';
|
|
16
24
|
import '../types/radio-tokens.types.mjs';
|
|
17
25
|
import '../types/accordion-tokens.types.mjs';
|
|
18
26
|
import '../types/avatar-tokens.types.mjs';
|
|
19
27
|
import '../types/buttons-tokens.types.mjs';
|
|
20
28
|
import '../types/card-tokens.types.mjs';
|
|
21
|
-
import '../types/control-
|
|
29
|
+
import '../types/control-tokens.types.mjs';
|
|
22
30
|
import '../types/data-state-tokens.types.mjs';
|
|
23
|
-
import '../types/datetime-picker-tokens.types.mjs';
|
|
24
31
|
import '../types/divider-tokens.types.mjs';
|
|
25
32
|
import '../types/flyout-tokens.types.mjs';
|
|
26
33
|
import '../types/icon-tokens.types.mjs';
|
|
@@ -29,6 +36,7 @@ import '../types/progress-tokens.types.mjs';
|
|
|
29
36
|
import '../types/spinner-tokens.types.mjs';
|
|
30
37
|
import '../types/select-tokens.types.mjs';
|
|
31
38
|
import '../types/skeleton-tokens.types.mjs';
|
|
39
|
+
import '../types/slider-tokens.types.mjs';
|
|
32
40
|
import '../types/stepper-tokens.types.mjs';
|
|
33
41
|
import '../types/switch-tokens.types.mjs';
|
|
34
42
|
import '../types/tag-tokens.types.mjs';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
export * from "./action-state.utils";
|
|
2
|
+
export * from "./availability-state.utils";
|
|
3
|
+
export * from "./control-state.utils";
|
|
4
|
+
export * from "./datetime-picker-state.utils";
|
|
5
|
+
export * from "./field-state.utils";
|
|
6
|
+
export * from "./selection-item-state.utils";
|
|
7
|
+
export * from "./selection-state.utils";
|
|
1
8
|
export * from "./style.utils";
|
|
2
9
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from \"./style.utils\";\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from \"./action-state.utils\";\nexport * from \"./availability-state.utils\";\nexport * from \"./control-state.utils\";\nexport * from \"./datetime-picker-state.utils\";\nexport * from \"./field-state.utils\";\nexport * from \"./selection-item-state.utils\";\nexport * from \"./selection-state.utils\";\nexport * from \"./style.utils\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VisualStateTokens, SelectionItemVisualState, SelectionItemState } from '../types/components.types.mjs';
|
|
2
|
+
|
|
3
|
+
declare function getSelectionItemStateTokens<Tokens>(tokens: VisualStateTokens<SelectionItemVisualState, Tokens>, state: SelectionItemState): Tokens;
|
|
4
|
+
|
|
5
|
+
export { getSelectionItemStateTokens };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/selection-item-state.utils.ts"],"sourcesContent":["import type {\n SelectionItemState,\n SelectionItemVisualState,\n VisualStateTokens,\n} from \"../types\";\n\nexport function getSelectionItemStateTokens<Tokens>(\n tokens: VisualStateTokens<SelectionItemVisualState, Tokens>,\n state: SelectionItemState,\n): Tokens {\n const { selected } = state;\n\n return selected ? tokens.selected : tokens.default;\n}\n"],"mappings":"AAMO,SAAS,4BACd,QACA,OACQ;AACR,QAAM,EAAE,SAAS,IAAI;AAErB,SAAO,WAAW,OAAO,WAAW,OAAO;AAC7C;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VisualStateTokens, SelectionVisualState, SelectionState } from '../types/components.types.mjs';
|
|
2
|
+
|
|
3
|
+
declare function getSelectionStateTokens<Tokens>(tokens: VisualStateTokens<SelectionVisualState, Tokens>, state: SelectionState): Tokens;
|
|
4
|
+
|
|
5
|
+
export { getSelectionStateTokens };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function getSelectionStateTokens(tokens, state) {
|
|
2
|
+
const { disabled = false, selected } = state;
|
|
3
|
+
if (disabled) {
|
|
4
|
+
return selected ? tokens.disabledSelected : tokens.disabledUnselected;
|
|
5
|
+
}
|
|
6
|
+
return selected ? tokens.selected : tokens.unselected;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
getSelectionStateTokens
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=selection-state.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/selection-state.utils.ts"],"sourcesContent":["import type {\n SelectionState,\n SelectionVisualState,\n VisualStateTokens,\n} from \"../types\";\n\nexport function getSelectionStateTokens<Tokens>(\n tokens: VisualStateTokens<SelectionVisualState, Tokens>,\n state: SelectionState,\n): Tokens {\n const { disabled = false, selected } = state;\n\n if (disabled) {\n return selected ? tokens.disabledSelected : tokens.disabledUnselected;\n }\n\n return selected ? tokens.selected : tokens.unselected;\n}\n"],"mappings":"AAMO,SAAS,wBACd,QACA,OACQ;AACR,QAAM,EAAE,WAAW,OAAO,SAAS,IAAI;AAEvC,MAAI,UAAU;AACZ,WAAO,WAAW,OAAO,mBAAmB,OAAO;AAAA,EACrD;AAEA,SAAO,WAAW,OAAO,WAAW,OAAO;AAC7C;","names":[]}
|
|
@@ -17,7 +17,7 @@ import '../types/accordion-tokens.types.mjs';
|
|
|
17
17
|
import '../types/avatar-tokens.types.mjs';
|
|
18
18
|
import '../types/buttons-tokens.types.mjs';
|
|
19
19
|
import '../types/card-tokens.types.mjs';
|
|
20
|
-
import '../types/control-
|
|
20
|
+
import '../types/control-tokens.types.mjs';
|
|
21
21
|
import '../types/data-state-tokens.types.mjs';
|
|
22
22
|
import '../types/datetime-picker-tokens.types.mjs';
|
|
23
23
|
import '../types/divider-tokens.types.mjs';
|
|
@@ -28,6 +28,7 @@ import '../types/progress-tokens.types.mjs';
|
|
|
28
28
|
import '../types/spinner-tokens.types.mjs';
|
|
29
29
|
import '../types/select-tokens.types.mjs';
|
|
30
30
|
import '../types/skeleton-tokens.types.mjs';
|
|
31
|
+
import '../types/slider-tokens.types.mjs';
|
|
31
32
|
import '../types/stepper-tokens.types.mjs';
|
|
32
33
|
import '../types/switch-tokens.types.mjs';
|
|
33
34
|
import '../types/tag-tokens.types.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import {
|
|
2
|
+
import { ShadowScale, StylePropsSet } from "../constants";
|
|
3
3
|
const isStylePropKey = (k) => StylePropsSet.has(k);
|
|
4
4
|
const extractStyleProps = (props) => {
|
|
5
5
|
const style = {};
|
|
@@ -20,7 +20,7 @@ const createStyleKey = (props) => {
|
|
|
20
20
|
return key;
|
|
21
21
|
};
|
|
22
22
|
const getShadowStyle = (level = "none", position = "bottom", colors) => {
|
|
23
|
-
const token =
|
|
23
|
+
const token = ShadowScale[level];
|
|
24
24
|
if (level === "none") return {};
|
|
25
25
|
if (Platform.OS === "android") {
|
|
26
26
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/style.utils.ts"],"sourcesContent":["import { Platform, ViewStyle } from \"react-native\";\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/style.utils.ts"],"sourcesContent":["import { Platform, ViewStyle } from \"react-native\";\n\nimport { ShadowScale, StylePropsSet } from \"../constants\";\nimport {\n ShadowLevel,\n ShadowPosition,\n StylePropKey,\n StyleProps,\n ThemeColors,\n} from \"../types\";\n\nconst isStylePropKey = (k: string): k is StylePropKey =>\n StylePropsSet.has(k as StylePropKey);\n\nexport const extractStyleProps = <Props extends object>(\n props: Props,\n): StyleProps => {\n const style: StyleProps = {};\n\n for (const k in props) {\n if (isStylePropKey(k) && props[k] !== undefined) {\n style[k] = props[k] as any;\n }\n }\n\n return style;\n};\n\nexport const createStyleKey = <Props extends object>(props: Props) => {\n let key = \"\";\n\n for (const k in props) {\n if (isStylePropKey(k)) {\n key += String(props[k as keyof Props]);\n }\n }\n\n return key;\n};\n\nexport const getShadowStyle = (\n level: ShadowLevel = \"none\",\n position: ShadowPosition = \"bottom\",\n colors: ThemeColors,\n): ViewStyle => {\n const token = ShadowScale[level];\n\n if (level === \"none\") return {};\n\n if (Platform.OS === \"android\") {\n return {\n elevation: token.elevation,\n };\n }\n\n let offsetY = 0;\n\n if (position === \"bottom\") offsetY = token.radius / 2;\n if (position === \"top\") offsetY = -token.radius / 2;\n if (position === \"around\") offsetY = 0;\n\n return {\n shadowColor: colors.black,\n shadowOpacity: token.opacity,\n shadowRadius: token.radius,\n shadowOffset: {\n width: 0,\n height: offsetY,\n },\n };\n};\n"],"mappings":"AAAA,SAAS,gBAA2B;AAEpC,SAAS,aAAa,qBAAqB;AAS3C,MAAM,iBAAiB,CAAC,MACtB,cAAc,IAAI,CAAiB;AAE9B,MAAM,oBAAoB,CAC/B,UACe;AACf,QAAM,QAAoB,CAAC;AAE3B,aAAW,KAAK,OAAO;AACrB,QAAI,eAAe,CAAC,KAAK,MAAM,CAAC,MAAM,QAAW;AAC/C,YAAM,CAAC,IAAI,MAAM,CAAC;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAuB,UAAiB;AACpE,MAAI,MAAM;AAEV,aAAW,KAAK,OAAO;AACrB,QAAI,eAAe,CAAC,GAAG;AACrB,aAAO,OAAO,MAAM,CAAgB,CAAC;AAAA,IACvC;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAC5B,QAAqB,QACrB,WAA2B,UAC3B,WACc;AACd,QAAM,QAAQ,YAAY,KAAK;AAE/B,MAAI,UAAU,OAAQ,QAAO,CAAC;AAE9B,MAAI,SAAS,OAAO,WAAW;AAC7B,WAAO;AAAA,MACL,WAAW,MAAM;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,UAAU;AAEd,MAAI,aAAa,SAAU,WAAU,MAAM,SAAS;AACpD,MAAI,aAAa,MAAO,WAAU,CAAC,MAAM,SAAS;AAClD,MAAI,aAAa,SAAU,WAAU;AAErC,SAAO;AAAA,IACL,aAAa,OAAO;AAAA,IACpB,eAAe,MAAM;AAAA,IACrB,cAAc,MAAM;AAAA,IACpB,cAAc;AAAA,MACZ,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/theme",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Theme tokens, providers, and styling utilities for ImpulseUI Native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@impulse-ui-native/core": "
|
|
31
|
+
"@impulse-ui-native/core": "4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/react": "~19.2.14",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"react": "19.2.3",
|
|
38
38
|
"react-native": "0.86.2",
|
|
39
39
|
"typescript": "~6.0.3",
|
|
40
|
-
"@impulse-ui-native/prettier-config": "1.0.0",
|
|
41
40
|
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
41
|
+
"@impulse-ui-native/prettier-config": "1.0.0",
|
|
42
42
|
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { ComponentVariant, ComponentSize } from './components.types.mjs';
|
|
2
|
-
|
|
3
|
-
type ControlAddonVariantTokens = Record<ComponentVariant, {
|
|
4
|
-
iconColor: string;
|
|
5
|
-
errorIconColor: string;
|
|
6
|
-
disabledIconColor: string;
|
|
7
|
-
}>;
|
|
8
|
-
interface ControlAddonTokens {
|
|
9
|
-
marginHorizontal: number;
|
|
10
|
-
hitSlop: number;
|
|
11
|
-
variants: ControlAddonVariantTokens;
|
|
12
|
-
}
|
|
13
|
-
type ControlContainerSizeTokens = Record<ComponentSize, {
|
|
14
|
-
height: number;
|
|
15
|
-
paddingHorizontal: number;
|
|
16
|
-
}>;
|
|
17
|
-
type ControlContainerVariantTokens = Record<ComponentVariant, {
|
|
18
|
-
backgroundColor: string;
|
|
19
|
-
borderColor: string;
|
|
20
|
-
errorBorderColor: string;
|
|
21
|
-
disabledBackgroundColor: string;
|
|
22
|
-
disabledBorderColor: string;
|
|
23
|
-
}>;
|
|
24
|
-
interface ControlContainerTokens {
|
|
25
|
-
borderWidth: number;
|
|
26
|
-
borderRadius: number;
|
|
27
|
-
disabledOpacity: number;
|
|
28
|
-
sizes: ControlContainerSizeTokens;
|
|
29
|
-
variants: ControlContainerVariantTokens;
|
|
30
|
-
}
|
|
31
|
-
interface ControlErrorTokens {
|
|
32
|
-
marginTop: number;
|
|
33
|
-
color: string;
|
|
34
|
-
fontSize: number;
|
|
35
|
-
}
|
|
36
|
-
type ControlInputSizeTokens = Record<ComponentSize, {
|
|
37
|
-
fontSize: number;
|
|
38
|
-
}>;
|
|
39
|
-
type ControlInputVariantTokens = Record<ComponentVariant, {
|
|
40
|
-
color: string;
|
|
41
|
-
placeholderColor: string;
|
|
42
|
-
disabledColor: string;
|
|
43
|
-
disabledPlaceholderColor: string;
|
|
44
|
-
errorColor: string;
|
|
45
|
-
errorPlaceholderColor: string;
|
|
46
|
-
}>;
|
|
47
|
-
interface ControlInputTokens {
|
|
48
|
-
flex: number;
|
|
49
|
-
fontFamily: string;
|
|
50
|
-
paddingHorizontal: number;
|
|
51
|
-
sizes: ControlInputSizeTokens;
|
|
52
|
-
variants: ControlInputVariantTokens;
|
|
53
|
-
}
|
|
54
|
-
interface ControlLabelTokens {
|
|
55
|
-
marginBottom: number;
|
|
56
|
-
fontSize: number;
|
|
57
|
-
color: string;
|
|
58
|
-
disabledColor: string;
|
|
59
|
-
errorColor: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type { ControlAddonTokens, ControlAddonVariantTokens, ControlContainerSizeTokens, ControlContainerTokens, ControlContainerVariantTokens, ControlErrorTokens, ControlInputSizeTokens, ControlInputTokens, ControlInputVariantTokens, ControlLabelTokens };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=control-tokes.types.js.map
|
|
File without changes
|