You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

577 lines
19 KiB

  1. ---
  2. layout : 'default'
  3. css : 'shape'
  4. element : 'shape'
  5. elementType : 'module'
  6. title : 'Shape'
  7. description : 'A shape is a three dimensional object displayed on a two dimensional plane'
  8. type : 'UI Module'
  9. themes : ['default']
  10. ---
  11. <link rel="stylesheet/less" type="text/css" href="/build/less/definitions/modules/shape.less" />
  12. <link rel="stylesheet" type="text/css" class="ui" href="/stylesheets/shape.css">
  13. <script src="/javascript/shape.js"></script>
  14. <%- @partial('header', { tabs: 'module' }) %>
  15. <div class="main container">
  16. <div class="ui tab" data-tab="definition">
  17. <h2 class="ui dividing header">Types</h2>
  18. <div class="example">
  19. <h4 class="ui header">Shape</h4>
  20. <p>A standard shape</p>
  21. <div class="ui warning icon message">
  22. <i class="info letter icon"></i>
  23. <div class="content">
  24. <div class="header">Using Shapes</div>
  25. <ul class="list">
  26. <li>A shape must have defined width and heights for each side or else text flow may change during animation</li>
  27. <li>The module uses 3D transformations which are currently only supported in modern versions of Chrome, Safari, and Firefox.</li>
  28. </ul>
  29. </div>
  30. </div>
  31. <div class="code" data-type="html">
  32. <div class="ui shape">
  33. <div class="sides">
  34. <div class="active side">This side starts visible.</div>
  35. <div class="side">This is yet another side</div>
  36. <div class="side">This is the last side</div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="example">
  42. <h4 class="ui header">Cube</h4>
  43. <p>A cube shape is formatted so that each side is the face of a cube</p>
  44. <div class="ui ignored info message">Content must be included inside <code>.content .center</code> to display centered on a cube's side</div>
  45. <div class="ui cube shape">
  46. <div class="sides">
  47. <div class="active side">
  48. <div class="content">
  49. <div class="center">
  50. 1
  51. </div>
  52. </div>
  53. </div>
  54. <div class="side">
  55. <div class="content">
  56. <div class="center">
  57. 2
  58. </div>
  59. </div>
  60. </div>
  61. <div class="side">
  62. <div class="content">
  63. <div class="center">
  64. 3
  65. </div>
  66. </div>
  67. </div>
  68. <div class="side">
  69. <div class="content">
  70. <div class="center">
  71. 4
  72. </div>
  73. </div>
  74. </div>
  75. <div class="side">
  76. <div class="content">
  77. <div class="center">
  78. 5
  79. </div>
  80. </div>
  81. </div>
  82. <div class="side">
  83. <div class="content">
  84. <div class="center">
  85. 6
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="ui ignored divider"></div>
  92. <div class="ui ignored icon direction buttons">
  93. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  94. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  95. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  96. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  97. </div>
  98. <div class="ui ignored icon direction buttons">
  99. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  100. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  101. </div>
  102. </div>
  103. <div class="example">
  104. <h4 class="ui header">Text</h4>
  105. <p>A text shape is formatted to allow for sides of text to be displayed</p>
  106. <div class="ui text shape">
  107. <div class="sides">
  108. <div class="active ui header side">Did you know? This side starts visible.</div>
  109. <div class="ui header side">Help, its another side!</div>
  110. <div class="ui header side">This is the last side</div>
  111. </div>
  112. </div>
  113. <div class="ui ignored divider"></div>
  114. <div class="ui ignored icon direction buttons">
  115. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  116. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  117. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  118. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  119. </div>
  120. <div class="ui ignored icon direction buttons">
  121. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  122. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="ui tab" data-tab="examples">
  127. <div class="no example">
  128. <h3 class="ui header">Shape Types</h3>
  129. <p>Shapes do not have to be regular or have its sides match up in length and width to animate correctly.</p>
  130. <h3 class="ui header">Shape</h3>
  131. <div class="ui type buttons">
  132. <div class="active ui button" data-shape="rectangle">Rectangle</div>
  133. <div class="ui button" data-shape="square">Square</div>
  134. <div class="ui button" data-shape="irregular">Irregular</div>
  135. </div>
  136. <div class="ui divider"></div>
  137. <div class="demo rectangle ui shape">
  138. <div class="sides">
  139. <div class="active jira side">
  140. <img src="/images/shape/jira.png">
  141. </div>
  142. <div class="heroku side">
  143. <img src="/images/shape/heroku.png">
  144. </div>
  145. <div class="quirky side">
  146. <img src="/images/shape/quirky.png">
  147. </div>
  148. </div>
  149. </div>
  150. <div class="ui ignored divider"></div>
  151. <div class="ui ignored icon direction buttons">
  152. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  153. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  154. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  155. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  156. </div>
  157. <div class="ui ignored icon direction buttons">
  158. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  159. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  160. </div>
  161. </div>
  162. <div class="ui clearing section divider"></div>
  163. <h3 class="ui header">Shape with Content</h3>
  164. <p>Any type of element can be used as a side of a shape.</p>
  165. <div class="dog ui shape">
  166. <div class="sides">
  167. <div class="active side">
  168. <div class="ui cards">
  169. <div class="card">
  170. <div class="image">
  171. <a class="ui like corner label">
  172. <i class="like icon"></i>
  173. </a>
  174. <img src="/images/demo/highres2.jpg">
  175. </div>
  176. <div class="content">
  177. <div class="header">Cute Dog</div>
  178. <p class="description">This dog has some things going for it. Its pretty cute and looks like it'd be fun to cuddle up with.</p>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="side">
  184. <div class="ui cards">
  185. <div class="card">
  186. <div class="image">
  187. <a class="ui like corner label">
  188. <i class="like icon"></i>
  189. </a>
  190. <img src="/images/demo/highres5.jpg">
  191. </div>
  192. <div class="content">
  193. <div class="header">Silly Dog</div>
  194. <p class="description">Silly dogs can be quite fun to have as companions. You never know what kind of ridiculous thing they will do.</p>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="side">
  200. <div class="ui cards">
  201. <div class="card">
  202. <div class="image">
  203. <a class="ui like corner label">
  204. <i class="like icon"></i>
  205. </a>
  206. <img src="/images/demo/highres4.jpg">
  207. </div>
  208. <div class="content">
  209. <div class="header">Faithful Dog</div>
  210. <div class="meta">5 days ago</div>
  211. <p class="description">Sometimes its more important to have a dog you know you can trust. But not every dog is trustworthy, you can tell by looking at its smile.</p>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <div class="dog ui shape">
  219. <div class="sides">
  220. <div class="active side">
  221. <div class="ui cards">
  222. <div class="card">
  223. <div class="image">
  224. <a class="ui like corner label">
  225. <i class="like icon"></i>
  226. </a>
  227. <img src="/images/demo/highres.jpg">
  228. </div>
  229. <div class="content">
  230. <div class="header">Cute Dog</div>
  231. <p class="description">This dog has some things going for it. Its pretty cute and looks like it'd be fun to cuddle up with.</p>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="side">
  237. <div class="ui cards">
  238. <div class="card">
  239. <div class="image">
  240. <a class="ui like corner label">
  241. <i class="like icon"></i>
  242. </a>
  243. <img src="/images/demo/highres4.jpg">
  244. </div>
  245. <div class="content">
  246. <div class="header">Silly Dog</div>
  247. <p class="description">Silly dogs can be quite fun to have as companions. You never know what kind of ridiculous thing they will do.</p>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <div class="side">
  253. <div class="ui cards">
  254. <div class="card">
  255. <div class="image">
  256. <a class="ui like corner label">
  257. <i class="like icon"></i>
  258. </a>
  259. <img src="/images/demo/highres6.jpg">
  260. </div>
  261. <div class="content">
  262. <div class="header">Faithful Dog</div>
  263. <div class="meta">5 days ago</div>
  264. <p class="description">Sometimes its more important to have a dog you know you can trust. But not every dog is trustworthy, you can tell by looking at its smile.</p>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <div class="ui clearing divider"></div>
  272. <div class="code" data-demo="true">
  273. $('.dog.shape')
  274. .eq(0)
  275. .shape('flip over')
  276. .end()
  277. .eq(1)
  278. .shape('flip back')
  279. ;
  280. </div>
  281. </div>
  282. <div class="ui tab" data-tab="usage">
  283. <h2 class="ui dividing header">Getting Started</h2>
  284. <p>Initializing a shape</p>
  285. <div class="code">
  286. $('.shape').shape();
  287. </div>
  288. <p>Transitions automatically assume next side is the next sibling (or first if last element)</p>
  289. <div class="code">
  290. $('.shape').shape('flip up');
  291. </div>
  292. <p>To manually set the next side to appear use a selector or jQuery object</p>
  293. <div class="code">
  294. $('.shape')
  295. .shape('set next side', '.second.side')
  296. .shape('flip up')
  297. ;
  298. </div>
  299. <p>Any internal method can be invoked programmatically</p>
  300. <div class="code">
  301. $('.shape').shape('repaint');
  302. </div>
  303. <h2 class="ui dividing header">Behavior</h2>
  304. <p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
  305. <div class="code">
  306. $('.your.element')
  307. .shape('behavior name', argumentOne, argumentTwo)
  308. ;
  309. </div>
  310. <table class="ui definition sortable celled table segment">
  311. <thead>
  312. <th>Behavior</th>
  313. <th>Description</th>
  314. </thead>
  315. <tbody>
  316. <tr>
  317. <td>flip up</td>
  318. <td>Flips the shape upward</td>
  319. </tr>
  320. <tr>
  321. <td>flip down</td>
  322. <td>Flips the shape downward</td>
  323. </tr>
  324. <tr>
  325. <td>flip right</td>
  326. <td>Flips the shape right</td>
  327. </tr>
  328. <tr>
  329. <td>flip left</td>
  330. <td>Flips the shape left</td>
  331. </tr>
  332. <tr>
  333. <td>flip over</td>
  334. <td>Flips the shape over clock-wise</td>
  335. </tr>
  336. <tr>
  337. <td>flip back</td>
  338. <td>Flips the shape over counter-clockwise</td>
  339. </tr>
  340. <tr>
  341. <td>set next side(selector)</td>
  342. <td>Set the next side to a specific selector</td>
  343. </tr>
  344. <tr>
  345. <td>is animating</td>
  346. <td>Returns whether shape is currently animating</td>
  347. </tr>
  348. <tr>
  349. <td>reset</td>
  350. <td>Removes all inline styles</td>
  351. </tr>
  352. <tr>
  353. <td>queue(animation)</td>
  354. <td>Queues an animationtill after current animation</td>
  355. </tr>
  356. <tr>
  357. <td>repaint</td>
  358. <td>Forces a reflow on element</td>
  359. </tr>
  360. <tr>
  361. <td>set default side</td>
  362. <td>Set the next side to next sibling to active element</td>
  363. </tr>
  364. <tr>
  365. <td>set stage size</td>
  366. <td>Sets shape to the content size of the next side</td>
  367. </tr>
  368. <tr>
  369. <td>refresh</td>
  370. <td>Refreshes the selector cache for element sides</td>
  371. </tr>
  372. <tr>
  373. <td>get transform down</td>
  374. <td>Returns translation for next side staged below</td>
  375. </tr>
  376. <tr>
  377. <td>get transform left</td>
  378. <td>Returns translation for next side staged left</td>
  379. </tr>
  380. <tr>
  381. <td>get transform right</td>
  382. <td>Returns translation for next side staged right</td>
  383. </tr>
  384. <tr>
  385. <td>get transform up</td>
  386. <td>Returns translation for next side staged up</td>
  387. </tr>
  388. <tr>
  389. <td>get transform down</td>
  390. <td>Returns translation for next side staged down</td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. </div>
  395. <div class="ui tab" data-tab="settings">
  396. <h3 class="ui header">
  397. Shape Settings
  398. <div class="sub header">Shape settings modify the shape's behavior</div>
  399. </h3>
  400. <table class="ui celled sortable definition table segment">
  401. <thead>
  402. <th>Setting</th>
  403. <th class="four wide">Default</th>
  404. <th>Description</th>
  405. </thead>
  406. <tbody>
  407. <tr>
  408. <td>duration</td>
  409. <td>700ms</td>
  410. <td>Duration of side change animation</td>
  411. </tr>
  412. </tbody>
  413. </table>
  414. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  415. <h3 class="ui header">
  416. Callbacks
  417. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  418. </h3>
  419. <table class="ui celled sortable definition table segment">
  420. <thead>
  421. <th class="four wide">Setting</th>
  422. <th>Context</th>
  423. <th>Description</th>
  424. </thead>
  425. <tbody>
  426. <tr>
  427. <td>beforeChange</td>
  428. <td>Next Side</td>
  429. <td>Is called before side change</td>
  430. </tr>
  431. <tr>
  432. <td>onChange</td>
  433. <td>Active Side</td>
  434. <td>Is called after visible side change</td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  439. <h3 class="ui header">
  440. DOM Settings
  441. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  442. </h3>
  443. <table class="ui celled sortable definition table segment">
  444. <thead>
  445. <th>Setting</th>
  446. <th class="four wide">Default</th>
  447. <th>Description</th>
  448. </thead>
  449. <tbody>
  450. <tr>
  451. <td>namespace</td>
  452. <td>shape</td>
  453. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  454. </tr>
  455. <tr>
  456. <td>selector</td>
  457. <td colspan="2">
  458. <div class="code">
  459. selector : {
  460. sides : '.sides',
  461. side : '.side'
  462. }
  463. </div>
  464. </td>
  465. </tr>
  466. <tr>
  467. <td>className</td>
  468. <td colspan="2">
  469. <div class="code">
  470. className : {
  471. animating : 'animating',
  472. hidden : 'hidden',
  473. loading : 'loading',
  474. active : 'active'
  475. }
  476. </div>
  477. </td>
  478. </tr>
  479. </tbody>
  480. </table>
  481. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  482. <h3 class="ui header">
  483. Debug Settings
  484. <div class="sub header">Debug settings controls debug output to the console</div>
  485. </h3>
  486. <table class="ui celled sortable definition table segment">
  487. <thead>
  488. <th>Setting</th>
  489. <th class="four wide">Default</th>
  490. <th>Description</th>
  491. </thead>
  492. <tbody>
  493. <tr>
  494. <td>name</td>
  495. <td>Shape</td>
  496. <td>Name used in debug logs</td>
  497. </tr>
  498. <tr>
  499. <td>debug</td>
  500. <td>True</td>
  501. <td>Provides standard debug output to console</td>
  502. </tr>
  503. <tr>
  504. <td>performance</td>
  505. <td>True</td>
  506. <td>Provides standard debug output to console</td>
  507. </tr>
  508. <tr>
  509. <td>verbose</td>
  510. <td>True</td>
  511. <td>Provides ancillary debug output to console</td>
  512. </tr>
  513. <tr>
  514. <td>error</td>
  515. <td colspan="2">
  516. <div class="code">
  517. error: {
  518. side : 'You tried to switch to a side that does not exist.',
  519. method : 'The method you called is not defined'
  520. }
  521. </div>
  522. </td>
  523. </tr>
  524. </tbody>
  525. </table>
  526. </div>
  527. </div>