@appdirect/design-system 0.0.21 → 0.0.23

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/Combobox/Select.js +11 -2
  3. package/dist/Combobox/Select.module.css +8 -0
  4. package/dist/Combobox/Select.tsx +16 -3
  5. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +1 -24
  6. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +2 -5
  7. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +15 -22
  8. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +1 -2
  9. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.module.css +2 -9
  10. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +4 -5
  11. package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +2 -6
  12. package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +1 -1
  13. package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +1 -1
  14. package/dist/DESIGN.md +11 -7
  15. package/dist/DataDisplay/Alert.js +3 -2
  16. package/dist/DataDisplay/Alert.tsx +4 -1
  17. package/dist/DataDisplay/Badge.js +37 -12
  18. package/dist/DataDisplay/Badge.tsx +42 -12
  19. package/dist/Inputs/NumberInput.js +28 -27
  20. package/dist/Inputs/NumberInput.tsx +53 -32
  21. package/dist/Inputs/Radio.js +1 -1
  22. package/dist/Inputs/Radio.tsx +1 -1
  23. package/dist/Inputs/RadioGroup.js +1 -1
  24. package/dist/Inputs/RadioGroup.tsx +1 -1
  25. package/dist/Overlays/Modal.js +2 -2
  26. package/dist/Overlays/Modal.tsx +2 -2
  27. package/dist/contracts/index.json +1 -1
  28. package/dist/css/foundations.css +44 -2
  29. package/dist/css/mantine.css +1541 -48
  30. package/dist/css/tokens.css +4 -12
  31. package/dist/stories/Inputs/Radio.stories.tsx +10 -5
  32. package/dist/stories/Inputs/RadioGroup.stories.tsx +122 -80
  33. package/dist/stories/Overlays/Drawer.stories.tsx +2 -2
  34. package/dist/stories/Overlays/Modal.stories.tsx +2 -2
  35. package/dist/stories/index.json +1 -1
  36. package/package.json +10 -6
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React, { forwardRef } from 'react';
4
- import { NumberInput as MantineNumberInput, ActionIcon, Group } from '@mantine/core';
5
- import { IconInfoCircle } from '@tabler/icons-react';
4
+ import { NumberInput as MantineNumberInput, ActionIcon, Group, } from '@mantine/core';
5
+ import { RiInformationLine } from '@remixicon/react';
6
6
  import { Text } from '../Typography/Text.js';
7
7
  import { Tooltip } from '../Overlays/Tooltip.js';
8
8
  // ========================== COMPONENT ==========================
@@ -11,39 +11,40 @@ import { Tooltip } from '../Overlays/Tooltip.js';
11
11
  *
12
12
  * A numeric input built on top of Mantine's NumberInput with
13
13
  * consistent design system styling and enforced radius.
14
- *
15
- * @example
16
- * ```tsx
17
- * <NumberInput label="Quantity" placeholder="Enter a number" />
18
- * ```
19
- *
20
- * @example
21
- * ```tsx
22
- * <NumberInput
23
- * label="Price"
24
- * prefix="$"
25
- * decimalScale={2}
26
- * fixedDecimalScale
27
- * showOptional
28
- * hasHelpIcon
29
- * helpIconLabel="Enter the item price"
30
- * />
31
- * ```
14
+ * Increment/decrement uses Mantine's native stacked chevron controls (styled via mantine.css).
32
15
  */
