@pingux/astro 2.242.0-alpha.0 → 2.243.0-alpha.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.
Files changed (35) hide show
  1. package/lib/cjs/components/CodeView/CodeView.js +8 -4
  2. package/lib/cjs/components/CopyText/CopyButton.js +2 -7
  3. package/lib/cjs/components/CopyText/CopyText.js +10 -3
  4. package/lib/cjs/components/MultivaluesField/BadgeLabelTooltip.d.ts +3 -0
  5. package/lib/cjs/components/MultivaluesField/BadgeLabelTooltip.js +3 -3
  6. package/lib/cjs/components/MultivaluesField/CondensedMultivaluesField.d.ts +4 -0
  7. package/lib/cjs/components/MultivaluesField/CondensedMultivaluesField.js +24 -132
  8. package/lib/cjs/components/MultivaluesField/DefaultMultivaluesField.d.ts +4 -0
  9. package/lib/cjs/components/MultivaluesField/DefaultMultivaluesField.js +33 -139
  10. package/lib/cjs/components/MultivaluesField/MultivaluesField.d.ts +4 -0
  11. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +6 -104
  12. package/lib/cjs/components/MultivaluesField/index.d.ts +1 -0
  13. package/lib/cjs/components/RadioGroupField/RadioGroupField.js +1 -1
  14. package/lib/cjs/styles/themes/next-gen/codeView/codeView.d.ts +6 -42
  15. package/lib/cjs/styles/themes/next-gen/codeView/codeView.js +2 -14
  16. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +10 -70
  17. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +2 -14
  18. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +4 -28
  19. package/lib/cjs/types/MultivaluesField.d.ts +212 -0
  20. package/lib/cjs/types/MultivaluesField.js +5 -0
  21. package/lib/cjs/types/copyText.d.ts +1 -0
  22. package/lib/cjs/types/index.d.ts +1 -0
  23. package/lib/cjs/types/index.js +11 -0
  24. package/lib/components/CodeView/CodeView.js +8 -4
  25. package/lib/components/CopyText/CopyButton.js +2 -7
  26. package/lib/components/CopyText/CopyText.js +10 -3
  27. package/lib/components/MultivaluesField/BadgeLabelTooltip.js +3 -3
  28. package/lib/components/MultivaluesField/CondensedMultivaluesField.js +24 -132
  29. package/lib/components/MultivaluesField/DefaultMultivaluesField.js +33 -139
  30. package/lib/components/MultivaluesField/MultivaluesField.js +7 -105
  31. package/lib/components/RadioGroupField/RadioGroupField.js +1 -1
  32. package/lib/styles/themes/next-gen/codeView/codeView.js +2 -14
  33. package/lib/types/MultivaluesField.js +1 -0
  34. package/lib/types/index.js +1 -0
  35. package/package.json +1 -1
@@ -1155,23 +1155,11 @@ declare const buttons: {
1155
1155
  alignSelf: string;
1156
1156
  };
1157
1157
  copyButton: {
1158
+ mx: string;
1158
1159
  path: {
1159
1160
  fill: string;
1160
1161
  };
1161
- default: {
1162
- mx: string;
1163
- path: {
1164
- fill: string;
1165
- };
1166
- border: string;
1167
- };
1168
- light: {
1169
- mx: string;
1170
- path: {
1171
- fill: string;
1172
- };
1173
- border: string;
1174
- };
1162
+ border: string;
1175
1163
  };
1176
1164
  deleteAttachment: {
1177
1165
  backgroundColor: string;
@@ -493,23 +493,11 @@ declare const _default: {
493
493
  lineHeight: string;
494
494
  };
495
495
  copyButton: {
496
+ mx: string;
496
497
  path: {
497
498
  fill: string;
498
499
  };
499
- default: {
500
- mx: string;
501
- path: {
502
- fill: string;
503
- };
504
- border: string;
505
- };
506
- light: {
507
- mx: string;
508
- path: {
509
- fill: string;
510
- };
511
- border: string;
512
- };
500
+ border: string;
513
501
  };
514
502
  };
515
503
  light: {
@@ -627,23 +615,11 @@ declare const _default: {
627
615
  backgroundColor: string;
628
616
  };
629
617
  copyButton: {
618
+ mx: string;
630
619
  path: {
631
620
  fill: string;
632
621
  };
633
- default: {
634
- mx: string;
635
- path: {
636
- fill: string;
637
- };
638
- border: string;
639
- };
640
- light: {
641
- mx: string;
642
- path: {
643
- fill: string;
644
- };
645
- border: string;
646
- };
622
+ border: string;
647
623
  };
648
624
  };
