{"version":3,"file":"ng-primitives-toolbar.mjs","sources":["../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar-state.ts","../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar.ts","../../../../packages/ng-primitives/toolbar/src/ng-primitives-toolbar.ts"],"sourcesContent":["import { Signal, WritableSignal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { NgpRovingFocusGroupState } from 'ng-primitives/roving-focus';\nimport {\n  attrBinding,\n  controlled,\n  createPrimitive,\n  dataBinding,\n  deprecatedSetter,\n} from 'ng-primitives/state';\n\nexport interface NgpToolbarState {\n  /**\n   * The orientation of the toolbar.\n   */\n  readonly orientation: WritableSignal<NgpOrientation>;\n  /**\n   * Set the orientation of the toolbar.\n   * @param value The orientation value\n   */\n  setOrientation(value: NgpOrientation): void;\n}\n\nexport interface NgpToolbarProps {\n  /**\n   * The roving focus group state.\n   */\n  readonly rovingFocusGroup: NgpRovingFocusGroupState;\n  /**\n   * The orientation of the toolbar.\n   */\n  readonly orientation: Signal<NgpOrientation>;\n}\n\nexport const [NgpToolbarStateToken, ngpToolbar, injectToolbarState, provideToolbarState] =\n  createPrimitive(\n    'NgpToolbar',\n    ({ rovingFocusGroup, orientation: _orientation }: NgpToolbarProps) => {\n      const element = injectElementRef();\n      const orientation = controlled(_orientation);\n\n      // Setup host attribute bindings\n      attrBinding(element, 'role', 'toolbar');\n      attrBinding(element, 'aria-orientation', orientation);\n      dataBinding(element, 'data-orientation', orientation);\n\n      function setOrientation(value: NgpOrientation) {\n        orientation.set(value);\n        rovingFocusGroup.setOrientation(value);\n      }\n\n      return {\n        orientation: deprecatedSetter(orientation, 'setOrientation', setOrientation),\n        setOrientation,\n      } satisfies NgpToolbarState;\n    },\n  );\n","import { Directive, input } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from 'ng-primitives/roving-focus';\nimport { ngpToolbar, provideToolbarState } from './toolbar-state';\n\n@Directive({\n  selector: '[ngpToolbar]',\n  exportAs: 'ngpToolbar',\n  providers: [provideToolbarState(), provideRovingFocusGroupState()],\n})\nexport class NgpToolbar {\n  /**\n   * The orientation of the toolbar.\n   */\n  readonly orientation = input<NgpOrientation>('horizontal', {\n    alias: 'ngpToolbarOrientation',\n  });\n\n  /**\n   * The toolbar state.\n   */\n  protected readonly state = ngpToolbar({\n    rovingFocusGroup: ngpRovingFocusGroup({ orientation: this.orientation }),\n    orientation: this.orientation,\n  });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAmCO,MAAM,CAAC,oBAAoB,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,GACtF,eAAe,CACb,YAAY,EACZ,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAmB,KAAI;AACnE,IAAA,MAAM,OAAO,GAAG,gBAAgB,EAAE;AAClC,IAAA,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,CAAC;;AAG5C,IAAA,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;AACvC,IAAA,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC;AACrD,IAAA,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC;IAErD,SAAS,cAAc,CAAC,KAAqB,EAAA;AAC3C,QAAA,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;AACtB,QAAA,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC;IACxC;IAEA,OAAO;QACL,WAAW,EAAE,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,CAAC;QAC5E,cAAc;KACW;AAC7B,CAAC;;MC9CQ,UAAU,CAAA;AALvB,IAAA,WAAA,GAAA;AAME;;AAEG;QACM,IAAA,CAAA,WAAW,GAAG,KAAK,CAAiB,YAAY,mFACvD,KAAK,EAA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