33
- export const NumberInput = forwardRef(({ size = 'md', showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, rightSection, error, errorCaption, ...props }, ref) => {
16
+ export const NumberInput = forwardRef(({ size = 'md', showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, leftSection, rightSection, error, errorCaption, hideControls, ...props }, ref) => {
34
17
  const effectiveError = error === true ? (errorCaption ?? true) : error;
35
18
  const enhancedLabel = React.useMemo(() => {
36
19
  if (!label)
37
20
  return label;
38
21
  if (showOptional && !required) {
39
- return (_jsxs(_Fragment, { children: [label, " ", _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
22
+ return (_jsxs(_Fragment, { children: [label, ' ', _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
40
23
  }
41
24
  return label;
42
25
  }, [label, showOptional, required]);
43
- const helpIconElement = hasHelpIcon ? (_jsx(Tooltip, { label: helpIconLabel ?? 'Help', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "transparent", size: "xs", "aria-label": helpIconLabel ?? 'Help', onClick: onHelpIconClick, color: "gray", style: { cursor: onHelpIconClick ? 'pointer' : 'default' }, children: _jsx(IconInfoCircle, { size: 14, "aria-hidden": true }) }) })) : null;
44
- const composedRightSection = (helpIconElement && rightSection)
45
- ? _jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] })
46
- : helpIconElement || rightSection;
47
- return (_jsx(MantineNumberInput, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, rightSection: composedRightSection, error: effectiveError, ...props }));
26
+ const helpIconElement = hasHelpIcon ? (_jsx(Tooltip, { label: helpIconLabel ?? 'Help', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "transparent", size: "xs", "aria-label": helpIconLabel ?? 'Help', onClick: onHelpIconClick, color: "gray", style: { cursor: onHelpIconClick ? 'pointer' : 'default' }, children: _jsx(RiInformationLine, { size: 14, "aria-hidden": true }) }) })) : null;
27
+ const nativeControlsVisible = !hideControls && !props.readOnly && !props.disabled;
28
+ const composedLeftSection = React.useMemo(() => {
29
+ if (!helpIconElement)
30
+ return leftSection;
31
+ if (nativeControlsVisible) {
32
+ if (leftSection) {
33
+ return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [helpIconElement, leftSection] }));
34
+ }
35
+ return helpIconElement;
36
+ }
37
+ return leftSection;
38
+ }, [helpIconElement, leftSection, nativeControlsVisible]);
39
+ const composedRightSection = React.useMemo(() => {
40
+ if (!helpIconElement || nativeControlsVisible) {
41
+ return rightSection;
42
+ }
43
+ if (rightSection) {
44
+ return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] }));
45
+ }
46
+ return helpIconElement;
47
+ }, [helpIconElement, nativeControlsVisible, rightSection]);
48
+ return (_jsx(MantineNumberInput, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, error: effectiveError, hideControls: hideControls, leftSection: composedLeftSection, rightSection: composedRightSection, ...props }));
48
49
  });
49
50
  NumberInput.displayName = 'NumberInput';
@@ -1,8 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import React, { forwardRef } from 'react';
4
- import { NumberInput as MantineNumberInput, NumberInputProps as MantineNumberInputProps, ActionIcon, Group } from '@mantine/core';
5
- import { IconInfoCircle } from '@tabler/icons-react';
4
+ import {
5
+ NumberInput as MantineNumberInput,
6
+ NumberInputProps as MantineNumberInputProps,
7
+ ActionIcon,
8
+ Group,
9
+ } from '@mantine/core';
10
+ import { RiInformationLine } from '@remixicon/react';
6
11
  import { ComponentSize } from '../config';
7
12
  import { Text } from '../Typography/Text';
8
13
  import { Tooltip } from '../Overlays/Tooltip';
@@ -34,24 +39,7 @@ export interface DSNumberInputProps extends Omit<MantineNumberInputProps, 'size'
34
39
  *
35
40
  * A numeric input built on top of Mantine's NumberInput with
36
41
  * consistent design system styling and enforced radius.
37
- *
38
- * @example
39
- * ```tsx
40
- * <NumberInput label="Quantity" placeholder="Enter a number" />
41
- * ```
42
- *
43
- * @example
44
- * ```tsx
45
- * <NumberInput
46
- * label="Price"
47
- * prefix="$"
48
- * decimalScale={2}
49
- * fixedDecimalScale
50
- * showOptional
51
- * hasHelpIcon
52
- * helpIconLabel="Enter the item price"
53
- * />
54
- * ```
42
+ * Increment/decrement uses Mantine's native stacked chevron controls (styled via mantine.css).
55
43
  */