649
625
  };
@@ -0,0 +1,212 @@
1
+ import { MutableRefObject, ReactNode } from 'react';
2
+ import type { Key, Node, PressEvent } from '@react-types/shared';
3
+ import { Status } from './item';
4
+ import { ScrollBoxProps } from './scrollBox';
5
+ import { Axis, loadingState } from './shared';
6
+ import { TextProps } from './text';
7
+ /** A selected value rendered as a badge, with optional sections in condensed mode. */
8
+ export interface MultivaluesFieldItem {
9
+ /** A unique identifier for the item. */
10
+ id?: string | number;
11
+ /** The key of the item. */
12
+ key?: Key;
13
+ /** The rendered label for the item. */
14
+ name?: string;
15
+ /** Props object that is spread directly into the Badge element. */
16
+ badgeProps?: {
17
+ textProps?: TextProps;
18
+ } & Record<string, unknown>;
19
+ /** Props object that is spread directly into the delete IconButton element. */
20
+ buttonProps?: Record<string, unknown>;
21
+ /** Props object that is spread directly into the Badge slots. */
22
+ slots?: {
23
+ leftIcon?: ReactNode;
24
+ };
25
+ /** Child items, when the item is a section (condensed mode). */
26
+ children?: MultivaluesFieldItem[];
27
+ }
28
+ /**
29
+ * Shared field/menu props for both MultivaluesField modes. Consumers should use
30
+ * `CondensedMultivaluesFieldProps`, `DefaultMultivaluesFieldProps`, or the
31
+ * dispatcher type `MultivaluesFieldProps` rather than this interface directly.
32
+ */
33
+ interface MultivaluesFieldBaseProps {
34
+ /** Identifies the element (or elements) whose contents or presence
35
+ * are controlled by the current element. */
36
+ 'aria-controls'?: string;
37
+ /** Identifies the element (or elements) that describes the object. */
38
+ 'aria-describedby'?: string;
39
+ /** Identifies the element (or elements) that provide a detailed, extended description
40
+ * for the object. */
41
+ 'aria-details'?: string;
42
+ /** Identifies the element that provides an error message for the object. */
43
+ 'aria-errormessage'?: string;
44
+ /** Defines a string value that labels the current element. */
45
+ 'aria-label'?: string;
46
+ /** Identifies the element (or elements) that labels the current element. */
47
+ 'aria-labelledby'?: string;
48
+ /** Props object spread into the outer-most container. Wrapper and label will be children. */
49
+ containerProps?: Record<string, unknown>;
50
+ /** The initial selected keys in the collection (uncontrolled). */
51
+ defaultSelectedKeys?: Iterable<Key>;
52
+ /** Where the menu opens relative to its trigger. */
53
+ direction?: Axis;
54
+ /**
55
+ * The item keys that are disabled. These items cannot be selected.
56
+ */
57
+ disabledKeys?: Key[];
58
+ /** A function that filters the items in the collection. If undefined, the
59
+ * component's default filtering is used. */
60
+ filter?: (nodes: Iterable<Node<object>>) => Iterable<Node<object>>;
61
+ /** Whether the element should receive focus on render. */
62
+ hasAutoFocus?: boolean;
63
+ /** Whether the field has a status indicator. */
64
+ hasNoStatusIndicator?: boolean;
65
+ /** Text rendered below the input. */
66
+ helperText?: ReactNode;
67
+ /**
68
+ * Props that get passed as-is to the underlying TextField element
69
+ */
70
+ inputProps?: Record<string, unknown>;
71
+ /** Whether the input is disabled. */
72
+ isDisabled?: boolean;
73
+ /**
74
+ * Whether the menu is prevented from flipping directions when insufficient space is
75
+ * available for the given `direction` placement.
76
+ */
77
+ isNotFlippable?: boolean;
78
+ /** Whether the input can be selected but not changed by the user. */
79
+ isReadOnly?: boolean;
80
+ /** Whether user input is required on the input before form submission. */
81
+ isRequired?: boolean;
82
+ /** The list of items.
83
+ *
84
+ * **Note:** Every item needs to have key and name properties.
85
+ */
86
+ items?: MultivaluesFieldItem[];
87
+ /** The rendered label for the field. */
88
+ label?: ReactNode;
89
+ /** The contents of the collection. Supports item render props (as children). */
90
+ children?: ReactNode | ((item: MultivaluesFieldItem) => ReactNode);
91
+ /** Whether the component allows to create new values or only choose from the selection list */
92
+ mode?: 'restrictive' | 'non-restrictive' | 'condensed';
93
+ /** Whether the items are currently loading. */
94
+ loadingState?: loadingState;
95
+ /**
96
+ * Handler that is called when the element loses focus.
97
+ */
98
+ onBlur?: (e: FocusEvent) => void;
99
+ /**
100
+ * Handler that is called when the element receives focus.
101
+ */
102
+ onFocus?: (e: FocusEvent) => void;
103
+ /**
104
+ * Handler that is called when the input value changes.
105
+ */
106
+ onInputChange?: (value: string) => void;
107
+ /**
108
+ * Handler that is called when a key is pressed.
109
+ */
110
+ onKeyDown?: (e: KeyboardEvent) => void;
111
+ /**
112
+ * Handler that is called when a key is released.
113
+ */
114
+ onKeyUp?: (e: KeyboardEvent) => void;
115
+ /**
116
+ * Handler that is called when more items should be loaded, e.g. while scrolling near the bottom.
117
+ */
118
+ onLoadMore?: () => unknown;
119
+ /**
120
+ * Handler that is called when more items should be loaded, e.g. while scrolling near the top.
121
+ */
122
+ onLoadPrev?: () => unknown;
123
+ /**
124
+ * Method that is called when the open state of the menu changes.
125
+ */
126
+ onOpenChange?: (isOpen: boolean) => void;
127
+ /**
128
+ * Handler that is called when the selection changes.
129
+ */
130
+ onSelectionChange?: (keys: Iterable<Key>) => unknown;
131
+ /** Temporary text that occupies the text input when it is empty. */
132
+ placeholder?: string;
133
+ /** Props object that is spread directly into the input element. Will be a child
134
+ * of the Wrapper. */
135
+ controlProps?: Record<string, unknown>;
136
+ /** Props object spread to the field control wrapper, i.e. the immediate parent
137
+ * element for the control, sibling of the label, and child of the field container. */
138
+ controlWrapperProps?: Record<string, unknown>;
139
+ /** Props object spread to the field label, i.e. the visible text which labels the control. */
140
+ labelProps?: Record<string, unknown>;
141
+ /** The currently selected keys in the collection (controlled). */
142
+ selectedKeys?: Iterable<Key>;
143
+ /** @ignore Props object that is spread directly into the ScrollBox element. */
144
+ scrollBoxProps?: ScrollBoxProps;
145
+ /** Determines any status related styling. */
146
+ status?: Status;
147
+ }
148
+ /** Props for the MultivaluesField in `condensed` mode. */
149
+ export interface CondensedMultivaluesFieldProps extends MultivaluesFieldBaseProps {
150
+ /** Whether the component allows to create new values or only choose from the selection list */
151
+ mode?: 'condensed';
152
+ /** Whether the field has the select all button. */
153
+ hasNoSelectAll?: boolean;
154
+ /** Whether filtering of the options list is disabled. */
155
+ isFilteringDisabled?: boolean;
156
+ /** Text describing the currently selected options in place of the default count. */
157
+ selectedOptionText?: string;
158
+ }
159
+ /** Props for the MultivaluesField in `restrictive` or `non-restrictive` mode. */
160
+ export interface DefaultMultivaluesFieldProps extends MultivaluesFieldBaseProps {
161
+ /** Whether the component allows to create new values or only choose from the selection list */
162
+ mode?: 'restrictive' | 'non-restrictive';
163
+ /** Whether filtering of the options list is disabled. */
164
+ isFilteringDisabled?: boolean;
165
+ /**
166
+ * The item keys that are readonly. These items cannot be changed or selected.
167
+ */
168
+ readOnlyKeys?: string[];
169
+ /** Props object spread into the outer-most container. */
170
+ multivaluesProps?: Record<string, unknown>;
171
+ }
172
+ /**
173
+ * Mode-specific props that either mode may accept. The original dispatcher's
174
+ * PropTypes declared all of these on the parent component, so the dispatcher
175
+ * type exposes them as optional members regardless of the active `mode`.
176
+ */
177
+ interface MultivaluesFieldModeProps {
178
+ /** Whether the field has the select all button (condensed mode). */
179
+ hasNoSelectAll?: boolean;
180
+ /** Whether filtering of the options list is disabled. */
181
+ isFilteringDisabled?: boolean;
182
+ /** Text describing the currently selected options in place of the default count. */
183
+ selectedOptionText?: string;
184
+ /** The item keys that are readonly. These items cannot be changed or selected. */
185
+ readOnlyKeys?: string[];
186
+ /** Props object spread into the outer-most container (default mode). */
187
+ multivaluesProps?: Record<string, unknown>;
188
+ }
189
+ /**
190
+ * Props for the MultivaluesField dispatcher. Accepts the props of either mode.
191
+ *
192
+ * Note: this deliberately avoids `Omit`/intersection-based composition.
193
+ * react-docgen (used by Storybook to extract the props table) only resolves
194
+ * plain interface inheritance; an unresolved extends clause or an intersection
195
+ * type silently produces an empty props table in the docs.
196
+ */
197
+ export interface MultivaluesFieldProps extends MultivaluesFieldBaseProps, MultivaluesFieldModeProps {
198
+ }
199
+ /** Props for the badge rendered for each selected item in the default mode. */
200
+ export interface BadgeLabelTooltipProps {
201
+ /** The selected item to render as a badge. */
202
+ item: MultivaluesFieldItem;
203
+ /** The index of the badge in the selected items list. */
204
+ index: number;
205
+ /**
206
+ * Handler that is called when the badge's delete button is pressed.
207
+ */
208
+ deleteItem: (key: Key, e: PressEvent) => void;
209
+ /** Refs to the badge delete buttons, used to manage focus when badges are removed. */
210
+ closeBadgeRefs: MutableRefObject<(HTMLDivElement | HTMLButtonElement | null)[]>;
211
+ }
212
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -20,6 +20,7 @@ export interface CopyTextProps extends HoverProps, TestingAttributes {
20
20
  tooltipProps?: TooltipTriggerProps;
21
21
  wrapperProps?: TooltipWrapperProps;
22
22
  iconButtonProps?: Omit<IconButtonProps, 'onPress'>;
23
+ iconProps?: IconProps;
23
24
  }
