@ynput/ayon-react-components 1.7.10 → 1.7.11

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.
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { DropdownProps, DropdownRef } from '../Dropdown';
2
+ import { DefaultValueTemplateProps, DropdownProps, DropdownRef } from '../Dropdown';
3
3
  import { IconType } from '../../Icon';
4
- export interface EnumTemplateProps {
4
+ export interface EnumTemplateProps extends Omit<DefaultValueTemplateProps, 'value'> {
5
5
  option: EnumDropdownOption | null | undefined;
6
6
  isSelected?: boolean;
7
+ isChanged?: boolean;
7
8
  }
9
+ export declare const EnumTemplate: ({ option, isSelected, isChanged, ...props }: EnumTemplateProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export type EnumDropdownOption = {
9
11
  value: string;
10
12
  label: string;
@@ -11342,50 +11342,52 @@ const $o = rt(({
11342
11342
  multiSelect: t,
11343
11343
  featuredOnly: e,
11344
11344
  widthExpand: i = !1,
11345
- ...c
11346
- }, u) => {
11347
- const d = Nt(() => {
11348
- const _ = [], h = e ? o : Object.keys(B1e);
11349
- for (const g of h)
11350
- _.push({
11351
- label: g,
11352
- value: g
11345
+ sortBySelected: c = !0,
11346
+ ...u
11347
+ }, d) => {
11348
+ const p = Nt(() => {
11349
+ const h = [], g = e ? o : Object.keys(B1e);
11350
+ for (const k of g)
11351
+ h.push({
11352
+ label: k,
11353
+ value: k
11353
11354
  });
11354
- return _;
11355
- }, []), p = o.map((_) => _);
11356
- return d.sort((_, h) => p.includes(_.value) && !p.includes(h.value) ? -1 : !p.includes(_.value) && p.includes(h.value) ? 1 : 0), /* @__PURE__ */ w($o, {
11355
+ return h;
11356
+ }, []), _ = o.map((h) => h);
11357
+ return p.sort((h, g) => _.includes(h.value) && !_.includes(g.value) ? -1 : !_.includes(h.value) && _.includes(g.value) ? 1 : 0), /* @__PURE__ */ w($o, {
11357
11358
  value: n,
11358
11359
  multiSelect: t,
11359
- valueTemplate: (_, h, g) => /* @__PURE__ */ w(Va, {
11360
- value: (g ? h : _) || [],
11361
- isOpen: g,
11360
+ valueTemplate: (h, g, k) => /* @__PURE__ */ w(Va, {
11361
+ value: (k ? g : h) || [],
11362
+ isOpen: k,
11362
11363
  children: /* @__PURE__ */ w(e_, {
11363
- value: (g ? h : _) || []
11364
+ value: (k ? g : h) || []
11364
11365
  })
11365
11366
  }),
11366
- options: d,
11367
+ options: p,
11367
11368
  itemTemplate: ({
11368
- value: _
11369
- }, h, g) => /* @__PURE__ */ w(e_, {
11370
- value: [_],
11371
- isActive: h,
11372
- isSelected: g
11369
+ value: h
11370
+ }, g, k) => /* @__PURE__ */ w(e_, {
11371
+ value: [h],
11372
+ isActive: g,
11373
+ isSelected: k
11373
11374
  }),
11374
11375
  onChange: a,
11375
11376
  search: !0,
11376
11377
  valueStyle: {
11377
11378
  width: 150,
11378
- ...c.valueStyle
11379
+ ...u.valueStyle
11379
11380
  },
11380
11381
  style: {
11381
11382
  maxWidth: 150,
11382
- ...c.style
11383
+ ...u.style
11383
11384
  },
11384
- ref: u,
11385
- ...c,
11386
- maxOptionsShown: Math.max(c.maxOptionsShown || 25, o.length),
11385
+ ref: d,
11386
+ ...u,
11387
+ maxOptionsShown: Math.max(u.maxOptionsShown || 25, o.length),
11387
11388
  minSelected: 1,
11388
- widthExpand: i
11389
+ widthExpand: i,
11390
+ sortBySelected: c
11389
11391
  });
11390
11392
  }), om = ({ $color: n }) => n ? ke`
11391
11393
  background: ${n};
@@ -11406,8 +11408,6 @@ const $o = rt(({
11406
11408
  color: var(--md-sys-color-on-primary-container);
11407
11409
  }
11408
11410
  `, Nbe = le(Va)`
11409
- padding-left: 0;
11410
-
11411
11411
  &.inverse {
11412
11412
  ${({ $color: n }) => om({ $color: n })}
11413
11413
  border-color: ${({ $color: n }) => n && "transparent"};
@@ -11415,11 +11415,7 @@ const $o = rt(({
11415
11415
  `, Abe = le.div`
11416
11416
  display: flex;
11417
11417
  align-items: center;
11418
- /* justify-content: center; */
11419
-
11420
11418
  gap: 8px;
11421
- padding-left: 0.5rem;
11422
-
11423
11419
  height: 32px;
11424
11420
 
11425
11421
  span:last-child {
@@ -11438,27 +11434,38 @@ const $o = rt(({
11438
11434
  &.selected {
11439
11435
  ${({ $color: n }) => om({ $color: n })}
11440
11436
  }
11437
+
11438
+ &.isChanged {
11439
+ .value-label,
11440
+ .icon {
11441
+ color: var(--color-on-changed);
11442
+ }
11443
+ }
11441
11444
  `, t_ = ({
11442
11445
  option: n,
11443
- isSelected: a
11446
+ isSelected: a,
11447
+ isChanged: o,
11448
+ ...t
11444
11449
  }) => {
11445
11450
  const {
11446
- value: o,
11447
- label: t,
11448
- icon: e,
11449
- color: i
11451
+ value: e,
11452
+ label: i,
11453
+ icon: c,
11454
+ color: u
11450
11455
  } = n || {};
11451
11456
  return /* @__PURE__ */ ce(Abe, {
11452
11457
  className: Je({
11453
- selected: a
11454
- }),
11455
- id: o,
11456
- $color: i,
11457
- children: [e && /* @__PURE__ */ w(pt, {
11458
- icon: e
11458
+ selected: a,
11459
+ isChanged: o
11460
+ }, t.className),
11461
+ id: e,
11462
+ $color: u,
11463
+ ...t,
11464
+ children: [c && /* @__PURE__ */ w(pt, {
11465
+ icon: c
11459
11466
  }), /* @__PURE__ */ w("span", {
11460
11467
  className: "value-label",
11461
- children: t
11468
+ children: i
11462
11469
  })]
11463
11470
  });
11464
11471
  }, vDe = rt(({
@@ -11471,18 +11478,22 @@ const $o = rt(({
11471
11478
  return /* @__PURE__ */ w(Nbe, {
11472
11479
  isOpen: i,
11473
11480
  ...a,
11474
- $color: c == null ? void 0 : c.color,
11481
+ $color: a.isChanged || c == null ? void 0 : c.color,
11475
11482
  className: Je({
11476
11483
  inverse: n
11477
11484
  }),
11478
11485
  children: /* @__PURE__ */ w(t_, {
11479
- option: c
11486
+ option: c,
11487
+ isChanged: a.isChanged
11480
11488
  })
11481
11489
  });
11482
11490
  },
11483
11491
  itemTemplate: (t, e) => /* @__PURE__ */ w(t_, {
11484
11492
  option: t,
11485
- isSelected: e
11493
+ isSelected: e,
11494
+ style: {
11495
+ paddingLeft: "0.5rem"
11496
+ }
11486
11497
  }),
11487
11498
  ...a
11488
11499
  })), Rbe = le.div`
@@ -842,7 +842,7 @@ function print() { __p += __j.call(arguments, '') }
842
842
  background: var(--md-sys-color-primary-container);
843
843
  color: var(--md-sys-color-on-primary-container);
844
844
  `}
845
- `,R_=({value:n,isSelected:a})=>ie(m1,{$isActive:a,children:[n==null?void 0:n.map(o=>w(ut,{icon:o},o)),n&&n.length<2&&w("span",{children:n})]}),g1=W.forwardRef(({value:n,onChange:a,featured:o=[],multiSelect:t,featuredOnly:e,widthExpand:i=!1,...c},u)=>{const d=W.useMemo(()=>{const f=[],h=e?o:Object.keys(Tg);for(const g of h)f.push({label:g,value:g});return f},[]),_=o.map(f=>f);return d.sort((f,h)=>_.includes(f.value)&&!_.includes(h.value)?-1:!_.includes(f.value)&&_.includes(h.value)?1:0),w(no,{value:n,multiSelect:t,valueTemplate:(f,h,g)=>w(Wo,{value:(g?h:f)||[],isOpen:g,children:w(R_,{value:(g?h:f)||[]})}),options:d,itemTemplate:({value:f},h,g)=>w(R_,{value:[f],isActive:h,isSelected:g}),onChange:a,search:!0,valueStyle:{width:150,...c.valueStyle},style:{maxWidth:150,...c.style},ref:u,...c,maxOptionsShown:Math.max(c.maxOptionsShown||25,o.length),minSelected:1,widthExpand:i})}),N_=({$color:n})=>n?he.css`
845
+ `,R_=({value:n,isSelected:a})=>ie(m1,{$isActive:a,children:[n==null?void 0:n.map(o=>w(ut,{icon:o},o)),n&&n.length<2&&w("span",{children:n})]}),g1=W.forwardRef(({value:n,onChange:a,featured:o=[],multiSelect:t,featuredOnly:e,widthExpand:i=!1,sortBySelected:c=!0,...u},d)=>{const _=W.useMemo(()=>{const h=[],g=e?o:Object.keys(Tg);for(const k of g)h.push({label:k,value:k});return h},[]),f=o.map(h=>h);return _.sort((h,g)=>f.includes(h.value)&&!f.includes(g.value)?-1:!f.includes(h.value)&&f.includes(g.value)?1:0),w(no,{value:n,multiSelect:t,valueTemplate:(h,g,k)=>w(Wo,{value:(k?g:h)||[],isOpen:k,children:w(R_,{value:(k?g:h)||[]})}),options:_,itemTemplate:({value:h},g,k)=>w(R_,{value:[h],isActive:g,isSelected:k}),onChange:a,search:!0,valueStyle:{width:150,...u.valueStyle},style:{maxWidth:150,...u.style},ref:d,...u,maxOptionsShown:Math.max(u.maxOptionsShown||25,o.length),minSelected:1,widthExpand:i,sortBySelected:c})}),N_=({$color:n})=>n?he.css`
846
846
  background: ${n};
847
847
  &:hover {
848
848
  filter: brightness(1.1);
@@ -861,8 +861,6 @@ function print() { __p += __j.call(arguments, '') }
861
861
  color: var(--md-sys-color-on-primary-container);
862
862
  }
863
863
  `,v1=ue.default(Wo)`
864
- padding-left: 0;
865
-
866
864
  &.inverse {
867
865
  ${({$color:n})=>N_({$color:n})}
868
866
  border-color: ${({$color:n})=>n&&"transparent"};
@@ -870,11 +868,7 @@ function print() { __p += __j.call(arguments, '') }
870
868
  `,y1=ue.default.div`
871
869
  display: flex;
872
870
  align-items: center;
873
- /* justify-content: center; */
874
-
875
871
  gap: 8px;
876
- padding-left: 0.5rem;
877
-
878
872
  height: 32px;
879
873
 
880
874
  span:last-child {
@@ -893,7 +887,14 @@ function print() { __p += __j.call(arguments, '') }
893
887
  &.selected {
894
888
  ${({$color:n})=>N_({$color:n})}
895
889
  }
896
- `,A_=({option:n,isSelected:a})=>{const{value:o,label:t,icon:e,color:i}=n||{};return ie(y1,{className:Xe({selected:a}),id:o,$color:i,children:[e&&w(ut,{icon:e}),w("span",{className:"value-label",children:t})]})},b1=W.forwardRef(({colorInverse:n,...a},o)=>w(no,{ref:o,valueTemplate:(t,e,i)=>{const c=a.options.find(u=>u.value===t[0]);return w(v1,{isOpen:i,...a,$color:c==null?void 0:c.color,className:Xe({inverse:n}),children:w(A_,{option:c})})},itemTemplate:(t,e)=>w(A_,{option:t,isSelected:e}),...a})),w1=ue.default.div`
890
+
891
+ &.isChanged {
892
+ .value-label,
893
+ .icon {
894
+ color: var(--color-on-changed);
895
+ }
896
+ }
897
+ `,A_=({option:n,isSelected:a,isChanged:o,...t})=>{const{value:e,label:i,icon:c,color:u}=n||{};return ie(y1,{className:Xe({selected:a,isChanged:o},t.className),id:e,$color:u,...t,children:[c&&w(ut,{icon:c}),w("span",{className:"value-label",children:i})]})},b1=W.forwardRef(({colorInverse:n,...a},o)=>w(no,{ref:o,valueTemplate:(t,e,i)=>{const c=a.options.find(u=>u.value===t[0]);return w(v1,{isOpen:i,...a,$color:a.isChanged||c==null?void 0:c.color,className:Xe({inverse:n}),children:w(A_,{option:c,isChanged:a.isChanged})})},itemTemplate:(t,e)=>w(A_,{option:t,isSelected:e,style:{paddingLeft:"0.5rem"}}),...a})),w1=ue.default.div`
897
898
  height: 30px;
898
899
  display: flex;
899
900
  align-items: center;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ynput/ayon-react-components",
3
3
  "private": false,
4
- "version": "1.7.10",
4
+ "version": "1.7.11",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",