@cognite/aura 1.47805.0 → 1.47905.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.
@@ -47,11 +47,18 @@ function isSelectionHidden(selectedCount) {
47
47
  }
48
48
  function playToolbarMotion(node, keyframes, duration) {
49
49
  if (typeof node.animate !== 'function') return null;
50
- return node.animate(keyframes, {
50
+ const animation = node.animate(keyframes, {
51
51
  duration,
52
52
  easing: 'linear',
53
53
  fill: 'forwards'
54
54
  });
55
+ // Cancelling (e.g. on rapid selection toggles or unmount) rejects `finished`
56
+ // with an AbortError; that's expected here, so swallow only that.
57
+ animation.finished.catch((error)=>{
58
+ if (error instanceof DOMException && error.name === 'AbortError') return;
59
+ throw error;
60
+ });
61
+ return animation;
55
62
  }
56
63
  function startToolbarMotion(node, hidden, motionRef, exitTimerRef, onExit) {
57
64
  motionRef.current?.cancel();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/ui/core/action-toolbar/action-toolbar-motion.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nconst TOOLBAR_ENTER_MS = 420;\nconst TOOLBAR_EXIT_MS = 560;\nconst TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS = 640;\nconst TOOLBAR_DRIFT_OFFSET = '0.75rem';\nconst TOOLBAR_TRAVEL_OFFSET = '3.5rem';\nconst TOOLBAR_EXIT_FADE_START = 0.4;\nconst TOOLBAR_ENTER_SETTLE_START = 0.6;\n\nconst TOOLBAR_ENTER_KEYFRAMES: Keyframe[] = [\n { transform: `translateY(${TOOLBAR_TRAVEL_OFFSET})`, opacity: 0 },\n {\n transform: `translateY(${TOOLBAR_DRIFT_OFFSET})`,\n opacity: 1,\n offset: TOOLBAR_ENTER_SETTLE_START,\n },\n { transform: 'translateY(0)', opacity: 1 },\n];\n\nconst TOOLBAR_EXIT_KEYFRAMES: Keyframe[] = [\n { transform: 'translateY(0)', opacity: 1 },\n // Drift down while the toolbar is still fully visible.\n // Fade only after that, while the rest of the travel finishes.\n {\n transform: `translateY(${TOOLBAR_DRIFT_OFFSET})`,\n opacity: 1,\n offset: TOOLBAR_EXIT_FADE_START,\n },\n { transform: `translateY(${TOOLBAR_TRAVEL_OFFSET})`, opacity: 0 },\n];\n\ntype ActionToolbarPresence = {\n mounted: boolean;\n selectedCount: number | undefined;\n bindMotion: (node: HTMLDivElement | null) => void;\n};\n\nfunction prefersReducedMotion(): boolean {\n if (typeof window === 'undefined') return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nfunction isSelectionHidden(selectedCount: number | undefined): boolean {\n return typeof selectedCount === 'number' && selectedCount === 0;\n}\n\nfunction playToolbarMotion(\n node: HTMLDivElement,\n keyframes: Keyframe[],\n duration: number\n): Animation | null {\n if (typeof node.animate !== 'function') return null;\n return node.animate(keyframes, {\n duration,\n easing: 'linear',\n fill: 'forwards',\n });\n}\n\nfunction startToolbarMotion(\n node: HTMLDivElement,\n hidden: boolean,\n motionRef: { current: Animation | null },\n exitTimerRef: { current: number },\n onExit: () => void\n): () => void {\n motionRef.current?.cancel();\n\n if (!hidden) {\n motionRef.current = playToolbarMotion(\n node,\n TOOLBAR_ENTER_KEYFRAMES,\n TOOLBAR_ENTER_MS\n );\n return () => {\n motionRef.current?.cancel();\n };\n }\n\n const animation = playToolbarMotion(\n node,\n TOOLBAR_EXIT_KEYFRAMES,\n TOOLBAR_EXIT_MS\n );\n motionRef.current = animation;\n let finished = false;\n const finishExit = () => {\n if (finished) return;\n finished = true;\n window.clearTimeout(exitTimerRef.current);\n onExit();\n };\n // element.animate() reports completion through onfinish.\n // It does not dispatch animationend.\n if (animation) animation.onfinish = finishExit;\n exitTimerRef.current = window.setTimeout(\n finishExit,\n TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS\n );\n\n return () => {\n window.clearTimeout(exitTimerRef.current);\n motionRef.current?.cancel();\n };\n}\n\nfunction useActionToolbarPresence(\n selectedCount: number | undefined\n): ActionToolbarPresence {\n const hidden = isSelectionHidden(selectedCount);\n const reducedMotion = prefersReducedMotion();\n const [trackedHidden, setTrackedHidden] = useState(hidden);\n const [mounted, setMounted] = useState(!hidden);\n const [displayedCount, setDisplayedCount] = useState(selectedCount);\n const nodeRef = useRef<HTMLDivElement | null>(null);\n const motionRef = useRef<Animation | null>(null);\n const exitTimerRef = useRef(0);\n\n if (hidden !== trackedHidden) {\n setTrackedHidden(hidden);\n if (!hidden) {\n setMounted(true);\n if (typeof selectedCount === 'number') setDisplayedCount(selectedCount);\n } else if (!mounted || reducedMotion) {\n setMounted(false);\n }\n } else if (\n !hidden &&\n typeof selectedCount === 'number' &&\n selectedCount !== displayedCount\n ) {\n setDisplayedCount(selectedCount);\n }\n\n const bindMotion = useCallback((node: HTMLDivElement | null) => {\n nodeRef.current = node;\n }, []);\n\n useEffect(() => {\n if (reducedMotion || !mounted) return undefined;\n const node = nodeRef.current;\n if (!node) return undefined;\n\n return startToolbarMotion(node, hidden, motionRef, exitTimerRef, () => {\n setMounted(false);\n });\n }, [hidden, mounted, reducedMotion]);\n\n return {\n mounted,\n selectedCount: hidden ? displayedCount : selectedCount,\n bindMotion,\n };\n}\n\nexport { TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS, useActionToolbarPresence };\n"],"names":["useCallback","useEffect","useRef","useState","TOOLBAR_ENTER_MS","TOOLBAR_EXIT_MS","TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS","TOOLBAR_DRIFT_OFFSET","TOOLBAR_TRAVEL_OFFSET","TOOLBAR_EXIT_FADE_START","TOOLBAR_ENTER_SETTLE_START","TOOLBAR_ENTER_KEYFRAMES","transform","opacity","offset","TOOLBAR_EXIT_KEYFRAMES","prefersReducedMotion","window","matchMedia","matches","isSelectionHidden","selectedCount","playToolbarMotion","node","keyframes","duration","animate","easing","fill","startToolbarMotion","hidden","motionRef","exitTimerRef","onExit","current","cancel","animation","finished","finishExit","clearTimeout","onfinish","setTimeout","useActionToolbarPresence","reducedMotion","trackedHidden","setTrackedHidden","mounted","setMounted","displayedCount","setDisplayedCount","nodeRef","bindMotion","undefined"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEjE,MAAMC,mBAAmB;AACzB,MAAMC,kBAAkB;AACxB,MAAMC,mCAAmC;AACzC,MAAMC,uBAAuB;AAC7B,MAAMC,wBAAwB;AAC9B,MAAMC,0BAA0B;AAChC,MAAMC,6BAA6B;AAEnC,MAAMC,0BAAsC;IAC1C;QAAEC,WAAW,CAAC,WAAW,EAAEJ,sBAAsB,CAAC,CAAC;QAAEK,SAAS;IAAE;IAChE;QACED,WAAW,CAAC,WAAW,EAAEL,qBAAqB,CAAC,CAAC;QAChDM,SAAS;QACTC,QAAQJ;IACV;IACA;QAAEE,WAAW;QAAiBC,SAAS;IAAE;CAC1C;AAED,MAAME,yBAAqC;IACzC;QAAEH,WAAW;QAAiBC,SAAS;IAAE;IACzC,uDAAuD;IACvD,+DAA+D;IAC/D;QACED,WAAW,CAAC,WAAW,EAAEL,qBAAqB,CAAC,CAAC;QAChDM,SAAS;QACTC,QAAQL;IACV;IACA;QAAEG,WAAW,CAAC,WAAW,EAAEJ,sBAAsB,CAAC,CAAC;QAAEK,SAAS;IAAE;CACjE;AAQD,SAASG;IACP,IAAI,OAAOC,WAAW,aAAa,OAAO;IAC1C,OAAOA,OAAOC,UAAU,CAAC,oCAAoCC,OAAO;AACtE;AAEA,SAASC,kBAAkBC,aAAiC;IAC1D,OAAO,OAAOA,kBAAkB,YAAYA,kBAAkB;AAChE;AAEA,SAASC,kBACPC,IAAoB,EACpBC,SAAqB,EACrBC,QAAgB;IAEhB,IAAI,OAAOF,KAAKG,OAAO,KAAK,YAAY,OAAO;IAC/C,OAAOH,KAAKG,OAAO,CAACF,WAAW;QAC7BC;QACAE,QAAQ;QACRC,MAAM;IACR;AACF;AAEA,SAASC,mBACPN,IAAoB,EACpBO,MAAe,EACfC,SAAwC,EACxCC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AACuB;QAC9B2B,QAAQhB,OAAO,GAAGX;IACpB,GAAG,EAAE;IAELtB,UAAU;QACR,IAAI0C,iBAAiB,CAACG,SAAS,OAAOM;QACtC,MAAM7B,OAAO2B,QAAQhB,OAAO;QAC5B,IAAI,CAACX,MAAM,OAAO6B;QAElB,OAAOvB,mBAAmBN,MAAMO,QAAQC,WAAWC,cAAc;YAC/De,WAAW;QACb;IACF,GAAG;QAACjB;QAAQgB;QAASH;KAAc;IAEnC,OAAO;QACLG;QACAzB,eAAeS,SAASkB,iBAAiB3B;QACzC8B;IACF;AACF;AAEA,SAAS7C,gCAAgC,EAAEoC,wBAAwB,GAAG"}
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/action-toolbar/action-toolbar-motion.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nconst TOOLBAR_ENTER_MS = 420;\nconst TOOLBAR_EXIT_MS = 560;\nconst TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS = 640;\nconst TOOLBAR_DRIFT_OFFSET = '0.75rem';\nconst TOOLBAR_TRAVEL_OFFSET = '3.5rem';\nconst TOOLBAR_EXIT_FADE_START = 0.4;\nconst TOOLBAR_ENTER_SETTLE_START = 0.6;\n\nconst TOOLBAR_ENTER_KEYFRAMES: Keyframe[] = [\n { transform: `translateY(${TOOLBAR_TRAVEL_OFFSET})`, opacity: 0 },\n {\n transform: `translateY(${TOOLBAR_DRIFT_OFFSET})`,\n opacity: 1,\n offset: TOOLBAR_ENTER_SETTLE_START,\n },\n { transform: 'translateY(0)', opacity: 1 },\n];\n\nconst TOOLBAR_EXIT_KEYFRAMES: Keyframe[] = [\n { transform: 'translateY(0)', opacity: 1 },\n // Drift down while the toolbar is still fully visible.\n // Fade only after that, while the rest of the travel finishes.\n {\n transform: `translateY(${TOOLBAR_DRIFT_OFFSET})`,\n opacity: 1,\n offset: TOOLBAR_EXIT_FADE_START,\n },\n { transform: `translateY(${TOOLBAR_TRAVEL_OFFSET})`, opacity: 0 },\n];\n\ntype ActionToolbarPresence = {\n mounted: boolean;\n selectedCount: number | undefined;\n bindMotion: (node: HTMLDivElement | null) => void;\n};\n\nfunction prefersReducedMotion(): boolean {\n if (typeof window === 'undefined') return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nfunction isSelectionHidden(selectedCount: number | undefined): boolean {\n return typeof selectedCount === 'number' && selectedCount === 0;\n}\n\nfunction playToolbarMotion(\n node: HTMLDivElement,\n keyframes: Keyframe[],\n duration: number\n): Animation | null {\n if (typeof node.animate !== 'function') return null;\n const animation = node.animate(keyframes, {\n duration,\n easing: 'linear',\n fill: 'forwards',\n });\n // Cancelling (e.g. on rapid selection toggles or unmount) rejects `finished`\n // with an AbortError; that's expected here, so swallow only that.\n animation.finished.catch((error: unknown) => {\n if (error instanceof DOMException && error.name === 'AbortError') return;\n throw error;\n });\n return animation;\n}\n\nfunction startToolbarMotion(\n node: HTMLDivElement,\n hidden: boolean,\n motionRef: { current: Animation | null },\n exitTimerRef: { current: number },\n onExit: () => void\n): () => void {\n motionRef.current?.cancel();\n\n if (!hidden) {\n motionRef.current = playToolbarMotion(\n node,\n TOOLBAR_ENTER_KEYFRAMES,\n TOOLBAR_ENTER_MS\n );\n return () => {\n motionRef.current?.cancel();\n };\n }\n\n const animation = playToolbarMotion(\n node,\n TOOLBAR_EXIT_KEYFRAMES,\n TOOLBAR_EXIT_MS\n );\n motionRef.current = animation;\n let finished = false;\n const finishExit = () => {\n if (finished) return;\n finished = true;\n window.clearTimeout(exitTimerRef.current);\n onExit();\n };\n // element.animate() reports completion through onfinish.\n // It does not dispatch animationend.\n if (animation) animation.onfinish = finishExit;\n exitTimerRef.current = window.setTimeout(\n finishExit,\n TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS\n );\n\n return () => {\n window.clearTimeout(exitTimerRef.current);\n motionRef.current?.cancel();\n };\n}\n\nfunction useActionToolbarPresence(\n selectedCount: number | undefined\n): ActionToolbarPresence {\n const hidden = isSelectionHidden(selectedCount);\n const reducedMotion = prefersReducedMotion();\n const [trackedHidden, setTrackedHidden] = useState(hidden);\n const [mounted, setMounted] = useState(!hidden);\n const [displayedCount, setDisplayedCount] = useState(selectedCount);\n const nodeRef = useRef<HTMLDivElement | null>(null);\n const motionRef = useRef<Animation | null>(null);\n const exitTimerRef = useRef(0);\n\n if (hidden !== trackedHidden) {\n setTrackedHidden(hidden);\n if (!hidden) {\n setMounted(true);\n if (typeof selectedCount === 'number') setDisplayedCount(selectedCount);\n } else if (!mounted || reducedMotion) {\n setMounted(false);\n }\n } else if (\n !hidden &&\n typeof selectedCount === 'number' &&\n selectedCount !== displayedCount\n ) {\n setDisplayedCount(selectedCount);\n }\n\n const bindMotion = useCallback((node: HTMLDivElement | null) => {\n nodeRef.current = node;\n }, []);\n\n useEffect(() => {\n if (reducedMotion || !mounted) return undefined;\n const node = nodeRef.current;\n if (!node) return undefined;\n\n return startToolbarMotion(node, hidden, motionRef, exitTimerRef, () => {\n setMounted(false);\n });\n }, [hidden, mounted, reducedMotion]);\n\n return {\n mounted,\n selectedCount: hidden ? displayedCount : selectedCount,\n bindMotion,\n };\n}\n\nexport { TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS, useActionToolbarPresence };\n"],"names":["useCallback","useEffect","useRef","useState","TOOLBAR_ENTER_MS","TOOLBAR_EXIT_MS","TOOLBAR_EXIT_UNMOUNT_FALLBACK_MS","TOOLBAR_DRIFT_OFFSET","TOOLBAR_TRAVEL_OFFSET","TOOLBAR_EXIT_FADE_START","TOOLBAR_ENTER_SETTLE_START","TOOLBAR_ENTER_KEYFRAMES","transform","opacity","offset","TOOLBAR_EXIT_KEYFRAMES","prefersReducedMotion","window","matchMedia","matches","isSelectionHidden","selectedCount","playToolbarMotion","node","keyframes","duration","animate","animation","easing","fill","finished","catch","error","DOMException","name","startToolbarMotion","hidden","motionRef","exitTimerRef","onExit","current","cancel","finishExit","clearTimeout","onfinish","setTimeout","useActionToolbarPresence","reducedMotion","trackedHidden","setTr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,CAAC6B,WAAWH,eAAe;YACpCI,WAAW;QACb;IACF,OAAO,IACL,CAACf,UACD,OAAOf,kBAAkB,YACzBA,kBAAkB+B,gBAClB;QACAC,kBAAkBhC;IACpB;IAEA,MAAMkC,aAAavD,YAAY,CAACuB;QAC9B+B,QAAQd,OAAO,GAAGjB;IACpB,GAAG,EAAE;IAELtB,UAAU;QACR,IAAI8C,iBAAiB,CAACG,SAAS,OAAOM;QACtC,MAAMjC,OAAO+B,QAAQd,OAAO;QAC5B,IAAI,CAACjB,MAAM,OAAOiC;QAElB,OAAOrB,mBAAmBZ,MAAMa,QAAQC,WAAWC,cAAc;YAC/Da,WAAW;QACb;IACF,GAAG;QAACf;QAAQc;QAASH;KAAc;IAEnC,OAAO;QACLG;QACA7B,eAAee,SAASgB,iBAAiB/B;QACzCkC;IACF;AACF;AAEA,SAASjD,gCAAgC,EAAEwC,wBAAwB,GAAG"}
@@ -5,6 +5,11 @@ type SelectPropsBase = Omit<SelectPrimitive.Root.Props<string>, "open" | "defaul
5
5
  open?: boolean;
6
6
  defaultOpen?: boolean;
7
7
  onOpenChange?: (open: boolean) => void;
8
+ /**
9
+ * Shows a clear button in the trigger while the select has a value.
10
+ * Ignored when the select is required, disabled or read-only.
11
+ */
12
+ clearable?: boolean;
8
13
  };
9
14
  type SelectPropsSingle = SelectPropsBase & {
10
15
  multiple?: false;
@@ -27,6 +32,7 @@ declare function SelectValue({ icon, ...props }: SelectPrimitive.Value.Props & {
27
32
  declare const SelectTrigger: ForwardRefExoticComponent<Omit<SelectTriggerProps & {
28
33
  size?: "sm" | "default";
29
34
  errorMessage?: string;
35
+ clearLabel?: string;
30
36
  }, "ref"> & RefAttributes<HTMLButtonElement>>;
31
37
  declare function SelectContent({ className, children, position: _position, align, alignOffset, side, sideOffset, ...props }: SelectPrimitive.Popup.Props & {
32
38
  position?: "popper" | "item-aligned";
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { createContext, forwardRef, useContext, useId, useMemo } from "react";
3
3
  import { Select as SelectPrimitive } from "@base-ui/react/select";
4
- import { IconCheck, IconChevronDown, IconChevronUp, IconExclamationCircle } from "@tabler/icons-react";
4
+ import { IconCheck, IconChevronDown, IconChevronUp, IconCircleXFilled, IconExclamationCircle } from "@tabler/icons-react";
5
5
  import { usePortalContainer } from "../../../../lib/portal-container-context.js";
6
6
  import { useControllableState } from "../../../../lib/use-controllable-state.js";
7
7
  import { cn, formFieldOpenState, formFieldTriggerClasses, menuContainerPadding, menuItemPadding, menuSectionLabelClasses, menuSectionSeparatorClasses } from "../../../../lib/utils.js";
8
+ import { Button } from "../button/button.js";
8
9
  const SelectContext = /*#__PURE__*/ createContext(null);
9
10
  const useSelect = ()=>{
10
11
  const context = useContext(SelectContext);
@@ -19,42 +20,57 @@ function Select(props) {
19
20
  defaultProp: props.defaultOpen ?? false,
20
21
  onChange: props.onOpenChange
21
22
  });
23
+ const [value, setValue] = useControllableState({
24
+ prop: props.value,
25
+ defaultProp: props.defaultValue ?? (props.multiple ? [] : ''),
26
+ onChange: (nextValue)=>{
27
+ if (props.multiple) {
28
+ props.onValueChange?.(Array.isArray(nextValue) ? nextValue : []);
29
+ } else {
30
+ props.onValueChange?.(typeof nextValue === 'string' ? nextValue : '');
31
+ }
32
+ }
33
+ });
34
+ const hasValue = value.length > 0;
35
+ const canClear = props.clearable === true && hasValue && !props.required && !props.disabled && !props.readOnly;
36
+ const isMultiple = props.multiple === true;
22
37
  const selectContext = useMemo(()=>({
23
- isOpen: isOpen ?? false
38
+ isOpen: isOpen ?? false,
39
+ canClear,
40
+ clear: ()=>setValue(isMultiple ? [] : '')
24
41
  }), [
25
- isOpen
42
+ isOpen,
43
+ canClear,
44
+ isMultiple,
45
+ setValue
26
46
  ]);
27
47
  if (props.multiple) {
28
- const { multiple: _multiple, value, defaultValue, onValueChange, ...rest } = props;
48
+ const { multiple: _multiple, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, clearable: _clearable, ...rest } = props;
29
49
  return /*#__PURE__*/ _jsx(SelectContext.Provider, {
30
50
  value: selectContext,
31
51
  children: /*#__PURE__*/ _jsx(SelectPrimitive.Root, {
32
52
  "data-slot": "select",
33
53
  open: isOpen,
34
54
  onOpenChange: (nextOpen)=>setIsOpen(nextOpen),
35
- value: value,
36
- defaultValue: defaultValue,
55
+ value: Array.isArray(value) ? value : [],
37
56
  onValueChange: (nextValue, _details)=>{
38
- onValueChange?.(nextValue ?? []);
57
+ setValue(nextValue ?? []);
39
58
  },
40
59
  multiple: true,
41
60
  ...rest
42
61
  })
43
62
  });
44
63
  }
45
- const { value, defaultValue, onValueChange, ...rest } = props;
46
- const mappedValue = value === undefined ? undefined : value === '' ? null : value;
47
- const mappedDefaultValue = defaultValue === undefined ? undefined : defaultValue === '' ? null : defaultValue;
64
+ const { value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, clearable: _clearable, ...rest } = props;
48
65
  return /*#__PURE__*/ _jsx(SelectContext.Provider, {
49
66
  value: selectContext,
50
67
  children: /*#__PURE__*/ _jsx(SelectPrimitive.Root, {
51
68
  "data-slot": "select",
52
69
  open: isOpen,
53
70
  onOpenChange: (nextOpen)=>setIsOpen(nextOpen),
54
- value: mappedValue,
55
- defaultValue: mappedDefaultValue,
71
+ value: typeof value === 'string' && value !== '' ? value : null,
56
72
  onValueChange: (nextValue, _details)=>{
57
- onValueChange?.(typeof nextValue === 'string' ? nextValue : '');
73
+ setValue(typeof nextValue === 'string' ? nextValue : '');
58
74
  },
59
75
  ...rest
60
76
  })
@@ -87,10 +103,40 @@ function SelectValue({ icon, ...props }) {
87
103
  ...props
88
104
  });
89
105
  }
90
- const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, size = 'default', children, errorMessage, ...props }, ref)=>{
91
- const { isOpen } = useSelect();
106
+ const stopTriggerEvent = (event)=>{
107
+ event.stopPropagation();
108
+ };
109
+ function SelectClearButton({ label }) {
110
+ const { clear } = useSelect();
111
+ return /*#__PURE__*/ _jsx(Button, {
112
+ "data-slot": "select-clear",
113
+ variant: "ghost",
114
+ size: "icon-sm",
115
+ render: /*#__PURE__*/ _jsx("span", {}),
116
+ "aria-label": label,
117
+ className: "rounded-md",
118
+ onPointerDown: stopTriggerEvent,
119
+ onMouseDown: stopTriggerEvent,
120
+ onKeyDown: stopTriggerEvent,
121
+ onKeyUp: stopTriggerEvent,
122
+ onClick: (event)=>{
123
+ event.stopPropagation();
124
+ event.preventDefault();
125
+ const trigger = event.currentTarget.closest('[data-slot="select-trigger"]');
126
+ clear();
127
+ trigger?.focus();
128
+ },
129
+ children: /*#__PURE__*/ _jsx(IconCircleXFilled, {
130
+ className: "size-4 text-medium-foreground",
131
+ "aria-hidden": true
132
+ })
133
+ });
134
+ }
135
+ const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, size = 'default', children, errorMessage, clearLabel = 'Clear selection', ...props }, ref)=>{
136
+ const { isOpen, canClear } = useSelect();
92
137
  const isInvalid = !!errorMessage;
93
138
  const errorId = useId();
139
+ const showClear = canClear && !isOpen && !props.disabled;
94
140
  return /*#__PURE__*/ _jsxs(_Fragment, {
95
141
  children: [
96
142
  /*#__PURE__*/ _jsxs(SelectPrimitive.Trigger, {
@@ -103,6 +149,9 @@ const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, size = 'default', c
103
149
  ...props,
104
150
  children: [
105
151
  children,
152
+ showClear && /*#__PURE__*/ _jsx(SelectClearButton, {
153
+ label: clearLabel
154
+ }),
106
155
  /*#__PURE__*/ _jsx(SelectPrimitive.Icon, {
107
156
  render: /*#__PURE__*/ _jsx(IconChevronDown, {
108
157
  className: cn('size-4 opacity-50 transition-transform', isOpen ? 'rotate-180' : 'rotate-0')
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/ui/core/select/select.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentRef,\n type ReactNode,\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n} from 'react';\n\nimport type { SelectTriggerProps } from '@base-ui/react/select';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronUp,\n IconExclamationCircle,\n} from '@tabler/icons-react';\n\nimport { usePortalContainer } from '../../../../lib/portal-container-context';\nimport { useControllableState } from '../../../../lib/use-controllable-state';\nimport {\n cn,\n formFieldOpenState,\n formFieldTriggerClasses,\n menuContainerPadding,\n menuItemPadding,\n menuSectionLabelClasses,\n menuSectionSeparatorClasses,\n} from '../../../../lib/utils';\n\ntype SelectContextValue = {\n isOpen: boolean;\n};\n\nconst SelectContext = createContext<SelectContextValue | null>(null);\n\nconst useSelect = () => {\n const context = useContext(SelectContext);\n if (!context) {\n throw new Error('Select components must be used within Select');\n }\n return context;\n};\n\ntype SelectPropsBase = Omit<\n SelectPrimitive.Root.Props<string>,\n | 'open'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'multiple'\n> & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\ntype SelectPropsSingle = SelectPropsBase & {\n multiple?: false;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype SelectPropsMultiple = SelectPropsBase & {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\ntype SelectProps = SelectPropsSingle | SelectPropsMultiple;\n\nfunction Select(props: SelectPropsSingle): ReactNode;\nfunction Select(props: SelectPropsMultiple): ReactNode;\nfunction Select(props: SelectProps) {\n const [isOpen, setIsOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n const selectContext = useMemo(() => ({ isOpen: isOpen ?? false }), [isOpen]);\n\n if (props.multiple) {\n const {\n multiple: _multiple,\n value,\n defaultValue,\n onValueChange,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={value}\n defaultValue={defaultValue}\n onValueChange={(nextValue, _details) => {\n onValueChange?.(nextValue ?? []);\n }}\n multiple\n {...rest}\n />\n </SelectContext.Provider>\n );\n }\n\n const { value, defaultValue, onValueChange, ...rest } = props;\n\n const mappedValue =\n value === undefined ? undefined : value === '' ? null : value;\n const mappedDefaultValue =\n defaultValue === undefined\n ? undefined\n : defaultValue === ''\n ? null\n : defaultValue;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={mappedValue}\n defaultValue={mappedDefaultValue}\n onValueChange={(nextValue, _details) => {\n onValueChange?.(typeof nextValue === 'string' ? nextValue : '');\n }}\n {...rest}\n />\n </SelectContext.Provider>\n );\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: SelectPrimitive.Group.Props): ReactNode {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({\n icon,\n ...props\n}: SelectPrimitive.Value.Props & {\n icon?: ReactNode;\n}): ReactNode {\n if (icon) {\n return (\n <span className=\"flex flex-1 items-center gap-2 min-w-0 overflow-hidden\">\n {icon}\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n </span>\n );\n }\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n );\n}\n\nconst SelectTrigger: ForwardRefExoticComponent<\n Omit<\n SelectTriggerProps & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n },\n 'ref'\n > &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n }\n>(({ className, size = 'default', children, errorMessage, ...props }, ref) => {\n const { isOpen } = useSelect();\n const isInvalid = !!errorMessage;\n const errorId = useId();\n\n return (\n <>\n <SelectPrimitive.Trigger\n ref={ref}\n data-slot=\"select-trigger\"\n data-size={size}\n aria-invalid={isInvalid ? true : undefined}\n aria-describedby={isInvalid ? errorId : undefined}\n className={cn(\n 'min-w-50 max-w-[min(100%,420px)]',\n formFieldTriggerClasses,\n isOpen && formFieldOpenState,\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={\n <IconChevronDown\n className={cn(\n 'size-4 opacity-50 transition-transform',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n />\n }\n />\n </SelectPrimitive.Trigger>\n {errorMessage && (\n <div\n id={errorId}\n className=\"flex flex-row gap-1 justify-start items-center p-1\"\n >\n <IconExclamationCircle className=\"text-destructive-foreground text-sm size-4\" />\n <span className=\"text-destructive-foreground text-sm\">\n {errorMessage}\n </span>\n </div>\n )}\n </>\n );\n});\n\nSelectTrigger.displayName = 'SelectTrigger';\n\nfunction SelectContent({\n className,\n children,\n position: _position = 'popper',\n align = 'start',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: SelectPrimitive.Popup.Props & {\n position?: 'popper' | 'item-aligned';\n align?: SelectPrimitive.Positioner.Props['align'];\n alignOffset?: SelectPrimitive.Positioner.Props['alignOffset'];\n side?: SelectPrimitive.Positioner.Props['side'];\n sideOffset?: SelectPrimitive.Positioner.Props['sideOffset'];\n}): ReactNode {\n const container = usePortalContainer();\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={false}\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n collisionPadding={10}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover-background text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) max-w-[min(100%,420px)] min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-default shadow-md outline-none',\n menuContainerPadding,\n _position === 'popper' && 'data-[side=bottom]:translate-y-1',\n className\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props): ReactNode {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(menuSectionLabelClasses, className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n icon,\n suffix,\n ...props\n}: SelectPrimitive.Item.Props & {\n icon?: ReactNode;\n suffix?: ReactNode;\n}): ReactNode {\n const title = typeof children === 'string' ? children : undefined;\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-lg pr-8 text-sm leading-4.5 font-medium outline-hidden select-none focus:bg-popover-background-hover focus:text-popover-foreground data-[disabled]:pointer-events-none data-[disabled]:text-base-foreground-disabled data-[disabled]:opacity-100 data-[disabled]:[&_svg]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n menuItemPadding,\n className\n )}\n {...props}\n >\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <IconCheck className=\"size-4 text-popover-foreground\" />\n </span>\n }\n />\n {icon && <span className=\"flex items-center gap-2 mr-1\">{icon}</span>}\n <SelectPrimitive.ItemText\n className=\"flex-1 truncate min-w-0\"\n title={title}\n >\n {children}\n </SelectPrimitive.ItemText>\n {suffix && <span className=\"shrink-0 ml-auto\">{suffix}</span>}\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props): ReactNode {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n menuSectionSeparatorClasses,\n 'pointer-events-none',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: SelectPrimitive.ScrollUpArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 top-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: SelectPrimitive.ScrollDownArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"names":["createContext","forwardRef","useContext","useId","useMemo","Select","SelectPrimitive","IconCheck","IconChevronDown","IconChevronUp","IconExclamationCircle","usePortalContainer","useControllableState","cn","formFieldOpenState","formFieldTriggerClasses","menuContainerPadding","menuItemPadding","menuSectionLabelClasses","menuSectionSeparatorClasses","SelectContext","useSelect","context","Error","props","isOpen","setIsOpen","prop","open","defaultProp","defaultOpen","onChange","onOpenChange","selectContext","multiple","_multiple","value","defaultValue","onValueChange","rest","Provider","Root","data-slot","nextOpen","nextValue","_details","mappedValue","undefined","mappedDefaultValue","SelectGroup","className","Group","SelectValue","icon","span","Value","SelectTrigger","size","children","errorMessage","ref","isInvalid","errorId","Trigger","data-size","aria-invalid","aria-describedby","Icon","render","div","id","displayName","SelectContent","position","_position","align","alignOffset","side","sideOffset","container","Portal","Positioner","alignItemWithTrigger","collisionPadding","Popup","SelectScrollUpButton","List","SelectScrollDownButton","SelectLabel","GroupLabel","SelectItem","suffix","title","Item","ItemIndicator","ItemText","SelectSeparator","Separator","ScrollUpArrow","ScrollDownArrow"],"mappings":";AAAA,SAKEA,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,OAAO,QACF,QAAQ;AAGf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAClE,SACEC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,qBAAqB,QAChB,sBAAsB;AAE7B,SAASC,kBAAkB,QAAQ,8CAA2C;AAC9E,SAASC,oBAAoB,QAAQ,4CAAyC;AAC9E,SACEC,EAAE,EACFC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBC,2BAA2B,QACtB,2BAAwB;AAM/B,MAAMC,8BAAgBpB,cAAyC;AAE/D,MAAMqB,YAAY;IAChB,MAAMC,UAAUpB,WAAWkB;IAC3B,IAAI,CAACE,SAAS;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOD;AACT;AAmCA,SAASjB,OAAOmB,KAAkB;IAChC,MAAM,CAACC,QAAQC,UAAU,GAAGd,qBAAqB;QAC/Ce,MAAMH,MAAMI,IAAI;QAChBC,aAAaL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AS6D,qBAAqB,EAC5BnC,SAAS,EACT,GAAG1B,OACiC;IACpC,qBACE,KAAClB,gBAAgB4F,aAAa;QAC5BxD,aAAU;QACVQ,WAAWrC,GACT,gGACAqC;QAED,GAAG1B,KAAK;kBAET,cAAA,KAACf;YAAcyC,WAAU;;;AAG/B;AAEA,SAASqC,uBAAuB,EAC9BrC,SAAS,EACT,GAAG1B,OACmC;IACtC,qBACE,KAAClB,gBAAgB6F,eAAe;QAC9BzD,aAAU;QACVQ,WAAWrC,GACT,mGACAqC;QAED,GAAG1B,KAAK;kBAET,cAAA,KAAChB;YAAgB0C,WAAU;;;AAGjC;AAEA,SACE7C,MAAM,EACNmE,aAAa,EACbvB,WAAW,EACXyC,UAAU,EACVF,WAAW,EACXD,sBAAsB,EACtBF,oBAAoB,EACpBW,eAAe,EACfxC,aAAa,EACbJ,WAAW,GACX"}
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/select/select.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentRef,\n type ReactNode,\n type SyntheticEvent,\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n} from 'react';\n\nimport type { SelectTriggerProps } from '@base-ui/react/select';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronUp,\n IconCircleXFilled,\n IconExclamationCircle,\n} from '@tabler/icons-react';\n\nimport { usePortalContainer } from '../../../../lib/portal-container-context';\nimport { useControllableState } from '../../../../lib/use-controllable-state';\nimport {\n cn,\n formFieldOpenState,\n formFieldTriggerClasses,\n menuContainerPadding,\n menuItemPadding,\n menuSectionLabelClasses,\n menuSectionSeparatorClasses,\n} from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\ntype SelectContextValue = {\n isOpen: boolean;\n canClear: boolean;\n clear: () => void;\n};\n\nconst SelectContext = createContext<SelectContextValue | null>(null);\n\nconst useSelect = () => {\n const context = useContext(SelectContext);\n if (!context) {\n throw new Error('Select components must be used within Select');\n }\n return context;\n};\n\ntype SelectPropsBase = Omit<\n SelectPrimitive.Root.Props<string>,\n | 'open'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'multiple'\n> & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Shows a clear button in the trigger while the select has a value.\n * Ignored when the select is required, disabled or read-only.\n */\n clearable?: boolean;\n};\n\ntype SelectPropsSingle = SelectPropsBase & {\n multiple?: false;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype SelectPropsMultiple = SelectPropsBase & {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\ntype SelectProps = SelectPropsSingle | SelectPropsMultiple;\n\nfunction Select(props: SelectPropsSingle): ReactNode;\nfunction Select(props: SelectPropsMultiple): ReactNode;\nfunction Select(props: SelectProps) {\n const [isOpen, setIsOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n const [value, setValue] = useControllableState<string | string[]>({\n prop: props.value,\n defaultProp: props.defaultValue ?? (props.multiple ? [] : ''),\n onChange: (nextValue) => {\n if (props.multiple) {\n props.onValueChange?.(Array.isArray(nextValue) ? nextValue : []);\n } else {\n props.onValueChange?.(typeof nextValue === 'string' ? nextValue : '');\n }\n },\n });\n\n const hasValue = value.length > 0;\n const canClear =\n props.clearable === true &&\n hasValue &&\n !props.required &&\n !props.disabled &&\n !props.readOnly;\n const isMultiple = props.multiple === true;\n\n const selectContext = useMemo(\n () => ({\n isOpen: isOpen ?? false,\n canClear,\n clear: () => setValue(isMultiple ? [] : ''),\n }),\n [isOpen, canClear, isMultiple, setValue]\n );\n\n if (props.multiple) {\n const {\n multiple: _multiple,\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={Array.isArray(value) ? value : []}\n onValueChange={(nextValue, _details) => {\n setValue(nextValue ?? []);\n }}\n multiple\n {...rest}\n />\n </SelectContext.Provider>\n );\n }\n\n const {\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={typeof value === 'string' && value !== '' ? value : null}\n onValueChange={(nextValue, _details) => {\n setValue(typeof nextValue === 'string' ? nextValue : '');\n }}\n {...rest}\n />\n </SelectContext.Provider>\n );\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: SelectPrimitive.Group.Props): ReactNode {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({\n icon,\n ...props\n}: SelectPrimitive.Value.Props & {\n icon?: ReactNode;\n}): ReactNode {\n if (icon) {\n return (\n <span className=\"flex flex-1 items-center gap-2 min-w-0 overflow-hidden\">\n {icon}\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n </span>\n );\n }\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n );\n}\n\nconst stopTriggerEvent = (event: SyntheticEvent) => {\n event.stopPropagation();\n};\n\nfunction SelectClearButton({ label }: { label: string }): ReactNode {\n const { clear } = useSelect();\n\n return (\n <Button\n data-slot=\"select-clear\"\n variant=\"ghost\"\n size=\"icon-sm\"\n render={<span />}\n aria-label={label}\n className=\"rounded-md\"\n onPointerDown={stopTriggerEvent}\n onMouseDown={stopTriggerEvent}\n onKeyDown={stopTriggerEvent}\n onKeyUp={stopTriggerEvent}\n onClick={(event) => {\n event.stopPropagation();\n event.preventDefault();\n const trigger = event.currentTarget.closest<HTMLElement>(\n '[data-slot=\"select-trigger\"]'\n );\n clear();\n trigger?.focus();\n }}\n >\n <IconCircleXFilled\n className=\"size-4 text-medium-foreground\"\n aria-hidden\n />\n </Button>\n );\n}\n\nconst SelectTrigger: ForwardRefExoticComponent<\n Omit<\n SelectTriggerProps & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n },\n 'ref'\n > &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n }\n>(\n (\n {\n className,\n size = 'default',\n children,\n errorMessage,\n clearLabel = 'Clear selection',\n ...props\n },\n ref\n ) => {\n const { isOpen, canClear } = useSelect();\n const isInvalid = !!errorMessage;\n const errorId = useId();\n const showClear = canClear && !isOpen && !props.disabled;\n\n return (\n <>\n <SelectPrimitive.Trigger\n ref={ref}\n data-slot=\"select-trigger\"\n data-size={size}\n aria-invalid={isInvalid ? true : undefined}\n aria-describedby={isInvalid ? errorId : undefined}\n className={cn(\n 'min-w-50 max-w-[min(100%,420px)]',\n formFieldTriggerClasses,\n isOpen && formFieldOpenState,\n className\n )}\n {...props}\n >\n {children}\n {showClear && <SelectClearButton label={clearLabel} />}\n <SelectPrimitive.Icon\n render={\n <IconChevronDown\n className={cn(\n 'size-4 opacity-50 transition-transform',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n />\n }\n />\n </SelectPrimitive.Trigger>\n {errorMessage && (\n <div\n id={errorId}\n className=\"flex flex-row gap-1 justify-start items-center p-1\"\n >\n <IconExclamationCircle className=\"text-destructive-foreground text-sm size-4\" />\n <span className=\"text-destructive-foreground text-sm\">\n {errorMessage}\n </span>\n </div>\n )}\n </>\n );\n }\n);\n\nSelectTrigger.displayName = 'SelectTrigger';\n\nfunction SelectContent({\n className,\n children,\n position: _position = 'popper',\n align = 'start',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: SelectPrimitive.Popup.Props & {\n position?: 'popper' | 'item-aligned';\n align?: SelectPrimitive.Positioner.Props['align'];\n alignOffset?: SelectPrimitive.Positioner.Props['alignOffset'];\n side?: SelectPrimitive.Positioner.Props['side'];\n sideOffset?: SelectPrimitive.Positioner.Props['sideOffset'];\n}): ReactNode {\n const container = usePortalContainer();\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={false}\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n collisionPadding={10}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover-background text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) max-w-[min(100%,420px)] min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-default shadow-md outline-none',\n menuContainerPadding,\n _position === 'popper' && 'data-[side=bottom]:translate-y-1',\n className\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props): ReactNode {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(menuSectionLabelClasses, className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n icon,\n suffix,\n ...props\n}: SelectPrimitive.Item.Props & {\n icon?: ReactNode;\n suffix?: ReactNode;\n}): ReactNode {\n const title = typeof children === 'string' ? children : undefined;\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-lg pr-8 text-sm leading-4.5 font-medium outline-hidden select-none focus:bg-popover-background-hover focus:text-popover-foreground data-[disabled]:pointer-events-none data-[disabled]:text-base-foreground-disabled data-[disabled]:opacity-100 data-[disabled]:[&_svg]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n menuItemPadding,\n className\n )}\n {...props}\n >\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <IconCheck className=\"size-4 text-popover-foreground\" />\n </span>\n }\n />\n {icon && <span className=\"flex items-center gap-2 mr-1\">{icon}</span>}\n <SelectPrimitive.ItemText\n className=\"flex-1 truncate min-w-0\"\n title={title}\n >\n {children}\n </SelectPrimitive.ItemText>\n {suffix && <span className=\"shrink-0 ml-auto\">{suffix}</span>}\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props): ReactNode {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n menuSectionSeparatorClasses,\n 'pointer-events-none',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: SelectPrimitive.ScrollUpArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 top-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: SelectPrimitive.ScrollDownArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"names":["createContext","forwardRef","useContext","useId","useMemo","Select","SelectPrimitive","IconCheck","IconChevronDown","IconChevronUp","IconCircleXFilled","IconExclamationCircle","usePortalContainer","useControllableState","cn","formFieldOpenState","formFieldTriggerClasses","menuContainerPadding","menuItemPadding","menuSectionLabelClasses","menuSectionSeparatorClasses","Button","SelectContext","useSelect","context","Error","props","isOpen","setIsOpen","prop","open","defaultProp","defaultOpen","onChange","onOpenChange","value","setValue","defaultValue","multiple","nextValue","onValueChange","Array","isArray","hasValue","length","canClear","clearable","required","disabled","readOnly","isMultiple","selectContext","clear","_multiple","_value","_defaultValue","_onValueChange","_clearable","rest","Provider","Root","data-slot","nextOpen","_details","SelectGroup","className","Group","SelectValue","icon","span","Value","stopTriggerEvent","event","stopPropagation","SelectClearButton","label","variant","size","render","aria-label","onPointerDown","onMouseDown","onKeyDown","onKeyUp","onClick","preventDefault","trigger","currentTarget","closest","focus","aria-hidden","SelectTrigger","children","errorMessage","clearLabel","ref","isInvalid","errorId","showClear","Trigger","data-size","aria-invalid","undefined","aria-describedby","Icon","div","id","displayName","SelectContent","position","_position","align","alignOffset","side","sideOffset","container","Portal","Positioner","alignItemWithTrigger","collisionPadding","Popup","SelectScrollUpButton","List","SelectScrollDownButton","SelectLabel","GroupLabel","SelectItem","suffix","title","Item","ItemIndicator","ItemText","SelectSeparator","Separator","ScrollUpArrow","ScrollDownArrow"],"mappings":";AAAA,SAMEA,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,OAAO,QACF,QAAQ;AAGf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAClE,SACEC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,iBAAiB,EACjBC,qBAAqB,QAChB,sBAAsB;AAE7B,SAASC,kBAAkB,QAAQ,8CAA2C;AAC9E,SAASC,oBAAoB,QAAQ,4CAAyC;AAC9E,SACEC,EAAE,EACFC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBC,2BAA2B,QACtB,2BAAwB;AAC/B,SAASC,MAAM,QAAQ,sBAAmB;AAQ1C,MAAMC,8BAAgBtB,cAAyC;AAE/D,MAAMuB,YAAY;IAChB,MAAMC,UAAUtB,WAAWoB;IAC3B,IAAI,CAACE,SAAS;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOD;AACT;AAwCA,SAASnB,OAAOqB,KAAkB;IAChC,MAAM,CAACC,QAAQC,UAAU,GAAGf,qBAAqB;QAC/CgB,MAAMH,MAAMI,IAAI;QAChBC,aAAaL,MAAMM,WAAW,IAAI;QAClCC,UAAUP,MAAMQ,YAAY;IAC9B;IAEA,MAAM,CAACC,OAAOC,SAAS,GAAGvB,qBAAwC;QAChEgB,MAAMH,MAAMS,KAAK;QACjBJ,aAAaL,MAAMW,YAAY,IAAKX,CAAAA,MAAMY,QAAQ,GAAG,EAAE,GAAG,EAAC;QAC3DL,UAAU,CAACM;YACT,IAAIb,MAAMY,QAAQ,EAAE;gBAClBZ,MAAMc,aAAa,GAAGC,MAAMC,OAAO,CAACH,aAAaA,YAAY,EAAE;YACjE,OAAO;gBACLb,MAAMc,aAAa,GAAG,OAAOD,cAAc,WAAWA,YAAY;YACpE;QACF;IACF;I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GACAmD;QAED,GAAGvC,KAAK;kBAET,cAAA,KAAClB;YAAgByD,WAAU;;;AAGjC;AAEA,SACE5D,MAAM,EACNuG,aAAa,EACb5C,WAAW,EACX8D,UAAU,EACVF,WAAW,EACXD,sBAAsB,EACtBF,oBAAoB,EACpBW,eAAe,EACfzC,aAAa,EACbxB,WAAW,GACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/aura",
3
- "version": "1.47805.0",
3
+ "version": "1.47905.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": [