24
25
  export interface CopyButtonProps extends IconButtonProps {
25
26
  iconProps?: IconProps;
@@ -53,6 +53,7 @@ export * from './menuItem';
53
53
  export * from './menuSection';
54
54
  export * from './messages';
55
55
  export * from './Modal';
56
+ export * from './MultivaluesField';
56
57
  export * from './navBar';
57
58
  export * from './navSideBar';
58
59
  export * from './numberField';
@@ -608,6 +608,17 @@ Object.keys(_Modal).forEach(function (key) {
608
608
  }
609
609
  });
610
610
  });
611
+ var _MultivaluesField = require("./MultivaluesField");
612
+ Object.keys(_MultivaluesField).forEach(function (key) {
613
+ if (key === "default" || key === "__esModule") return;
614
+ if (key in exports && exports[key] === _MultivaluesField[key]) return;
615
+ Object.defineProperty(exports, key, {
616
+ enumerable: true,
617
+ get: function () {
618
+ return _MultivaluesField[key];
619
+ }
620
+ });
621
+ });
611
622
  var _navBar = require("./navBar");
612
623
  Object.keys(_navBar).forEach(function (key) {
613
624
  if (key === "default" || key === "__esModule") return;
@@ -137,10 +137,14 @@ const CodeView = /*#__PURE__*/forwardRef((props, ref) => {
137
137
  ref: ref,
138
138
  mode: "rightText",
139
139
  textToCopy: textToCopy || children,
140
- iconButtonProps: {
141
- ...iconButtonProps,
142
- variant
143
- }
140
+ iconProps: {
141
+ sx: {
142
+ '&& path': {
143
+ fill: variant === 'light' ? 'black' : 'white'
144
+ }
145
+ }
146
+ },
147
+ iconButtonProps: iconButtonProps
144
148
  })), content);
