@agility/plenum-ui 2.0.0-rc45 → 2.0.0-rc47

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/tailwind.css CHANGED
@@ -2013,6 +2013,54 @@ select {
2013
2013
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
2014
2014
  }
2015
2015
 
2016
+ @keyframes bounce {
2017
+ 0%, 100% {
2018
+ transform: translateY(-25%);
2019
+ animation-timing-function: cubic-bezier(0.8,0,1,1);
2020
+ }
2021
+
2022
+ 50% {
2023
+ transform: none;
2024
+ animation-timing-function: cubic-bezier(0,0,0.2,1);
2025
+ }
2026
+ }
2027
+
2028
+ .animate-\[bounce_1s_infinite\] {
2029
+ animation: bounce 1s infinite;
2030
+ }
2031
+
2032
+ @keyframes bounce {
2033
+ 0%, 100% {
2034
+ transform: translateY(-25%);
2035
+ animation-timing-function: cubic-bezier(0.8,0,1,1);
2036
+ }
2037
+
2038
+ 50% {
2039
+ transform: none;
2040
+ animation-timing-function: cubic-bezier(0,0,0.2,1);
2041
+ }
2042
+ }
2043
+
2044
+ .animate-\[bounce_1s_infinite_0\.2s\] {
2045
+ animation: bounce 1s infinite 0.2s;
2046
+ }
2047
+
2048
+ @keyframes bounce {
2049
+ 0%, 100% {
2050
+ transform: translateY(-25%);
2051
+ animation-timing-function: cubic-bezier(0.8,0,1,1);
2052
+ }
2053
+
2054
+ 50% {
2055
+ transform: none;
2056
+ animation-timing-function: cubic-bezier(0,0,0.2,1);
2057
+ }
2058
+ }
2059
+
2060
+ .animate-\[bounce_1s_infinite_0\.4s\] {
2061
+ animation: bounce 1s infinite 0.4s;
2062
+ }
2063
+
2016
2064
  @keyframes spin {
2017
2065
  to {
2018
2066
  transform: rotate(360deg);
@@ -2893,6 +2941,10 @@ select {
2893
2941
  align-items: center;
2894
2942
  }
2895
2943
 
2944
+ .items-baseline {
2945
+ align-items: baseline;
2946
+ }
2947
+
2896
2948
  .items-stretch {
2897
2949
  align-items: stretch;
2898
2950
  }
@@ -3012,6 +3064,12 @@ select {
3012
3064
  column-gap: 6px;
3013
3065
  }
3014
3066
 
3067
+ .space-x-1 > :not([hidden]) ~ :not([hidden]) {
3068
+ --tw-space-x-reverse: 0;
3069
+ margin-right: calc(0.25rem * var(--tw-space-x-reverse));
3070
+ margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse)));
3071
+ }
3072
+
3015
3073
  .space-x-2 > :not([hidden]) ~ :not([hidden]) {
3016
3074
  --tw-space-x-reverse: 0;
3017
3075
  margin-right: calc(0.5rem * var(--tw-space-x-reverse));
@@ -5,7 +5,7 @@ import { IDynamicIconProps } from "@/stories/atoms/icons";
5
5
  export interface IItemProp {
6
6
  icon?: IDynamicIconProps;
7
7
  iconPosition?: "trailing" | "leading";
8
- label: string;
8
+ label: string | JSX.Element;
9
9
  onClick?(): void;
10
10
  isEmphasized?: boolean;
11
11
  key: React.Key;
@@ -30,6 +30,8 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
30
30
  alignmentAxis: number | null;
31
31
  }>;
32
32
  disabled?: boolean;
33
+ onFocus?: () => void;
34
+ onBlur?: () => void;
33
35
  }
34
36
  export declare const defaultClassNames: {
35
37
  groupClassname: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.0.0-rc45",
3
+ "version": "2.0.0-rc47",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -39,6 +39,30 @@ export const WithLabelAndIcons: Story = {
39
39
  items: [...dropdownDataWithIcons]
40
40
  }
41
41
  }
42
+ export const WithCustomItemLabelsAndIcons: Story = {
43
+ args: {
44
+ ...defaultArgs,
45
+ items: [
46
+ ...dropdownDataWithIcons,
47
+ [
48
+ {
49
+ icon: { icon: "Icon123" },
50
+ label: (
51
+ <div className="flex items-baseline gap-x-2">
52
+ sdfsdf{" "}
53
+ <div className="flex space-x-1">
54
+ <div className="h-1 w-1 animate-[bounce_1s_infinite] rounded-full bg-gray-500"></div>
55
+ <div className="h-1 w-1 animate-[bounce_1s_infinite_0.2s] rounded-full bg-gray-500"></div>
56
+ <div className="h-1 w-1 animate-[bounce_1s_infinite_0.4s] rounded-full bg-gray-500"></div>
57
+ </div>
58
+ </div>
59
+ ),
60
+ key: "sdfsdf"
61
+ }
62
+ ]
63
+ ]
64
+ }
65
+ }
42
66
  export const WithIcons: Story = {
43
67
  args: {
44
68
  ...defaultArgs,
@@ -26,7 +26,7 @@ export interface IItemProp {
26
26
  //Don't think this needs to extend HtmlButton... extends HTMLAttributes<HTMLButtonElement> {
27
27
  icon?: IDynamicIconProps
28
28
  iconPosition?: "trailing" | "leading"
29
- label: string
29
+ label: string | JSX.Element
30
30
  onClick?(): void
31
31
  isEmphasized?: boolean
32
32
  key: React.Key
@@ -52,6 +52,8 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
52
52
  alignmentAxis: number | null
53
53
  }>
54
54
  disabled?: boolean
55
+ onFocus?: () => void
56
+ onBlur?: () => void
55
57
  }
56
58
  export const defaultClassNames = {
57
59
  groupClassname: "flex inline-block text-left",
@@ -82,6 +84,8 @@ const Dropdown: React.FC<IDropdownProps> = ({
82
84
  placement = "bottom-start",
83
85
  offsetOptions,
84
86
  disabled,
87
+ onFocus,
88
+ onBlur,
85
89
  ...props
86
90
  }: IDropdownProps): JSX.Element | null => {
87
91
  const [isOpen, setIsOpen] = useState(false)
@@ -93,8 +97,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
93
97
  // Floating UI logic
94
98
  const { refs, floatingStyles, context } = useFloating({
95
99
  open: isOpen,
96
- onOpenChange: (bool) => {
97
-
100
+ onOpenChange: (bool: boolean) => {
98
101
  listRef.current = []
99
102
  setActiveIndex(null)
100
103
  setIsOpen(bool)
@@ -115,7 +118,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
115
118
  const listNavigation = useListNavigation(context, {
116
119
  listRef,
117
120
  activeIndex,
118
- onNavigate: (index) => {
121
+ onNavigate: (index: number | null) => {
119
122
  if (index !== null && listRef.current[index]) {
120
123
  setActiveIndex(index)
121
124
  listRef.current[index]?.focus()
@@ -130,6 +133,14 @@ const Dropdown: React.FC<IDropdownProps> = ({
130
133
  listNavigation
131
134
  ])
132
135
 
136
+ useEffect(() => {
137
+ if (isOpen) {
138
+ onFocus && onFocus()
139
+ } else {
140
+ onBlur && onBlur()
141
+ }
142
+ }, [isOpen, onBlur, onFocus])
143
+
133
144
  const ItemComponents = useMemo(
134
145
  () =>
135
146
  items.map((itemStack, stackIndex) => {