56
44
  export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
57
45
  (
@@ -63,9 +51,11 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
63
51
  hasHelpIcon = false,
64
52
  helpIconLabel,
65
53
  onHelpIconClick,
54
+ leftSection,
66
55
  rightSection,
67
56
  error,
68
57
  errorCaption,
58
+ hideControls,
69
59
  ...props
70
60
  },
71
61
  ref
@@ -77,7 +67,10 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
77
67
  if (showOptional && !required) {
78
68
  return (
79
69
  <>
80
- {label} <Text span c="dimmed" fw="normal">(Optional)</Text>
70
+ {label}{' '}
71
+ <Text span c="dimmed" fw="normal">
72
+ (Optional)
73
+ </Text>
81
74
  </>
82
75
  );
83
76
  }
@@ -85,11 +78,7 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
85
78
  }, [label, showOptional, required]);
86
79
 
87
80
  const helpIconElement = hasHelpIcon ? (
88
- <Tooltip
89
- label={helpIconLabel ?? 'Help'}
90
- position="top"
91
- withArrow
92
- >
81
+ <Tooltip label={helpIconLabel ?? 'Help'} position="top" withArrow>
93
82
  <ActionIcon
94
83
  variant="transparent"
95
84
  size="xs"
@@ -98,14 +87,44 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
98
87
  color="gray"
99
88
  style={{ cursor: onHelpIconClick ? 'pointer' : 'default' }}
100
89
  >
101
- <IconInfoCircle size={14} aria-hidden />
90
+ <RiInformationLine size={14} aria-hidden />
102
91
  </ActionIcon>
103
92
  </Tooltip>
104
93
  ) : null;
105
94
 
106
- const composedRightSection = (helpIconElement && rightSection)
107
- ? <Group gap={4} wrap="nowrap">{rightSection}{helpIconElement}</Group>
108
- : helpIconElement || rightSection;
95
+ const nativeControlsVisible =
96
+ !hideControls && !props.readOnly && !props.disabled;
97
+
98
+ const composedLeftSection = React.useMemo(() => {
99
+ if (!helpIconElement) return leftSection;
100
+ if (nativeControlsVisible) {
101
+ if (leftSection) {
102
+ return (
103
+ <Group gap={4} wrap="nowrap">
104
+ {helpIconElement}
105
+ {leftSection}
106
+ </Group>
107
+ );
108
+ }
109
+ return helpIconElement;
110
+ }
111
+ return leftSection;
112
+ }, [helpIconElement, leftSection, nativeControlsVisible]);
113
+
114
+ const composedRightSection = React.useMemo(() => {
115
+ if (!helpIconElement || nativeControlsVisible) {
116
+ return rightSection;
117
+ }
118
+ if (rightSection) {
119
+ return (
120
+ <Group gap={4} wrap="nowrap">
121
+ {rightSection}
122
+ {helpIconElement}
123
+ </Group>
124
+ );
125
+ }
126
+ return helpIconElement;
127
+ }, [helpIconElement, nativeControlsVisible, rightSection]);
109
128
 
110
129
  return (
111
130
  <MantineNumberInput
@@ -114,12 +133,14 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
114
133
  radius="sm"
115
134
  required={required}
116
135
  label={enhancedLabel}
117
- rightSection={composedRightSection}
118
136
  error={effectiveError}
137
+ hideControls={hideControls}
138
+ leftSection={composedLeftSection}
139
+ rightSection={composedRightSection}
119
140
  {...props}
120
141
  />
121
142
  );
122
143
  }
123
144
  );
124
145
 
125
- NumberInput.displayName = 'NumberInput';
146
+ NumberInput.displayName = 'NumberInput';
@@ -40,7 +40,7 @@ import { Radio as MantineRadio } from '@mantine/core';
40
40
  * <Radio label="Required radio" value="required" required />