145
149
  }
146
150
  if (hasNoCopyButton) {
@@ -6,22 +6,17 @@ import Icon from '../Icon';
6
6
  import IconButton from '../IconButton';
7
7
  import { jsx as ___EmotionJSX } from "@emotion/react";
8
8
  const CopyButton = /*#__PURE__*/forwardRef((props, ref) => {
9
- /* istanbul ignore next */
10
9
  const {
11
10
  iconProps,
12
- variant = 'default',
13
11
  ...others
14
12
  } = props;
15
13
  const {
16
- copyButtonSize,
17
- themeState
14
+ copyButtonSize
18
15
  } = useGetTheme();
19
- /* istanbul ignore next */
20
- const themeVariant = themeState.isOnyx ? `copyButton.${variant}` : 'copyButton';
21
16
  return ___EmotionJSX(IconButton, _extends({
22
17
  ref: ref,
23
18
  "aria-label": "copy to clipboard",
24
- variant: themeVariant
19
+ variant: "copyButton"
25
20
  }, others), ___EmotionJSX(Icon, _extends({
26
21
  icon: ContentCopy,
27
22
  size: copyButtonSize,
@@ -25,6 +25,7 @@ const CopyText = /*#__PURE__*/forwardRef((props, ref) => {
25
25
  tooltipProps,
26
26
  wrapperProps,
27
27
  iconButtonProps,
28
+ iconProps,
28
29
  ...others
29
30
  } = props;
30
31
  const value = textToCopy || (mode === 'link' ? children?.props?.href : children.props?.children);
@@ -105,7 +106,9 @@ const CopyText = /*#__PURE__*/forwardRef((props, ref) => {
105
106
  role: "presentation"
106
107
  }), content, ___EmotionJSX(CopyButton, _extends({
107
108
  onPress: copyToClipboard
108
- }, focusProps, iconButtonProps))));
109
+ }, focusProps, {
110
+ iconProps: iconProps
111
+ }, iconButtonProps))));
109
112
  }
110
113
  if (mode === 'link') {
111
114
  return ___EmotionJSX(Box, _extends({
@@ -118,7 +121,9 @@ const CopyText = /*#__PURE__*/forwardRef((props, ref) => {
118
121
  tooltip: tooltip
119
122
  }, tooltipProps), ___EmotionJSX(CopyButton, _extends({
120
123
  onPress: copyToClipboard
121
- }, mergeProps(hoverProps, focusProps, iconButtonProps)))));
124
+ }, mergeProps(hoverProps, focusProps, iconButtonProps), {
125
+ iconProps: iconProps
126
+ }))));
122
127
  }
123
128
  return ___EmotionJSX(TooltipWrapper, _extends({
124
129
  isOpen: isTooltipOpen,
@@ -140,7 +145,9 @@ const CopyText = /*#__PURE__*/forwardRef((props, ref) => {
140
145
  gap: "sm"
141
146
  }), mode !== 'rightText' && content, ___EmotionJSX(CopyButton, _extends({
142
147
  onPress: copyToClipboard
143
- }, focusProps, iconButtonProps)), mode === 'rightText' && content)));
148
+ }, focusProps, {
149
+ iconProps: iconProps
150
+ }, iconButtonProps)), mode === 'rightText' && content)));
144
151
  });
145
152
  CopyText.defaultProps = {
146
153
  mode: 'text',
@@ -13,13 +13,13 @@ const BadgeLabelTooltip = ({
13
13
  deleteItem,
14
14
  closeBadgeRefs
15
15
  }) => {
16
- const isLong = item.name.length > BADGE_TOOLTIP_CHAR_THRESHOLD;
16
+ const isLong = (item.name || '').length > BADGE_TOOLTIP_CHAR_THRESHOLD;
17
17
  const {
18
18
  hoverProps,
19
19
  isHovered
20
20
  } = useHover({});
21
21
  const textProps = mergeProps(item.badgeProps?.textProps || {}, hoverProps);
22
- const badgeRef = useRef();
22
+ const badgeRef = useRef(null);
23
23
  return ___EmotionJSX(Box, {
24
24
  as: "li"
25
25
  }, ___EmotionJSX(TooltipTrigger, {
@@ -39,7 +39,7 @@ const BadgeLabelTooltip = ({
39
39
  }), ___EmotionJSX(IconButton, _extends({
40
40
  "aria-label": `delete ${item.name}`,
41
41
  "data-item": item.name,
42
- onPress: e => deleteItem(item.key, e),
42
+ onPress: e => item.key !== undefined && deleteItem(item.key, e),
43
43
  ref: el => closeBadgeRefs.current[index] = el // eslint-disable-line
44
44
  ,
45
45
  variant: "badge.deleteButton",