41
41
  * ```
42
42
  */
43
- export const Radio = forwardRef(({ size = 'md', label, ...props }, ref) => {
43
+ export const Radio = forwardRef(({ size = 'sm', label, ...props }, ref) => {
44
44
  // Construct label with required asterisk if needed
45
45
  const enhancedLabel = React.useMemo(() => {
46
46
  if (!label)
@@ -53,7 +53,7 @@ export interface DSRadioProps extends Omit<MantineRadioProps, 'size'> {
53
53
  export const Radio = forwardRef<HTMLInputElement, DSRadioProps>(
54
54
  (
55
55
  {
56
- size = 'md',
56
+ size = 'sm',
57
57
  label,
58
58
  ...props
59
59
  },
@@ -44,7 +44,7 @@ import { Radio as MantineRadio } from '@mantine/core';
44
44
  * </RadioGroup>
45
45
  * ```
46
46
  */
47
- export const RadioGroup = forwardRef(({ size = 'md', label, ...props }, ref) => {
47
+ export const RadioGroup = forwardRef(({ size = 'sm', label, ...props }, ref) => {
48
48
  // Construct label with required asterisk if needed
49
49
  const enhancedLabel = React.useMemo(() => {
50
50
  if (!label)
@@ -57,7 +57,7 @@ export interface DSRadioGroupProps extends Omit<React.ComponentPropsWithoutRef<t
57
57
  export const RadioGroup = forwardRef<HTMLDivElement, DSRadioGroupProps>(
58
58
  (
59
59
  {
60
- size = 'md',
60
+ size = 'sm',
61
61
  label,
62
62
  ...props
63
63
  },
@@ -33,7 +33,7 @@ import { Button } from '../Buttons/index.js';
33
33
  * >
34
34
  * <Stack gap="md">
35
35
  * <Text>Are you sure you want to perform this action?</Text>
36
- * <Inline justify="flex-end" gap="sm">
36
+ * <Inline justify="flex-start" gap="sm">
37
37
  * <Button variant="outline">Cancel</Button>
38
38
  * <Button variant="primary">Confirm</Button>
39
39
  * </Inline>
@@ -56,6 +56,6 @@ export const ConfirmationModal = forwardRef(({ confirmLabel = 'Confirm', cancelL
56
56
  onClose();
57
57
  }
58
58
  };
59
- return (_jsx(Modal, { ref: ref, onClose: onClose, ...props, children: _jsxs(Stack, { gap: "md", children: [children, _jsxs(Inline, { justify: "flex-end", gap: "sm", children: [_jsx(Button, { variant: "outline", onClick: handleCancel, children: cancelLabel }), _jsx(Button, { variant: confirmVariant, onClick: handleConfirm, loading: confirmLoading, children: confirmLabel })] })] }) }));
59
+ return (_jsx(Modal, { ref: ref, onClose: onClose, ...props, children: _jsxs(Stack, { gap: "md", children: [children, _jsxs(Inline, { justify: "flex-start", gap: "sm", children: [_jsx(Button, { variant: "outline", onClick: handleCancel, children: cancelLabel }), _jsx(Button, { variant: confirmVariant, onClick: handleConfirm, loading: confirmLoading, children: confirmLabel })] })] }) }));
60
60
  });
61
61
  ConfirmationModal.displayName = 'ConfirmationModal';
@@ -45,7 +45,7 @@ export interface DSModalProps extends Omit<MantineModalProps, 'title'> {
45
45
  * >
46
46
  * <Stack gap="md">
47
47
  * <Text>Are you sure you want to perform this action?</Text>
48
- * <Inline justify="flex-end" gap="sm">
48
+ * <Inline justify="flex-start" gap="sm">
49
49
  * <Button variant="outline">Cancel</Button>
50
50
  * <Button variant="primary">Confirm</Button>
51
51
  * </Inline>
@@ -142,7 +142,7 @@ export const ConfirmationModal = forwardRef<HTMLDivElement, ConfirmationModalPro
142
142
  >
143
143
  <Stack gap="md">
144
144
  {children}
145
- <Inline justify="flex-end" gap="sm">
145
+ <Inline justify="flex-start" gap="sm">
146
146
  <Button variant="outline" onClick={handleCancel}>
147
147
  {cancelLabel}
148
148
  </Button>
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.21",
2
+ "version": "0.0.23",
3
3
  "contracts": [
4
4
  {
5
5
  "id": "Alert",
@@ -706,10 +706,52 @@
706
706
  --ad-action-default-border: #424242;
707
707
  }
708
708
 
709
- /* Mantine semantic aliases — map Mantine CSS vars onto AppDirect tokens */
709
+ /* Mantine semantic aliases — parity with micro-ui-ts global.css (:root / :host block) */
710
+ :root,
711
+ :host {
712
+ --mantine-color-scheme: light dark;
713
+ --mantine-font-family:
714
+ "Inter", sans-serif, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial,
715
+ sans-serif, Apple Color Emoji, Segoe UI Emoji;
716
+ --mantine-radius-default: calc(0.25rem * var(--mantine-scale));
717
+ --mantine-color-blue-0: var(--ad-open-color-blue-0, #e9f4ff);
718
+ --mantine-color-blue-1: var(--ad-open-color-blue-1, #d5e3fb);
719
+ --mantine-color-blue-2: var(--ad-open-color-blue-2, #abc5f0);
720
+ --mantine-color-blue-3: var(--ad-open-color-blue-3, #7ea4e6);
721
+ --mantine-color-blue-4: var(--ad-open-color-blue-4, #5889dd);
722
+ --mantine-color-blue-5: var(--ad-open-color-blue-5, #4078d8);
723
+ --mantine-color-blue-6: var(--ad-open-color-blue-6, #326fde);
724
+ --mantine-color-blue-7: var(--ad-open-color-blue-7, #235ebf);
725
+ --mantine-color-blue-8: var(--ad-open-color-blue-8, #1953ac);
726
+ --mantine-color-blue-9: var(--ad-open-color-blue-9, #024899);
727
+ }
728
+
710
729
  :root,
711
730
  :root[data-mantine-color-scheme="light"],
712
731
  :root[data-mantine-color-scheme="dark"],
732
+ :host([data-mantine-color-scheme="light"]),
733
+ :host([data-mantine-color-scheme="dark"]),
713
734
  [data-theme="dark"] {
714
- --mantine-color-dimmed: var(--ad-color-text-dimmed, var(--mantine-color-gray-6));
735
+ --mantine-color-dimmed: var(--ad-color-text-dimmed, #495057);
736
+ }
737
+
738
+ :root[data-mantine-color-scheme="light"],
739
+ :host([data-mantine-color-scheme="light"]) {
740
+ --mantine-color-text: var(--ad-color-text-default, #000);
741
+ --mantine-color-body: var(--ad-color-bg-default, #fff);
742
+ --mantine-color-error: var(--ad-color-status-error, #fa5252);
743
+ --mantine-color-success: var(--ad-color-status-success, var(--mantine-color-green-6));
744
+ /* micro-ui a11y: darker than --ad-color-text-placeholder for light-mode contrast */
745
+ --mantine-color-placeholder: #767676;
746
+ --mantine-color-anchor: var(--ad-color-text-link, #326fde);
747
+ --mantine-color-blue-filled: var(--ad-color-brand-primary, var(--mantine-color-blue-6));
748
+ --mantine-color-blue-filled-hover: var(--ad-color-brand-primary-hover, var(--mantine-color-blue-7));
749
+ }
750
+
751
+ :root[data-mantine-color-scheme="dark"],
752
+ :host([data-mantine-color-scheme="dark"]) {
753
+ --mantine-color-success: var(--ad-color-status-success, var(--mantine-color-green-8));
754
+ --mantine-color-anchor: var(--ad-color-text-link, var(--mantine-color-blue-4));
755
+ --mantine-color-blue-filled: var(--ad-color-brand-primary, var(--mantine-color-blue-8));
756
+ --mantine-color-blue-filled-hover: var(--ad-color-brand-primary-hover, var(--mantine-color-blue-9));
715
757
  }